Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany
6842
Bin Fu Ding-Zhu Du (Eds.)
Computing and Combinatorics 17th Annual International Conference, COCOON 2011 Dallas, TX, USA, August 14-16, 2011 Proceedings
13
Volume Editors Bin Fu University of Texas-Pan American Department of Computer Science Edinburg, TX 78539, USA E-mail:
[email protected] Ding-Zhu Du University of Texas at Dallas Department of Computer Science Richardson, TX 75080, USA E-mail:
[email protected]
ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-642-22684-7 e-ISBN 978-3-642-22685-4 DOI 10.1007/978-3-642-22685-4 Springer Heidelberg Dordrecht London New York Library of Congress Control Number: 2011932219 CR Subject Classification (1998): F.2, C.2, G.2, F.1, E.1, I.3.5 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues
© Springer-Verlag Berlin Heidelberg 2011 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)
Preface
The Annual International Computing and Combinatorics Conference is a forum for researchers working in the areas of algorithms, theory of computation, computational complexity, and combinatorics related to computing. The papers in this volume were presented at the 17th Annual International Computing and Combinatorics Conference (COCOON 2011), held in the city of Dallas, Texas, USA, during August 14-16, 2011. Previous meetings of this conference were held in Singapore (2002), Big Sky (2003), Jeju Island (2004), Kunming (2005), Taipei (2006), Alberta (2007), Dalian (2008), New York (2009), and NhaTrang (2010). A total of 136 papers were submitted, of which 54 were accepted for presentation at the conference. We received papers from Austrialia, Brazil, Canada, China, Denmark, Finland, France, Germany, Greece, Hong Kong, India, Iran, Israel, Italy, Japan, Korea, Mexico, Norway, Poland, Singapore, Spain, Taiwan, UK, and USA. The papers were evaluated by an international Program Committee consisting of Hee-Kap Ahn, Tatsuya Akutsu, Eric Allender, Zhixiang Chen, Zhi-zhong Chen, Qi Cheng, Ding-Zhu Du, Bin Fu, Xiaofeng Gao, Wen-Lian Hsu, Kazuo Iwama, Iyad Kanj, Neeraj Kayal, Ming-Yang Kao, Donghyun Kim, D. T. Lee, Angsheng Li, Pinyan Lu, Jack Lutz, Mitsunori Ogihara, Hi-rotaka Ono, Desh Ranjan, David Sankoff, Kavitha Telikepalli, Carola Wenk, Boting Yang, Louxin Zhang, and Shengyu Zhang. Each paper was evaluated by at least three Program Committee members, assisted in some cases by external referees. The selection was based on the papers’ originality, quality, and relevance to topics of the COCOON 2011. It is expected that most of the accepted papers will appear in a more polished form in scientific journals. In addition to the selected papers, the conference also included one invited presentation by Ryan Williams. The Program Committee selected “Unions of Disjoint NP-complete Sets” by Christian Glaßer, John Hitchcocky, A. Pavan, and Stephen Travers for the Best Paper Award. We thank all the people who made this meeting possible: the authors for submitting papers, the Program Committee members and external referees for their excellent work, and the invited speaker. Finally, we thank the colleagues at the University of Texas at Dallas for their local arrangements and assistance. August 2011
Bin Fu Ding-Zhu Du
Organization
Executive Committee Conference TPC Chairs
Local Arrangements Chair
Bin Fu (University of Texas - Pan American, USA) Ding-Zhu Du (University of Texas at Dallas, USA) Weili Wu (University of Texas at Dallas, USA)
Program Committee Hee-Kap Ahn Tatsuya Akutsu Eric Allender Zhixiang Chen Zhi-zhong Chen Qi Cheng Ding-zhu Du Bin Fu Xiaofeng Gao Wen-Lian Hsu Kazuo Iwama Iyad Kanj Neeraj Kayal Ming-Yang Kao Donghyun Kim D.T. Lee Angsheng Li Pinyan Lu Jack Lutz Mitsunori Ogihara Hirotaka Ono Desh Ranjan David Sankoff Kavitha Telikepalli Carola Wenk Boting Yang Louxin Zhang Shengyu Zhang
Pohang University of Science and Technology, Korea Kyoto University, Japan Rugters University, USA University of Texas-Pan American, USA Tokyo Denki University, Japan Univeristy of Oklahoma, USA University of Texas at Dallas, USA, Co-chair University of Texas-Pan American, USA, Co-chair Georgia Gwinnett College, USA Academia Sinica, Taiwan Kyoto University, Japan DePaul University, USA Microsoft, USA Northwestern University, USA North Carolina Central University, USA Academia Sinica, Taiwan Chinese Academia of Science, China Beijing Microsoft Lab, China Iowa State Univeristy, USA University of Miami, USA Kyushu University, Japan Old Dominion University, USA University of Ottawa, Canada Tata Institute of Fundamental Research, India Univeristy of Texas at San Antonio, USA University of Regina, Canada University of Singapore, Singapore Chinese University of Hong Kong, Hong Kong
VIII
Organization
Referees Ferdinando Cicalese Paolo D’Arco Yuan-Shin Lee
Zaixin Lu Gaolin Milledge Seth Pettie
Salvatore La Torre Lidong Wu Jiaofei Zhong
Invited Speaker Ryan Williams
IBM T.J. Walson Research Center, USA
Table of Contents
Derandomizing HSSW Algorithm for 3-SAT . . . . . . . . . . . . . . . . . . . . . . . . . Kazuhisa Makino, Suguru Tamaki, and Masaki Yamamoto
1
Dominating Set Counting in Graph Classes . . . . . . . . . . . . . . . . . . . . . . . . . . Shuji Kijima, Yoshio Okamoto, and Takeaki Uno
13
The Density Maximization Problem in Graphs . . . . . . . . . . . . . . . . . . . . . . . Mong-Jen Kao, Bastian Katz, Marcus Krug, D.T. Lee, Ignaz Rutter, and Dorothea Wagner
25
FlipCut Supertrees: Towards Matrix Representation Accuracy in Polynomial Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Malte Brinkmeyer, Thasso Griebel, and Sebastian B¨ ocker
37
Tight Bounds on Local Search to Approximate the Maximum Satisfiability Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Daming Zhu, Shaohan Ma, and Pingping Zhang
49
Parameterized Complexity in Multiple-Interval Graphs: Partition, Separation, Irredundancy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minghui Jiang and Yong Zhang
62
Exact Parameterized Multilinear Monomial Counting via k-Layer Subset Convolution and k-Disjoint Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dongxiao Yu, Yuexuan Wang, Qiang-Sheng Hua, and Francis C.M. Lau On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Kei Uchizawa, Takanori Aoki, Takehiro Ito, Akira Suzuki, and Xiao Zhou
74
86
On Parameterized Independent Feedback Vertex Set . . . . . . . . . . . . . . . . . . Neeldhara Misra, Geevarghese Philip, Venkatesh Raman, and Saket Saurabh
98
Cograph Editing: Complexity and Parameterized Algorithms . . . . . . . . . . Yunlong Liu, Jianxin Wang, Jiong Guo, and Jianer Chen
110
Approximation Complexity of Complex-Weighted Degree-Two Counting Constraint Satisfaction Problems (Extended Abstract) . . . . . . . Tomoyuki Yamakami
122
X
Table of Contents
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Desh Ranjan, John Savage, and Mohammad Zubair
134
Spin Systems on Graphs with Complex Edge Functions and Specified Degree Regularities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jin-Yi Cai and Michael Kowalczyk
146
Quantum Algorithm for the Boolean Hidden Shift Problem . . . . . . . . . . . . Dmitry Gavinsky, Martin Roetteler, and J´er´emie Roland A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma for Satisfiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jochen Messner and Thomas Thierauf Proper n-Cell Polycubes in n – 3 Dimensions . . . . . . . . . . . . . . . . . . . . . . . . Andrei Asinowski, Gill Barequet, Ronnie Barequet, and G¨ unter Rote
158
168 180
Largest Area Convex Hull of Axis-Aligned Squares Based on Imprecise Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ovidiu Daescu, Wenqi Ju, Jun Luo, and Binhai Zhu
192
Improved Algorithms for the Point-Set Embeddability Problem for Plane 3-Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tanaeem M. Moosa and M. Sohel Rahman
204
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Aritra Banik, Bhaswar B. Bhattacharya, and Sandip Das
213
Computing the Girth of a Planar Graph in Linear Time . . . . . . . . . . . . . . Hsien-Chih Chang and Hsueh-I. Lu Diagonalization Strikes Back: Some Recent Lower Bounds in Complexity Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ryan Williams
225
237
Unions of Disjoint NP-Complete Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Christian Glaßer, John M. Hitchcock, A. Pavan, and Stephen Travers
240
ReachFewL = ReachUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Brady Garvin, Derrick Stolee, Raghunath Tewari, and N.V. Vinodchandran
252
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment with Resource Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yuichi Asahiro, Kenta Kanmera, and Eiji Miyano Scheduling Jobs on Heterogeneous Platforms . . . . . . . . . . . . . . . . . . . . . . . . Marin Bougeret, Pierre Francois Dutot, Klaus Jansen, Christina Robenek, and Denis Trystram
259 271
Table of Contents
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Steven M. Kautz and Brad Shutters
XI
284
Approximately Uniform Online Checkpointing . . . . . . . . . . . . . . . . . . . . . . . Lauri Ahlroth, Olli Pottonen, and Andr´e Schumacher
297
Bandwidth of Convex Bipartite Graphs and Related Graphs . . . . . . . . . . . Anish Man Singh Shrestha, Satoshi Tayu, and Shuichi Ueno
307
Algorithms for Partition of Some Class of Graphs under Compaction . . . Narayan Vikas
319
A Generic Approach to Decomposition Algorithms, with an Application to Digraph Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Binh-Minh Bui-Xuan, Pinar Heggernes, Daniel Meister, and Andrzej Proskurowski
331
Matching and P2 -Packing: Weighted Versions . . . . . . . . . . . . . . . . . . . . . . . . Qilong Feng, Jianxin Wang, and Jianer Chen
343
On Totally Unimodularity of Edge-Edge Adjacency Matrices . . . . . . . . . . Yusuke Matsumoto, Naoyuki Kamiyama, and Keiko Imai
354
The Topology Aware File Distribution Problem . . . . . . . . . . . . . . . . . . . . . . Shawn T. O’Neil, Amitabh Chaudhary, Danny Z. Chen, and Haitao Wang
366
Exploiting the Robustness on Power-Law Networks . . . . . . . . . . . . . . . . . . . Yilin Shen, Nam P. Nguyen, and My T. Thai
379
Competitive Algorithms for Online Pricing . . . . . . . . . . . . . . . . . . . . . . . . . . Yong Zhang, Francis Y.L. Chin, and Hing-Fung Ting
391
Making Abstraction-Refinement Efficient in Model Checking . . . . . . . . . . Cong Tian and Zhenhua Duan
402
An Integer Programming Approach for the Rural Postman Problem with Time Dependent Travel Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Guozhen Tan and Jinghao Sun
414
Property Testing for Cyclic Groups and Beyond . . . . . . . . . . . . . . . . . . . . . Fran¸cois Le Gall and Yuichi Yoshida
432
Canonizing Hypergraphs under Abelian Group Action . . . . . . . . . . . . . . . . V. Arvind and Johannes K¨ obler
444
XII
Table of Contents
Linear Time Algorithms for the Basis of Abelian Groups . . . . . . . . . . . . . . Gregory Karagiorgos and Dimitrios Poulakis Characterizations of Locally Testable Linear- and Affine-Invariant Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Angsheng Li and Yicheng Pan
456
467
A New Conditionally Anonymous Ring Signature . . . . . . . . . . . . . . . . . . . . Shengke Zeng, Shaoquan Jiang, and Zhiguang Qin
479
On the Right-Seed Array of a String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Michalis Christou, Maxime Crochemore, Ondrej Guth, Costas S. Iliopoulos, and Solon P. Pissis
492
Compressed Directed Acyclic Word Graph with Application in Local Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Do Huy Hoang and Sung Wing Kin
503
Unavoidable Regularities in Long Words with Bounded Number of Symbol Occurrences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Juha Kortelainen, Tuomas Kortelainen, and Ari Vesanen
519
Summing Symbols in Mutual Recurrences . . . . . . . . . . . . . . . . . . . . . . . . . . . Berkeley R. Churchill and Edmund A. Lamagna
531
Flipping Triangles and Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minghui Jiang
543
Unconstrained and Constrained Fault-Tolerant Resource Allocation . . . . Kewen Liao and Hong Shen
555
Finding Paths with Minimum Shared Edges . . . . . . . . . . . . . . . . . . . . . . . . . Masoud T. Omran, J¨ org-R¨ udiger Sack, and Hamid Zarrabi-Zadeh
567
Combinatorial Group Testing for Corruption Localizing Hashing . . . . . . . Annalisa De Bonis and Giovanni Di Crescenzo
579
Task Ordering and Memory Management Problem for Degree of Parallelism Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sergiu Carpov, Jacques Carlier, Dritan Nace, and Renaud Sirdey
592
Computing Majority with Triple Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gianluca De Marco, Evangelos Kranakis, and G´ abor Wiener
604
A New Variation of Hat Guessing Games . . . . . . . . . . . . . . . . . . . . . . . . . . . Tengyu Ma, Xiaoming Sun, and Huacheng Yu
616
Table of Contents
Oblivious Transfer and n-Variate Linear Function Evaluation . . . . . . . . . . Yeow Meng Chee, Huaxiong Wang, and Liang Feng Zhang
XIII
627
Optimal Online Algorithms on Two Hierarchical Machines with Resource Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yiwei Jiang, An Zhang, and Jueliang Hu
638
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
649
Derandomizing HSSW Algorithm for 3-SAT Kazuhisa Makino1 , Suguru Tamaki2 , and Masaki Yamamoto3 1
Graduate School of Information Science and Technology, University of Tokyo
[email protected] 2 Graduate School of Informatics, Kyoto University
[email protected] 3 Dept. of Informatics, Kwansei-Gakuin University
[email protected]
Abstract. We present a (full) derandomization of HSSW algorithm for 3-SAT, proposed by Hofmeister, Sch¨ oning, Schuler, and Watanabe in n [STACS’02]. Thereby, we obtain an O(1.3303 )-time deterministic algorithm for 3-SAT, which is currently fastest.
1
Introduction
The satisfiability problem (SAT) is one of the most fundamental NP-hard problems. Questing for faster (exponential-time) exact algorithms is one of the main research directions on SAT. Initiated by Monien and Speckenmeyer [12], a number of algorithms for exactly solving SAT have been proposed, and many important techniques to analyze those algorithms have been developed [6]. See also [5, 13, 15, 16, 20], for example. The most well-studied restriction of the satisfiability problem is 3-SAT [2, 3, 7–10, 18, 19, 21], i.e., the CNF satisfiability problem with clauses of length at most three. The currently best known time n complexities for 3-SAT are O(1.3211 ) achieved by randomized algorithms [7] n and O(1.3334 ) derived by deterministic algorithms [13], where n denotes the in the number of Boolean variables in the formula. (We use the notation O ordinary way, that is, O(f (n)) means O(poly(n)f (n)).) As we can see, there is a noticeable gap between the current randomized and deterministic time bounds for 3-SAT. This raises a natural question: Can we close the gap completely? One promising way to attack the above question is derandomization. Roughly speaking, the task of derandomization is to construct an algorithm which deterministically and efficiently simulates the original randomized algorithm. There are a lot of strong derandomization results, e.g. [1, 4, 14, 17] to name a few, and one excellent example in the area of satisfiability is the derandomization of Sch¨ oning’s algorithm for k-SAT. In [20], Sch¨ oning proposed a simple randomized local search algorithm for k-SAT, and showed that it runs in expected time O((2 − 2/k)n), which is n O(1.3334 ) when k = 3. Later it was derandomized by Dantsin et al. [5]. They proposed a k-SAT algorithm that deterministically simulates Sch¨ oning’s algon rithm in time O((2 − 2/(k + 1))n ), which is O(1.5 ) when k = 3. Sch¨ oning’s algorithm makes use of randomness in the following two parts: (i) choosing initial B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 1–12, 2011. c Springer-Verlag Berlin Heidelberg 2011
2
K. Makino, S. Tamaki, and M. Yamamoto
assignments for local search uniformly at random, and (ii) performing random walks as the local search. Dantsin et al. [5] derandomized it (i) by constructing a set of Hamming balls (so-called covering codes), which efficiently covers the entire search space {0, 1}n, and (ii) by replacing each random walk by backtracking search. Here (i) is “perfectly” derandomized in some sense, however, the derandomization of (ii) loses some efficiency. For 3-SAT, the efficiency in derandomizing part (ii) was gradually improved by a sequence of works [3, 5, 11, 21]. Finally, and very recently, Moser and Scheder [13] showed a full derandomization of Sch¨ oning’s algorithm, that is, they proposed a deterministic algorithm for k SAT that runs in time O((2−2/k +)n) for any > 0. The running time matches n ) time that of Sch¨ oning’s algorithm, and we now have a deterministic O(1.3334 algorithm for 3-SAT. Our Contribution We investigate the possibility of derandomizing faster randomized algorithms for 3-SAT. In [8], Hofmeister, Sch¨oning, Schuler and Watanabe improved Sch¨ oning’s algorithm for the 3-SAT case, that is, they proposed a randomized algorithm for n 3-SAT that runs in expected time O(1.3303 ). Their improvement is based on a sophisticated way of randomly choosing initial assignments rather than just choosing the ones uniformly at random. In this paper, we present a full derandomization of their algorithm, that immediately implies the following result: n ). Theorem 1. Problem 3-SAT is deterministically solvable in time O(1.3303 As long as the authors know, it is the currently fastest deterministic algorithm for 3-SAT. Our result seems to be a necessary step towards a full derandomization of the currently best known randomized algorithm, since it is based on the combination of two algorithms [9] and [7], which are respectively a modification of Hofmeister et al.’s algorithm [8] and an extension of Paturi et al.’s algorithm [15]. To prove the above result, we develop a new way of explicitly constructing covering codes with the properties which corresponds to the distribution used to generate initial assignments in Hofmeister et al.’s algorithm. More precisely, we respectively denote by SCH and HSSW the randomized algorithms by Sch¨ oning [20], and by Hofmeister, Sch¨oning, Schuler, and Watanabe [8]. Algorithm HSSW is obtained by modifying SCH, where one of the main differences between SCH and HSSW is to choose initial assignments for random walks as the local search: HSSW starts the random walk at an assignment choˆ sen randomly from ({0, 1}3 \ 03 )m for some m ˆ ≤ n/3, while SCH starts it at an assignment chosen uniformly from the whole space {0, 1}n. We derandomized this random selection of initial assignments for HSSW in the similar way to SCH [5], i.e., by constructing a covering code (i.e., a set of ˆ balls that covers the whole search space ({0, 1}3 \ 03 )m ). However, due to the 3 3 m ˆ n difference of ({0, 1} \ 0 ) and {0, 1} , we cannot directly apply a uniform ˆ covering code developed in [5]. To efficiently cover the space ({0, 1}3 \ 03 )m , we
Derandomizing HSSW Algorithm for 3-SAT
3
introduced a generalized covering code, an []-covering code, which is a sequence of codes C(0), C(1), . . . , C() such that (i) C(i) is a set of balls of radius i, and (ii) 3 3 m ˆ i=0 C(i) covers ({0, 1} \ 0 ) . We remark that the generalized covering code has non-uniform covering radius while an ordinary covering code has uniform radius. We first show the existence of small []-covering code (C(0), C(1), . . . , C()), and then similarly to [5], by using an approximation algorithm for the set cover problem, we show a deterministic construction of an []-covering code ˜ ˜ ˜ ˜ C(0), C(1), . . . , C() such that |C(i)| ≈ |C(i)|. We remark that our technique of constructing certain types of covering codes has a potential application, for example, it can be applied to the further extensions [2, 18] of HSSW.
2
Preliminaries
In this section, we briefly review HSSW algorithm for 3-SAT proposed in [8]. In what follows, we focus on 3-CNF formulas. Let ϕ be a 3-CNF formula over X = {x1 , . . . , xn }. We alternatively regard ϕ as the set of clauses of ϕ. Thus, the size of ϕ, which is the number of clauses of ϕ, is denoted by |ϕ|. For any sub-formula ϕ ⊂ ϕ (resp., any clause C ∈ ϕ), we denote by X(ϕ ) (resp., X(C)) the set of variables of ϕ (resp., C). A clause set ϕ ⊂ ϕ is independent if X(C) ∩ X(C ) = ∅ for any pair of clauses C, C ∈ ϕ . An independent clause set ϕ is maximal if for any clause C ∈ (ϕ \ ϕ ) there exists a clause C ∈ ϕ such that X(C) ∩ X(C ) = ∅. For any partial assignment t to X(ϕ), we denote by ϕ|t a sub-formula obtained from ϕ by fixing variables according to t. Given a 3-CNF formula ϕ, algorithm HSSW starts with arbitrarily finding a maximal independent clause set of ϕ. Fact 1. Let ϕ be a 3-CNF formula. Let ϕ ⊂ ϕ be a maximal independent clause set of ϕ. Then, for any assignment t to X(ϕ ), the formula ϕ|t is a 2-CNF formula. Before describing HSSW, we briefly review SCH algorithm for k-SAT proposed in [20]. Algorithm SCH is a randomized algorithm which repeats the following procedure exponentially (in n) many times: choose a random assignment t, and run a random walk starting at t as follows: for a current assignment t , if ϕ is satisfied by t , then output YES and halt. Otherwise, choose an arbitrary clause C unsatisfied by t , and then update t by flipping the assignment of a variable of C chosen uniformly at random. This random walk procedure denoted by SCH-RW(ϕ, t) is also exploited in HSSW. The success probability of SCH-RW(ϕ, t) for a satisfiable ϕ was analyzed in [20]: Let ϕ be a 3-CNF formula that is satisfiable. Let t0 be an arbitrary satisfying assignment of ϕ. Then, for any initial assignment t with Hamming distance d(t0 , t) = r, we have r 1 1 Pr{SCH-RW(ϕ, t) = YES} ≥ · . (1) 2 poly(n)
4
K. Makino, S. Tamaki, and M. Yamamoto
Now, we are ready to present HSSW. Given a 3-CNF formula ϕ, HSSW first obtains a maximal independent clause set ϕ ⊂ ϕ. Note here that the formula ϕ|t for any assignment to X(ϕ ) is a 2-CNF, and hence we can check in polynomial time whether ϕ|t is satisfiable. From this observation, when ϕ is small, we can |ϕ | ) significantly improve the whole running time, that is, it only requires O(7 time. On the other hand, when the size of ϕ is large, we repeatedly apply the random walk procedure SCH-RW. In this case, we can also reduce the running time by smartly choosing initial assignments from satisfiable assignments of ϕ : Recall that SCH uniformly chooses initial assignments from {0, 1}n, which utilizes no information on ϕ. Intuitively, HSSW uses initial assignments for SCH-RW that are closer to any satisfiable assignment. In fact we can prove that the larger the size of ϕ is, the higher the probability that the random walk starts at an assignment closer to a satisfying assignment is. Formally, algorithm HSSW is described in Fig. 1. The algorithm contains 5 parameters α, c, and triple (a1 , a2 , a3 ) with 3a1 +3a2 +a3 = 1. These parameters are set to minimize the whole expected running time. HSSW(ϕ)
// ϕ: a 3-CNF formula over X
Obtain a maximal independent clause set ϕ ⊂ ϕ If |ϕ | ≤ αn, then for each t ∈ {0, 1}X(ϕ ) that satisfies ϕ Check the satisfiability of ϕ|t // ϕ|t : a 2-CNF formula If |ϕ | > αn, then c times do Run t = init-assign(X, ϕ ) Run SCH-RW(ϕ, t) // YES is output here if a solution is found Output NO init-assign(X, ϕ ) follows
// return an assignment t ∈ {0, 1}X defined as
for each C ∈ ϕ Assume C = xi ∨ xj ∨ xk Choose a random assignment t to x = (xi , xj , xk ) following the probability distribution: Pr{x = (1, 0, 0)} = Pr{x = (0, 1, 0)} = Pr{x = (0, 0, 1)} = a1 Pr{x = (1, 1, 0)} = Pr{x = (1, 0, 1)} = Pr{x = (0, 1, 1)} = a2 Pr{x = (1, 1, 1)} = a3 for each x ∈ X \ X(ϕ ) Choose a random assignment t to x ∈ {0, 1} Fig. 1. Algorithm HSSW
Derandomizing HSSW Algorithm for 3-SAT
5
Consider algorithm HSSW in Fig. 1 when |ϕ | > αn for some constant α > 0. (In what follows, we focus on this case since for the other case, it has no randomness.) Let HSSW-RW(ϕ, ϕ ) be the procedure that is repeated c times. Then, by using the lower bound (1), and setting parameters (a1 , a2 , a3 ) suitably (c.f., Lemma 1 below), we have: for any satisfiable 3-CNF formula ϕ, n |ϕ | 3 64 Pr {HSSW-RW(ϕ, ϕ ) = YES} ≥ · . t,SCH-RW 4 63
(2)
n The whole expected running time O(1.3303 ) is obtained by setting α to satisfy the following equation.
n αn −1 3 64 · = 7αn . 4 63 The values of parameters (a1 , a2 , a3 ) are determined according to the following lemma, which will be used by our derandomization. Lemma 1 (Hofmeister, Sch¨ oning, Schuler, and Watanabe [8]). Let ϕ be a 3-CNF formula that is satisfiable, and let ϕ ⊂ ϕ be a maximal independent clause set of ϕ. Let t be a random (partial) assignment obtained via init-assign(X, ϕ ) and restricted to X(ϕ ). Then, for any (partial) assignment t0 ∈ {0, 1}X(ϕ ) that satisfies ϕ , d(t0 ,t) |ϕ | 1 3 E = . (3) t 2 7 There are two types of randomness that are used in HSSW: (1) the random assignment obtained via init-assign, and (2) the random walk of SCH-RW. Fortunately, the latter type of randomness can be (fully) removed by the recent result. (Compare it with the inequality (1).) Theorem 2 (Moser and Scheder [13]). Let ϕ be a 3-CNF formula that is satisfiable. Given an assignment t such that there exists a satisfying assignment t0 of ϕ such that d(t0 , t) = r for a non-negative integer r. Then, a satisfying assignment (not necessarily to be t0 ) can be found deterministically in time O((2 + )r ) for any constant > 0. In the next section, we show that the former type of randomness is also not necessary. It is shown by using covering codes, that is in the similar way to [5]. But, the covering code we make use of is different from ordinary ones. For any positive integer n, a code of length n is a subset of {0, 1}n , where each element of a code is called a codeword. A code C ⊂ {0, 1}n is called an r-covering code if for every x ∈ {0, 1}n, there exists a codeword y ∈ C such that d(x, y) ≤ r. This is the definition of an ordinary covering code. We define a generalization of covering codes in the following way:
6
K. Makino, S. Tamaki, and M. Yamamoto
Definition 1. Let be a non-negative integer. A sequence C(0), C(1), . . . , C() of codes is a {0, 1, . . . , }-covering code, or simply an []-covering code, if for every x ∈ {0, 1}n, there exists a codeword y ∈ C(r) for some r : 0 ≤ r ≤ such that d(x, y) ≤ r. For a set S of non-negative integers, a sequence (C(i) : i ∈ S) of codes is called an S-covering code. For ordinary covering codes, it is easy to show the existence of a “good” rcovering code. Moreover, it is known that we can deterministically construct such an r-covering code. Lemma 2 (Dantsin et al. [5]). Let d ≥ 2 be a constant that divides n ≥ 1, and let 0 < ρ < 1/2. Then, there is a polynomial qd (n) such that a covering code of length n, radius at most ρn, and size at most qd (n)2(1−h(ρ))n , can be deterministically constructed in time qd (n)(23n/d +2(1−h(ρ))n ). The function h(x) is the binary entropy function, that is, h(x) = −x log2 x − (1 − x) log2 (1 − x) for 0 < x < 1.
3
A Derandomization of HSSW
In this section, we prove Theorem 1 by derandomizing HSSW. We do that in the similar way to [5]. Let ϕ be a 3-CNF formula, and ϕ be a maximal independent clause set of ϕ. Let |ϕ | = m. ˆ We suppose m ˆ = Ω(n) since we focus on the case of |ϕ | > αn. As is explained in the Introduction, we will use a generalized covering code: an []-covering code. First, we show that there exists an []-covering code ˆ for ({0, 1}3 \ 03 )m where each of its codes is of small size. ˆ , there exists an []-covering code C(0), C(1), . . . , Lemma 3. For ({0, 1}3 \ 03 )m ˆ C(), where is the maximum integer such that (3/7)m < (1/2)−2 , and |C(i)| = 2 m ˆ i O(m ˆ (7/3) /2 ).
Proof. We show the existence of such an []-covering code by a probabilistic argument, as is the case of the existence of an ordinary covering code for {0, 1}n. However, the probabilistic construction of an []-covering code is different from the simple one of an ordinary covering code in terms of, (1) non-uniform covering radius, and (2) non-uniform choice of codewords. For obtaining the desired covering code, we make use of the probability distribution calculated in [8], that is, the equation (3) of Lemma 1. The probabilistic construction is as follows: Let be the integer defined above. For each ˆ be a random code obtained by choosi : 0 ≤ i ≤ , let C(i) ⊂ ({0, 1}3 \ 03 )m 3 3 m ˆ ing y ∈ ({0, 1} \ 0 ) according to the distribution defined by the function ˆ init-assign (in Fig. 1), and by repeating it independently s(i) = 8m ˆ 2 (7/3)m /2i times. Note here that |C(i)| ≤ s(i). We will show that C(0), C(1), . . . , C() is an []-covering code with high probˆ ability. Fix x ∈ ({0, 1}3 \ 03 )m arbitrarily. Note here that ≤ 2m ˆ and (1/2)−1 ≤ m ˆ (3/7) . Then, 3m ˆ i=0
(1/2)i Pr{d(x, y) = i} y
Derandomizing HSSW Algorithm for 3-SAT
=
(1/2)i Pr{d(x, y) = i} + y
i=0
≤
≤
(1/2)i Pr{d(x, y) = i} y
i=+1
(1/2)i Pr{d(x, y) = i} + (1/2) y
i=0
3m ˆ
7
ˆ (1/2)i Pr{d(x, y) = i} + (3/7)m /2. y
i=0
Recall from the equation (3) of Lemma 1 that, 3m m ˆ d(x,y) ˆ 1 3 i E = (1/2) Pr{d(x, y) = i} = . y y 2 7 i=0 From these two, we have ˆ (1/2)i Pr{d(x, y) = i} ≥ (3/7)m /2. i=0
y
From this, we see there exists an r : 0 ≤ r ≤ such that ˆ r−1 Pr{d(x, y) = r} ≥ (3/7)m 2 /( + 1). y
(4)
ˆ Note that this value of r depends on x. Thus, for each x ∈ ({0, 1}3 \ 03 )m , if we define
def rx = arg max (1/2)i Pr{d(x, y) = i} , i:0≤i≤
we see that r = rx satisfies the above inequality (4) 1 . Let B(z, i) be the set ˆ of w ∈ {0, 1}3m such that d(z, w) ≤ i. Then, from the lower bound (4), the probability that x is not covered with any C(i) is ⎧ ⎫ ⎧ ⎫ ⎨ ⎬ ⎨ ⎬ Pr x ∈ B(z, i) ≤ Pr x ∈ B(z, rx ) C ⎩ ⎭ C(rx ) ⎩ ⎭ i=0 z∈C(i)
z∈C(rx )
= Pr {∀y ∈ C(rx )[d(x, y) > rx ]} C(rx )
s(rx ) = Pr {[d(x, y) > rx ]} y
s(rx ) = 1 − Pr{d(x, y) ≤ rx } y
s(rx ) ≤ 1 − Pr{d(x, y) = rx } y
1
This definition of rx is not meaningful if we merely show the existence. However, it is used when we consider a deterministic construction. See the next lemma.
8
K. Makino, S. Tamaki, and M. Yamamoto
s(rx ) ˆ rx −1 ≤ 1 − (3/7)m 2 /( + 1) ˆ rx −1 ≤ exp −(3/7)m 2 s(rx )/( + 1) ≤ exp (−(2m ˆ − 1)) ˆ Thus, from the union bound, the probability that some x ∈ ({0, 1}3 \ 03 )m is not m ˆ ˆ − 1)) = o(1). Therefore, there covered with any C(i) is at most 7 · exp(−(2m does exist an []-covering code stated in this lemma.
Note that this lemma only shows the existence of such an []-covering code. We need to deterministically construct it. However, we can get around this issue in the same way as [5]: applying the approximation algorithm for the set cover problem. But, since an []-covering code is not of uniform radius, we can not directly apply the approximation algorithm. Lemma 4. Let d ≥ 2 be a constant that divides m, ˆ and let m ˆ = m/d. ˆ Let ˆ be the maximum integer such that (3/7)m < (1/2) −2 . Let = d. Then, there is a polynomial qd (m) ˆ that satisfies the following: an []-covering code ˆ ˆ C(0), C(1), . . . , C() for ({0, 1}3 \ 03 )m such that |C(i)| ≤ qd (m) ˆ · (7/3)m /2i ˆ for 0 ≤ i ≤ , can be deterministically constructed in time poly(m) ˆ · 73m/d + ˆ qd (m) ˆ · (7/3)m .
ˆ ˆ 2 (7/3)m /2i for each i : 0 ≤ i ≤ . First, we deterministically Proof. Let si = 8m ˆ such construct an [ ]-covering code D (0), D (1), . . . , D ( ) for ({0, 1}3 \ 03 )m that |D (i)| ≤ poly(m ˆ ) · si . (Then, we concatenate all of them. See below for details.) Recall the proof of the previous lemma: Let pi = (1/2)i Pr{d(x, y) = i} for ˆ each i : 0 ≤ i ≤ . For any x ∈ ({0, 1}3 \03 )m , we have defined rx = arg max{pi : 0 ≤ i ≤ }, which depends only on x. Note here that rx is not random but a fixed value. Then, we have concluded that the sequence C (0), C (1), . . . , C ( ) of random codes of |C (i)| ≤ si satisfies the following with high probability: every ˆ is covered with the random code C (rx ). We can regard this x ∈ ({0, 1}3 \ 03 )m ˆ fact as follows: Let [A0 , A1 , . . . , A ] be a partition of ({0, 1}3 \ 03 )m , where def ˆ Ai = x ∈ ({0, 1}3 \ 03 )m : rx = i .
Then, there exists an [ ]-covering code C (0), C (1), . . . , C ( ) of |C (i)| ≤ si such that C (i) covers Ai . The point of the proof is that we apply the approximation algorithm for the ˆ ), from set cover problem to each Ai (not to the whole space ({0, 1}3 \ 03 )m which we (deterministically) obtain a covering code for each Ai . For this, we obtain all elements of Ai and keep them. This is done by calculating the value ˆ of rx for each x ∈ ({0, 1}3 \ 03 )m . Furthermore, the calculation of rx is done by ˆ calculating pj for every j : 0 ≤ j ≤ : enumerate all y ∈ ({0, 1}3 \ 03 )m such that d(x, y) = j, and then calculate the probability that y is generated by the function init-assign. Then, summing up those values of the probability, we can calculate Pr{d(x, y) = j}, and hence pj . Choosing j as rx such that pj is
Derandomizing HSSW Algorithm for 3-SAT
9
the maximum of all j : 0 ≤ j ≤ , we can obtain the value of rx , and hence Ai . ˆ In total, it takes poly(m) ˆ · 72m time for that procedure. Now, we apply the approximation algorithm for the set cover problem to each Ai . (The approximation algorithmtakes {B(z, i) ∩ Ai : z ∈ Ai } as input, and outputs a set S ⊂ Ai such that z∈S B(z, i) ∩ Ai = Ai .) As is similar to [5], the approximation algorithm finds a covering code D (i) for Ai such that |D (i)| ≤ poly(m ˆ )·si because at least C (i) of size at most si covers Ai , and hence the size of an optimal covering code for Ai is also at most si . Furthermore, this ˆ ˆ is done in time poly(m ˆ ) · |Ai |3 . In total, since |Ai | ≤ 7m , it takes poly(m ˆ ) · 73 m time for that procedure. So far, we have obtained an [ ]-covering code D (0), D (1), . . . , D ( ) for ˆ ({0, 1}3 \ 03 )m such that |D (i)| ≤ poly(m ˆ ) · si . For each 0 ≤ i ≤ = d, let C(i) = {D (i1 ) × D (i2 ) × · · · × D (id ) : i = i1 + i2 + · · · + id , 0 ≤ ij ≤ }. def
ˆ It is easy to see that C(0), C(1), . . . , C() is an []-covering code for ({0, 1}3 \03 )m . We (naively) estimate the upper bound on |C(i)|. Let i1 , i2 , · · · , id be integers such that i = i1 + i2 + · · · + id and 0 ≤ ij ≤ . Then,
|D (i1 ) × D (i2 ) × · · · × D (id )|
ˆ ˆ ˆ 8m ˆ 2 (7/3)m 8m ˆ 2 (7/3)m 8m ˆ 2 (7/3)m = (poly(m ˆ )) · · · · · · · 2i1 2i2 2id 2 d m ˆ d (8m ˆ ) (7/3) = (poly(m ˆ ))d · 2i1 +···+id ˆ (7/3)m = (poly(m ˆ ))d · . 2i
d
Since the number of combinations i1 , . . . , id such that i = i1 + · · · + id and 0 ≤ ij ≤ is at most ( + 1)d , we have |C(i)| ≤ ( + 1)d · poly(m ˆ ) ·
ˆ ˆ (7/3)m (7/3)m ≤ qd (m) ˆ · i i 2 2
for some polynomial qd (m). ˆ Finally, we check the running time needed to construct C(i). It takes poly(m) ˆ · ˆ 73m/d time to construct the [ ]-covering code D (0), D (1), . . . , D ( ) for ({0, 1}3\ ˆ 03 )m . Furthermore, it takes i=0 |C(i)| time to construct the []-covering code ˆ m ˆ C(0), C(1), . . . , C() for ({0, 1}3 \03 )m , which is at most qd (m)·(7/3) ˆ . Summing 3m/d ˆ m ˆ up, it takes poly(m) ˆ ·7 + qd (m) ˆ · (7/3) in total. Recall that |ϕ | = m ˆ = Ω(n). Let n = n − 3m, ˆ which is the number of variables in ϕ not appeared in ϕ . For the space {0, 1}n , we use an ordinary covering code, that is guaranteed by Lemma 2 to be deterministically constructed. Corollary 1. Let d be a sufficiently large positive constant, and let 0 < ρ < 1/2. Then, there is a polynomial qd (n) that satisfies the following: an {i + ρn :
10
K. Makino, S. Tamaki, and M. Yamamoto
0 ≤ i ≤ }-covering code C(0 + ρn ), C(1 + ρn ), C(2 + ρn ), . . . , C( + ρn ) for ˆ ˆ (1−h(ρ))n ({0, 1}3 \ 03 )m × {0, 1}n such that |C(i)| ≤ qd (n)(7/3)m 2 /2i, can be m ˆ (1−h(ρ))n deterministically constructed in time qd (n)(7/3) 2 . Proof. It is derived from the previous lemma and Lemma 2. Given an []-covering ˆ code C1 (0), C1 (1), . . . , C1 () for ({0, 1}3 \ 03 )m , and a ρn -covering code C2 (ρn ) n for {0, 1} . For each 0 ≤ i ≤ , let C(i + ρn ) = C1 (i) × C2 (ρn ). def
It is easy to see that C(0 + ρn ), C(1 + ρn ), C(2 + ρn ), . . . , C( + ρn ) is an ˆ {i + ρn : 0 ≤ i ≤ }-covering code for the space ({0, 1}3 \ 03 )m × {0, 1}n . Fur ˆ (1−h(ρ))n thermore, |C(i + ρn )| ≤ qd (n)(7/3)m 2 /2i for each i : 0 ≤ i ≤ . From the previous lemma, if the constant d is sufficiently large, the running time for m ˆ (deterministically) constructing C1 (0), C1 (1), . . . , C1 () is at most qd (m)(7/3) ˆ . Similarly, from Lemma 2, the running time for (deterministically) constructing C2 (ρn ) is at most qd (n )2(1−h(ρ))n . Thus, the total running time is at most
m ˆ qd (m)(7/3) ˆ + qd (n )2(1−h(ρ))n +
ˆ (1−h(ρ))n qd (n)(7/3)m 2 /2i
i=0
ˆ (1−h(ρ))n ≤ qd (n)(7/3)m 2
for some polynomial qd (n).
Now, using this corollary, we show a derandomization of HSSW, and hence we prove Theorem 1. The outline of the deterministic algorithm is almost same as HSSW, which is described in Fig. 1. We show the derandomization for the case of |ϕ | > αn. Given ϕ , we deterministically construct an {i + ρn : 0 ≤ i ≤ }covering code C(0 + ρn ), C(1 + ρn ), C(2 + ρn ), . . . , C( + ρn ), as is specified in the proofs of Lemma 2, Lemma 4, and Corollary 1. For any z ∈ {0, 1}n and non-negative integer i, we denote by B(z, i) the set of w ∈ {0, 1}n such that d(z, w) ≤ i. Then, given such an {i + ρn : 0 ≤ i ≤ }-covering code, we check whether there is a satisfying assignment within B(z, i + ρn ) for each 0 ≤ i ≤ and each z ∈ C(i + ρn ). It is easy to see that this algorithm finds a satisfying assignment of ϕ if and only if ϕ is satisfiable. We estimate the running time of the algorithm. For any fixed i and z, the search of a satisfying assignment within B(z, i + ρn ) is done in time (2 + )i+ρn for any small constant > 0, which is guaranteed by Theorem 2. Thus, given an {i + ρn : 0 ≤ i ≤ }-covering code, the running time for this task for all B(z, i + ρn ) is at most ˆ (7/3)m (1−h(ρ))n qd (n) · · 2 · 2i+ρn · (1 + )n i 2 0≤i≤ m ˆ 7 = qd (n) · · 2(1−h(ρ))n · 2ρn · (1 + )n 3
Derandomizing HSSW Algorithm for 3-SAT
11
m ˆ n 7 4 = qd (n) · · · (1 + )n (∵ ρ = 1/4) 3 3 n m ˆ 4 63 = qd (n) · · · (1 + )n , (∵ n = n − 3m) ˆ 3 64 for some polynomial qd (n). Note from the above corollary that the running time for constructing {i + ρn : 0 ≤ i ≤ }-covering code is less than the above value. Thus, the total running time in case of |ϕ | > αn is at most n ˆ O((4/3) (63/64)m (1 + )n ) for any > 0. (Compare this value with the success probability of (2).) On the other hand, it is easy to see that the running ˆ m time in case of |ϕ | ≤ αn is at most O(7 ). Therefore, by setting α so that n αn n αn (4/3) (63/64) (1 + ) = 7 holds (with > 0 arbitrarily small), we obtain n the running time O(1.3303 ).
4
Conclusion
We have shown a full derandomization of HSSW, and thereby present a currently fastest deterministic algorithm for 3-SAT. An obvious future work is to obtain a full derandomization of the currently best known randomized algorithm for 3-SAT [7]. To do so, it seems to be required to derandomize Paturi et al.’s algorithm [15] completely. Another possible future work is to extend HSSW algorithm to the k-SAT case. It leads to the fastest deterministic algorithms for k-SAT, combined with the derandomization techniques of this paper and Moser and Scheder [13]. Acknowledgements. We are grateful to anonymous referees for giving us useful comments for improving the presentation.
References 1. Agrawal, M., Kayal, N., Saxena, N.: PRIMES is in P. Annals of Mathematics 160(2), 781–793 (2004) 2. Baumer, S., Schuler, R.: Improving a probabilistic 3-SAT algorithm by dynamic search and independent clause pairs. In: Giunchiglia, E., Tacchella, A. (eds.) SAT 2003. LNCS, vol. 2919, pp. 150–161. Springer, Heidelberg (2004) 3. Br¨ ueggemann, T., Kern, W.: An improved deterministic local search algorithm for 3-SAT. Theoretical Computer Science 329(1-3), 303–313 (2004) 4. Chandrasekaran, K., Goyal, N., Haeupler, B.: Deterministic Algorithms for the Lov´ asz Local Lemma. In: Proc. of SODA 2010, pp. 992–1004 (2010) 5. Dantsin, E., Goerdt, A., Hirsch, E., Kannan, R., Kleinberg, J., Papadimitriou, C., Raghavan, P., Sch¨ oning, U.: A deterministic (2 − 2/(k + 1))n algorithm for k-SAT based on local search. Theoretical Computer Science 289(1), 69–83 (2002) 6. Dantsin, E., Hirsch, E.A.: Worst-Case Upper Bounds. In: Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185, pp. 403–424. IOS Press, Amsterdam (2009)
12
K. Makino, S. Tamaki, and M. Yamamoto
7. Hertli, T., Moser, R.A., Scheder, D.: Improving PPSZ for 3-SAT using Crititical Variables. In: Proceedings of the 28th International Symposium on Theoretical Aspects of Computer Science (STACS), pp. 237–248 (2011) 8. Hofmeister, T., Sch¨ oning, U., Schuler, R., Watanabe, O.: A probabilistic 3-SAT algorithm further improved. In: Alt, H., Ferreira, A. (eds.) STACS 2002. LNCS, vol. 2285, pp. 192–202. Springer, Heidelberg (2002) 9. Iwama, K., Seto, K., Takai, T., Tamaki, S.: Improved Randomized Algorithms for 3-SAT. In: Cheong, O., Chwa, K.-Y., Park, K. (eds.) ISAAC 2010. LNCS, vol. 6506, pp. 73–84. Springer, Heidelberg (2010) 10. Iwama, K., Tamaki, S.: Improved upper bounds for 3-SAT. In: Proceedings of the 15th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 328– 329 (2004) 11. Kutzkov, K., Scheder, D.: Using CSP To Improve Deterministic 3-SAT. arXiv:1007.1166v2 (2010) 12. Monien, B., Speckenmeyer, E.: Solving satisfiability in less than 2n steps. Discrete Applied Mathematics 10, 287–295 (1985) 13. Moser, R., Scheder, D.: A Full Derandomization of Sch¨ oning’s k-SAT Algorithm. In: Proceedings of the 43rd ACM Symposium on Theory of Computing (STOC), pp. 245–252 (2011) arXiv:1008.4067v1 14. Mahajan, S., Ramesh, H.: Derandomizing Approximation Algorithms Based on Semidefinite Programming. SIAM J. Comput. 28(5), 1641–1663 (1999) 15. Paturi, R., Pudl´ ak, P., Saks, M., Zane, F.: An Improve Exponential-Time Algorithm for k-SAT. In: Proceedings of the 39th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 628–637 (1998); Journal version: J. of the ACM 52(3), 337–364 (2005) 16. Paturi, R., Pudl´ ak, P., Zane, F.: Satisfiability coding lemma. In: Proceedings of the 38th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 566–574 (1997) 17. Reingold, O.: Undirected connectivity in log-space. J. ACM 55(4), Article 17 (2008) 18. Rolf, D.: 3-SAT ∈ RTIME(O(1.32793n )). Electronic Colloquium on Computational Complexity, TR03-054 (2003) 19. Rolf, D.: Improved bound for the PPSZ/Sch¨ oning-algorithm for 3-SAT. Journal on Satisfiability, Boolean Modeling and Computation 1, 111–122 (2006) 20. Sch¨ oning, U.: A probabilistic algorithm for k-SAT and constraint satisfaction problems. In: Proceedings of the 40th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 410–414 (1999) 21. Scheder, D.: Guided search and a faster deterministic algorithm for 3-SAT. In: Laber, E.S., Bornstein, C., Nogueira, L.T., Faria, L. (eds.) LATIN 2008. LNCS, vol. 4957, pp. 60–71. Springer, Heidelberg (2008)
Dominating Set Counting in Graph Classes Shuji Kijima1 , Yoshio Okamoto2, and Takeaki Uno3 1
Graduate School of Information Science and Electrical Engineering, Kyushu University, Japan
[email protected] 2 Center for Graduate Education Initiative, Japan Advanced Institute of Science and Technology, Japan
[email protected] 3 National Institute of Informatics, Japan
[email protected]
Abstract. We make an attempt to understand the dominating set counting problem in graph classes from the viewpoint of polynomial-time computability. We give polynomial-time algorithms to count the number of dominating sets (and minimum dominating sets) in interval graphs and trapezoid graphs. They are based on dynamic programming. With the help of dynamic update on a binary tree, we further reduce the time complexity. On the other hand, we prove that counting the number of dominating sets (and minimum dominating sets) in split graphs and chordal bipartite graphs is #P-complete. These results are in vivid contrast with the recent results on counting the independent sets and the matchings in chordal graphs and chordal bipartite graphs.
1 Introduction Combinatorics is a branch of mathematics that often deals with counting various objects, and has a long tradition. However, the algorithmic aspect of counting has been less studied. This seems due to the facts that most of the problems turn out to be #Phard (thus unlikely to have polynomial-time algorithms) and that not many algorithmic techniques have been known. In the study of graph classes, the situation does not differ. There are many studies on decision problems and optimization problems, but fewer studies on counting problems. Certainly, counting algorithms require properties of graphs that are not needed for solving decision and optimization problems. From this perspective, Okamoto, Uehara and Uno studied two basic counting problems for graph classes. The first paper [8] studied the problem to count the number of independent sets, and provided a linear-time algorithm for chordal graphs. On the other hand, their second paper [7] in the series studied the problems to count the number of matchings and perfect matchings, respectively, and proved that the problem is #P-complete for chordal graphs (actually for split graphs). They are also #P-complete for chordal bipartite graphs. It still remains open whether
The first and second authors are supported by Grant-in-Aid for Scientific Research from Ministry of Education, Science and Culture, Japan, and Japan Society for the Promotion of Science.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 13–24, 2011. c Springer-Verlag Berlin Heidelberg 2011
14
S. Kijima, Y. Okamoto, and T. Uno
AT-free
weakly chordal
bipartite
cocomparability
chordal
chordal bipartite
cobipartite permutation
trapezoid
strongly chordal interval
split
Fig. 1. Complexity landscape for the dominating set counting problem regarding graph classes
the number of matchings (or perfect matchings) can be computed in polynomial time for interval graphs, and even for proper interval graphs. This paper is concerned with dominating sets. In this paper, we will try to understand the dominating set counting problem from the viewpoint of polynomial-time computability. Domination is one of the main subjects in graph theory and graph algorithms, and there are some books especially devoted to that topic [3,4]. However, not much is known for the counting aspect. Our result. We give polynomial-time algorithms to count the number of dominating sets (and minimum dominating sets) in interval graphs and trapezoid graphs. They are based on dynamic programming. With the help of dynamic update on a binary tree, we reduce the time complexity. On the other hand, we prove that counting the number of dominating sets in split graphs, chordal bipartite graphs, and cobipartite graphs is #P-complete, and counting the number of minimum dominating sets in split graphs and chordal bipartite graphs is #P-hard. Fig. 1 summarizes our results on counting the number of dominating sets. In the figure, each arrow means that the class on the tail is a subclass of the class on the head. For the graph classes in solid lines polynomial-time algorithms exist, and for the graph classes in double solid lines the problem is #P-complete. For strongly chordal graphs, in a dashed line, the question is left open. As for counting the minimum dominating sets, Kratsch [5] very recently gave an O(n7 )-time algorithm for AT-free graphs, while the polynomial-time computability is open for strongly chordal graphs. Note that a trapezoid graph is AT-free, but the bound of our algorithm is better than Kratsch’s algorithm. Related work. On counting the number of independent dominating sets and the number of minimum independent dominating sets, Okamoto, Uno and Uehara [8] proved the #P-hardness for chordal graphs, and Lin and Chen [6] gave linear-time algorithms for interval graphs. We note that the parity version of the problem turns out to be trivial: Brouwer, Csorba, and Schrijver [2] proved that every graph has an odd number of dominating sets. Preliminaries. In this paper, all graphs are finite, simple and undirected. A graph G is denoted by a pair (V, E) of its vertex set V and its edge set E. The set of adjacent vertices of v is called the neighborhood of v, and denoted by NG (v). If there is no confusion, we simply write N (v). For a vertex subset X ⊆ V , we denote N (X) := N (v) \ X. v∈X
Dominating Set Counting in Graph Classes
2
y1 y2
x1 x2
1 6
1 3
2
4
5
3 4
An interval graph G
15
6
5
7
An interval representation of G
Fig. 2. Example of an interval graph and the corresponding intervals
For u, v ∈ V , we say u dominates v if u and v are adjacent in G. A subset D ⊆ V dominates v if at least one vertex in D dominates v. A dominating set of G is a vertex subset D ⊆ V that dominates all vertices in V \ D. A dominating set of G is minimum if it has the smallest number of elements among all dominating sets of G. In the analysis of our algorithms, the time complexity refers to the number of arithmetic operations, not bit operations. Due to the space constraint, we postpone the proofs of theorems/lemmas with * marks to the full version.
2 Interval Graphs A graph G = ({1, . . . , n}, E) is interval if there exists a set {I1 , . . . , In } of closed intervals on a real line such that {i, j} ∈ E if and only if Ii ∩ Ij = ∅. Such a set of intervals is called an interval representation of G. It is known that there always exists an interval representation in which the endpoints of intervals are all distinct, and we can find such a representation of a given interval graph that is sorted by their right endpoints in O(n + m) time [1], where n is the number of vertices and m is the number of edges. Let {I1 , . . . , In } be such a representation, and let each interval be represented as Ii = [xi , yi ]. By the assumption, it holds that yi < yj if i < j. For the sake of technical simplicity, in the following we add an extra interval [xn+1 , yn+1 ] satisfying that xn+1 > yi for all i ∈ {1, . . . , n} and xn+1 < yn+1 . See an example in Fig. 2. Note that this addition only doubles the number of dominating sets. 2.1 Counting the Dominating Sets The basic strategy is to apply the dynamic programming. To this end, we look at the intervals from left to right, and keep track of the following families of subsets. Let F (i, j) denote the family of subsets S ⊆ {1, . . . , n} satisfying the following two conditions; 1. j = max{j ∈ {1, . . . , n} | j ∈ S}, and 2. i = min{i ∈ {1, . . . , n + 1} | S does not dominate i }. Note that for any S ⊆ {1, . . . , n}, there exists a unique pair (i, j) such that S ∈ F (i, j). Moreover, S ⊆ {1, . . . , n} is a dominating set of the interval graph if and only if S ∈ F (n + 1, j) for some j. Therefore, we readily obtain the following lemma.
16
S. Kijima, Y. Okamoto, and T. Uno
Lemma 1. The number of dominating sets of the interval graph is
n
|F (n + 1, j)| .
j=1
The next is our key lemma, which indicates an algorithm based on dynamic programming. Let i∗ (j) := min{i | i ∈ N (j) ∪ {j}, i > j}, and let F ⊗ {{j}} denote {S ∪ {j} | S ∈ F } for F ⊆ 2{1,...,j−1} . For instance, in the example of Fig. 2, we have i∗ (1) = 3 and i∗ (3) = 7. Lemma 2. For j = 1, – F (i, 1) = {{1}} if i = i∗ (1), and – F (i, 1) = ∅ otherwise. For j ∈ {2, . . . , n + 1}, – F (i, j) = ∅⎛if i ∈ N (j) ∪⎞{j}, F (i, j )⎠ ⊗ {{j}} if i ∈ N (j) ∪ {j} and i < j, – F (i, j) = ⎝ j <j
⎛ – F (i, j) = ⎝
⎞ F (i , j )⎠ ⊗ {{j}} if i = i∗ (j),
i ∈N (j)∪{j,i} j <j
– F (i, j) = ∅ if i > i∗ (j).
Proof. Consider the case j = 1. By the definition of i∗ (1), we see that the vertices in {1, . . . , i∗ (1) − 1} are dominated by 1. Thus, F (i∗ (1), 1) = {{1}} and F (i, 1) = ∅ when i = i∗ (1). Consider next the case j ≥ 2. We distinguish the following three cases. Case 1: i ∈ N (j) ∪ {j}. This means that i is dominated by j, and thus F (i, j) = ∅. Case 2: i ∈ N (j) ∪ {j} and i < j. For any S ∈ F (i, j ) with j < j, it holds that S ∪ {j} ∈ F (i, j) since i ∈ N (j) ∪ {j}. On the other hand, let S ∈ F (i, j) be chosen arbitrarily. Since the intervals are sorted by their right endpoints and i is not dominated by S, we see that i ∈ N (j) for any i < i. By the hypothesis on S ∈ F (i, j), every i < i must be dominated by S \ {j}. Hence, S \ {j} ∈ F (i, j ) for some j < j. Case 3: i ∈ N (j) ∪ {j} and i > j. If i > i∗ (j), then F (i, j) = ∅ since i∗ (j) is ∗ not dominated by j. If i = i∗ (j), way to then by the definition of i (j), in a similar F (i, j ) ∪ F (i , j ) ⊗ {{j}} = Case 2, it holds that F (i, j) = i ∈N (j)∪{j} j <j j <j F (i , j ) ⊗ {{j}}. i ∈N (j)∪{j,i} j <j
A na¨ıve dynamic-programming algorithm based on the lemma runs in O(n3 ) time. In the next section, we discuss how to obtain a faster O(n log n)-time algorithm using a binary-tree data structure.
Dominating Set Counting in Graph Classes
17
2.2 Speeding Up the Dynamic Programming
j We define s(i, j) := j =1 |F (i, j )| for any pair of i, j ∈ {1, . . . , n + 1}. Then
n s(n + 1, n) = j =1 |F (n + 1, j )| is the number of dominating sets of the interval graph, from Lemma 1. From Lemma 2, we have s(i∗ (1), 1) = |F (i∗ (1), 1)| = 1 and s(i, 1) = |F (i, 1)| = 0 for i = i∗ (1). Now let i∗∗ (j) := max{i | i ∈ N (j) ∪ {j} and i < j}, where we define i∗∗ (j) := 0 if there is no i < j such that i ∈ N (j) ∪ {j}. For instance, in the example of Fig. 2, i∗∗ (3) = 2 and i∗∗ (4) = 0. Then, any i ≤ i∗∗ (j) satisfies that i ∈ N (j) and i < j. Furthermore, any i ∈ {i∗∗ (j) + 1, . . . , i∗ (j) − 1} satisfies that i ∈ N (j) ∪ {j}. Thus, from Lemma 2, we have the following for j ∈ {2, . . . , n + 1}: – s(i, j) = 2 · s(i, j − 1) if i ≤ i∗∗ (j), i s(i , j − 1) if i = i∗ (j), – s(i, j) = s(i, j − 1) + i =i∗∗ (j)+1
– s(i, j) = s(i, j − 1) otherwise.
This way, we have an O(n2 )-time algorithm to compute s(n + 1, n), that is, the number of dominating sets of the interval graph. Namely, we compute s(1, j), . . . , s(n + 1, j) from s(1, j − 1), . . . , s(n + 1, j − 1) for each j ∈ {2, . . . , n + 1} in O(n) time. This already improves the bound above. Now, we discuss how to compute s(1, j), . . . , s(n+ 1, j) from s(1, j − 1), . . . , s(n+ 1, j − 1) in O(log n) time. To achieve such a running time, we cannot explicitly compute all s(1, j), . . . , s(n + 1, j), since it would take Θ(n) time. However, the recursive formula above is structured: We either multiply by two over the interval i ∈ {1, . . . , i∗∗ (j)}, add the sum of the values s(i , j − 1) over the interval i ∈ {i∗∗ (j) + 1, . . . , i∗ (j)}, or do nothing. This suggests the use of a binary-tree structure to update these values in an implicit way. We represent the intervals I1 , . . . , In+1 and the values s(1, j), . . . , s(n + 1, j) in an ordered binary tree T . The tree T has height O(log n), with a root r, and with n + 1 leaves corresponding to the intervals I1 , . . . , In+1 : We name the leaves 1, . . . , n + 1 and the leaf i corresponds to the interval Ii . The structure of T does not change through computation, but only the values carried by nodes change. To represent s(i, j), every node v ∈ T carries two values wj (v) and cj (v) satisfying the following three conditions; wj (v) = cj (v) · (wj (u1 ) + wj (u2 )) for every inner node v, s(i, j) = wj (i) · cj (u) for every leaf i ∈ {1, . . . , n + 1},
(1) (2)
u∈Anc(i)
where u1 and u2 are the children of v, and Anc(v) denotes the set of proper ancestors of v. When j = 1, we set c1 (v) := 1 for all v ∈ T , w1 (v) := 0 for all v = i∗ (1), and w1 (i∗ (1)) := 1. Note that this choice makes the conditions above satisfied when j = 1. These values are interpreted as follows. The value wj (i) plays a role of s(i, j), but since we multiply two in an implicit fashion, we use another value cj (i) for this purpose, and so s(i, j) cannot be equal to wj (i), but equal to the product of wj (i) and the cj (u) for all proper ancestors u of i.
18
S. Kijima, Y. Okamoto, and T. Uno
Fig. 3. An example of representing ancestors when n = 15. For the leaves {3, . . . , 11}, shown by the solid-line interval, the representing ancestors are depicted by white nodes.
In our algorithm, we always keep these conditions satisfied, and we only use these conditions for our proof. Then we observe the following. Lemma 3 (*). If wj and cj satisfy conditions (1) and (2), then s(i, j) = wj (v) · cj (u) i∈L(v)
u∈Anc(v)
holds for any node v ∈ T , where L(v) denotes the set of leaves in the subtree of T rooted at v. For a consecutive sequence of leaves {i1 , . . . , i2 } of T , we define the representing ancestors Si1 ,i2 as a minimal subset of nodes in T satisfying that v∈Si ,i L(v) = 1 2 {i1 , . . . , i2 }. Note that if v, v ∈ Si1 ,i2 and v = v , then L(v) ∩ L(v ) = ∅. Fig. 3 shows an example. Then, we see that i2 i=i1
s(i, j) =
s(i, j) =
v∈Si1 ,i2 i∈L(v)
v∈Si1 ,i2
wj (v)
cj (u),
u∈Anc(v)
where the last equality follows from Lemma 3. Note that given a consecutive sequence of leaves {i1 , . . . , i2 } of T , we can find its representing ancestors Si1 ,i2 in O(log n) time in a bottom-up fashion. This also shows that the number of representing ancestors is O(log n). Now we are ready to describe our algorithm to compute s(1, j), . . . , s(n + 1, j) from s(1, j − 1), . . . , s(n + 1, j − 1). First, we give a rough outline. Step 1. We identify i∗∗ (j) and i∗ (j). Step 2. For every i ∈ {1, . . . , i∗∗ (j)}, let s(i, j) = 2 · s(i, j − 1) in an implicit way. Step 3. We sum up s(i , j − 1) over all i ∈ {i∗∗ (j) + 1, . . . , i} in an implicit way, and add it to s(i, j − 1) to obtain s(i, j). For implicit updates, we use the following flush operation. Let i be a leaf of T , and u0 , . . . , ud be the sequence of nodes of T from the root r to i satisfying that u0 = r, ud = i and u is a child of u−1 for each ∈ {1, . . . , d}. Further, let v be the child of u−1 different from u . The flush operation F LUSH(i) turns cj and wj into c˜j and w ˜j in the following way. – c˜j (u ) = 1 for all ∈ {0, . . . , d − 1}.
Dominating Set Counting in Graph Classes
– w ˜ j (u ) = wj (u ) ·
cj (u) and w ˜j (v ) = wj (v ) ·
u∈Anc(u )
∈ {1, . . . , d}. ˜ j (u) = wj (u) for all other u. – c˜j (u) = cj (u) and w
19
cj (u) for all
u∈Anc(v )
Note that the operation can be performed in O(log n) time in a top-down manner, since d = O(log n). Also observe that c˜j and w ˜ j satisfy conditions (1) and (2), and hence j s(i, j) = w ˜ (i). We now discuss how to perform each step in more detail. In Step 1, we need to identify i∗∗ (j) and i∗ (j). To find i∗∗ (j), we look for the rightmost interval {I1 , . . . , Ij−1 } that does not intersect Ij (remind that Ii represents the interval corresponding to the vertex i.) Here, the rightmost interval means the interval with rightmost right endpoint. Note that if Ii intersects Ij and 1 ≤ i < i ≤ j − 1, then Ii also intersects Ij . Therefore, i∗∗ (j) can be found in O(log n) time by binary search. Similarly, to find i∗ (j), we look for the leftmost interval in {Ij+1 , . . . , In+1 } that does not intersect Ij . If we further store the sorted order of I1 , . . . , In+1 by their left endpoints, by the same argument as above, we can find i∗ (j) in O(log n) time. Before Step 2, we perform F LUSH(i∗∗ (j)) and F LUSH(i∗ (j)) for later use. This only takes O(log n) time. Let c˜j−1 and w ˜j−1 be the values obtained by these flush operations. The order of executions of these flushes does not matter: the results are identical, ˜j−1 (i∗∗ (j)) and s(i∗ (j), j − 1) = and we only need to ensure that s(i∗∗ (j), j − 1) = w j−1 ∗ w ˜ (i (j)). In Step 2, we first identify the representing ancestors S1,i∗∗ (j) . For later reference, let S = S1,i∗∗ (j) . Note that at most one representing ancestor can be a leaf of T , in which i∗∗ (j) is such a representing ancestor. For every non-leaf representing ancestor v ∈ S, set cj (v) = 2 · c˜j−1 (v). If i∗∗ (j) is a representing ancestor, then set wj (i∗∗ (j)) = 2·w ˜ j−1 (i∗∗ (j)). The whole procedure in Step 2 can be done in O(log n) time from the discussion above. In Step 3, we first identify the representing ancestors Si∗∗ (j)+1,i∗ (j)−1 . For later reference, let S = Si∗∗ (j)+1,i∗ (j)−1 . Then, set ⎛ ⎞ ⎝w ˜j−1 (v) · wj (i∗ (j)) = 2 · w ˜ j−1 (i∗ (j)) + c˜j−1 (u)⎠ . v∈S
u∈Anc(v)
A top-down calculation of the right-hand side only takes O(log n) time. Thus, the whole computation in Step 2 can be done in O(log n) time. Finally, if cj (v) and/or wj (v) are unset yet, then we keep them unchanged: cj (v) = j−1 j c˜ (v) and ˜j−1 (v), respectively. Then, we adjust the values wj (u) for all w (v) = w u ∈ S ∪ v∈S Anc(v) ∪ Anc(i∗ (j)) in a bottom-up manner to keep condition (1) satisfied. This can also be done in O(log n) time: For unset values, we do not have to set the values explicitly, butwe just keep these values; For the adjustment, observe that the number of nodes in S ∪ v∈S Anc(v) ∪ Anc(i∗ (j))is O(log n). Note that wj (u) = w ˜j−1 (u) for every node u that does not belong to S ∪ v∈S Anc(v) ∪ Anc(i∗ (j)). This completes the description of the whole algorithm. The running time amounts to O(log n), and after iterating over j ∈ {2, . . . , n}, we get O(n log n) as the overall time complexity.
20
S. Kijima, Y. Okamoto, and T. Uno
We now prove its correctness. Note that after the whole procedure condition (1) is satisfied. Therefore, it suffices to prove that condition (2) is satisfied. If i < i∗∗ (j), then there exists a unique ancestor v ∈ Anc(i) such that v ∈ S and i ∈ L(v). Hence, c˜j−1 (u) s(i, j) = 2 · s(i, j − 1) = 2 · w ˜j−1 (i) · u∈Anc(i)
=w ˜j−1 (i) · (2 · c˜j−1 (v)) ·
u∈Anc(i)\{v}
= w (i) · c (v) · j
j
c˜j−1 (u)
cj (u) = wj (i) ·
u∈Anc(i)\{v}
cj (u).
u∈Anc(i)
If i = i∗∗ (j), then we have two cases. If i∗∗ (j) ∈ S, then we can proceed as above for i< i∗∗ (j). If i∗∗ (j) ∈ S, then s(i, j) = 2 · s(i, j − 1) = 2 · w ˜ j−1 (i) = wj (i) = wj (i) · j u∈Anc(i) c (u), where the second equality holds since F LUSH(i∗∗ (j)) was performed, and the last equality holds since cj (u) = c˜j−1 (u) = 1 due to F LUSH(i∗∗ (j)). If i = i∗ (j), then i∗ (j) ∗
∗
s(i (j), j) = s(i (j), j − 1) +
s(i , j − 1)
i =i∗∗ (j)+1 i∗ (j)−1
∗
= 2 · s(i (j), j − 1) +
s(i , j − 1)
i =i∗∗ (j)+1
=2·w ˜ j−1 (i∗ (j)) +
w ˜j−1 (v)
v∈S
c˜j−1 (u)
u∈Anc(v)
(i (j)) + (w (i (j)) − 2 · w ˜j−1 (i∗ (j))) cj (u), = wj (i∗ (j)) = wj (i∗ (j)) ·
=2·w ˜
j−1
∗
j
∗
u∈Anc(i∗ (j))
where the last equality holds since cj (u) = c˜j−1 (u) = 1 due to F LUSH(i∗ (j)). Thus, we conclude that our algorithm correctly computes cj and wj that satisfy conditions (1) and (2). After iterating the procedure in the increasing order of j ∈ {2, . . . , n}, we output s(n + 1, n). This is the number of dominating sets. Thus, we obtain the following theorem. Theorem 1. We can count the number of dominating sets of an n-vertex interval graph in O(n log n) time, when the graph is given by a set of n intervals sorted by their right endpoints. 2.3 Counting the Minimum Dominating Sets By slightly modifying the recursion formulas in Lemma 2, we obtain a polynomialtime algorithm for counting the number of dominating sets of each possible size in an interval graph. We define F (i, j, k) as {S ∈ F (i, j) | |S| = k}. Then we have the following.
Dominating Set Counting in Graph Classes
21
Lemma 4. For j = 1, – F (i, 1, 1) = {{1}} if i = i∗ (1), and – F (i, 1, k) = ∅ otherwise. For j ∈ {2, . . . , n + 1}, – F (i, j, k) = ∅if i ∈ N (j) ∪ {j}; – F (i, j, k) = f (i, j , k − 1) ⊗ {{j}} if i ∈ N (j) ∪ {j} and i < j; j <j f (i , j , k − 1) ⊗ {{j}} if i = i∗ (j); – F (i, j, k) =
i ∈N (j)∪{j,i} j <j ∗
– F (i, j, s) = ∅ if i > i (j).
Based on this lemma, we obtain the following theorem in a similar way to the dominating set counting problem. Theorem 2. Given an n-vertex interval graph, we can count the number of dominating sets of each possible size, hence the number of minimum dominating sets, in O(n2 log n) time. In a similar way, we can deal with trapezoid graphs. Theorem 3 (*). Given an n-vertex trapezoid graph, we can count the number of dominating sets in O(n3 log n) time, and the number of dominating sets of each possible size, hence the number of minimum dominating sets, in O(n4 log n) time.
3 Split Graphs A graph is split if its vertex set can be partitioned into a clique and an independent set. In other words, it can be obtained from a bipartite graph by adding edges to turn one partite set into a clique. Note that a split graph is always chordal. Theorem 4. Counting the number of dominating sets in a split graph is #P-complete. Proof. We reduce the following problem to the problem in the statement: Count the number of independent sets in a bipartite graph. This is known to be #P-complete [9]. Recall that an independent set in a graph is a vertex subset that induces no edge. Let G = (U, V ; E) be a given bipartite graph where |U | = n and |V | = m. Without loss of generality, we assume that G has no isolated vertex, and thus NG (V ) = U . (Otherwise, let k be the number of isolated vertices in G. Then, the number of independent sets is 2k times the number of independent sets in the graph obtained from G by deleting all isolated vertices.) Consider an independent set S of G, and let X := S ∩ U . Then, (S ∩ V ) ∩ NG (X) = ∅. Namely, S ∩ V ⊆ V \ NG (X). Therefore, S gives rise to a pair (X, Y ) ∈ 2U × 2V such that Y = S ∩ V ⊆ V \ NG (X). On the other hand, for any pair (X, Y ) ∈ 2U × 2V such that Y ⊆ V \ NG (X), we can see that X ∪ Y is independent in G.
22
S. Kijima, Y. Okamoto, and T. Uno
This means that S ↔ (X, Y ) is a one-to-one correspondence, and this correspondence yields the following formula if we denote by ind(G) the number
of independent sets in G: ind(G) = |{(X, Y ) ∈ 2U × 2V | Y ⊆ V \ NG (X)}| = X⊆U 2|V \NG (X)| . Let ⊆ U | NG (X) = i}|. Then, the above formula can be rephrased as ind(G) = νi :=
|{X m 2m i=0 νi 2−i . Therefore, if we are able to know ν0 , ν1 , . . . , νm in polynomial time, then we can retrieve ind(G) in polynomial time. Let G1 be a split graph constructed from G by filling the edges between all pairs of vertices in U . Let D be a dominating set of G1 . Then, there exists a unique pair of sets (X, Y ) ∈ 2U × 2V such that D = X ∪˙ Y ∪˙ (V \ NG (X)). Note that this is also valid when X = ∅ since we have assumed that NG (V ) = U . Also note that Y ⊆ NG (X) (re˙ means a disjoint union). On the other hand, for any X ⊆ U and any minder: “∪” Y ⊆ NG (X), the set D = X ∪˙ Y ∪˙ (V \ NG (X)) is a dominating set of G. Therefore, D ↔ (X, Y ) is a one-to-one correspondence, and this correspondence yields the following formula if we denote by
mdom(G1 ) the number of independent sets in G1 : dom(G1 ) = X⊆U 2|NG (X)| = i=0 νi 2i . More generally, we construct a split graph Gj from G as follows. The vertex set of Gj consists of U and j copies V1 , . . . , Vj of V . We denote the copy of v ∈ V in Vj by vj . As for the edges, every pair of vertices in U is joined by an edge. A vertex u ∈ U is joined by an edge with vj ∈ Vj if and only if {u, v} is an edge of G. Let D be a dominating set of Gj . Then, there exists a (j +1)-tuple (X, Y1 , . . . , Yj ) ∈ U 2 × 2V1 × · · · × 2Vj such that D = X ∪˙ ˙ j (Yj ∪˙ (Vj \ NG (X)). We can see this is a one-to-one correspondence as in the argument for G1 . Therefore, we obtain j m
dom(Gj ) = X⊆U 2|NG (X)| = i=0 νi (2j )i . Thus, dom(Gj ) is represented as a linear combination of ν0 , . . . , νm for all j = 1, . . . , m+1. We want to extract ν0 , . . . , νm from these combinations. This can be done if we regard them as a system of linear equations in which ν0 , . . . , νm are variables. It turns out that the coefficient matrix in the system is a Vandermonde matrix, and thus non-singular. Therefore, if we have dom(Gj ) for all j ∈ {1, . . . , m + 1} in polynomial time, then we obtain νi for all i ∈ {0, . . . , m} in polynomial time. This concludes the reduction. (This proof technique is often called the interpolation method.) Theorem 5 (*). Counting the number of minimum dominating sets in a split graph is #P-hard.
4 Cobipartite Graphs A graph is cobipartite if it is the complement of a bipartite graph. Namely, the vertex set can be partitioned into two cliques. Note that a cobipartite graph is cocomparability graph, and thus AT-free. Theorem 6 (*). Counting the number of dominating sets in a cobipartite graph is #Pcomplete. Note that we can easily count the number of minimum dominating sets in a cobipartite graph, since the size of a minimum dominating set is always at most two.
Dominating Set Counting in Graph Classes
23
5 Chordal Bipartite Graphs A graph is chordal bipartite if it is bipartite and every induced cycle is of length four. Theorem 7. Counting the number of dominating sets in a chordal bipartite graph is #P-complete. Proof. We reduce the following problem to the problem in the statement: Count the number of independent sets in a bipartite graph. This is known to be #P-complete [9]. Let G = (U, V ; E) be a given bipartite graph. We construct a chordal bipartite graph Gi,j as follows. The vertex set of Gi,j is U ∪ V ∪ {au,j | u ∈ U, j ∈ {1, . . . , j}} ∪ {bv,j | v ∈ V, j ∈ {1, . . . , j}} ∪ {pei | e ∈ E, i ∈ {1, . . . , i}} ∪ {qie | e ∈ E, i ∈ {1, . . . , i}}. The edge set of Gi,j is {{u, v} | u ∈ U, v ∈ V } ∪ {{au,j , u} | u ∈ U, j ∈ {1, . . . , j}} ∪ {{bv,j , v} | v ∈ V, j ∈ {1, . . . , j}} ∪ {{pei , qie } | e ∈ E, i ∈ {1, . . . , i}} ∪ {{u, pei } | u ∈ U, e ∈ E, u ∈ e, i ∈ {1, . . . , i}} ∪ {{v, qie } | v ∈ V, e ∈ E, v ∈ e, i ∈ {1, . . . , i}}. Let D be a dominating set of Gi,j . Let X = D ∩ U and Y = D ∩ V . Then, it must hold that au,j ∈ D for all u ∈ U \ X, j ∈ {1, . . . , j}, and bv,j ∈ D for all v ∈ V \ Y, j ∈ {1, . . . , j}. For an edge e = {u, v} ∈ E such that u ∈ X or v ∈ Y , at least one of pei and qie should belong to D for every i ∈ {1, . . . , i}. Therefore, for fixed X ⊆ U and Y ⊆ V , the number of dominating sets D such that X = D ∩ U and Y = D ∩ V is equal to 2j|X| · 2j|Y | ·
22i
{u,v}∈E, u∈X,v∈Y
3i = 2j(|X|+|Y |) · 3i|E| ·
{u,v}∈E, u∈X or v∈Y
i·e(X,Y ) 4 , 3
where e(X, Y ) = |{{u, v} ∈ E | u ∈ X, v ∈ Y }|. Therefore, the number of dominating sets in Gi,j is equal to
dom(Gi,j ) =
X⊆U Y ⊆V
⎛
|E|
=
⎜ ⎜ ⎝
k=0
i·e(X,Y ) 4 3 ⎞ k i ⎟ 4 |E| 2j(|X|+|Y |) ⎟ . ⎠ 3 3
2j(|X|+|Y |) · 3i|E| ·
X⊆U,Y ⊆V, e(X,Y )=k
=: δj,k
Then, from the interpolation method, by solving this system of linear equations, we can retrieve δj,0 , . . . , δj,|E| from dom(G1,j ), . . . , dom(G|E|+1,j ) in polynomial time. Now notice that δj,0 =
X⊆U,Y ⊆V, e(X,Y )=0
|U|+|V |
2
j(|X|+|Y |)
=
=0
2j α ,
24
S. Kijima, Y. Okamoto, and T. Uno
where α denotes the number of independent sets of size in G, since X ∪ Y is independent in G if and only if e(X, Y ) = 0. Then, by the interpolation method, we can retrieve α0 , . . . , α|U|+|V | from δ1,0 , . . . , δ|U|+|V |+1,0 in polynomial time. Thus, the reduction is completed. Theorem 8 (*). Counting the number of minimum dominating sets in a chordal bipartite graph is #P-hard.
6 Concluding Remarks We have investigated the dominating set counting problem in graph classes from the viewpoint of polynomial-time computability. An obvious open question is to determine the complexity of the dominating set counting problem and the minimum dominating set counting problem for strongly chordal graphs. Further investigation should be done from the viewpoints of approximation and fixed-parameter tractability, too. A similar question can be asked for counting the number of minimal dominating sets. In the full version, we prove #P-hardness of the problem in cobipartite graphs and chordal bipartite graphs.
References 1. Booth, K.S., Lueker, G.S.: Testing for the consecutive ones property, interval graphs, and graph planarity using PQ-tree algorithms. Journal of Computer and System Sciences 13, 335– 379 (1976) 2. Brouwer, A.E., Csorba, P., Schrijver, A.: The number of dominating sets of a finite graph is odd. Preprint (2009), http://www.win.tue.nl/˜aeb/preprints/domin4a.pdf 3. Haynes, T.W., Hedetniemi, S.T., Slater, P.J. (eds.): Fundamentals of Domination in Graphs. Marcel Dekker, New York (1998) 4. Haynes, T.W., Hedetniemi, S.T., Slater, P.J. (eds.): Domination in Graphs: Advanced Topics. Marcel Dekker, New York (1998) 5. Kratsch, D.: Personal communication (April 2011) 6. Lin, M.-S., Chen, Y.-J.: Linear time algorithms for counting the number of minimal vertex covers with minimum/maximum size in an interval graph. Information Processing Letters 107, 257–264 (2008) 7. Okamoto, Y., Uehara, R., Uno, T.: Counting the number of matchings in chordal and chordal bipartite graph classes. In: Paul, C., Habib, M. (eds.) WG 2009. LNCS, vol. 5911, pp. 296– 307. Springer, Heidelberg (2010) 8. Okamoto, Y., Uno, T., Uehara, R.: Counting the number of independent sets in chordal graphs. Journal of Discrete Algorithms 6, 229–242 (2008) 9. Provan, J.S., Ball, M.O.: The complexity of counting cuts and of computing the probability that a graph is connected. SIAM Journal on Computing 12, 777–788 (1983)
The Density Maximization Problem in Graphs Mong-Jen Kao2 , Bastian Katz1 , Marcus Krug1 , D.T. Lee2, , Ignaz Rutter1 , and Dorothea Wagner1 1
Faculty of Informatics, Karlsruhe Institute of Technology (KIT), Germany
[email protected] 2 Dep. of Computer Science and Information Engineering, National Taiwan University, Taiwan {d97021,dtlee}@csie.ntu.edu.tw
Abstract. We consider a framework for bi-objective network construction problems where one objective is to be maximized while the other is to be minimized. Given a host graph G = (V, E) with edge weights we ∈ Z and edge lengths e ∈ N for e ∈ E we define the density of a pattern subgraph H = (V , E ) ⊆ G as the ratio (H) = e∈E we / e∈E e . We consider the problem of computing a maximum density pattern H with weight at least W and and length at most L in a host G. We consider this problem for different classes of hosts and patterns. We show that it is NP-hard even if the host has treewidth 2 and the pattern is a path. However, it can be solved in pseudo-polynomial linear time if the host has bounded treewidth and the pattern is a graph from a given minor-closed family of graphs. Finally, we present an FPTAS for a relaxation of the density maximization problem, in which we are allowed to violate the upper bound on the length at the cost of some penalty.
1
Introduction
Many realistic network construction problems are characterized by complex constraints and multiple, possibly conflicting, objectives. There are several ways to define optimality in the context of more than one objective. While Paretooptimality seems to capture the classical notion of optimality best, it is undesirable to confront users with a possibly exponential number of Pareto-optimal solutions. Therefore it is common to combine the objectives into a single new aggregate objective, which is then optimized as a single-criterion objective. Typical aggregate functions include weighted sum or weighted minimum and maximum. These weighted aggregate functions, however, must be guided in that the decision maker has to supply a set of suitable weights at the risk of arbitrariness. We consider a framework for bi-objective network construction problems, motivated from economics, where one objective must be maximized (profit) while the other must be minimized (cost). Additionally, we assume that we are given an upper bound on the objective to be minimized (limited budget) and a lower
Supported by NSC-DFG Projects NSC98-2221-E-001-007-MY3 and WA 654/18. Also supported by the Institute of Information Science, Academia Sinica, Taiwan.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 25–36, 2011. c Springer-Verlag Berlin Heidelberg 2011
26
M.-J. Kao et al.
bound on the objective to be maximized (target profit). Bi-objective optimization functions of this sort can be aggregated by the ratio of the two optimization goals featuring two main advantages over other aggregate functions. First, we do not need to supply any weights—if we did, it would not alter our notion of optimality. Second, any optimal solution with respect to the ratio is Pareto-optimal. Our framework is defined as folllows. Let G = (V, E) be a graph, which we will refer to as the host. Given G, we write V (G) = V and E(G) = E. Throughout the paper we write n := |V (G)| and m := |E(G)|.We assume that we are given a weight function w : E → Z and a length function : E → N on the edges, respectively. As a shorthand we will write we := w(e) and e := (e) and for a subgraph H ⊆ G we define w(H) := e∈E(H) we and (H) := e∈E(H) e . We refer to a subgraph of G as a pattern. Given W ∈ Z and L ∈ N a pattern H is called W -viable if w(H) ≥ W and it is called (W, L)-viable if it is W viable and (H) ≤ L. Our goal is to find a (W, L)-viable pattern H maximizing w(H) and minimizing (H), which we formalize by maximizing the ratio (H) = w(H)/(H), defined as the density of H. Given a tuple (G, w, , W, L) the Biconstrained Maximum Density Subgraph (BMDS) problem asks for a connected (W, L)-viable pattern H ⊆ G with maximum density. In realistic applications, it may be desirable to be able to violate the hard limitations of our framework. For instance, it may be possible to exceed the budget by loaning additional money at the cost of some interest. We model this by introducing the L-deviation of H, defined as Δ(H) := max{0, (H) − L}, and the penalized density, defined as (H) := w(H)/((H)+c·Δ(H)), where c is some non-negative constant. Given a tuple (G, w, , W, L) the Relaxed Maximum Density Subgraph (RMDS) problem asks for a connected W -viable pattern H ⊆ G with maximum penalized density. Overview and Related Work. An overview of recent developments in multiobjective optimization is given in [3]. B´ alint [1] proves inapproximability for bi-objective network optimization problems, where the task is to minimize the diameter of a spanning subgraph with respect to a given length on the edges, subject to a limited budget on the total cost of the edges. Marathe et al. [15] study bi-objective network design problems with two minimization objectives. Given a limited budget on the first objective, they provide a PTAS for minimizing the second objective among a set of feasible graphs. The considered objectives include total edge weight, diameter and maximum degree. The study of dense segments from in bi-weighted sequences arises from the investigation of non-uniformity of nucleotide composition with genomic sequences [9,14] and has received considerable attention in bio-informatics. Here, we are given a sequence of I with length pairs (ai , bi ) and we wish to find a subsequence bounded by A ≤ i∈I bi ≤ B that maximizes the density i∈I ai / i∈I bi . For uniform lengths, Lin et al. [12] give an O(n log A) algorithm, which is improved to O(n) by Goldwasser et al. [6]. A linear time algorithm for the non-uniform case is given by Chung and Lu [4]. Lee et al. [11] show how to select a subsequence whose density is closest to a given density δ in O(n log2 n) time. Without the upper bound on the length B an optimal O(n log n)-time algorithm is given.
The Density Maximization Problem in Graphs
27
Subsequently, this problem has been generalized to graphs. Hsieh et al. [8,7] show that a maximum density path in a tree subject to lower and upper length bounds can be computed in time O(Bn) and that it is NP-hard to find a maximum density subtree in a tree, for which they also presented an O(B 2 n) time algorithm. Wu et al. [19,18] improve on this by presenting an optimal algorithm for computing a maximum density path in a tree in time O(n log n) in the presence of both a lower and upper length bounds. They also give an O(n log2 n) algorithm for finding a heaviest path in a tree in the presence of length constraints [19], which is improved to O(n log n) by Liu and Chao [13] . Our Contribution. In Section 2 we prove that the BMDS problem is NP-hard, even if the host has treewidth 2 and the pattern is a path. Then we show how to compute a maximum density path in a tree and further extend this result to graphs that can be turned into a tree by removing k edges, thus, showing that the problem is FPT with respect to k. Next, we show how to solve the BMDS and the RMDS problems in pseudo-polynomial linear time if the host has bounded treewidth and the pattern must be contained in a given minorclosed family of graphs. In Section 3 we present a general FPTAS that can be applied to all RMDS problems that admit algorithms whose running time is pseudo-polynomial in the length. We show that it can be used to approximate the maximum penalized density if the host has bounded tree-width and the pattern belongs to a minor-closed family of graphs.
2
Bi-constrained Maximum Density Subgraph
In this section we consider the Bi-constrained Maximum Density Subgraph (BMDS) problem. Given an instance I = (G, w, , W, L) we wish to find a connected (W, L)-viable subgraph of G with maximum density. By a reduction from the NP-hard Partition problem we can show that this problem is NPhard even if the pattern is a path. The reduction involves the construction of a simply connected outerplanar graph consisting of a sequence of 4-cycles that are joined by a single node, with two more edges e and f at the ends. The chosen densities force any maximum density path to go from e to f choosing one of two possible paths in each of the cycles, encoding, whether the corresponding number is in the partition represented by the path. A full proof can be found in [10]. Theorem 1. BMDS is NP-hard, even if the host has treewidth two, the pattern is a path and we drop the upper bound on the length of the pattern. Density Maximization for Trees and Almost-Trees. In this section we consider instances of the density maximization problem where the pattern is a path. First, we show how to compute a maximum density path when the host is a tree. The problem can trivially be solved in O(n2 ) time by enumerating all possible paths, but we show how to solve it in O(n log3 n) time. Throughout the section we will be using the key idea that the combined density of two subpaths P and Q is equal to the slope between two points uP =
28
M.-J. Kao et al.
wt W − wt(P ∪ R)
UH(PQ ) PQ
P
Ws (vi) UH(P)
Ps (u) len
Q
L − len(P ∪ R)
s
Wt (vj ) vj
Pt (w)
vi u
w t
R
Fig. 1. Tangent query for Q (left), combining two paths extending R (right)
((P ), w(P )) and −uQ = (−(Q), −w(Q)) in the Euclidean plane. This path is feasible iff w(P ) ≥ W − w(Q) and (P ) ≤ L − (Q). For a given query path Q this slope is maximized on the convex hull of the set of points PQ representing the candidate subpaths for Q in the range (−∞, L − (Q)] × [W − w(Q), ∞). Since we wish to maximize the density it suffices to perform tangent queries to the upper chain of the convex hull of PQ , denoted by UH(PQ ), which is more efficient than trying all possible combinations (see Figure 1). We use a dynamic data structure for the maintenance of the upper chain of the convex hull of a set of points P [16] allowing point insertions in time O(log2 n). It maintains the upper chain of the convex hull by a dynamically maintained ordered binary tree. Each leaf of this tree corresponds to a point in the plane and each inner node v corresponds to the segment of the upper hull of the set of points Pv that does not contribute to the upper hull of the set of points in the subtree of the father of v. Each inner node additionally stores the number of points on its upper hull (head or tail) that it inherits from its father. The segments of the upper hulls are represented by concatenable queues which allow insertion, deletion, concatenation and split in O(log n) time. Lemma 1 shows how to compute UH(PQ ) from a given set of candidate paths P in time O(log2 n) given the dynamic data structure. Lemma 1. Given a point Q, a set of points P and a dynamic data structure for the maintenance of UH(P) as described in [16] we can compute UH(PQ ) in time O(log2 n). Proof. If PQ is empty, there is nothing to do. Otherwise, let pmin be the leftmost point in PQ and let pmax be the rightmost point in PQ . Let xmin and xmax be the respective x-coordinates of these points. Let P := {(x, y) ∈ P | xmin ≤ x ≤ xmax }. It is easy to see that UH(PQ ) = UH(P ). Let T denote the tree used by the dynamic data structure for the maintenance of the upper hull. In order to compute UH(P ) we traverse the paths from the root of T to pmin and pmax , respectively, in parallel. In each step we reconstruct the upper hull using the concatenation and split operation of the concatenable queues stored in the nodes of the tree. We split off branches of the tree that are to the left of the path from the root to pmin and to the right of the path from the root to pmax . These branches contain only points whose x-coordinates are either greater than xmax or smaller than xmin . Since T is balanced we have reconstructed UH(P ) after at
The Density Maximization Problem in Graphs
29
most log n steps using time O(log n) per step and O(log2 n) time in total. Clearly, we can reconstruct the original data structure with the same complexity. Theorem 2. Given an instance (T, w, , W, L) of the BMDS problem, where T = (V, E) is a tree, we can compute a (W, L)-viable maximum density path in O(n log3 n) time. Proof. Without loss of generality we may assume that T is a binary tree. Otherwise we can make it binary by adding dummy edges with weight and length 0 in linear time. A centroid of a binary tree is a vertex whose removal disconnects T into at most 3 subtrees with at most half of the vertices of the original tree in each of the subtrees. We root T in one of its centroids r. Let v1 , v2 be two children of r and let R be the path between v1 and v2 via r. Then we can compute the maximum density path including R using tangent queries in time O(n log2 n) as follows: First, we compute the set P1 of paths starting in v1 . Each of those paths P ∈ P1 is mapped to a point uP := ((P ∪ R), w(P ∪ R)) in the plane and inserted into the dynamic datastructure for the maintenance of the upper hull. This can be done in O(n log2 n). Then we compute the set of paths P2 starting in v2 . For each of these paths Q ∈ P2 we want to compute the best path P ∈ P1 , i.e., a path P such that the concatenation of Q and P ∪ R has maximum density. To this end, we map each Q ∈ P2 to a point −uQ := (−(Q), −w(Q)). Since we have bounds on both the weight and the length of a feasible solution, not all paths in P1 will be feasible partners for a given Q ∈ P2 . We require that the length of P ∈ P1 is bounded by w(P ) ≥ W − w(Q) − w(R) and (P ) ≤ L − (Q) − (R). Using Lemma 1 we can compute the maximum density partner for Q ∈ P2 in time O(log2 n). Then we can compute the maximum density path P ∗ through r in time O(n log2 n). We do this for all combinations of children of r and store the path of maximum density. Next, we recursively compute the best path through each of the children of r in the subtrees rooted in the children. Let Pˆ be the maximum density path over all the paths computed this way. Then the maximum density path in the tree rooted in r is the maximum density ∗ ˆ path over relation for the computation is given by 3P and P . The recurrence T (n) = i=1 T (ni ) + O(n log2 n), where ni is the number of vertices in the tree rooted in vi . Hence, the running time of this approach is O(n log3 n). Next, we show that we can obtain a similar result if the host is a graph that can be turned into a tree by deleting a fixed number of k edges. Roughly, the key idea consists of enumerating all possible subsets of the k edges and computing, for each of those subsets, the maximum density path containing all theses edges. The following lemma can be used to enumerate those paths efficiently. Lemma 2. Given a graph G = (V, E ∪ F ) such that T = (V, E) is a tree and F ∩ E = ∅ as well as F ⊆ F and vertices s, t ∈ V incident to the edges in F , then there is at most one s-t-path in G containing all edges in F . We can compute such a path or prove that no path exists in linear time. Proof. Suppose that there are two different paths P1 and P2 both containing all edges in F and ending with s and t, respectively. Since the paths are different
30
M.-J. Kao et al.
and both contain all edges in F the symmetric difference Δ of E(P1 ) and E(P2 ) is non-empty and contained in E. Since both paths end at s and t, all vertices of Δ have even degree. Hence, Δ contains a cycle contradicting Δ ⊆ T . We proceed by showing that the uniquely determined feasible path can be computed in linear time, if it exists. We root T in some vertex r ∈ V (T ). By Tv we denote the tree rooted in v ∈ V (T ). For a given F ⊆ F we call v ∈ V (T )\{s, t} a loose end if it is incident to exactly one edge in F . To compute P we traverse T in a bottom-up fashion constructing P by iteratively matching loose ends. For each vertex v we store a reference to the unmatched loose end, if it exists. Let v be a vertex with children w1 , . . . , w . Clearly, there can only be a valid path if at most two children contain an unmatched loose end in their subtrees. Otherwise there is no feasible path. If none of the children contains an unmatched loose end, then there is nothing to do. If exactly one child contains an unmatched loose end in its subtree, we store a reference to this vertex in v. If exactly two children of v contain unmatched loose ends 1 and 2 in their subtrees, then we update the path by matching these loose ends and adding the unique path in T that connects 1 and 2 . We accept the resulting graph if it is a path. Theorem 3. Given an instance (G, w, , W, L) of the BMDS problem such that G is a tree with k additional edges, we can compute a maximum density (W, L)viable path in time O(2k k 2 n log2 n + n log3 n). Proof. Given a tree with k additional edges G = (V, E), we first compute an arbitrary spanning tree T = (V, E ) of G. This leaves exactly k edges, denoted by F := E \ E , which may or may not be used by the optimal path. For each F ⊆ F we compute the maximum density path containing all edges in F and we return the maximum density path over all F ⊆ F . At first we compute the maximum density path in T in O(n log3 n) time using Theorem 2. Any path containing some non-empty subset of edges F ⊆ F can be decomposed into three subpaths P, Q and R such that R starts and ends with edges in F and contains all edges in F . By Lemma 2 the possible paths R are uniquely determined by choosing a set F ⊆ F as well as two vertices incident to F and R can be computed in linear time from this information. Hence, we iterate over all possible F ⊆ F and all s, t ∈ V incident to F . In each of the 2k k 2 iterations, we first compute both weight and length of R in linear time, resulting in O(2k k 2 n) time. Then we find paths P and Q starting at s and t, respectively, such that the density of the concatenation of P , R and Q has maximum density among all paths including R in time O(log2 n). For the remainder of the proof we show how this can be accomplished and we thus assume that R, s and t are fixed. Our approach is similar to the proof of Theorem 2. However, we must take care of the disjointness of the paths. Let s = v0 , . . . , v = t be the sequence of vertices on the path from s to t in T . For each of these vertices vi = s, t, we define Ws (v) as the set of vertices in Tvi that are reachable from s in T without crossing the path R. Each of the vertices w ∈ Ws (vi ) defines a path Ps (w). Analogously, we define the set of vertices Wt (vi ) in Tvi that are reachable from t in T without crossing R. Each of those vertices w ∈ Wt (vi ) defines a path Pt (w) from t to w. Two paths in Ps (vi )
The Density Maximization Problem in Graphs
31
and Pt (vj ), respectively, are disjoint, whenever vi is encountered before vj on the path from s to t, i.e., if i < j, otherwise they will have at least one vertex in common. See Fig. 1 for an illustration. Now we describe how we insert the paths into the dynamic data structure for the maintenance of the upper hull. As pointed out, paths may not be disjoint, hence, we must insert the paths in a specific order. First, we insert all paths starting in s that do not include any vertex on the path from s to t. Then, for each i = 1, . . . , − 1 we insert all paths Ps (w) for all w ∈ Ws (vi ). After inserting the paths for a specific i < − 2 we make tangent queries for all paths Pt (w) for w ∈ Wt (vi+1 ). Note that at that point, we have included all paths starting in s except those that would not be disjoint to the paths in Ps (w) for w ∈ Wt (vi+1 ). After we have inserted all paths Ps (w) for all w ∈ Ws (v−1 ) we have inserted all paths starting in s, which do not cross R. Then we make tangent queries for all paths starting in t that do not use any vertex on the path from s to t. In order to compute the best path for F = ∅ we proposed an algorithm with running time O(n log3 n). For each specific non-empty choice of F ⊆ F and vertices s and t incident to F we thus insert at most n points into the data structure with a total running time of O(n log2 n) and we perform at most n tangent queries, each with a running time of at most O(log2 n). Hence, the overall running time is O(2k k 2 n log2 n + n log3 n). Density Maximization in Graphs with Bounded Treewidth. In this section we show that a large class of problems can be solved in pseudo-polynomial FPT time when parameterized by the treewidth k of the host, i.e., in time O(f (k)p(L, n)) where f is a function depending only on k and p is a polynomial depending on the maximum length L of any feasible pattern and the number of vertices n of the graph. In the light of the results on the hardness of the problem this seems to be the best we can hope for. Given a graph G with treewidth k and a finite set of graphs F , we wish to find some connected (W, L)-viable pattern H with maximum density that does not contain any graph in F as a minor. Such a graph is called F -minor-free. We assume that we are given a tree decomposition of the host as an input; otherwise it can be computed in FPT time [2]. Theorem 4. Let (G, w, , W, L) be an instance of the BMDS problem such that G has treewidth at most k and let F be a non-empty finite set of graphs. Then the maximum density F -minor-free (W, L)-viable pattern can be computed 2 in time O(2O(k +k log N +N ) |F |Ln) where N = maxF ∈F |V (F )|. Our algorithm is based on dynamic programming on the tree decomposition of the graph and is inspired by Eppstein’s work on subgraph isomorphism in planar graphs [5]. Based on Eppstein’s idea of enumerating partial isomorphisms for the bags of the tree decomposition, we enumerate partial minors of the graphs induced by the bags. In the following we present the key ideas in more detail. Due to space limitations, a full proof can be found in [10]. Let G = (V, E) be a graph. A tree decomposition of G is a pair (X , T ) where X = {Xi | i ∈ I} is a collection of subsets of V which are called bags and T = (I, ET ) is a tree with the following properties: (i) i∈I Xi = V . (ii) For all
32
M.-J. Kao et al.
e ∈ E there is an i ∈ I such that e ⊆ Xi . (iii) For all v ∈ V , Xv = {i ∈ I | v ∈ Xi } induces a connected subtree of T . We will refer to the elements in I as nodes. The treewidth of a tree decomposition equals maxi∈I |Xi | − 1. The treewidth of G = (V, E), denoted by tw(G) is the minimum treewidth of a tree decomposition. Let G = (V, E) be a graph tw(G) = k and let (X , T ) be a corresponding tree decomposition, rooted in a node r ∈ I. For i ∈ I we denote the graph induced by the union of the bags of all descendants of i (including i) by Gi and we denote the graph induced by Xi by G[Xi ]. Let C := {V1 , . . . , Vq } be a disjoint collection of connected subsets of V . Then we denote the graph obtained by contracting the vertices in each Vi into a single vertex by G/C and we refer the Vi as branch sets and to C as a contraction set. A graph F is a minor of G iff there is a subgraph H and a contraction set C such that H/C is isomorphic to F . Let C be a contraction set and let H be a subgraph of G[Xi ] for some i ∈ I. A partial minor embedding of F into H with respect to C is a mapping ϕ : V (F ) → V (H/C) ∪ {⊥, } such that the following holds: (i) ϕ is injective on the preimage of V (H/C), (ii) uv ∈ E(F ) ⇒ ϕ(u)ϕ(v) ∈ E(H/C) for all uv ∈ E(F ) with u, v ∈ / ϕ−1 (⊥) ∪ ϕ−1 (). Hence, ϕ maps a subgraph of F to a minor of H. The image ⊥ represents vertices in Gi − Xi and the image represents vertices in G which have not been considered yet, i.e., vertices in G − Gi . A partial minor embedding ϕ is called proper if and only if ϕ−1 () = ∅. Otherwise, it represents a minor embedding of F into a subgraph of Gi . For each node i in the tree decomposition, we enumerate all subgraphs H ⊆ Xi as well as all partial minor embeddings of a forbidden obstruction F into H. For 2 each node in the tree decomposition, there are at most 2O(k ) subgraphs. We enumerate the |V (F )|k+1 2|V (F )| potential partial minor embeddings and check if they are valid in O(k 2 ) time. By W (i, H, Φ, ) we denote the maximum weight of a subgraph G of Gi with length , such that G [Xi ] = H and Φ represents all partial minor embeddings ϕ of F into G for F ∈ F. We compute these values in a bottom-up fashion. Finally, we pick a feasible pattern with maximum density among all enumerated graphs or output infeasible. Note, that the result can be also be applied to the problem of maximizing the density in the absence of any restriction on the pattern. The resulting running time is bounded by 2 2O(k +k log N +N ) Ln. The following result can be obtained by a straightforward modification of the approach sketched above and yields an FPTAS for the RMDS problem with the technique developed in the next section. Corollary 1. Let (G, w, , W ) be an instance of the RMDS and let G and F be as in Theorem 4. Then for any λ ∈ R a maximum penalized density F -minor2 free (W, λ)-viable pattern can be computed in time O(2O(k +k log N +N ) |F |λn) where N = maxF ∈F |V (F )|.
3
An FPTAS for Relaxed Density Maximization
In this section we consider the Relaxed Maximum Density Subgraph (RMDS) problem, where the upper bound on the length may be violated at the cost of some penalty. We assume that the weight function is strictly positive.
The Density Maximization Problem in Graphs
33
While it is NP-hard to decide whether a feasible solution exists for the original problem, we show that this slight relaxation allows us to give an FPTAS for penalized density. This can be applied to any problem that allows a quasipolynomial-time algorithm that computes an optimal solution with respect to the penalized density. Note that the relaxed density maximization problem remains NP-hard as we can choose L very small such that every subgraph is penalized and we have that (H) ≈ (1/2)(H) for any subgraph H. Then the NP-hardness result of Theorem 1 naturally applies to this problem. For simplicity, we will assume that the scaling constant c for the penalized density equals 1. Let Π be a relaxed density maximization problem that admits an algorithm A that takes as input an instance I of the relaxed density maximization problem and λ ∈ N and computes an optimal (W, λ)-viable pattern H with respect to penalized density, , in O(p(λ, n)) time, where p(λ, n) is a function that is polynomial in λ and n. We show how to construct an FPTAS for Π that uses A as a subroutine. We present our algorithm within the terminology introduced by Schuurman and Woeginger for approximation schemes [17]. We first structure the output of our algorithm to form exponentially growing buckets based on the length of the solutions. In order to compute approximately optimal solutions in each of the buckets efficiently we structure the input of algorithm A by exponentially compressing the lengths and weights in such a way that the error resulting from the compression is proportional to the size of the solutions in each bucket. Let k be a suitably chosen integer depending on ε, which will be defined later. We structure the output in logk B − 1 buckets, where B = (G), such that bucket i with 0 ≤ i ≤ logk B − 2 contains solutions with total length at most k i+2 m, where m is the number of edges. For each bucket we compute an approximately optimal solution and return the overall best solution as output of our algorithm. To compute an approximately optimal solution for bucket i we structure the input by considering instances Ii = (G, i , wi , Wi , Li ), where i (e) = (e)/ki , wi (e) = w(e)/k i for e ∈ E(G) and Wi = W/k i as well as Li = L/ki. We apply algorithm A on instance Ii with λ = k 2 m. When considering the i-th bucket, we refer to the deviation of H ⊆ G with respect to i and Li as Δi (H) = max{0, i(H) − Li }. Similarly the penalized density of H ⊆ G is defined as i (H) = wi (H)/(i (H)+Δi (H)). Lemma 3 shows that our structuring scheme implies that i (H) is monotonically decreasing in i for each H ⊆ G. Corollary 2 establishes a length lower bound on a certain set of subgraphs which will be used in Lemma 4 to show that for each subgraph H there is a bucket i such that i (H) ≈ (H). Lemma 3. For any subgraph H and each 1 ≤ i < logk B, we have (H) ≤ k i · i (H) ≤ (H) + |E(H)| · ki , Δ(H) ≤ ki · Δi (H) ≤ Δ(H) + |E(H)| · k i , i (H) ≤ i−1 (H) ≤ (H), i (H) ≤ k · m implies that i−1 (H) ≤ k 2 · m .
(1) (2) (3) (4)
34
M.-J. Kao et al.
Proof. We will use the following equation, which holds for any real positive numbers r, s ∈ R. r r ≤ s· ≤r+s () s We start by proving Eq. (1). By the definition of and Eq. () we have e (H) = e ≤ k i · ≤ e + |E(H)| · k i = (H) + |E(H)| · k i . ki e∈E(H)
e∈E(H)
e∈E(H)
Note that the 3rd term equals i (H). For Eq. (2) note that the first part trivially holds if Δ(H) = 0. If Δ(H) > 0 we get Δ(H) = (H) − L ≤ k i · i (H) − L ≤ k i · Δi (H) by applying Eq. (1). The second part of Eq. (2) again trivially holds if Δi (H) = 0. Similarly, if Δi (H) > 0, we get k i Δi (H) = k i i (H) − L ≤ (H) + |E(H)| · k i − L = Δ(H) + |E(H)| · k i . Note that the first part of Eq. (3) implies the second part since 0 (H) = (H) holds for any subgraph H. From Inequality () we get that k · i (H) ≥ i−1 (H) for any subgraph H, which immediately implies Eq. (4). Similarly, we also get k · Δi (H) ≥ Δi−1 (H) since max{0, r} ≥ max{0, s} for r ≥ s. Therefore, we obtain i (H) =
wi−1 (H) wi−1 (H) ≤ = i−1 (H) k · (i (H) + Δi (H)) i−1 (H) + Δi−1 (H)
using wi (H) = wi−1 (H) and i (H) + Δi (H) = k · (i (H) + Δi (H)).
Let Ω(H) be the smallest integer such that Ω(H) (H) ≤ k 2 m. In other words, Ω(H) denotes the smallest bucket for which H will be considered by algorithm A. Equation (4) implies a lower bound on the length of H in this bucket. Corollary 2. For any subgraph H, Ω(H) > 0 implies Ω(H) (H) > km. Now we are ready to bound the density of an instance H in bucket Ω(H) in terms of k and its true penalized density (H). Lemma 4. For any subgraph H, we have (H) ≤
k+1 k−1
· Ω(H) (H).
Proof. Clearly, this inequality holds when Ω(H) = 0. For Ω(H) ≥ 1, by Lemma 3, Equation 1, and |E(H)| ≤ m we get (H) ≥ k Ω(H) · (Ω(H) (H) − m). Together with Corollary 2 this implies k Ω(H) m ≤ 1/(k − 1) · (H) ≤ 1/(k − 1) · ((H) + Δ(H)). We now compute the density of H in Iteration ω := Ω(H) by using Equations (1) and (2). wω (H) w(H) = ω ω (H) + Δω (H) k · (ω (H) + Δω (H)) wt(H) w(H) k−1
≥ ≥ = · (H) . 2 (H) + Δ(H) + 2m · k ω k+1 1 + k−1 ((H) + Δ(H)) ω (H) =
The Density Maximization Problem in Graphs
35
Theorem 5. Given 0 < ε < 1, we can compute a (1 − ε)-approximation for the RMDS problem in O(p(m/ε2 , n) log B) time, where B is the maximum total length of the edges, provided that an O(p(λ, n)) time algorithm A for the RMDS problem is available. Proof. Clearly, the A computes a W -viable solution if one exists due to the correctness of A, the fact that we do not introduce any errors when scaling the weights, and since the union of the buckets covers all feasible solutions. Next we show that the algorithm indeed produces a (1 − ε) approximation of the optimal penalized density. Let opt be an optimal solution and H ∗ be the solution returned by our algorithm. By the above lemmas and choosing k = 2ε , we have (H ∗ ) ≥
max i (H ∗ ) ≥ max i (opt) ≥ Ω(opt) (opt) i≥Ω(opt) k−1 2 ≥ · (opt) ≥ 1 − · (opt) ≥ (1 − ε) · (opt). k+1 k+1 The running time of this approach is clearly O(p(m/ε2 , n) log B) since k = 2ε ≥ 2, and logk B ≤ log2 B = O(log B). i≥Ω(H ∗ )
By choosing k = c + 1/ε we can accomplish the same result for any scaling factor c = 1. In our analysis, we further assumed that we are given an algorithm A that computes a (W, λ)-viable pattern for a given value of λ. However, our approach still works if A only computes a W -viable pattern with maximum penalized density. In each iteration we pre-process the instance Ii by removing edges which are longer than k 2 m from G. Then the maximum length of any W viable pattern considered by A will naturally be bounded by k 2 m2 . The running time of the resulting FPTAS is bounded by O(p(m2 /ε2 , n) log B), assuming that A has a running time bounded by O(p((G), n)). Finally, with the results from Corollary 1 we immediately obtain the following result as an application of the FPTAS to the problem of maximizing the penalized density objective function. Corollary 3. Let (G, w, , W ) be an instance of the RMDS problem such that G has treewidth at most k and let F be a finite set of graphs. Let B := (G), 0 < ε < 1 and let opt be the optimal penalized density of an F -minor-free W viable pattern. Then a W -viable F -minor-free pattern with penalized density at 2 least (1 − ε) · opt can be computed in time O(2O(k +k log N +N )|F |m/ε2 log B).
4
Conclusion and Outlook
We have investigated bi-objective network design problems with one minimization and one maximization objective in the presence of additional constraints by studying the complexity of maximizing the ratio of the two objectives for different classes of graphs. Although the general problem is NP-hard like many multi-objective optimization problems, we were able to efficiently solve some special cases and give an FPTAS for the relaxed problem. Similar results can be obtained for structural constraints, such as Steiner-constraints.
36
M.-J. Kao et al.
References 1. B´ alint, V.: The non-approximability of bicriteria network design problems. J. of Discrete Algorithms 1, 339–355 (2003) 2. Bodlaender, H.L.: A linear time algorithm for finding tree-decompositions of small treewidth. In: STOC 1993: Proceedings of the 25th Annual ACM Symposium on Theory of Computing, pp. 226–234. ACM, New York (1993) 3. Chinchuluun, A., Pardalos, P.: A survey of recent developments in multiobjective optimization. Annals of Operations Research 154, 29–50 (2007) 4. Chung, K.-M., Lu, H.-I.: An optimal algorithm for the maximum-density segment problem. SIAM J. Comput. 34(2), 373–387 (2005) 5. Eppstein, D.: Subgraph isomorphism in planar graphs and related problems. In: Proc. 6th Ann. ACM-SIAM Sympos. Disc. Alg., pp. 632–640. SIAM, Philadelphia (1995) 6. Goldwasser, M.H., Kao, M.-Y., Lu, H.-I.: Linear-time algorithms for computing maximum-density sequence segments with bioinformatics applications. J. Comput. Syst. Sci. 70(2), 128–144 (2005) 7. Hsieh, S.-Y., Cheng, C.-S.: Finding a maximum-density path in a tree under the weight and length constraints. Information Processing Letters 105(5), 202–205 (2008) 8. Hsieh, S.-Y., Chou, T.-Y.: Finding a Weight-Constrained Maximum-Density Subtree in a Tree. In: Deng, X., Du, D.-Z. (eds.) ISAAC 2005. LNCS, vol. 3827, pp. 944–953. Springer, Heidelberg (2005) 9. Inman, R.B.: A denaturation map of the lambda phage DNA molecule determined by electron microscopy. Journal of Molecular Biology 18(3), 464–476 (1966) 10. Kao, M.-J., Katz, B., Krug, M., Lee, D.T., Rutter, I., Wagner, D.: The density maximization problem in graphs. Technical Report 2011-2018, Kalrsruhe Institute of Technology, KIT (2011), http://digbib.ubka.uni-karlsruhe.de/volltexte/ 1000023123 11. Lee, D.T., Lin, T.-C., Lu, H.-I.: Fast algorithms for the density finding problem. Algorithmica 53(3), 298–313 (2009) 12. Lin, Y.-L., Jiang, T., Chao, K.-M.: Efficient algorithms for locating the lengthconstrained heaviest segments with applications to biomolecular sequence analysis. J. Comput. Syst. Sci. 65(3), 570–586 (2002) 13. Liu, H.-F., Chao, K.-M.: Algorithms for finding the weight-constrained k longest paths in a tree and the length-constrained k maximum-sum segments of a sequence. Theor. Comput. Sci. 407(1-3), 349–358 (2008) 14. Macaya, G., Thiery, J.-P., Bernardi, G.: An approach to the organization of eukaryotic genomes at a macromolecular level. Journal of Molecular Biology 108(1), 237–254 (1976) 15. Marathe, M.V., Ravi, R., Sundaram, R., Ravi, S.S., Rosenkrantz, D.J., Hunt, H.B.: Bicriteria network design problems. Journal of Algorithms 28(1), 142–171 (1998) 16. Overmars, M.H., van Leeuwen, J.: Maintenance of configurations in the plane. Journal of Computer and System Sciences 23(2), 166–204 (1981) 17. Schuurman, P., Woeginger, G.: Approximation schemes – a tutorial. Preliminary version of a chapter in the book ”Lectures on Scheduling”, (to appear, 2011) 18. Wu, B.Y.: An optimal algorithm for the maximum-density path in a tree. Inf. Process. Lett. 109(17), 975–979 (2009) 19. Wu, B.Y., Chao, K.-M., Tang, C.Y.: An efficient algorithm for the lengthconstrained heaviest path problem on a tree. Inf. Process. Lett. 69(2), 63–67 (1999)
FlipCut Supertrees: Towards Matrix Representation Accuracy in Polynomial Time Malte Brinkmeyer, Thasso Griebel, and Sebastian B¨ ocker Lehrstuhl f¨ ur Bioinformatik, Friedrich-Schiller-Universit¨ at Jena, Ernst-Abbe-Platz 2, 07743 Jena, Germany
[email protected]
Abstract. In computational phylogenetics, supertree methods provide a way to reconstruct larger clades of the Tree of Life. The supertree problem can be formalized in different ways, to cope with contradictory information in the input. In particular, there exist methods based on encoding the input trees in a matrix, and methods based on finding minimum cuts in some graph. Matrix representation methods compute supertrees of superior quality, but the underlying optimization problems are computationally hard. In contrast, graph-based methods have polynomial running time, but supertrees are inferior in quality. In this paper, we present a novel approach for the computation of supertrees called FlipCut supertree. Our method combines the computation of minimum cuts from graph-based methods with a matrix representation method, namely Minimum Flip Supertrees. Here, the input trees are encoded in a 0/1/?-matrix. We present a heuristic to search for a minimum set of 0/1-flips such that the resulting matrix admits a directed perfect phylogeny. We then extend our approach by using edge weights to weight the columns of the 0/1/?-matrix. In our evaluation, we show that our method is extremely swift in practice, and orders of magnitude faster than the runner up. Concerning supertree quality, our method is sometimes on par with the “gold standard” Matrix Representation with Parsimony.
1
Introduction
When studying the relationship and ancestry of current organisms, discovered relations are usually represented as phylogenetic trees: These are rooted trees where each leaf corresponds to a group of organisms, called taxon. Inner vertices represent hypothetical last common ancestors of the organisms located at the leaves of its subtree. Supertree methods assemble phylogenetic trees with nonidentical but overlapping taxon sets, into a larger supertree that contains all taxa of every input tree and describes the evolutionary relationship of these taxa. Constructing a supertree is easy if no contradictory information is encoded in the input trees [1]. The major problem of supertree methods is dealing with incompatible data in a reasonable way. It is understood that incompatible input trees are the rule rather than the exception in application. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 37–48, 2011. c Springer-Verlag Berlin Heidelberg 2011
38
M. Brinkmeyer, T. Griebel, and S. B¨ocker
Current supertree methods can roughly be subdivided into two major families: matrix representation (MR) methods, and graph-based methods with polynomial running time. The former encode inner vertices of all input trees as partial binary characters in a matrix, which is then analyzed using an optimization or agreement criterion to yield the supertree. In 1992, Baum [2] and Ragan [14] independently proposed the matrix representation with parsimony (MRP) method as the first matrix representation method. MRP is by far the most widely used supertree method today, and constructed supertrees are of comparatively high quality. Other variants have been proposed using different optimization criteria, such as matrix representation with flipping (MRF) [5] and matrix representation with compatibility. All MR methods have in common that the underlying optimization problems are NP-hard [7, 5]. So, heuristic search strategies have to be used. Still, running times of MR methods can be prohibitive for large datasets. Recently, Ranwez et al. [16] presented SuperTriplets, a local search heuristic based on triplet dissimilarity and triplet matrix encoding. A particular matrix representation supertree method is “matrix representation with flipping”: Here, the rooted input trees are encoded in a matrix with entries ‘0’, ‘1’, and ‘?’ [5]. Utilizing the parsimony principle, MRF seeks the minimum number of “flips” 0 → 1 or 1 → 0 in the input matrix that make the resulting matrix consistent with a phylogenetic tree, where ‘?’-entries can be resolved arbitrarily. Evaluations indicate that MRF is on par with the “gold standard” MRP [4]. Graph-based methods make use of a graph to encode the topological information given by the input trees. This graph is used as a guiding structure to build the supertree top-down from the root to the leaves. The first graph-based supertree method was the Build algorithm [1]. This algorithm is only applicable to non-conflicting input trees, and, thus only of limited use in practice. This led to the development of the MinCut (MC) supertree algorithm [18] and a modified version, Modified MinCut (MMC) supertrees [12]. MC and MMC construct a supertree even if the input trees are conflicting. All three methods share the advantage of polynomial running time, what results in swift computations in applications. On the downside, supertrees constructed by both MC and MMC are consistently of inferior quality compared to those constructed using MR methods [3]. Another graph-based method is PhySIC [15], a so-called veto supertree method. A drawback of veto methods is that they tend to produce unresolved supertrees in case of highly conflicting and/or poorly overlapping input trees. PhySIC IST [17] tries to overcome this drawback by computing non-plenary supertrees: The supertree does not necessarily contain all taxa from the input trees. The Build With Distances algorithm (BWD) [21] is the first graphbased method that uses branch length information from the input trees to build the supertree. It also generalizes the Build algorithm but uses branch lengths to find better vertex partitions in the Build graph. Simulations indicate BWD supertrees are of much better quality than MC and MMC supertrees, but results are not on par with MRP [3].
FlipCut Supertrees
39
In this paper, we concentrate on the matrix representation with flipping framework. Recall that the problem is NP-hard [5], and only little algorithmic progress has been made towards its solution. We can test whether an MRF supertree instance admits a perfect phylogeny without flipping in time O(mn log2 (m + n)) [13]. There exist no parameterized algorithms or non-trivial approximation algorithms in the literature. Chen et al. [4] present a heuristic for MRF supertrees based on branch swapping, and Chimani et al. [6] introduce an Integer Linear Program to find exact solutions. Our contributions. Here, we present a novel algorithm, named FlipCut, based on minimizing the number of 0/1-flips in the matrix representation. Our algorithm constructs the phylogenetic tree top-down, minimizing in each step the number of required flips. Running time of our algorithm is comparable to that of the MinCut algorithm: For n taxa and m internal nodes in the input trees, running time is O(mn3 ). We show that our method usually outperforms all other polynomial supertree methods with regards to supertree quality. In contrast to MinCut supertrees, our results are interpretable in the sense that we try to minimize a global objective function, namely the number of flips in the input matrix.
2
Preliminaries
Let n be the number of taxa in our study; for brevity, we assume that our set of taxa equals {1, . . . , n}. In this paper, we assume all trees to be rooted phylogenetic trees, that is, there exist no vertices with out-degree one. If there are unrooted trees in the input set, each such tree has to be rooted using an outgroup. In this case, branch lengths (see Sec. 4) of edges incident to the root can be ignored. We are given a set of input trees T1 , . . . , Tl with leaf set L(Ti ) ⊆ {1, . . . , n}. We assume i L(Ti ) = {1, . . . , n}. We search for a supertree T of these input trees, that is, a tree with leave set L(T ) = {1, . . . , n}. For Y ⊆ L(T ) we define the induced subtree T |Y of T where all internal vertices with degree two are contracted. Some tree T refines T if T can be reached from T by contracting internal edges. We say that a supertree T of T1 , . . . , Tl is a parent tree if T |L(Ti ) refines T , for all i = 1, . . . , l. In this case, T1 , . . . , Tl are called compatible. To cope with incompatibilities in the input, we employ the framework of Flip Supertrees: We encode the input trees in a matrix M with elements in {0, 1, ?}, where rows correspond to taxa. Each inner vertex (except the root) in each input tree is encoded in one column of the matrix: Entry ‘1’ indicates that the corresponding taxon is a leaf of the subtree rooted in the inner node, whereas all other taxa are encoded ‘0’. The state of taxa that are not part of the input tree is unknown, and represented by a question mark (‘?’). Columns of the matrix are called characters, and we assume that the set of characters equals {1, . . . , m}. Clearly, m ≤ l(n − 2). In detail, m is the total number of non-root inner vertices in T1 , . . . , Tl . From the construction of M , we infer that each column in M contains a least one ‘0’-entry and at least two ‘1’-entries.
40
M. Brinkmeyer, T. Griebel, and S. B¨ocker
The classical (directed) perfect phylogeny model assumes that the matrix M is binary, and that there exists an ancestral species that possesses none of the characters, corresponding to a row of zeros. This is sometimes referred to as directed perfect phylogeny. Further it is assumed that each transition from ‘0’ to ‘1’ happens at most once in the tree: An invented character never disappears and is never invented twice. According to the perfect phylogeny model, M admits a perfect phylogeny if there is a rooted tree with n leaves corresponding to the n taxa, where for each character u, there is an inner node w of the tree such that M [t, u] = 1 holds if and only if taxon t is a leaf of the subtree below w, for all t. Given an arbitrary binary matrix M , we may ask whether M admits a perfect phylogeny. Gusfield [10] shows how to check if a matrix M admits a perfect phylogeny and, if possible, constructs the corresponding phylogenetic tree in time Θ(mn). There exist several characterizations for matrices that admit a perfect phylogeny, see for example [13]. We now ask whether a matrix with ‘?’-entries allows for a perfect phylogeny, where ‘?’-entries can be arbitrarily resolved to ‘0’ or ‘1’. Interestingly, this can ˜ ˜ notation suppresses all also be decided in O(mn) time [13]. (As usual, the O(·) poly-log factors.) To resolve incompatibilities among the input trees, the Flip Supertrees model assumes that the matrix M is perturbed. We search for a perfect phylogeny matrix M ∗ such that the number of entries where one matrix M, M ∗ contains a ‘0’ and the other matrix a ‘1’, is minimal. This is the number of “flips” required to correct the input matrix M , also referred to as the cost of the instance. Unfortunately, finding the matrix with minimum flip costs is an NP-complete problem, even for an input matrix without ‘?’-entries [5]. To evaluate the quality of our supertrees, we use different measures: Each internal node of a rooted tree T induces a cluster Y ⊆ L(T ). The RobinsonFoulds (RF) symmetric distance between two trees T, T is the number of clusters induced by one tree but not the other, divided by the number of clusters induced by both trees. Another score between trees T, T is the maximum agreement subtree (MAST). This is a subset of leaves Y ⊆ L(T ) = L(T ) of maximum cardinality such that T |Y = T |Y holds. The MAST distance of T, T then equals 1 − |Y | / |L(T )|.
3
The FlipCut Algorithm
The MinCut algorithm [18] as well as the Modified MinCut algorithm [12] construct supertrees by resolving conflicts in the input trees in a recursive topdown procedure. This has been adapted from the Build algorithm [1] that returns a supertree only if the input trees are compatible. A related algorithm was given by Pe’er et al. [13]. This algorithm tests whether an MFST instance M allows for a perfect phylogeny without flipping, by resolving all ‘?’-entries. In fact, these two problems are equivalent: The input trees can be encoded in a matrix M as described in Sec. 2. Also, an input matrix M with m columns can be transformed into m input trees, where each column c is transformed into a tree with those taxa t satisfying M [t, c] =?, having a single non-trivial clade
FlipCut Supertrees
41
with taxa t such that M [t, c] = 1. In the following, we show how to apply the idea of finding minimum cuts to the algorithm of Pe’er et al.. For a subset S ⊆ {1, . . . , n} of taxa and a subset D ⊆ {1, . . . , m} of characters, the FlipCut graph G(S, D) is a bipartite graph with vertex sets S and D, and an edge (t, c) is present in G(S, D) if and only if M [t, c] = 1, for t ∈ S and c ∈ D. A character vertex c ∈ D is semiuniversal (in S, D) if M [t, c] ∈ {1, ?} holds for all t ∈ S. We immediately remove all semiuniversal character vertices from G(S, D), as all ‘?’-entries can be resolved to ‘1’ without flipping [13]. The algorithm of Pe’er et al. proceeds as follows: We start with S ← {1, . . . , n} and D ← {1, . . . , m}. We then construct the FlipCut graph G(S, D). If this graph is connected, the algorithm terminates, as there is no perfect phylogeny resolving M . Otherwise, we recursively repeat for each connected component S , D of the FlipCut graph with |S | > 1. In case the algorithm does not terminate early, then the sets S of taxa computed during the course of the algorithm, define the rooted phylogenetic tree. Assume that G(S, D) is connected at some point of the algorithm — how can we disconnect the graph by means of modifying the input matrix M ? Obviously, it does not help to insert new edges in G(S, D). Removing an edge (t, c) from G(S, D) can be achieved by two different operations: either flip M [t, c] from ‘1’ to ‘0’, or make character c semiuniversal by flipping all entries satisfying M [t , c] = 0 to ‘1’, for t ∈ S. Recall that any semiuniversal character c is deleted immediately, resulting in the deletion of all edges incident to c. This comes at the cost of w(c) := #{t ∈ S : M [t, c] = 0} flips in the matrix. To disconnect G(S, D) we can use an arbitrary combination of these edge deletion operations. Formally, we assume all edges in G(S, D) to have unit weight, and that each character vertex c has weight w(c). The weight of a bipartition of taxa vertices is the minimal cost of a set of edge and vertex deletions, such that the two subsets of taxa vertices lie in separate components of the resulting graph. We search for a bipartition of minimal weight. Clearly, this problem is closely related to finding minimal cuts in an undirected graph. Unfortunately, there exist two important differences here: First, we are not searching for an arbitrary cut in the graph G(S, D) but instead, require that the set of taxa vertices is partitioned. Second, these algorithms do not allow us to delete vertices. We conjecture that the first modification is relatively easy to overcome. However, it is not obvious how to include vertex deletions in these algorithms. To this end, we drop back to an older approach for finding minimum cuts: We fix one taxon vertex s, and for all other taxa vertices t we search for a minimum s-t-cut, allowing vertex deletions. Among these cuts, the cut with minimal weight is the solution to the above problem. To find a minimum s-t-cut with vertex deletions, we transform G(S, D) into a directed network H(S, D) with capacities: Each taxa vertex t is also a vertex in the network, each character vertex c is transformed to two vertices c− and c+ plus an arc (c− , c+ ) in the
42
M. Brinkmeyer, T. Griebel, and S. B¨ocker
network, and an edge (t, c) in G(S, D) is transformed to two arcs (t, c− ) and (c+ , t) in the network. Arcs (c− , c+ ) have weight w(c), all other arcs have unit weight. By the generalized min-cut max-flow theorem, finding a minimum cut in G(S, D) is equivalent to computing a maximum flow in the network H(S, D) [8]. Note that for all taxa s, t, the maximum s-t-flow in H(S, D) equals the maximum t-s-flow. We reach: Lemma 1. Let S ⊆ {1, . . . , n}, D ⊆ {1, . . . , m}, and M ∈ {0, 1, ?}m×n. We construct the network H := H(S, D) for the input matrix M . The minimum number of 0/1 flips required in M to make the induced FlipCut graph G(S, D) disconnected, equals the minimum cost of a minimum 1-t-cut in the network H, over all t = 2, . . . , n. We now proceed in a recursive top-down procedure to construct the supertree, similar to [18, 12, 13]. Due to space constraints, we omit the simple pseudocode of the algorithm. The subsets S ⊆ {1, . . . , n} that are output during the course of the algorithm, form a hierarchy which can be transformed into the desired supertree. As the algorithm reproduces that of Pe’er et al. in case the input trees are compatible or, equivalently, in case the input matrix allows for a perfect phylogeny without flipping, we infer: Lemma 2. In case the input matrix M allows for a perfect phylogeny without flipping, then the FlipCut algorithm returns the perfect phylogeny tree. What is the running time of the above algorithm? At most n − 1 minimum cuts have to be computed in total, as this is the number of inner nodes in the resulting phylogenetic tree. We reach a running time of O(n · T (m, n)) where T (m, n) is the time required for computing all maximum 1-t-flows in the networks H(S, D) with at most m character vertices and n taxa vertices. The running time is dominated by the algorithm we use for constructing maximum flows. For a network H = (V, E), Hao andOrlin [11] compute maximum flows from one source to all other vertices in O |V | · |E| · log(|V |2 / |E|) time, using the maximum flow algorithm of Goldberg and Tarjan. For a bipartite graph with vertex set V1 ∪ V2 and |V1 | ≤ |V2 |, running time can be improved to O |V1 | · 2 |E| · log(|V1 | / |E|) [11]. Our networks H(S, D) are bipartite and have O(n + m) vertices and O(mn) edges, and we may assume n ≤ m. So, a minimum cut with vertex deletions in G(S, D) can be computed in O(mn2 ) time. We infer: Lemma 3. Given an input matrix M over {0, 1, ?} for n taxa and m characters, the FlipCut algorithm computes a supertree in O(mn3 ) time. As presented here, the FlipCut algorithm may compute different solutions for the same input: This is because there can be several co-optimal minimum cuts, and our algorithm arbitrarily chooses one of these cuts. We can solve this by removing all edges and vertices that are part of at least one minimum cut, similar
FlipCut Supertrees
43
to the MinCut algorithm [18]. In the following, we ignore this modification: We weight all edges with real numbers, so the existence of several minimum cuts of identical weight is practically impossible.
4
Using Branch Lengths
To compare branch lengths from different trees in a real-world study, we first have to normalize them. Due to space constraints, we defer the details to the full version of this paper. We can use branch lengths in a straightforward fashion: We weight each column of the matrix by the length of the branch that was responsible for generating the column. This can be easily incorporated into the FlipCut graph, by weighting edges and character vertices. In this way, flipping an entry is cheaper for those branches that are possibly wrong, and harder for those branches that are most likely true. In our evaluations, a different weighting called “Edge & Level” showed a better performance: Each character vertex c corresponds to an internal edge e = (u, v) in one of the input trees, inducing the corresponding column in the matrix M . We set the weight of character c and, hence, the corresponding column in M to l(c) := w(e) · depth(v). Here, l(c) is the length of branch e, and depth(v) is the number of edges on the path from the root to v in the input tree.
5
The Undisputed Sibling Problem
Given a set of input trees, assume that some taxon x appears as a sibling of another taxon y in all the input trees in which it is present at all. In other words, for all trees where x is present, we also find y, and both are siblings. We call such x an undisputed sibling. Then, it is reasonable to assume that x is also a sibling of y in the supertree, possibly accompanied by other siblings. Unfortunately, Flip Supertrees does not necessarily enforce this: Minimizing the number of flips, it is sometimes cheaper to separate x and y. This is a seemingly rare but still undesirable effect of this objective function. To counter the above effect, we use a data reduction rule that is applied to all input trees before we compute FlipCut supertrees: If there is an undisputed sibling x of y, then remove x from all input trees. We repeat this until we find no more undisputed siblings. Note that by removing an undisputed sibling, we might produce new undisputed siblings. After we have computed the supertree, we reinsert all undisputed siblings in reverse order. If y has more than one undisputed sibling at the same time, we re-insert all siblings in one node, resulting in a polytomy in the supertree. There exist two possibilities to remove the undisputed sibling x: Either we simply delete x from the input trees, resulting in a deletion of row x from the input matrix, and subsequent deletion of all columns that have only a single ‘1’-entry. Or, we decide to add the weight of x and y in those trees where x is removed. In the matrix, we then treat 0/1-entries to be weighted by a positive integer. In our implementation, we concentrate on the first variant.
44
6
M. Brinkmeyer, T. Griebel, and S. B¨ocker
Experiments
We want to evaluate the performance of the FlipCut supertree method in comparison to Matrix Representation with Parsimony (MRP), Matrix Representation with Flipping (MRF), Build With Distances (BWD), PhySIC IST, and SuperTriplets. Recall that MC and MMC supertrees are of comparatively low quality, and consistently worse than BWD [3], so we excluded these two methods from our study. We use simulated data in our evaluation since here, the true tree (or model tree) is known. Thus, results of different methods can be compared at an absolute scale. Our evaluation study proceeds in the usual fashion: A model tree is generated, and gene sequences are evolved along the branches. Sequences at the taxa of the model tree are used as datasets from which source trees for a supertree method are inferred. Finally, the resulting supertree is compared to the model tree using distance or similarity measures. For our simulations, we used a dataset1 that was generated using the SMIDgen protocol described in [20]. Compared to previous protocols, this protocol better reflects data collection processes used by systematists when gathering empirical data. This includes creation of densely-sampled clade-based trees as well as sparsely-sampled scaffold trees. Model trees having either 100, 500 or 1000 taxa were generated with 30 replicates for the 100 and 500 taxon case, and ten replicates for the 1000 taxa case. We defer further details to the full version of this paper. For the simulation study, we know that all branch lengths are computed under the same model of sequence evolution. This can be seen as an optimal condition for the BWD and FlipCut algorithm. Again, we defer the evaluation on whether branch length normalization changes the quality of reconstructed supertrees, to the full version of this paper. We implemented the FlipCut algorithm in Java as part of the EPoS framework [9]. In order to to illustrate the influence of branch-length to our approach, we use two different weighting schemes for edges and character vertices in the graph model: First, unit costs, where branch lengths are ignored. Here, the cost of deleting an edge is one, and the cost of deleting a character vertex c is just the number of zeros in the corresponding column in matrix M . Second, “Edge & Level”, where we make use of branch lengths. We multiply deletion costs for character vertex c and all edges incident to c by w(c) = l(e) · depth(v). Here, l(e) is the length of branch e = (u, v), depth(v) is the number of edges on the path from the root to v, and c corresponds to v. MRP supertrees were computed using PAUP* 4.0b10 [19] with TBR branch swapping strategy, random addition of sequences, no limit on the maximal number of trees in memory, and 100 replicates. MRF supertrees were generated using the implementation provided by Duhong Chen2 , also with the TBR branch swapping strategy. For 100 taxa model trees, we used 30 replicates for the search, and in case of 500 and 1000 taxa model trees only ten replicates, 1 2
http://www.cs.utexas.edu/~ phylo/datasets/supertrees.html http://genome.cs.iastate.edu/CBL/download/
FlipCut Supertrees
45
Table 1. Running times (min:sec) of the different algorithms. MRP #TO is the number of timeouts of MRP where computation was stopped after one hour, and MRP avg* is the average running time of those runs that stopped before the time limit. ST is the SuperTriplets method. BWD computed four supertrees for different distance models within the measured time. Model Scaff. MRP MRP MRF BWD PhySIC IST tree factor #TO avg* c = 0.5 c = 1 100 taxa
20% 50% 75% 100%
19/30 20/30 14/30 0/30
18:47 4:36 16:47 0:36
3:01 5:15 5:40 4:51
500 taxa
20% 50% 75% 100%
30/30 30/30 30/30 30/30
– – – –
1000 taxa
20% 50% 75% 100%
10/10 10/10 10/10 10/10
– – – –
≈1 ≈1 ≈1 ≈1
28:02 10:57 12:52 08:33
ST
s s s s
16:16 17:04 17:02 5:54
0:05 0:05 0:06 0:06
45:37 18:36 16:36 34:14
20:41 29:49 33:30 31:54
– – – –
– 8:56 – 11:59 – 15:46 – 18:55
– – – –
– – – –
– – – –
– – – –
FlipCut unit E&L < < < <
1 1 1 1
s s s s
<1 <1 <1 <1
s s s s
0:30 0:55 0:40 0:12
0:22 0:42 0:38 0:15
– 8:21 – 15:42 – 13:23 – 1:51
2:28 4:41 6:59 1:50
because on our cluster the implementation failed with more replicates. BWD supertrees were constructed using the implementation by Stephen J. Willson.3 For the PhySIC IST supertrees [17] we used the implementation provided by the authors.4 PhySIC IST offers a parameter to tune the method from “veto” to “voting-like”. In our simulation, we used 0.5 and 1 as parameter settings. We generated SuperTriplets supertrees [16] using the implementation provided by the authors.5 . All computations were performed on a Linux cluster of AMD Opteron-2378, 2.4 GHz CPUs, with 16 GB of memory.
7
Results
We first consider running times of MRP, MRF, BWD, PhySIC IST, SuperTriplets, and the FlipCut algorithm presented here, see Table 1. For each instance, we use a running time limit of one hour in case of 100 and 500 taxon model trees, and two hours in case of 1000 taxon model trees. Entries ‘–’ indicate that no instance was finished within the time limit: Regarding MRP, PAUP* returns a consensus of the current trees in memory if the time limit is exceeded. In contrast, the MRF implementation returns no tree. PhySIC IST crashes for model tree sizes of 500 and 1000 taxa, and the SuperTriplets implementation crashes for model tree sizes of 1000 taxa. 3 4 5
http://www.public.iastate.edu/~ swillson/software.html http://www.atgc-montpellier.fr/physic_ist/ with option ‘-c’ http://www.supertriplets.univ-montp2.fr/download.php
46
M. Brinkmeyer, T. Griebel, and S. B¨ocker
100 Taxa
0.4
0.4
1000 Taxa
20
50
75
100
0.2 0.1
0.1
0.1
0.2
0.3
0.3
0.3 0.2
5)ï'LVWDQFH
0.4
500 Taxa
20
50
75
100
20
50
75
100
6FDIIold FDFWRU )OLS8QLW
)OLS(GJH
%:'
MRP
MRF
6ïTULSOHW
Ph\VLF
Ph\VLF
Fig. 1. Simulation results, quality of reconstructed supertrees. We plot the RobinsonFoulds distance between the calculated supertree to the true model tree, averaged over all simulation replicates. From left to right, model trees with 100, 500, and 1000 taxa. 100 Taxa
0.8
0.5
0.5
0.6
0.6
0.7
0.7
0.8
0.8 0.7 0.6 0.5
Mast
1000 Taxa
500 Taxa
20
50
75
100
20
50
75
100
20
50
75
100
Scaffold Factor Flip Unit
Flip Edge
BWD
MRP
MRF
6ïTriplet
Physic 0.5
Physic 1.0
Fig. 2. Simulation results, quality of reconstructed supertrees. We plot the MAST distance between the calculated supertree and the true model tree, averaged over all simulation replicates. From left to right, model trees with 100, 500, and 1000 taxa.
PAUP* often runs into timeouts even for the smallest instances containing only 100 taxa. Similarly, PhySIC IST can process only instances of this size. MRF, BWD, and SuperTriplets can process instances with up to 500 taxa in less than one hour. In contrast, our FlipCut method is several orders of magnitude faster than any other method. Even large instances with 1000 taxa can be processed in a matter of minutes. Next, we investigate the accuracy of reconstructed supertrees. Results are shown in Fig. 1 and 2. Recall that PhySIC IST usually computes non-plenary supertrees: Here, we first restrict the model tree to the taxon set of the supertree. This favors PhySIC IST for all distance measures but the MAST distance, so PhySIC IST results must be interpreted with some caution. For the RF distance, we see that for all model tree sizes, MRP supertrees are of the best quality. For 100 taxa model trees, MRP, the PhySIC IST variants,
FlipCut Supertrees
47
and MRF show the best performance, followed by FlipCut “Edge & Level”. For 500 taxa model trees, performance from best to worst is: MRP, MRF, FlipCut “Edge & Level”, BWD, and FlipCut unit costs. SuperTriplets performs good for small and large scaffold density. For 100 taxa model trees, performance from best to worst is: MRP, FlipCut “Edge & Level”, and FlipCut unit costs. The the MAST distance and 100 taxa model trees, PhySIC IST 1 performs significantly worse than all other methods. MRP outperforms the other methods only with input tree sets with a scaffold density of 75% and 100%. Both FlipCut “Edge & Level” and MRP compute supertrees such that the MAST between supertree and model tree consistently contains more than half of the taxa. MRP, MRF, and FlipCut “Edge & Level” perform almost on par. For 500 taxa model trees, we see three groups: MRP and MRF perform best, closely followed by FlipCut “Edge & Level” and SuperTriplets. Performance of FlipCut unit cost and BWD is much worse. Finally, for 1000 taxa model trees, MRP performs best, but FlipCut “Edge & Level” is on second place with similar performance except for scaffold density 100%.
8
Conclusion
We have presented a novel supertree method named FlipCut supertrees. Our method combines the intuition behind both Minimum Flip and MinCut supertrees. We have also presented a heuristic that ensures that undisputed siblings will be present in the constructed supertree. The FlipCut supertree method has polynomial running time and is extremely swift in practice. Regarding supertree quality, performance of the FlipCut algorithm is sometimes even on par with MRP. Besides much better performance in simulations, FlipCut supertrees offer a fundamental advantage over MinCut supertrees: We have defined a global objective function that we want to minimize, whereas no such objective can be defined for MinCut and its derivatives. Besides the theoretical amenity of such a objective function, this also has practical implications: We can compare the quality of different supertrees based on our objective function; and we can also compare the quality of partial solutions. We conjecture that this fact will allow us to further improve the quality of FlipCut supertrees. Finally, we want to evaluate methods for weighting the edges in the FlipCut graph. The “Edge & Level” weighting presented here, is merely meant to demonstrate the impact of weighting edges on the quality of constructed supertrees. Acknowledgments. Additional implementation by Markus Fleischauer.
References 1. Aho, A.V., Sagiv, Y., Szymanski, T.G., Ullman, J.D.: Inferring a tree from lowest common ancestors with an application to the optimization of relational expressions. SIAM J. Comput. 10(3), 405–421 (1981) 2. Baum, B.R.: Combining trees as a way of combining data sets for phylogenetic inference, and the desirability of combining gene trees. Taxon 41(1), 3–10 (1992)
48
M. Brinkmeyer, T. Griebel, and S. B¨ocker
3. Brinkmeyer, M., Griebel, T., B¨ ocker, S.: Polynomial supertree methods revisited. In: Dijkstra, T.M.H., Tsivtsivadze, E., Marchiori, E., Heskes, T. (eds.) PRIB 2010. LNCS, vol. 6282, pp. 183–194. Springer, Heidelberg (2010) 4. Chen, D., Eulenstein, O., Fern´ andez-Baca, D., Burleigh, J.G.: Improved heuristics for minimum-flip supertree construction. Evol. Bioinform. Online 2, 391–400 (2006) 5. Chen, D., Eulenstein, O., Fern´ andez-Baca, D., Sanderson, M.: Minimumflip supertrees: complexity and algorithms. IEEE/ACM Trans. Comput. Biol. Bioinform. 3(2), 165–173 (2006) 6. Chimani, M., Rahmann, S., B¨ ocker, S.: Exact ILP solutions for phylogenetic minimum flip problems. In: Proc. of ACM Conf. on Bioinformatics and Computational Biology (ACM-BCB 2010), pp. 147–153 (2010) 7. Day, W., Johnson, D., Sankoff, D.: The computational complexity of inferring rooted phylogenies by parsimony. Math. Biosci. 81, 33–42 (1986) 8. Ford, L.R., Fulkerson, D.R.: Flows in Networks. Princeton University Press, Princeton (1962) 9. Griebel, T., Brinkmeyer, M., B¨ ocker, S.: EPoS: a modular software framework for phylogenetic analysis. Bioinformatics 24(20), 2399–2400 (2008) 10. Gusfield, D.: Efficient algorithms for inferring evolutionary trees. Networks 21, 19–28 (1991) 11. Hao, J.X., Orlin, J.B.: A faster algorithm for finding the minimum cut in a directed graph. J. Algorithms 17(3), 424–446 (1994) 12. Page, R.D.M.: Modified mincut supertrees. In: Guig´ o, R., Gusfield, D. (eds.) WABI 2002. LNCS, vol. 2452, pp. 537–552. Springer, Heidelberg (2002) 13. Pe’er, I., Pupko, T., Shamir, R., Sharan, R.: Incomplete directed perfect phylogeny. SIAM J. Comput. 33(3), 590–607 (2004) 14. Ragan, M.A.: Phylogenetic inference based on matrix representation of trees. Mol. Phylogenet. Evol. 1(1), 53–58 (1992) 15. Ranwez, V., Berry, V., Criscuolo, A., Fabre, P.-H., Guillemot, S., Scornavacca, C., Douzery, E.J.P.: PhySIC: a veto supertree method with desirable properties. Syst. Biol. 56(5), 798–817 (2007) 16. Ranwez, V., Criscuolo, A., Douzery, E.J.P.: Supertriplets: a triplet-based supertree approach to phylogenomics. Bioinformatics 26(12), i115–i123 (2010) 17. Scornavacca, C., Berry, V., Lefort, V., Douzery, E.J.P., Ranwez, V.: PhySIC IST: cleaning source trees to infer more informative supertrees. BMC Bioinformatics 9, 413 (2008) 18. Semple, C., Steel, M.: A supertree method for rooted trees. Discrete Appl. Math. 105(1-3), 147–158 (2000) 19. Swafford, D., Paup*: Phylogenetic analysis using parsimony (*and other methods), Version 4 (2002) 20. Swenson, M.S., Barbancon, F., Warnow, T., Linder, C.R.: A simulation study comparing supertree and combined analysis methods using SMIDGen. Algorithms Mol. Biol. 5(1), 8 (2010) 21. Willson, S.J.: Constructing rooted supertrees using distances. Bull. Math. Biol. 66(6), 1755–1783 (2004)
Tight Bounds on Local Search to Approximate the Maximum Satisfiability Problems Daming Zhu, Shaohan Ma, and Pingping Zhang School of Computer Science and Technology, Shandong University, Jinan 250101 PR China
[email protected]
Abstract. Maximum Satisfiability problem is the central problem in theoretical computer science. Local search has been testified to be effective in the practice to solve these problems. This paper presents new local search methods to solve the maximum satisfiability problems and analyzes the performance of the methods. We focus on the sub problem with each clause containing at least k literals, Max-(k)-Sat briefly. The central issue is to discuss the local search algorithms as well as their performance to solve Max-(2)-Sat and Max-(3)-Sat. We first propose a local search algorithm to solve Max-(2)-Sat. This algorithm can achieve the performance ratio not larger than 4/3 and can be extended to solve Max-(k)-Sat with performance ratio not larger than k+2 for k ≥ 3. We k+1 then propose a local search algorithm for Max-(3)-Sat and show that the algorithm can achieve the performance ratio not larger than 8/7. This algorithm can be extended to solve Max-(k)-Sat with performance ratio not larger than 2k+2 for k ≥ 4. We can give examples to show that the 2k+1 aforementioned bounds are all tight. The algorithm for Max-(3)-Sat can naturally derive the local search algorithms for Not-2Sat and Not-3Sat with performance ratio 2 and 43 respectively.
1
Introduction
Maximum Satisfiability problem, Max-Sat briefly, is the central problem in theoretical computer science. Given a set of boolean variables and a set of clauses, the problem asks to find an assignment of the variables such that the satisfied clauses are maximized. As Max-Sat is NP-Hard[1] and in fact Max-SNP-Hard[2], much attention has been devoted to approximating it. Johnson[3] first designed the approximation algorithm for this problem with performance ratio at most 2. Chen, Friesen and Zheng[4] showed that the performance ratio of Johnson’s algorithm is actually 3/2. Many years passed before Yannakakis[5] obtained a 4/3-approximation algorithm for the problem. Goemans and Williamson then obtained a different and somewhat simpler 4/3-approximation algorithm[6]. The special version in which each clause contains at most k literals is referred to as the Maximum k-Satisfiability problem, Max-k-Sat briefly; the version in which each clause contains at least k literals is referred to as the Maximum (k)-Satisfiability problem, Max-(k)-Sat briefly; the version in which each clause B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 49–61, 2011. c Springer-Verlag Berlin Heidelberg 2011
50
D. Zhu, S. Ma, and P. Zhang
contains just k literals is referred to as the Maximum Ek-satisfiability problem, Max-Ek-Sat briefly. Johnson[3] proposed an algorithm for Max-(k)-Sat with k performance ratio 2k2−1 in 1974. In a major breakthrough, Goemans and Williamson[7] designed the 1.139approximation algorithm for Max-2-Sat in 1995. They used the semi-definite programming and relaxations of the problem, thus improved the performance of the solution. Feige and Goemans then obtained a 1.074-approximation algorithm for Max-2-Sat using the same method[8]. An attempt to squeeze more from the Max-2-Sat of Feige and Goemans was made by Trevisan, Sorkin, Sudan and Williamson[9]. They used an optimal gadget, a concept formalized by Bellare, Goldreich and Sudan, to reduce Max-3-Sat to Max-2-Sat, thereby obtaining a 1.248-approximation algorithm for Max-3Sat. Trevisan further obtained a 1.211-approximation algorithm for satisfiable instances of Max-3-Sat and a 1.25-approximation algorithm for satisfiable instances of Max-Sat[10]. Karloff and Zwick[11,12] obtained the 8/7-approximation algorithm for Max-3-Sat by a new semi-definite programming and relaxations. Halperin and Zwick[12] further obtained the 1.147-approximation algorithm for Max-4-Sat. In another major breakthrough, Hastad[13] showed that Max-E3-Sat cannot be approximated in polynomial time to within a ratio less than 8/7, if P = N P . Consequently, either Max-3-Sat or Max-(3)-Sat cannot be approximated to within a ratio less than 8/7 if P = N P . It appears that the algorithm of Karloff and Zwick has achieved the expected performance ratio 8/7 for Max-3Sat[11,12]. The algorithm of Johnson[3] has achieved the performance ratio 8/7 for Max-(3)-Sat. Although there are so abundant algorithms, many people are more willing to use local search for real Max-Sat solving. It appears that local-search can produce high quality solutions. The local search approach for Max-Sat can be traced back to the computational experiment of Gu[14] and Selman[15] in 1992, as well as the theoretical analysis of Hansen[17] in 1990, Papadimitriou[2] and Koutsoupias[16] in 1991. Generally speaking, the now available local search algorithms can be divided into three classes, which are termed as oblivious, non-oblivious, and tabu search respectively. Oblivious local search with 1-flip neighborhood achieve the performance ratio k+1 for Max-Ek-Sat[17]. Non-oblivious local search provides k k better worst case guarantee of 2k2−1 for Max-Ek-Sat. For Max-E2-Sat, tabu search was shown to have the tight performance ratio of 4/3[18]. For Max-EkSat with k > 2, tabu search was shown to have weaker approximation guarantee than non-oblivious local search[19]. Other approaches for local search to solve Max-Sat can be looked up in [20,21]. In this paper, we further discuss the performance of oblivious local search for Maximum Satisfiability problems. Oblivious local search starts with an arbitrary fixed truth assignment. At each step, it searches the one-flip neighborhood of the current assignment, to achieve a better value of the given objective function. If such a neighbor exists, the algorithm replaces the current assignment with a new assignment to improve the value of the objective function. If such a neighbor does
Tight Bounds on Local Search to Approximate Max-(k)-Sat
51
not exist, oblivious local search terminates. The local search algorithms as well as their performances for Max-(2)-Sat and Max-(3)-Sat are the key point of our studying. We first present a local search algorithm for Max-(2)-Sat. We can show that the algorithm has a performance ratio 4/3. This algorithm can be extended to solve Max-(k)-Sat for k ≥ 3 with performance ratio k+2 . We then present k+1 a local search algorithm for Max-(3)-Sat. We show that the algorithm has a performance ratio 8/7. This algorithm can be extended to solve Max-(k)-Sat for k ≥ 4 with performance ratio 2k+2 2k+1 . We can give examples to show that all the aforementioned bounds are tight. Using the local search method for Max(3)-Sat, we give an algorithm for Not-2Sat with performance ratio 2, and an algorithm for Not-3Sat with performance ratio 43 respectively. Our algorithms are very simple and very easy to be made into programs.
2
Local Search for Max-(2)-Sat
For a boolean variable u, u and u are the positive and the negative literals respectively. A clause is a set of literals. Setting a value T or F to a variable corresponds to setting the value T (F ) or F (T ) to its literals. We do not distinguish between a boolean variable and the literals of the variable. A clause is satisfied if at least one of its literals has value T . A clause is unsatisfied if every literal of the clause has value F . Max-(k)-SAT is described as follows. Instance:A set of boolean variables U = {u1 , ..., un } and a set of clauses C={C1 , ..., Cm }. Every clause contains at least k literals of the variables in U . Question: Find an assignment of the variables in U , a : U → {T, F }, such that the number of satisfied clauses are maximized. 2.1
The 4/3-Approximation Algorithm for Max-E2-Sat
We denote the value of u assigned by the assignment function a(•) as a(u), where u is a variable or a literal. We always assume that a clause does not contain the two literals of one variable simultaneously. Definition 1. Let a(U ) be an assignment of U . A clause is satisfied by a(u), if it contains the literal u and a(u) = T . A clause is not satisfied by a(u), if it contains u and a(u) = F . A clause is unrelated with the variable u, if it does not contain u or u. A clause is k-satisfied, if it is satisfied by the assignment of exactly k literals. In this paper, a clause satisfied by a(u) is also referred to as the clause satisfied by u. Moreover, to reset u by its complement value is referred to as flip the value of u, or flip u. Consider the local search method as follows. Set the value of the variables in U randomly, then select one variable and flip it to increase in number the satisfied clauses. Repeat the operation until no variable can be selected. Let C[j, T ] be the set of clauses, which are satisfied by a(uj ), and can be transformed into unsatisfied by flipping a(uj ). Let C[j, F ] be the set of clauses which are unsatisfied and not satisfied by a(uj ). The local search method is given in figure-1 formally.
52
D. Zhu, S. Ma, and P. Zhang
Algorithm One-Bit-Flip(U, C) a(uk ) ← Rand{T, F }, 1 ≤ k ≤ n; While (∃uj such that |C[j, T ]| < |C[j, F ]|) a(uj ) ← a(uj ) End While Return a(U ) Fig. 1. The local search algorithm of flipping one variable
In the algorithm, Rand{T, F } represents the function to select T or F randomly with identical probability. For each variable, constructing the set C[j, T ] and C[j, F ] takes O(m) time. Finding a variable uj with |C[j, T ]| < |C[j, F ]| takes O(mn) time. Thus the time complexity of One-Bit-Flip(U, C) is O(m2 n). Now we show that at least 23 |C| clauses in C are satisfied. A satisfied clause may be 1-satisfied or 2-satisfied. For the assignment obtained by the algorithm, we have to observe the 1-satisfied and 2-satisfied clauses respectively. Lemma 1. Let a(U ) be the assignment of U obtained by One-Bit-Flip(U, C). Then for every uj , 1 ≤ j ≤ n, |C[j, T ]| ≥ |C[j, F ]| holds. Proof. If there exists a variable uj such that the relation |C[j, T ]| < |C[j, F ]| holds, then a(uj ) will be flipped and the circulation cannot end. In the following of the paper, we use S[a, k] to represent the set of k-satisfied clauses when U gets an assignment a(U ). Lemma 2. Let a(U ) be the assignment of U obtained by One-Bit-Flip(U, C). Then |S[a, 1]| ≥ 2|S[a, 0]|. n Proof. We first show that |S[a, 1]| = j=1 |C[j, T ]| holds. Let Ct = {x[t, 1], x[t, 2]} ∈ S[a, 1]. We only consider the case of a(x[t, 1]) = T and a(x[t, 2]) = F . Flipping x[t, 1] can transform Ct into unsatisfied. Flipping any other variable keeps Ct satisfied. Let x[t, 1] ∈ {uj , uj }. Then Ct ∈ C[j, T ] and Ct ∈ / C[x, T ] for x = j. That is to say, Ct belongs to one and only one set of C[j, T ], 1 ≤ j ≤ n. Thus n |S[a, 1]| = j=1 |C[j, T ]|. n We then show that 2|S[a, 0]| = j=1 |C[j, F ]|. If Ct is unsatisfied, then a(x[t, 1]) =a(x[t, 2]) = F . Flipping either of x[t, 1] and x[t, 2] can transform Ct into satisfied. And flipping any variable other than x[t, 1] and x[t, 2] must keep Ct unsatisfied. That is to say, Ct belongs to exactly two sets of C[j, F ], 1 ≤ j ≤ n. n n Thus 2|S[a, 0]| = j=1 |C[j, F ]|. By lemma 1, we have |S[a, 1]| = j=1 |C[j, T ]| n ≥ j=1 |C[j, F ]| = 2|S[a, 0]|. By lemma 2, One-Bit-Flip(U, C) can give a solution with 1-satisfied clauses summing up to at least 2 times the number of unsatisfied clauses. In order to
Tight Bounds on Local Search to Approximate Max-(k)-Sat
53
increase in number the 2-satisfied clauses, we try to flip all the variables. We use S[a, k] as declared in lemma 2 in what follows. Lemma 3. Let a(U ) be an assignment of U and a(U ) be the assignment by flipping all the variables of U . Then S[a, 1] = S[a, 1], S[a, 0] = S[a, 2], S[a, 2] = S[a, 0]. Proof. For a clause Ct = {x[t, 1], x[t, 2]}, flipping all the variables of U must flip x[t, 1] and x[t, 2]. The lemma follows the following causalities. If Ct ∈ S[a, 1], then Ct ∈ S[a, 1]. If Ct ∈ S[a, 0], then Ct ∈ S[a, 2]. If Ct ∈ S[a, 2], then Ct ∈ S[a, 0]. By lemma 3, if the 2-satisfied clauses are less than the 0-satisfied clauses, we can flip all the variables to swap the 0-satisfied and 2-satisfied clauses. The algorithm is given in figure-2.
Algorithm MaxE2Sat(U, C) Call One-Bit-Flip(U, C) to get assignment a(U ). If |S[a, 2]| ≥ |S[a, 0]|, then b(U ) ← a(U ) Else b(U ) ← a(U ). End if Return b(U ) Fig. 2. The local search algorithm for Max-E2-Sat
The time complexity of MaxE2Sat(U, C) is O(m2 n). The performance of the algorithm can be fixed as follows. Theorem 1. Let b(U ) be the assignment of U obtained by MaxE2Sat(U, C). Then |S[b, 1]| + |S[b, 2]| ≥ 34 |C|. Proof. Let a(U ) be the assignment of U obtained by One-Bit-Flip(U, C). Then |S[a, 1]| ≥ 2|S[a, 0]| follows lemma 2. Moreover, |S[b, 1]| = |S[a, 1]|, |S[b, 2]| ≥ |S[b, 0]| and |S[b, 0]| ≤ |S[a, 0]| follows lemma 3. Thus, |S[b, 1]| + |S[b, 2]| = |S[a, 1]| + |S[b, 2]| ≥ 2|S[a, 0]| + |S[b, 0]| ≥ 2|S[b, 0]| + |S[b, 0]| = 3|S[b, 0]| Since C = S[b, 0]
S[b, 1]
(1)
S[b, 2], we have |S[b, 1]| + |S[b, 2]| ≥ 34 |C|.
Theorem 1 implies that the algorithm MaxE2Sat(U, C) has performance ratio not larger than 4/3. We give an example, for which the algorithm has performance ratio 4/3 exactly. The instance has the set of variables U = {u1 , u2 , u3 } and the set of clauses C = {C1 , C2 , C3 , C4 }, where C1 = {u1 , u3 }, C2 = {u1 , u2 },
54
D. Zhu, S. Ma, and P. Zhang
C3 = {u2 , u3 }, C4 = {u1 , u3 }. For the assignment a(u1 ) = a(u2 ) = a(u3 ) = F , C1 is 2-satisfied, C2 and C3 are 1-satisfied, and C4 is unsatisfied. This solution cannot be improved by flipping one variable or all the variables. Actually, we have an assignment to make all the clauses satisfied. Thus the performance of the algorithm is 4/3 tightly. 2.2
On the General Case of Max-(k)-Sat
If a clause is satisfied and all literals of the clause are set T by a(U ), then this clause is termed as full-satisfied(by a(U )). If a clause is satisfied other than full-satisfied, it is partly-satisfied(by a(U )). For the instances that a clause has k(≥ 2) or more literals, we can use the local search of flipping one variable to maximize the partly satisfied clauses. This method can obtain the assignment, say a(U ), to force the partly-satisfied clauses amount to at least k times the number of unsatisfied clauses. Then, we try to flip all the variables to increase in number the full satisfied clauses. At last, the satisfied clauses are increased in number to at least k + 1 times of the unsatisfied clauses, which means the algorithm can have performance ratio not larger than k+2 k+1 . We give an instance of Max-(k)-Sat for k ≥ 3. It has k variables , and k + 2 clauses, i.e., U = {u1 , ..., uk } and C = {C1 , ..., Ck+2 }. The first k clauses are given as C1 ={u1 , u2 , ..., uk }, C2 ={u1 , u2 , u3 , ..., uk },..., Ck = {u1 , ..., uk−1 , uk }. The last two clauses are, Ck+1 = {u1 , ..., uk } and Ck+2 = {u1 , ..., uk }. If every variable is assigned F , then the first k clauses and Ck+2 are satisfied, and Ck+1 is unsatisfied. The assignment a(uj ) = F, 1 ≤ j ≤ k, is a solution for the instance with performance ratio k+2 k+1 .
3
The 87 -Approximation Algorithm for Max-(3)-Sat
The algorithm in section 2 can only achieve performance ratio 5/4 for Max(3)-Sat. We present a new local search method to improve the performance for solving Max-(3)-Sat in this section. A satisfied clause of 3 literals can be 1-satisfied, 2-satisfied or 3-satisfied. We expect to use local search of one-bitflip to maximize the number of 1-satisfied together with 2-satisfied clauses, so that the 1-satisfied and 2-satisfied clauses can amount to 6 times the number of unsatisfied clauses. Pure local search cannot always attain the effect. However, we can use the technique of flipping all the variables to achieve the goal. 3.1
The
8 -Approximation 7
Algorithm for Max-E3-Sat
In this subsection, every clause contains 3 literals exactly. Let a(U ) be an assignment of U . Flipping a variable unrelated with a clause cannot change the clause on its satisfiability. Flipping a variable can change a clause on its satisfiability according to the following principles. (1)If Ct is 0-satisfied, then flipping a literal in Ct can only transform Ct into 1-satisfied. (2)If Ct is 1-satisfied, then flipping a literal in Ct can only transform Ct into 0-satisfied or 2-satisfied. (3)If Ct is
Tight Bounds on Local Search to Approximate Max-(k)-Sat
55
2-satisfied, then flipping a literal in Ct can only transform Ct into 1-satisfied or 3-satisfied. (4)If Ct is 3-satisfied, then flipping a literal in Ct can only transform Ct into 2-satisfied. By the aforementioned principles, let C[j, 0] denote the set of 0-satisfied clauses which can be transformed into 1-satisfied by flipping a(uj ); C[j, 1] denote the set of 1-satisfied clauses which can be transformed into 0-satisfied by flipping a(uj ); C[j, 2] denote the set of 2-satisfied clauses which can be transformed into 3-satisfied by flipping a(uj ); C[j, 3] denote the set of 3-satisfied clauses which can be transformed into 2-satisfied by flipping a(uj ). The local search algorithm to maximize the 1-satisfied and 2-satisfied clauses is given in figure-3.
Algorithm Improved-One-Flip(U, C) a(uk ) ← Rand{T, F }, 1 ≤ k ≤ n While (∃uj such that |C[j, 1]| + |C[j, 2]| < |C[j, 0]| + |C[j, 3]|) a(uj ) ← a(uj ). End While Return a(U ) Fig. 3. The local search algorithm of flipping one variable
The time complexity of the algorithm is O(m2 n). We discuss the performance of the algorithm now. Lemma 4. Let a(U ) be the assignment of U obtained by Improved-One-Flip (U, C). Then for every uj , the relation |C[j, 1]| + |C[j, 2]| ≥ |C[j, 0]| + |C[j, 3]| holds. Proof. If there is a variable uj , for which the relation |C[j, 1]| + |C[j, 2]| < |C[j, 0]| + |C[j, 3]| holds, then the step of flipping a(uj ) must be executed and the circulation cannot end at this time. Lemma 5. Let a(U ) be the assignment of U obtained n n by Improved-One-Flip (U, C). Then |S[a, 1]| + |S[a, 2]| = j=1 |C[j, 1]| + j=1 |C[j, 2]|. Proof. Let Ct ={x[t, 1], x[t, 2], x[t, 3]}, x[t, j] ∈{u1 , ..., un , u1 , ..., un },j ∈ {1, 2, 3}. If Ct ∈ S[a, 1], then without loss of generality, let a(x[t, 1]) = T , a(x[t, 2]) = a(x[t, 3]) = F . The clause Ct can be transformed into unsatisfied if and only if x[t, 1] is flipped. When flipping other variables, Ct keeps 1-satisfied or is transformed into 2-satisfied. Let x[t, 1] ∈ {uj , uj }, then Ct ∈ C[j, 1]. But for x = j, Ct ∈ / C[x, 1]. That isto say, Ct is contained in one and only n one set of C[j, 1]. Thus |S[a, 1]| = j=1 C[j, 1]. For the same reason, we have n n |S[a, 2]| = j=1 |C[j, 2]|. Therefore, we have |S[a, 1]|+|S[a, 2]| = j=1 |C[j, 1]|+ n j=1 |C[j, 2]|.
56
D. Zhu, S. Ma, and P. Zhang
Lemma 6. Let a(U ) be the assignment n of U obtained n by Improved-One-Flip (U, C). Then 3|S[a, 3]| + 3|S[a, 0]| = j=1 |C[j, 0]| + j=1 |C[j, 3]|. Proof. We show that for each clause Ct ∈ S[a, 0], there exist just 3 sets, say C[j1 , 0], C[j2 , 0], C[j3 , 0], such that Ct ∈ C[j1 , 0], Ct ∈ C[j2 , 0] and Ct ∈ C[j3 , 0] hold. Let Ct = {x[t, 1], x[t, 2], x[t, 3]} ∈ S[a, 0] and a(x[t, 1]) = a(x[t, 2]) = a(x[, t, 3]) = F . The clause Ct is transformed into 1-satisfied, if and only if one of x[t, 1], x[t, 2] and x[t, 3] is flipped, Let x[t, 1] ∈ {uj1 , uj1 }, x[t, 2] ∈ {uj2 , uj2 }, x[t, 3] ∈ {uj3 , uj3 }. Then Ct ∈ C[j1 , 0], Ct ∈ C[j2 , 0], Ct ∈ C[j3 , 0]. However, for any / {j1 , j2 , j3 }, Ct is unrelated with / C[x, 0]. Thus we have n x ∈ n ux , and Ct ∈ |C[j, 0]| =3|S[a, 0]|. The relation |C[j, 3]| =3|S[a, 3]| follows from the j=1 n j=1 n same argument. Thus j=1 |C[j, 0]| + j=1 |C[j, 3]| =3|S[a, 0]| + 3|S[a, 3]|. Lemma 7. Let a(U ) be the assignment of U obtained by Improved-One-Flip (U, C). Then |S[a, 1]| + |S[a, 2]| ≥6min{|S[a, 0]|, |S[a, 3]|}. Proof. By lemma 5, lemma 4 and lemma 6, we have |S[a, 1]| + |S[a, 2]| = ≥
n j=1 n j=1
|C[j, 1]| + |C[j, 0]| +
n j=1 n
|C[j, 2]| |C[j, 3]|
j=1
= 3|S[a, 0]| + 3|S[a, 3]| ≥ 6min{|S[a, 0]|, |S[a, 3]|}
(2)
By lemma 7, the 1-satisfied and 2-satisfied clauses are numbered at least 6 times of the unsatisfied clauses, if |S[a, 3]| ≥ |S[a, 0]|. If |S[a, 3]| < |S[a, 0]|, we do not always have the relation. To improve the performance definitely, we try to flip all the variables under the condition |S[a, 3]| < |S[a, 0]|. The algorithm is given in figure-4. Algorithm MaxE 3Sat(U, C) Call Improved-One-Flip(U, C) to get assignment a(U ). If |S[a, 3]| ≥ |S[a, 0]|, then b(U ) ← a(U ) Else b(U ) ← a(U ) End if Return b(U ) Fig. 4. The local search algorithm for MaxE3Sat
Tight Bounds on Local Search to Approximate Max-(k)-Sat
57
This algorithm has time complexity O(m2 n) for instances with n variables and m clauses. We show that the algorithm has performance ratio 8/7. Lemma 8. Let b(U ) be the assignment of U obtained by MaxE3Sat(U, C). Then the following relations hold. |S[b, 1]| + |S[b, 2]| = |S[a, 1]| + |S[a, 2]| |S[b, 0]| + |S[b, 3]| = |S[a, 0]| + |S[a, 3]| |S[b, 0]| = min{|S[a, 0]|, |S[a, 3]|} |S[b, 3]| = max{|S[a, 0]|, |S[a, 3]|}
(3) (4) (5) (6)
Proof. Flipping all the variables transforms a j-satisfied clause into (3 − j)satisfied for j, 0 ≤ j ≤ 3. The equations (3) and (4) follow this observation. The relations (5) and (6) follow the condition, |S[a, 3]| < |S[a, 0]|, of flipping all the variables. Theorem 2. Let b(U ) be the assignment of U obtained by MaxE3Sat(U, C). Then |S[b, 1]|+ |S[b, 2]|+ |S[b, 3]| ≥ 78 |C|. Proof. By lemma 8 and lemma 7, we have |S[b, 1]| + |S[b, 2]| = |S[a, 1]| + |S[a, 2]| ≥ 6min{|S[a, 0]|, |S[a, 3]|} = 6min{|S[b, 0]|, |S[b, 3]|} = 6|S[b, 0]|.
(7)
Thus we have |S[b, 1]| + |S[b, 2]| + |S[b, 3]| ≥ 7|S[b, 0]|.This leads to |S[b, 1]| + |S[b, 2]| + |S[b, 3]| ≥ 78 |C| because C = S[b, 0] S[b, 1] S[b, 2] S[b, 3]. Theorem 3 implies MaxE3Sat(U, C) can achieve the performance ratio of not larger than 8/7. We give an example for which the algorithm can give a solution with performance ratio 8/7 exactly. Let U = {u1 , u2 , u3 ,u4 , u5 , u6 }, C = {C1 ,C2 , C3 , C4 , C5 , C6 ,C7 , C8 , C9 , C10 , C11 , C12 , C13 , C14 , C15 , C16 }. The clauses in C are listed in table-1. For assigning F to every variable, there are 14 clauses satisfied. The satisfied and unsatisfied clauses are given in table-1. Table 1. The instance of Max-(3)-Sat has 6 variables and 16 clauses. There are 14 clauses satisfied by the assignment a(u1 ) = a(u2 ) = a(u3 ) = a(u4 ) = a(u5 ) = a(u6 ) = F.
S[a, 0] C1 = {u1 , u2 , u3 }, C2 = {u4 , u5 , u6 } S[a, 3] C3 ={u1 , u2 , u3 }, C4 ={u4 , u5 , u6 }. S[a, 1] C5 = {u1 , u4 , u5 }, C6 = {u2 , u5 , u6 }, C7 = {u3 , u6 , u4 }, C8 = {u4 , u1 , u2 }, C9 = {u5 , u2 , u3 }, C10 = {u6 , u3 , u1 } S[a, 2] C11 = {u1 , u4 , u5 }, C12 = {u2 , u5 , u6 }, C13 = {u3 , u6 , u4 }, C14 = {u4 , u1 , u2 }, C15 = {u5 , u2 , u3 }, C16 = {u6 , u3 , u1 }
58
3.2
D. Zhu, S. Ma, and P. Zhang
On the General Case of Max-(k)-Sat
It appears easy to extend the algorithm in section 3.1 to solving Max-Ek-Sat instances. Every clause has at least k(≥ 3) literals in this subsection. To fit for the case that a clause contains more than k literals, we need to modify the algorithms in section 3.1. The modified algorithm employs the same idea as for Max-E3-Sat and is described in figure-5.
Algorithm Max(k)Sat(U, C) (1)
Use local search of flipping one variable to maximize the partly-satisfied clauses. Obtain the assignment a(U ).
(2)
If the full-satisfied clauses are numbered less than the 0-satisfied clauses, then b(U ) ← a(U ). Else b(U ) ← a(U ).
(3)
Return b(U ). Fig. 5. The local search algorithm for Max(k)Sat
We just give a sketch of the performance analysis. Let a(U ) be the assignment of U obtained by the local search step (1). Let S[a, partly] be the set of partly-satisfied clauses, S[a, f ull] be the set of full-satisfied clauses, S[a, j] be defined as before. In comparing in number the partly-satisfied clauses with the 0-satisfied and full-satisfied clauses, the following relation must hold. |S[a, partly]| ≥ 2kmin{|S[a, 0]|, |S[a, f ull]|}
(8)
Moreover, flipping all the variables swaps the clauses in S[a, 0] and S[a, f ull], and keeps the set S[a, partly] unchanged. Consequently, step (2) must increase in number the full satisfied clauses to not less than the unsatisfied clauses, that is |S[b, f ull]| ≥ |S[b, 0]|. This leads to the relation |S[b, partly]| + |S[b, f ull]| ≥ (2k + 1)|S[b, 0]|.
(9)
Thus the algorithm has performance ratio not larger than 2k+2 for general 2k+1 Max-(k)-Sat. We give an example to show that the bound is tight. Let U = {u1 , ..., uk }, C = {C1 , ..., C2k+2 }, where the clauses are listed in table-2. For assigning F to every variable, C1 is unsatisfied and the other 2k + 1 clauses are satisfied. This is a local search solution of Max(k)Sat(U, C). Actually, for k ≥ 4, this instance has an assignment to make all the clauses satisfied. The satisfied and unsatisfied clauses are classified and given in table-2.
Tight Bounds on Local Search to Approximate Max-(k)-Sat
59
Table 2. The instance of Max-(k)-Sat has k variables and 2k + 2 clauses. There are 2k + 1 clauses satisfied by the assignment a(uj ) = F for j, 1 ≤ j ≤ k.
C1 = {u1 , ..., uk }. C2 ={u1 , ..., uk }. C3 = {u1 , u2 , ..., uk }, C4 = {u1 , u2 , u3 , ..., uk }, ..., Ck+2 = {u1 , ..., uk−1 , uk }. S[a, k − 1] Ck+3 = {u1 , u2 , ..., uk }, Ck+4 = {u1 , u2 , u3 , ..., uk },..., C2k+2 = {u1 , ..., uk−1 , uk }. S[a, 0] S[a, k] S[a, 1]
3.3
Local Search for Other Variants
Given a set U of variables, and a set C of clauses with k literals, Not-kSat asks to find the assignment of U to maximize the clauses with k literals assigned neither all true nor all false. In other words, Not-3Sat asks to find the assignment to maximize the 1-satisfied and 2-satisfied clauses. It is NP-Hard definitely[22]. The algorithm Improved-One-Flip(U, C) can be directly used for solving Not3Sat with performance ratio 43 . The problem of Not-2Sat asks to find the assignment of U to maximize the 1-satisfied clauses. This variant of Max-E2-Sat can be shown to be NP-hard by a reduction from Min UnCut[23]. The algorithm Improved-One-Flip(U, C) can also be used to solve Not-2Sat. The algorithm only needs to employ a while circulation of flipping one variable to increase the 1-satisfied clauses. The solution is the assignment, say a(U ), at the end of the while circulation. Using similar analysis as in section 3.1, we can show that the assignment satisfies the performance relation |S[a, 1]| ≥ |S[a, 0]| + |S[a, 2]|. We give the following theorem as a summarization. Theorem 3. The algorithm Improved-One-Flip(U, C) can be used to solve Not2Sat and Not-3Sat to achieve the performance ratio of 2 and 43 respectively.
4
Conclusion
We presented a 4/3-approximation local search algorithm for Max-(2)-Sat, and a 8/7-approximation local search algorithm for Max-(3)-Sat. The first algorithm can be extended to solve Max-(k)-Sat with performance ratio of not larger than k+2 for k ≥ 3. The second algorithm can be extended to solve Max-(k)-Sat with k+1 performance 2k+2 for k ≥ 4. By examples, we can show that the four bounds 2k+1 are all tight. The first bound, 4/3, and the second bound, 8/7, can be unified to 2k for Max-(2)-Sat and Max-(3)-Sat. Here we have two open questions, which 2k −1 look interesting. The first question is whether there is an local search algorithm for Max-3-Sat with performance ratio 8/7. The second question is whether there is a oblivious local search algorithm for Max-(k)-Sat to achieve the performance k ratio 2k2−1 for arbitrary k.
60
D. Zhu, S. Ma, and P. Zhang
Acknowledgements. We are grateful for the reviewer to give us important suggestions. This paper is supported by: (1)PhD station foundation of Chinese Education Department 20090131110009;(2)National natural science foundation of China 61070019.
References 1. Cook, S.A.: The complexity of theorem-proving procedures. In: Proceedings of the 3rd Annual ACM Symposium on Theorey of Computing, Shaker Heights, Ohio,USA, pp. 151–158. ACM, New York (1971) 2. Papadimitriou, C.H., Yanakakis, M.: Optimization, approximation, and complexity classes. Journal of Computer and System Sciences 43(3), 425–440 (1991) 3. Johnson, D.S.: Approximation algorithms for combinatorial problems. Journal of Computer and System Sciences 9(3), 256–278 (1974) 4. Chen, J., Friesen, D., Zheng, H.: Tight bound on Johnson’s algorithm for maximum satisfiability. Journal of Computer and System Sciences 58(3), 622–640 (1999) 5. Yannakakis, M.: On the approximation of maximum satisfiability. Journal of Algorithms 17, 475–502 (1994) 6. Goemans, M.X., Williamson, D.P.: New 3/4-approximation algorithms for the maximum satisfiability problem. Siam Journal on Discrete Mathematics 7(4), 656–666 (1994) 7. Goemans, M.X., Williamson, D.P.: Improved approximation algorithms for maximum cut and satisfiability problems using semi-definite programming. Journal of the ACM 42(6), 1115–1145 (1995) 8. Feige, U., Goemans, M.X.: Approximating the value of two power proof systems, with applications to Max-2Sat and Max-Dicut. In: Proceedings of the 3rd Israel Symposium on Theorey and Computing Systems, Tel Aviv, Israel, pp. 182–189. IEEE, Washington, DC, USA (1995) 9. Trevisan, L., Sorkin, G.B., Sudan, M., Williamson, D.P.: Gadets, approximation, and linear programming. In: Proceedings of the 37th Annual IEEE Symposium on Foundations of Computer Science, Burlington, Vermont, pp. 617–626. IEEE, Washington, DC, USA (1996) 10. Trevisan, L.: Approximating satisfiable satisfiability problems. Algorithmica 28(1), 145–172 (2000) 11. Karloff, H., Zwick, U.: A 7/8-approximation algorithm for Max 3Sat? In: Proceedings of the 38th IEEE Symposium on Foundations of Computer Science, Miami Beach, Florida, pp. 406–415. IEEE, Washington, DC, USA (1997) 12. Halperin, E., Zwick, U.: Approximation algorithms for MAX 4-SAT and rounding procedures for semidefinite programs. Journal of Algorithms 40(2), 184–211 (2001) 13. Hastad, J.: Some optimal inapproximability results. In: Proceedings of the 28th Annual ACM Symposium on Theorey of Computing, El Paso, Texas, pp. 1–10. ACM, New York (1997) 14. Gu, J.: Efficient local search for very large-scale satisfiability problems. ACM SIGART Bulletin 3(1), 8–12 (1992) 15. Selman, B., Levesque, H., Mitchell, D.: A new method for solving hard satisfiability problems. In: Proceedings of the 10th National Conference on Artificial Intelligence, Pasadena, Calefornia, pp. 440–446 (1992) 16. Koutsoupias, E., Papadimitriou, C.H.: On the greedy algorithm for satisfiability. Information Processing Letters 43(1), 53–55 (1992)
Tight Bounds on Local Search to Approximate Max-(k)-Sat
61
17. Hansen, P., Jaumard, B.: Algorithms for the maximum satisfiability problem. Computing 44(4), 279–303 (1990) 18. Mastrolilli, M., Gambardella, L.M.: Max-2-Sat: How good is tabu search in the worst case? In: Proceedings of AAAI, pp. 173–178 (2004) 19. Pankratov, D., Borodin, A.: On the relative merits of simple local search methods for the MAX-SAT problem. In: Strichman, O., Szeider, S. (eds.) SAT 2010. LNCS, vol. 6175, pp. 223–236. Springer, Heidelberg (2010) 20. Hirsch, E.A.: Worst Case Study of Local Search for Max-k-Sat. Discrete Applied Mathematics 130(2), 173–184 (2003) 21. Bulatov, A.A., Skvortsov, E.S.: The Efficiency of local search. In: Biere, A., Gomes, C.P. (eds.) SAT 2006. LNCS, vol. 4121, pp. 297–310. Springer, Heidelberg (2006) 22. Papadimitriou, C.H.: Computational Complexity, pp. 185–188. Addison Wesley, Reading (1994) √ 23. Agarwal, A., Charikar, M., Makarychev, K., Makarychev, Y.: logn algorithm for Min UnCut, Min 2CNF deletion, and directed cut problems. In: Proceeding of STOC 2005, pp. 573–581 (2005)
Parameterized Complexity in Multiple-Interval Graphs: Partition, Separation, Irredundancy Minghui Jiang1, and Yong Zhang2 1
2
Department of Computer Science, Utah State University, Logan, UT 84322, USA
[email protected] Department of Computer Science, Kutztown University of PA, Kutztown, PA 19530, USA
[email protected]
Abstract. We present new results on the parameterized complexities of kV ERTEX C LIQUE PARTITION and k-S EPARATING V ERTICES in multiple-interval graphs and their complements, and present a very simple alternative proof of the W[1]-hardness of k-I RREDUNDANT S ET in general graphs.
1 Introduction First we introduce some basic definitions. Given a family of sets F = {S1 , . . . , Sn }, the intersection graph Ω(F) of F is the graph with F as the vertex set and with two different vertices Si and Sj adjacent if and only if Si ∩ Sj = ∅. We call F a representation of the graph Ω(F ). Let t ≥ 2 be an integer. A t-interval is the union of t disjoint intervals in the real line. A t-track interval is the union of t disjoint intervals on t disjoint parallel lines called tracks, one interval on each track. A t-interval graph (resp. t-track interval graph) is the intersection graph of a family of t-intervals (resp. t-track intervals). Note that the t disjoint tracks for a t-track interval graph can be viewed as t disjoint “host intervals” in the real line for a t-interval graph. Thus t-track interval graphs are a subclass of t-interval graphs. If a t-interval graph (resp. t-track interval graph) has a representation in which all intervals have unit lengths, then the graph is a unit t-interval graph (resp. unit t-track interval graph). If a t-interval graph has a representation in which the t disjoint intervals of each t-interval have the same length (although the intervals from different t-intervals may have different lengths), then the graph is a balanced t-interval graph. Similarly we define balanced t-track interval graphs. Multiple-interval graphs such as t-interval graphs and t-track interval graphs are generalizations of the ubiquitous interval graphs. They have numerous applications, traditionally to scheduling and resource allocation [20,1], and more recently to bioinformatics [4,15]. For this reason, several groups of researchers systematically studied various classical optimization problems in multiple-interval graphs. In terms of approximability, Bar-Yejuda et al. [1] presented a 2t-approximation algorithm for M AXIMUM I NDEPENDENT S ET in t-interval graphs, and Butman et al. [2] presented approximation algorithms for M INIMUM V ERTEX C OVER, M INIMUM D OMINATING S ET , and
Supported in part by NSF grant DBI-0743670.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 62–73, 2011. c Springer-Verlag Berlin Heidelberg 2011
Parameterized Complexity: Partition, Separation, Irredundancy
63
M AXIMUM C LIQUE in t-interval graphs with approximation ratios 2 − 1/t, t2 , and (t2 − t + 1)/2, respectively. Fellows et al. [9] initiated the study of multiple-interval graph problems from the perspective of parameterized complexity. They showed that k-I NDEPENDENT S ET in t-interval graphs is W[1]-hard for any t ≥ 2, then, in sharp contrast, gave an FPT algorithm for k-C LIQUE in t-interval graphs parameterized by both k and t. They also showed that k-D OMINATING S ET in t-interval graphs is W[1]-hard for any t ≥ 2. Recently, Jiang [16] strengthened the two hardness results for t-interval graphs, and showed that k-I NDEPENDENT S ET and k-D OMINATING S ET remain W[1]-hard even in unit t-track interval graphs for any t ≥ 2. At the end of their paper, Fellows et al. [9] listed four problems that are W[1]-hard in general graphs, and suggested that a possibly prosperous direction for extending their work would be to investigate whether these problems become fixed-parameter tractable in multiple-interval graphs. The four problems are k-V ERTEX C LIQUE C OVER, kS EPARATING V ERTICES, k-P ERFECT C ODE, and k-I RREDUNDANT S ET . The problem k-V ERTEX C LIQUE C OVER has a close relative called k-E DGE C LIQUE C OVER. Given a graph G = (V, E) and an integer k, the problem k-V ERTEX C LIQUE C OVER asks whether the vertex set V can be partitioned into k disjoint subsets Vi , 1 ≤ i ≤ k, such that each subset Vi induces a complete subgraph of G, and the problem k-E DGE C LIQUE C OVER asks whether there are k (not necessarily disjoint) subsets Vi of V , 1 ≤ i ≤ k, such that each subset Vi induces a complete subgraph of G and, moreover, for each edge {u, v} ∈ E, there is some Vi that contains both u and v. The two problems k-V ERTEX C LIQUE C OVER and k-E DGE C LIQUE C OVER are also known in the literature as k-C LIQUE PARTITION and k-C LIQUE C OVER, respectively, and are both NP-complete [10, GT15 and GT17]. To avoid possible ambiguity, we will henceforth use the term k-V ERTEX C LIQUE PARTITION instead of k-V ERTEX C LIQUE C OVER or k-C LIQUE PARTITION. Although the two problems k-V ERTEX C LIQUE PARTITION and k-E DGE C LIQUE C OVER are both NP-complete, they have very different parameterized complexities. The problem k-E DGE C LIQUE C OVER is fixed-parameter tractable in general graphs [13]; hence it is also fixed-parameter tractable in multiple-interval graphs and their complements. On the other hand, the problem k-V ERTEX C LIQUE PARTITION in any graph G is the same as the problem k-V ERTEX C OLORING in the complement graph G. It is known that 3-V ERTEX C OLORING of planar graphs of maximum degree 4 is NPhard [12]. It is also known that k-V ERTEX C OLORING in circular-arc graphs is NPhard if k is part of the input [11]. Since graphs of maximum degree 4 are unit 3-track interval graphs [17, Theorem 4], and since circular-arc graphs are obviously 2-track interval graphs (by a simple cutting argument), we immediately have the following easy theorem on the complexity of k-V ERTEX C LIQUE PARTITION in the complements of multiple-interval graphs: Theorem 1. 3-V ERTEX C LIQUE PARTITION in co-unit 3-track interval graphs is NPhard; thus, unless NP = P, k-V ERTEX C LIQUE PARTITION in co-unit 3-track interval graphs does not admit any FPT algorithms with parameter k. Also, k-V ERTEX C LIQUE PARTITION in co-2-track interval graphs is NP-hard if k is part of the input.
64
M. Jiang and Y. Zhang
For the complexity of k-V ERTEX C LIQUE PARTITION in multiple-interval graphs, we obtain the following theorem: Theorem 2. k-V ERTEX C LIQUE PARTITION in unit 2-interval graphs is W[1]-hard with parameter k. Given a graph G = (V, E) and two integers k and l, the problem k-S EPARATING V ERTICES is that of deciding whether there is a partition V = X ∪S ∪Y of the vertices such that |X| = l, |S| ≤ k, and there is no edge between X and Y ? In other words, is it possible to cut l vertices off the graph by deleting k vertices? The problem k-S EPARATING V ERTICES is one of several closely related graph separation problems considered by Marx [19] in terms of parameterized complexity. Marx showed that k-S EPARATING V ERTICES is W[1]-hard in general graphs with two parameters k and l, but is fixed-parameterized tractable with three parameters k, l, and the maximum degree d of the graph. In the following two theorems, we show that with two parameters k and l, k-S EPARATING V ERTICES remains W[1]-hard in multiple-interval graphs and their complements: Theorem 3. k-S EPARATING V ERTICES in balanced 2-track interval graphs is W[1]hard with parameters k and l. Theorem 4. k-S EPARATING V ERTICES in co-balanced 3-track interval graphs is W[1]hard with parameters k and l. The problem k-S EPARATING V ERTICES was studied under the name C UTTING l V ERTICES by Marx [19], who also studied two closely related variants called C UTTING l C ONNECTED V ERTICES and C UTTING INTO l COMPONENTS. In C UTTING l C ON NECTED V ERTICES, the l vertices that are separated from the rest of G must induce a connected subgraph of G. In C UTTING INTO l COMPONENTS, the objective is to delete at most k vertices such that the remaining graph is broken into at least l connected components. Marx showed that C UTTING l C ONNECTED V ERTICES is W[1]-hard when parameterized by either k or l, and is fixed-parameter tractable when parameterized by both k and l. We observe that his W[1]-hardness proof with parameter l involves only line graphs, which are obviously a subclass of unit 2-interval graphs. Marx also showed that C UTTING INTO l COMPONENTS is W[1]-hard when parameterized by both k and l. In the following two theorems, we extend these W[1]-hardness results to multipleinterval graphs and their complements (proofs in appendix): Theorem 5. C UTTING l C ONNECTED V ERTICES in balanced 2-track interval graphs and co-balanced 3-track interval graphs is W[1]-hard with parameter k. Theorem 6. C UTTING INTO l COMPONENTS in balanced 2-track interval graphs and co-balanced 3-track interval graphs is W[1]-hard with parameters k and l. Both k-P ERFECT C ODE and k-I RREDUNDANT S ET are very important problems in the development of parameterized complexity theory. The problem k-P ERFECT C ODE1 1
The problem k-P ERFECT C ODE, also known as k-P ERFECT D OMINATING S ET , is a variant of k-D OMINATING S ET . In a sibling paper [18] that focuses on the parameterized complexities of variants of k-D OMINATING S ET in multiple-interval graphs and their complements, we showed that k-P ERFECT C ODE in unit 2-track interval graphs is W[1]-hard with parameter k.
Parameterized Complexity: Partition, Separation, Irredundancy
65
was shown to be W[1]-hard as early as 1995 [6], but its membership in W[1] was proved much later in 2002 [3]. Indeed this problem was once conjectured by Downey and Fellows [7, p. 487] either to represent an intermediate between W[1] and W[2], or is complete for W[2]. Similarly, the problem k-I RREDUNDANT S ET was shown to be in W[1] in 1992 [5], and was once conjectured as an intermediate between FPT and W[1] before it was finally proved to be W[1]-hard in 2000 [8]: Theorem 7 (Downey, Fellows, and Raman [8]). k-I RREDUNDANT S ET in general graphs is W[1]-hard with parameter k. The celebrated proof of Downey et al. [8] was a major breakthrough in parameterized complexity theory, but it is rather complicated, spanning seven pages. In this paper, we give a very simple alternative proof (less than two pages) of Theorem 7. Our proof is based on an FPT reduction from the W[1]-complete problem k-M ULTICOLORED C LIQUE [9]: Given a graph G and a vertex-coloring κ : V (G) → {1, 2, . . . , k}, decide whether G has a clique of k vertices containing exactly one vertex of each color.
2 Preliminaries For a graph G = (V, E) and a vertex u ∈ V , we define the open neighborhood of u in G as N (u) := {v | {u, v} ∈ E}, and define the closed neighborhood of u in G as N [u] := N (u) ∪ {u}. For a graph G = (V, E) and a subset V ⊆ V of vertices, we define the open neighborhood of V in G as N (V ) := ∪u∈V N (u) and define the closed neighborhood of V in G as N [V ] := ∪u∈V N [u]. An irredundant set in a graph G = (V, E) is a subset V ⊆ V such that each vertex u ∈ V is irredundant, i.e., N [V − {u}] is a proper subset of N [V ]. Equivalently, an irredundant set in a graph G = (V, E) is a subset V ⊆ V such that each vertex u ∈ V has a private neighbor π(u) ∈ V satisfying one of the two following conditions: 1. π(u) is adjacent to u but not to any other vertex v ∈ V . 2. π(u) is u itself, and u is not adjacent to any other vertex v ∈ V . In this case, we say that u is self-private. Note that an independent set is an irredundant set in which every vertex is self-private.
3 Vertex Clique Partition In this section we prove Theorem 2. We show that k-V ERTEX C LIQUE PARTITION in unit 2-interval graphs is W[1]-hard by an FPT reduction from the W[1]-complete problem k-M ULTICOLORED C LIQUE [9]. Let (G, κ) be an instance of k-M ULTICOLORED C LIQUE. We will construct a family F of unit 2-intervals such that G has a clique of k vertices containing exactly one vertex of each color if and only if the vertices of the intersection graph GF of F can be partitioned into k cliques, where k = 3k + 2 k2 . Denote by Cn the cycle graph of n vertices c1 , . . . , cn and n edges ci ci+1 , 1 ≤ i ≤ n − 1, and cn c1 . We first prove the following technical lemma:
66
M. Jiang and Y. Zhang
Lemma 1. For each integer n ≥ 1, the cycle graph C4n+1 satisfies the following properties: 1. The chromatic number of C4n+1 is 3. 2. The chromatic number of the graph obtained from C4n+1 by deleting at least 1 and at most 2n vertices, is 2. 3. In any partition of the vertices of C4n+1 into 3 independent sets, at most one independent set can have size one. 4. The complement graph C4n+1 is a unit 2-interval graph. Moreover, there exists a 2-partition An ∪ B3n+1 of the vertices such that the graph can be represented by one unit interval for each vertex ai ∈ An , 1 ≤ i ≤ n, and two unit intervals for each vertex bj ∈ B3n+1 , 1 ≤ j ≤ 3n + 1. a2
a1
a3
b10
b1
b9
b2
b8
b3 b4
b7 b6
b5
b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 a1 a2 a3 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
Fig. 1. Let a1 . . . an b1 . . . b3n+1 be the 4n + 1 vertices along the circle. Then C4n+1 can be represented by one unit interval for each ai and two unit intervals for each bj in the order b1 . . . b3n+1 a1 . . . an b1 . . . b3n+1 .
Proof. We prove the four properties one by one: 1. C4n+1 is an odd cycle; hence it is not bipartite and has chromatic number at least 3. To achieve the chromatic number 3, we can assign each vertex ci the color 1 if i is odd but not equal to 4n + 1, the color 2 if i is even, and the color 3 if i is equal to 4n + 1. 2. With any vertex deleted from C4n+1 , the resulting graph does not have any cycles and hence is bipartite, with chromatic number at most 2. Note that the number of edges in C4n+1 is 4n + 1, and that each vertex is incident to 2 edges. With at most 2n vertices deleted from C4n+1 , the resulting graph has at least one edge remaining, and hence has chromatic number at least 2.
Parameterized Complexity: Partition, Separation, Irredundancy
67
3. Let I1 ∪ I2 ∪ I3 be any partition of the vertices of C4n+1 into 3 independent sets. Again note that the number of edges in C4n+1 is 4n + 1 ≥ 5, and that each vertex is incident to 2 edges. If both I1 and I2 have size one, then the 2 vertices in I1 ∪ I2 are together incident to at most 4 edges, and there must be at least one edge remaining between two vertices in I3 , which contradicts our assumption that it is an independent set. 4. Consider 4n + 1 vertices spread evenly on a circle of unit perimeter. Connect each vertex to the two farthest vertices by two edges. Then we obtain the cycle graph C4n+1 . The complement graph C4n+1 is clearly a circular-arc graph, i.e., the intersection graph of a set of circular-arcs, where each vertex is represented by an open 2n circular arc of length 4n+1 . Let An be any n consecutive vertices along the circle and let B3n+1 be the remaining 3n+1 vertices. Then the circular-arc representation of C4n+1 can be easily “cut” and “stretched” into a 2-interval representation, with one unit interval for each vertex ai ∈ An , 1 ≤ i ≤ n, and with two unit intervals for each vertex bj ∈ B3n+1 , 1 ≤ j ≤ 3n + 1. We refer to Figure 1 for an example with n = 3. Vertex selection: For each color i, 1 ≤ i ≤ k, let Vi be the set of vertices of color i. Let ni = |Vi |. Construct a graph C4ni +1 on the ni vertices in Vi and 3ni + 1 additional dummy vertices, represented (using Property 4) by one unit interval for each vertex in Vi , and two unit intervals for each dummy vertex. This leaves one free interval for each vertex in Vi . Put these ni free intervals aside, pairwise-disjoint. Thus we have ni unit 2intervals including one unit 2-interval u for each vertex u ∈ Vi , and 3ni +1 additional dummy unit 2-intervals. Edge selection: For each pair of distinct colors i and j, 1 ≤ i < j ≤ k, let Eij be the set of edges uv such that u has color i and v has color j. Let mij = |Eij |. Construct a graph C4mij +1 on mij vertices (one for each edge in Eij ) and 3mij + 1 additional dummy vertices, represented (using Property 4) by one unit interval for each vertex that corresponds to an edge in Eij , and two unit intervals for each dummy vertex. For each edge uv = e ∈ Eij , we construct two unit 2-intervals ue and ve. Let e be the unit interval in the representation of C4mij +1 that corresponds to the edge e. The two unit 2-intervals ue and ve share e as one unit interval, and each of them has one more free interval. Thus we have 2mij unit 2-intervals including two unit 2-intervals ue and ve for each edge uv = e ∈ Eij , and 3mij + 1 additional dummy unit 2-intervals. Validation: For each edge uv = e ∈ Eij , place the free interval of ue to coincide with the free interval of u, and place the free interval of ve to coincide with the free interval of v. Let F be the following family of n + 2m + (3n + 3m + k + k2 ) unit 2-intervals: F = u | u ∈ Vi , 1 ≤ i ≤ k ∪ ue, ve | uv = e ∈ Eij , 1 ≤ i < j ≤ k ∪ DUMMIES, where DUMMIES is the set of i (3ni + 1) + ij (3mij + 1) = 3n + 3m + k + k2 dummy unit 2-intervals. This completes the construction. Lemma 2. G has a k-multicolored clique if and only if GF has a k -vertex clique partition.
68
M. Jiang and Y. Zhang
Proof. We first prove the direct implication. Suppose that G has a k-multicolored clique K. We partition GF into k = 3k + 2 k2 cliques as follows:
– For each color i, 1 ≤ i ≤ k, let Si be the subgraph of GF represented by the 4ni + 1 2-intervals for the ni vertices in Vi and the 3ni + 1 additional dummy vertices. Let ui be the vertex of color i in K. Put the 2-interval ui , together with the 2-intervals ui e for all edges e incident to ui , into one clique. Since Si is isomorphic to C4ni +1 , it follows by Property 2 that the remaining 4ni 2-intervals in Si can be partitioned into two cliques. Thus we have three cliques for each color. – For each pair of distinct colors i and j, 1 ≤ i < j ≤ k, let Sij be the subgraph of GF represented by the 5mij + 1 2-intervals including the two 2-intervals ue and
ve for each edge uv = e ∈ Eij and the 3mij + 1 additional dummy vertices. Let Sij be the graph obtained from Sij by contracting each pair of vertices represented by ue and ve for some edge e (they have the same open neighborhood in Sij ) is isomorphic to C4mij +1 . Let into a single vertex represented by e. Then Sij ui vj = eij be the edge in K such that ui has color i and vj has color j. Excluding
eij , the remaining 4mij 2-intervals in Sij can be partitioned into two cliques by Property 2. Now expand each contracted vertex back into two vertices. The two cliques in Sij remain two cliques in Sij . Thus we have two cliques for each pair of distinct colors.
We next prove the reverse implication. Suppose that GF has a k -vertex clique partition. We will find a k-multicolored clique in G. Define the subgraphs Si , 1 ≤ i ≤ k, and the subgraphs Sij and Sij , 1 ≤ i < j ≤ k, as before. By Property 1, each subgraph Si of GF can be partitioned into 3 but no less than 3 cliques. Define Sij , 1 ≤ i < j ≤ k, as the subgraph of Sij (and of Sij ) induced by the 3mij + 1 dummy vertices. Since Sij can be obtained from C4mij +1 by deleting mij vertices, it follows by Property 2 that Sij can be partitioned into 2 but no less than 2 cliques. Observe that the k subgraphs Si and the k2 subgraphs Sij do not have edges in between. Since k = 3k + 2 k2 , we must partition each subgraph Si into exactly 3 cliques, and partition each subgraph Sij into exactly 2 cliques. The remaining 2-intervals ue and ve for the edges e are then added to these cliques. For each pair of distinct colors i and j, 1 ≤ i < j ≤ k, since Sij is isomorphic to C4mij +1 , it follows by Property 1 that there exists at least one edge uv = e ∈ Eij such that neither ue nor ve is included in the two cliques for Sij . Then ue must be included in one of the three cliques for Si that includes u (and
ve must be included in one of the three cliques for Sj that includes v). Since ue intersects u but not the other 2-intervals in Si , this clique includes only one 2-interval
u from Si . By Property 3, at most one of the three cliques for Si can include only one 2-interval from Si . Now for each color i, 1 ≤ i ≤ k, find the unique vertex ui such that the 2-interval ui appears in a clique without any other 2-intervals from Si . Then the set of k vertices ui corresponds to a k-multicolored clique in G.
4 Separating Vertices In this section we prove Theorems 3 and 4. We use the notation (a, b) to represent a 2-track interval where a and b are intervals on different tracks. We use similar notations for 3-track intervals.
Parameterized Complexity: Partition, Separation, Irredundancy
69
Proof of Theorem 3. Following the approach of Marx [19], we show that k-S EPARATING V ERTICES in balanced 2-track interval graphs is W[1]-hard with parameters k and l by an FPT reduction from k-C LIQUE. Let G = (V, E) be an input instance of k-C LIQUE with n vertices and m edges. We construct a family F of balanced 2-track intervals as shown in Figure 2, and an input instance (GF , k , l ) for k-S EPARATING V ERTICES with k = k and l = 2 k2 . x
track 1
e
u track 2
u1 u2
v ua
v1 v2
vb
Fig. 2. An illustration of the construction of GF in Theorem 3
On track 1 there are m + 1 disjoint intervals. The first interval, labeled by x, has length n; the other m intervals, one for each edge e ∈ E, have length 1. On track 2 there are two rows of intervals. The first row has n disjoint intervals of length n, one for each vertex in V . For a vertex u ∈ V , if the degree of u is a, then there are a disjoint intervals u1 , u2 , . . . , ua of length 1 on the second row, all intersecting with the interval for u in the first row. There are n + 2m balanced 2-track intervals in F . For every vertex u ∈ V , add a 2-track interval (x, u) to F . For every vertex u, since there are a = deg(u) many edges incident to u, fix an one-to-one correspondence between edges incident to u and intervals ui with 1 ≤ i ≤ a. For an edge e = {u, v}, let ui (1 ≤ i ≤ a) and vj (1 ≤ j ≤ b, where b is the degree of v) be the intervals associated with e, add two 2-track intervals (e, ui ) and (e, vj ) to F . From the construction of GF , it is clear that GF has a clique of size n, represented by the set of 2-track intervals {(x, u) | u ∈ V }. For an edge e = {u, v} in G, GF has a path of length three, represented by 2-track intervals (x, u), (e, ui ), (e, vj ), (x, v), with the middle two vertices being degree-two. If there is a k-clique K in G, then we can cut the set ofk vertices in GF represented by {(x, u) | u ∈ K}. By doing this, we separate 2 k2 vertices represented by {(e, u), (e, v) | e ∈ E, e = {u, v}}. For the other direction, suppose k vertices can be deleted from GF such that l vertices are separated from the rest of GF . We partition k deleted vertices into two parts X and Y . Let X be the set of vertices from the clique of size n in GF and Y be the set of degree-two vertices in GF . Assume n > k + 2 k2 , after deleting X the rest of the clique in GF has size greater than l , so the l separated vertices must be degree-two vertices in GF . It is easy to see that by deleting X at most 2 |X| degree-two vertices are separated from the rest of GF , and by deleting Y at most 2 |Y | degree-two vertices are separated from the rest of GF . Thus we have |X| + |Y | = k and 2 |X| + |Y | ≥ 2 k2 . When k ≥ 2, these conditions hold only when |X| = k and 2 |Y | = 0. This implies that the set of k vertices {u | (x, u) ∈ X} induces a clique in G.
70
M. Jiang and Y. Zhang
Proof of Theorem 4. The reduction is also from k-C LIQUE. Given an input instance G = (V, E) with n vertices and m edges for k-C LIQUE, we construct a family F of 3-track intervals as shown in Figure 3. We then show k-C LIQUE reduces to kS EPARATING V ERTICES in GF . vi1
v11 e
vj1
e1
vn1
v12
vj2
vi2
vn2
v13
vi3
vj3
e2 track 1
track 2
vn3 e3
track 3
Fig. 3. An illustration of the construction of GF in Theorem 4. Only the 3-track interval (e1 , e2 , e3 ) corresponding to one edge e is drawn.
Fix an ordering v1 , . . . , vn of the vertices in G. On track k (1 ≤ k ≤ 3), there are n disjoint intervals v1k , . . . , vnk . For every vertex vi ∈ V , add a 3-track interval (vi1 , vi2 , vi3 ) to F . For every edge e = {vi , vj } with i < j, add a 3-track interval (e1 , e2 , e3 ) (see Figure 3) to F , such that e1 intersects with vl1 for all l < i on track 1, e2 intersects with vl2 for all i < l < j on track 2, and e3 intersects with vl3 for all l > j on track 3. The 3-track intervals for edges are pairwise intersecting at both left endpoint on track 1 and right endpoint on track 3. It is clear that GF has a clique of size n, represented by the set of 3-track intervals {(vi1 , vi2 , vi3 ) | vi ∈ G}. For each edge e = {vi , vj } in G, GF has a path of length two, represented by 3-track intervals (vi1 , vi2 , vi3 ), (e1 , e2 , e3 ), (vj1 , vj2 , vj3 ) with the middle vertex (e1 , e2 , e3 ) being degree-two. Set k = k and l = k2 . The rest of the proof is similar to the proof of Theorem 3. For the sake of simple illustration, we did not draw the 3-intervals as balanced 3intervals in Figure 3. Now we show how to transform them into balanced 3-intervals. First make all intervals of the form vik (1 ≤ i ≤ n, 1 ≤ k ≤ 3) unit-length open intervals. On track 1 align them next to each other without any gap between vi1 and 1 vi+1 for all 1 ≤ i < n. Do the same for track 3. But on track 2, align them with a gap 2 of length n between vi2 and vi+1 for all 1 ≤ i < n. Then, for any edge e = {vi , vj } with i < j, we can always use a balanced 3-track interval (e1 , e2 , e3 ) to achieve the same intersecting pattern as shown in Figure 3. In particular, first choose an appropriate length (between n and n2 ) for e2 so that e2 intersects with vl2 for all i < l < j on track 2, then make e1 and e3 the same length by extending e1 to the left and e3 to the right if necessary.
5 Irredundant Set In this section we prove Theorem 7. We show that k-I RREDUNDANT S ET is W[1]-hard by an FPT reduction from the W[1]-complete problem k-M ULTICOLORED C LIQUE [8].
Parameterized Complexity: Partition, Separation, Irredundancy
71
Let (G, κ) be an instance of k-M ULTICOLORED C LIQUE. We will construct a graph G such that G has a clique of k vertices containing exactly one vertexof each color if and only if G has an irredundant set of k vertices, where k = 3k + 5 k2 . Vertex Selection: For each color i, 1 ≤ i ≤ k, the graph G contains a subgraph Gi as the vertex gadget for the color i. Let Vi be the set of vertices in G with color i. For each vertex u ∈ Vi , Gi includes 3 vertices u1 , u2 , u3 forming a 3-clique. The vertices from different 3-cliques in Gi are disjoint. Edge Selection: For each pair of distinct colors i and j, 1 ≤ i < j ≤ k, the graph G contains a subgraph Gij as the edge gadget for the color pair ij. Let Eij be the set of edges uv such that u has color i and v has color j. For each edge e = uv ∈ Eij , Gi includes 5 vertices e1 , e2 , e3 , e4 , e5 forming a 5-clique. The vertices from different 5-cliques in Gij are disjoint. Validation: Each edge gadget Gij is connected to the two vertex gadgets Gi and Gj as follows. For each edge e = uv ∈ Eij , each of the 5 vertices e1 , e2 , e3 , e4 , e5 is connected to each of the 3 vertices u1 , u2 , u3 and to each of the 3 vertices v1 , v2 , v3 . In addition, we connect the edge gadget Gij to each vertex gadget Gz , z ∈ {1, 2, . . . , k} − {i, j}, by adding all possible edges between them. Also, we connect different edge gadgets to each other, and connect different vertex gadgets to each other, by adding all possible edges between them. Lemma 3. G has a clique of k vertices containing exactly one vertex ofeach color if and only if G has an irredundant set of k vertices, where k = 3k + 5 k2 . Proof. We first prove the direct implication. Suppose that G has a clique K of k vertices containing exactly one vertex of each color. Let I be the set of k vertices in G including the 3 vertices u1 , u2 , u3 for each vertex u ∈ V (K) and the 5 vertices e1 , e2 , e3 , e4 , e5 for each edge e ∈ E(K). Observe that I is a clique in G . It follows that I is an independent set hence also an irredundant set in G . We next prove the reverse implication. Suppose that G has an irredundant set I of k vertices. We start with two simple propositions: 1. For each color i, I includes at most 3 vertices in the subgraph Gi . Moreover, if I includes exactly 3 vertices in Gi , then they must be the vertices u1 , u2 , u3 from a 3-clique in Gi corresponding to some vertex u ∈ Vi . 2. For each color pair ij, I includes at most 5 vertices in the subgraph Gij . Moreover, if I includes exactly 5 vertices in Gij , then they must be the vertices e1 , e2 , e3 , e4 , e5 from a 5-clique in Gij corresponding to some edge e ∈ Eij . To prove the first proposition, observe that any two vertices in the same 3-clique in Gi has the same open neighborhood in G . If I includes two or more vertices from the same 3-clique in Gi , then all these vertices must be self-private, and I cannot include any vertex from a different 3-clique in Gi . Suppose that I includes three or more vertices in Gi that are not all from the same 3-clique, then these vertices must come from distinct 3-cliques in Gi . Let α, β, γ be three such vertices. Observe that γ is adjacent to both α and β in Gi . Also observe that the open neighborhood of γ in G is contained in the union of the open neighborhoods of α and β in G . Thus γ cannot have a private neighbor, self-private or not. Similarly for α and β. This contradicts their membership in I.
72
M. Jiang and Y. Zhang
To prove the second proposition, observe that any two vertices in the same 5-clique in Gij has the same open neighborhood in G . If I includes two or more vertices from the same 5-clique in Gij , then all these vertices must be self-private, and I cannot include any vertex from a different 5-clique in Gij . Suppose that I includes five or more vertices in Gij that are not all from the same 5-clique, then these vertices must come from distinct 5-cliques in Gij . Let α, β, γ, μ, ν be five such vertices. These vertices are pairwise adjacent in Gij , so they cannot be self-private. Observe that within the subgraph Gij , the open neighborhood of each of these five vertices is contained in the union of the open neighborhoods of any two of the other four vertices. Also observe that within any gadget subgraph except Gi , Gj , and Gij , any two of these five vertices have the same (empty) open neighborhood. From these observations, it follows that these five vertices must have private neighbors in Gi and Gj . Then, at least three of the five vertices must have private neighbors either all in Gi or all in Gj . Assume without loss of generality that the three vertices α, β, γ have private neighbors in Gi . If any two of the three vertices have the same open neighborhood in Gi , then the two vertices cannot both have private neighbors in Gi . Otherwise, the open neighborhood of any one of the three vertices is contained in the union of the open neighborhoods of the other two, so none of the three vertices can have a private neighbor in Gi . We have reached a contradiction. There are exactly k vertex gadgets and exactly k2 edge gadgets in our construction. Note that k = 3k + 5 k2 . From the two propositions, it follows that I must include exactly 3 vertices u1 , u2 , u3 from each vertex gadget Gi corresponding to a vertex u ∈ Vi , and exactly 5 vertices e1 , e2 , e3 , e4 , e5 from each edge gadget Gij corresponding to an edge e ∈ Eij . Moreover, these k vertices are all self-private, so the irredundant set I is indeed an independent set in G . Then the corresponding k vertices and k2 edges in G must be consistent, forming a multicolored clique with exactly one vertex of each color. Concluding Remark. Although we have managed to devise a simpler proof for the W[1]-hardness of k-I RREDUNDANT S ET in general graphs, we were unable to strengthen this result by proving the W[1]-hardness of k-I RREDUNDANT S ET in tinterval graphs or co-t-interval graphs for any constant t. Both the graph in the previous proof of Downey et al. [8] and the graph in our simpler proof contain very large complete bipartite graphs and complements of complete bipartite graphs. It is known [14] that the interval number of the complete bipartite graph Kn/2,n/2 is n+1 , i.e., 4 n+1 is the smallest number t such that K is a t-interval graph. Therefore, 4 n/2,n/2 unless with new techniques, the existing constructions cannot be directly adapted to prove the W[1]-hardness of k-I RREDUNDANT S ET in t-interval graphs or co-t-interval graphs even if t is a parameter of the problem besides k.
References 1. Bar-Yehuda, R., Halld´orsson, M.M., Naor, J., Shachnai, H., Shapira, I.: Scheduling split intervals. SIAM Journal on Computing 36, 1–15 (2006) 2. Butman, A., Hermelin, D., Lewenstein, M., Rawitz, D.: Optimization problems in multipleinterval graphs. ACM Transactions on Algorithms 6, 40 (2010)
Parameterized Complexity: Partition, Separation, Irredundancy
73
3. Cesati, M.: Perfect Code is W[1]-complete. Information Processing Letters 81, 163–168 (2002) 4. Chen, Z., Fu, B., Jiang, M., Zhu, B.: On recovering syntenic blocks from comparative maps. Journal of Combinatorial Optimization 18, 307–318 (2009) 5. Downey, R.G., Fellows, M.R.: Fixed-parameter tractability and completeness. Congressus Numerantium 87, 161–187 (1992) 6. Downey, R.G., Fellows, M.R.: Fixed-parameter tractability and completeness II: on completeness for W[1]. Theoretical Computer Science 141, 109–131 (1995) 7. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Heidelberg (1999) 8. Downey, R.G., Fellows, M.R., Raman, V.: The complexity of irredundant sets parameterized by size. Discrete Applied Mathematics 100, 155–167 (2000) 9. Fellows, M.R., Hermelin, D., Rosamond, F., Vialette, S.: On the parameterized complexity of multiple-interval graph problems. Theoretical Computer Science 410, 53–61 (2009) 10. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NPCompleteness. W. H. Freeman and Company, New York (1979) 11. Garey, M.R., Johnson, D.S., Miller, G.L., Papadimitriou, C.H.: The complexity of coloring circular arcs and chords. SIAM Journal on Algebraic and Discrete Methods 1, 216–227 (1980) 12. Garey, M.R., Johnson, D.S., Stockmeyer, L.: Some simplified NP-complete graph problems. Theoretical Computer Science 1, 237–267 (1976) 13. Gramm, J., Guo, J., H¨uffner, F., Niedermeier, R.: Data reduction and exact algorithms for clique cover. ACM Journal of Experimental Algorithmics 13, 2.2 (2009) 14. Griggs, J.R.: Extremal values of the interval number of a graph, II. Discrete Mathematics 28, 37–47 (1979) 15. Jiang, M.: Approximation algorithms for predicting RNA secondary structures with arbitrary pseudoknots. IEEE/ACM Transactions on Computational Biology and Bioinformatics 7, 323–332 (2010) 16. Jiang, M.: On the parameterized complexity of some optimization problems related to multiple-interval graphs. Theoretical Computer Science 411, 4253–4262 (2010) 17. Jiang, M.: Recognizing d-interval graphs and d-track interval graphs. In: Lee, D.-T., Chen, D.Z., Ying, S. (eds.) FAW 2010. LNCS, vol. 6213, pp. 160–171. Springer, Heidelberg (2010) 18. Jiang, M., Zhang, Y.: Parameterized complexity in multiple-interval graphs: domination. submitted (2011) 19. Marx, D.: Parameterized graph separation problems. In: Proceedings of the 1st International Workshop on Parameterized and Exact Computation, pp. 71–82 (2004) 20. Roberts, F.S.: Graph Theory and Its Applications to Problems of Society. SIAM, Philadelphia (1987)
Exact Parameterized Multilinear Monomial Counting via k-Layer Subset Convolution and k-Disjoint Sum Dongxiao Yu1 , Yuexuan Wang2 , Qiang-Sheng Hua2,1 , and Francis C.M. Lau1 1
Department of Computer Science, The University of Hong Kong, Pokfulam, Hong Kong, P.R. China 2 Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, 100084, P.R. China {dxyu,fcmlau}@cs.hku.hk, {qshua,wangyuexuan}@tsinghua.edu.cn
Abstract. We present new algorithms for exact multilinear k-monomial counting which is to compute the sum of coefficients of all degree-k multilinear monomials in a given polynomial P over a ring R described by an arithmetic circuit C. If the polynomial can be represented as a product of two polynomials with algorithm can < k,our n degree at most d n ) time, where ↓d = di=0 ni . O∗ omits solve this problem in O∗ ( ↓d a polynomial factor n in n. For the general case, the proposed algorithm ). In both cases, our results are superior to previous takes time O∗ ( ↓k approaches presented in [Koutis, I. and Williams, R.: Limits and applications of group algebras for parameterized problems. ICALP, pages 653-664 (2009)]. We also present a polynomial space algorithm with time bound O∗ (2k nk ). By reducing the #k-path problem and the #m-set kpacking problem to the exact multilinear k-monomial counting problem, we give algorithms for these two problems that match the fastest known results presented in [2].
1
Introduction
The multilinear k-monomial detection problem is a well studied problem from the algorithmic standpoint. A number of its applications in solving combinatorial parameter problems have been presented [12,16,13]. The multilinear k-monomial detection technique has been shown to be superior in solving parameter problems to older approaches such as color coding [1] and divide-and-color [5,11]. In [13], Koutis and Williams studied the technique for solving a related counting problem—exact multilinear k-monomial counting—and showed its power in solving parameter counting problems by reducing the #m-set k-packing problem to this counting problem. With the reduction, they gave a faster algorithm for the #m-set k-packing problem. Definition 1. (Exact multilinear k-monomial counting [13]) Given a (commutative) arithmetic circuit C describing an n-variate polynomial P over a ring R, compute the sum of the coefficients of degree-k multilinear monomials in P . B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 74–85, 2011. c Springer-Verlag Berlin Heidelberg 2011
Exact Parameterized Multilinear Monomial Counting
75
An arithmetic circuit C over a ring R and the set of variables x1 , . . . , xn is a directed acyclic graph. Every node with in-degree zero is called an input gate and is labeled by either a variable xi or an element in R. Every other gate is labeled by either + or ×, for an addition gate or a product gate respectively. The size of the circuit C, denoted by |C|, is defined as the number of gates in C. If there is no confusion, for each operator gate, we call its in-neighbors input gates. As will be shown later in this paper (see Section 5.1), the #k-path problem can be reduced to the multilinear k-monomial counting problem. Hence, the #W [1]-hardness of the #k-path problem with respect to the parameter k [8] implies that it is unlikely that an O(f (k)poly(n)) time algorithm for the exact multilinear k-monomial counting problem can be found. By making use of an algebraic method, Koutis and Williams in [13] gave an algorithm with running time O ∗ (2d nd +nk/2 ) for a special case where the polynomial P is a product of two polynomials P1 , P2 with degrees at most d. Their algorithm performs much worse for the general case, with a time complexity of O∗ (2k nk ). However, some recent results indicate orklund et al. nthat one could do better. For example, Bj¨ in [16] gave an O∗ ( k/2 ) algorithm for the #k-path problem. In this paper, we affirmatively show that an improvement can be achieved, via the following result. Theorem 1. Let P, Q ∈ R[X] be n-variate polynomials over a ring R described by arithmetic circuits and P, Q contain only multilinear monomials of degree at most d. The sum multilinear k-terms in P · Q can be n of coefficients nof all computed in O ∗ ( ↓d ) time, where ↓d = di=0 nd . n For the general case, our algorithm operates in time O∗ ( ↓k ) which is also superior to the result in [13]. Furthermore, based on the novel circuit constructed (see Section 3) which combines the k-layer subset convolution, we can give a polynomial space algorithm with running time O ∗ (2k nk ). The application of the multilinear monomial counting technique has partly been demonstrated in [13]. In this work, we further illustrate the advantages and applicability of this new technique. By reducing the #k-path problem and the #m-set k-packing problem to the multilinear k-monomial counting problem, our new proposed approach can yield parameterized algorithms for these two problems matching the state-of-the-art results in [2]. 1.1
Related Work
In this work, in order to compute faster the sum of coefficients of all degree-k multilinear monomials in the given polynomial, we transform the given polynomial circuit into a new circuit consisting of some novel combinatorial operation gates. The idea of applying combinatorial techniques to algebraic circuits first appeared in a recent paper [14] on designing polynomial space exact algorithms for several combinatorial problems. However, the underlying idea in [14] is to perform some combinatorial operations in a given algebraic framework rather
76
D. Yu et al.
than to intentionally accelerate the computation in a polynomial circuit by introducing some novel gates, such as k-layer subset convolution. The #k-path problem is to count the number of simple paths of length k in a graph G of n vertices V and m edges E. As a generalization of the classical Hamiltonion path problem, the decision version of the k-path problem has been well studied [1,5,11,12,16]. However, for the counting version, existing research is much less extensive possibly because the parameterized problem of counting k-paths appears to be harder than its decision version. The #W [1]hardness was proved by Flum and Grohe in [8], which implies that it is unlikely to find an O(f (k)poly(n)) algorithm for the #k-path problem. Recently, Vassilevska andWilliams [15] have shown that k-edge paths can be counted in time n O∗ (( k2 )! k/2 ). To the best of our knowledge, the fastest known result for #k n path problem was given by Bj¨oklund et al. [2] with running time O∗ ( k/2 ). The situations of set packing problems were similar. Deciding whether a given family of N subsets of an n-element universe contains a k-packing (no two sets in the k sets intersect) is also known to be W [1]-hard [7]. For the m-set kpacking problem where each subset contains exactly m elements, Jia et al. [9] showed that the decision problem is fixed parameter tractable with respect to the total size mk of the packing. Koutis [12] and Chen et al. [5] gave faster algorithms with running time O∗ (cmk ) for some constant c. For the counting m-set k-packing problem, Koutis and Williams [13] gave an algorithm with time complexity O∗ (nmk/2 ) by reducing the problem to the exact multilinear kmonomial counting problem. Based on the inclusion-exclusion principle and the meet-in-the-middle approach, oklund et al. in [2] gave the fastest known result nBj¨ with time complexity O∗ ( mk/2 ).
2
Preliminaries
2.1
Zeta Transform and M¨ obius Inversion
Given a universe set U = {1, 2, . . . , n} and a collection F of subsets of U , let f : F −→ R. The up-zeta transform f ζ ↑ [2] for all X ⊆ U is defined by f ζ ↑ (X) =
f (Y ).
(1)
X⊆Y
The down-zeta transform f ζ ↓ [4] for all X ⊆ U is defined by f ζ ↓ (X) =
f (Y ).
(2)
Y ⊆X
Given the down-zeta transform f ζ ↓ , the original function f may be recovered via the M¨ obius inversion formula f (Y ) =
X⊆Y
(−1)|Y \X| f ζ ↓ (X).
(3)
Exact Parameterized Multilinear Monomial Counting
77
The fast up-zeta transform [2], the fast down-zeta transform [17,10] and the fast M¨ obius inversion [3] are efficient algorithms for computing the up-zeta transform, the down-zeta transform and the M¨ obius inversion respectively. For a collection F of subsets of U , define ↓ F as the set of subsets of U having supersets in F . Based on the “trimmed” fast zeta transform presented in [4][2] which only considers the subsets in ↓ F , the following lemma holds. Lemma 1. There exist algorithms that construct, given G ⊆ 2U and F ⊆ 2U as input, an R-arithmetic circuit with input gates for f : F → R and output gates that evaluate to (1) f ζ ↑ : G → R, with time O∗ (| ↓ F | + |G|); (2) f ζ ↓ : G → R, with time O∗ (|F | + | ↓ G|); 2.2
Subset Convolution
Definition 2 (Subset convolution [3]). Let U be a set of n elements and R be a ring, and let f and g be functions that associate with every subset S ⊆ U an element of the ring R. The operator subset convolution ∗R over R for all S ⊆ U is defined as follows, f (X)g(S \ X). (4) f ∗R g(S) = X⊆S
In [3], the authors presented an algorithm called fast subset convolution to solve the subset convolution problem in O∗ (2n ) time. The whole algorithm can be divided into three parts: First, it calculates the ranked down-zeta transform of f, g defined in the following formula using the fast down-zeta transform independently for k = 0, 1, 2, . . . , n in O∗ (2n ) time. f ζ ↓ (k, X) = f (Y ). (5) Y ⊆X,|Y |=k
Second, it calculates f ζ ↓ gζ ↓ (k, S) defined as below for all k = 0, 1, . . . , n and S ⊆ U . f ζ ↓ gζ ↓ (k, S) =
k
f ζ ↓ (j, S)gζ ↓ (k − j, S).
(6)
j=0
Finally, f ∗R g can be expressed as the M¨obius inversion of f ζ ↓ gζ ↓ . f ∗R g(S) = (−1)|S\X| f ζ ↓ gζ ↓ (|S|, X).
(7)
X⊆S
obius inversion Then f ∗R g can be obtained by taking advantage of the fast M¨ in O∗ (2n ) time. For more details, please refer to [3].
78
3 3.1
D. Yu et al.
Faster Algorithms for Exact Multilinear k-Monomial Counting k-Disjoint Sum
Definition 3. (k-disjoint sum) Given a universe set U and two collections F1 and F2 of subsets of U , α and β are functions defined on F1 and F2 , respectively. The goal is to compute the sum α β of products α(S1 )β(S2 ) over all disjoint pairs of subsets (S1 , S2 ) such that |S1 |+|S2 | = k in the Cartesian product F1 ×F2 . n 2 An obvious way for computing the k-disjoint sum will take [ ↓k ] time in the worst case if we just simply compare each possible pair of sets in F 1 × F2 , where n k n i=0 k . By introducing a new convolution and generalizing the idea in ↓k = [2], we present next a new way to complete the computation efficiently. Let F ⊆ 2U and f : F −→ R. The ranked up-zeta transform f ζ ↑ (t, X) for every t = 0, 1, . . . , n and X ⊆ U is defined by f ζ ↑ (t, X) = f (S). (8) X⊆S,|S|=t
It is easy to see that the ranked up-zeta transform can be computed by performing the fast up-zeta transform independently for every t via setting the function value as 0 for all sets S ∈ F with |S| = t. For two ranked up-zeta transforms αζ ↑ and βζ ↑ , define the convolution αζ ↑ ↑ βζ for all k = 0, 1, . . . , n and X ⊆ U by αζ ↑ βζ ↑ (k, X) =
k
αζ ↑ (k1 , X)βζ ↑ (k − k1 , X).
(9)
k1 =0
Note that the convolution operation is over the rank parameter rather than the subset parameter. n Lemma 2. k-disjoint sum can be computed in O(kn ↓k ) time. Proof. αβ =
[A ∩ B = ∅][|A| + |B| = k]α(A)β(B)
A∈F1 B∈F2
=
(−1)|X| [X ⊆ A ∩ B][|A| + |B| = k]α(A)β(B)
A∈F1 B∈F2 X
=
(−1)|X|
X
=
X
=
[X ⊆ A][X ⊆ B][|A| + |B| = k]α(A)β(B)
A∈F1 B∈F2
(−1)|X|
k
[X ⊆ A][|A| = k1 ]α(A)
k1 =0 A∈F1
[X ⊆ B][|B| = k − k1 ]β(B)
B∈F2
(−1)|X| αζ ↑ βζ ↑ (k, X).
X
(10)
Exact Parameterized Multilinear Monomial Counting
79
The second equation comes from the fact that every nonempty set has exactly the same number of subsets of even size and subsets of odd size. By the above formula, we can evaluate α β by first computing the ranked up-zeta transforms αζ ↑ and βζ ↑ for every t = 0, 1, . . . , k over F1 and F2 , respectively, then taking the convolution (9), and finally evaluating the formula (10). Here we only need to consider the sets X with cardinality at most t for each t ≤ k in the process of computing the ranked up-zeta transforms αζ ↑ and βζ ↑ , since other sets have no supersets with cardinality t in F 1 and F2 .By Lemma 1, nwe n can obtain αζ ↑ and βζ ↑ for all t ≤ k and |X| ≤ t in kt=0 O(n ↓t ) = O(kn ↓k ) by performing the fast up-zeta transform. For the evaluation of formula (9), it takes O(k) time to get the convolution for each X with |X| ≤ k. Since the n number of sets which need to be considered is O( ↓k ), the time spent in this n process is O(k ↓k ). Finally, the time needed in evaluating the formula (10) is n O(n ↓k ) using the fast M¨ obius inversion in a layered manner (see the following Lemma 4). Then we can get our result.
The following special case allows us to present a stronger result for the k-disjoint sum problem. Lemma 3. If for each set in F1 and F2 , |S| ≤ d < k, then k-disjoint sum nS ) time. can be computed in O(dn ↓d Proof. Note that we only need to consider the sets X ⊆ U with cardinality at most d, since other sets have no supersets in F1 and F2 . Based on this fact, we redefine the convolution as follows. αζ ↑ βζ ↑ (k, X) =
d
αζ ↑ (k1 , X)βζ ↑ (k − k1 , X).
k1 =k−d
With this new convolution and the same other operations as in the proof for Lemma 2, we get the result for Lemma 3.
3.2
Algorithms for Exact Multilinear k-Monomial Counting
By observing the process of the fast subset convolution, we have the following Lemma 4. Lemma 4. The subset convolution f ∗R g for all subsets S ⊆ U with |S| ≤ k n k n n ) time, where ↓k = i=0 i . can be computed in O∗ ( ↓k Proof. Clearly, we only need to consider these sets S with |S| ≤ k in F1 and F2 ↓ ↓ under the given condition. First, note that f ζ (t, S), gζ (t, S) for all t ≤ k and n ∗ |S| ≤ k can be obtained in O ( ↓k ) time by Lemma 1. Based on this, for all n t ≤ k and |S| ≤ k, f ζ ↓ gζ ↓ (t, S) can be computed in O(k ↓k ) time. Then as shown in [3], we can perform the fast subset convolution in a layered manner, i.e., computing f ∗R g(S) for all sets S with |S| = i in the ith-layer using the fast M¨ obius inversion. It is easy to get that the time needed in the ith-layer is
O ∗ ( ni ). Then we get our result.
80
D. Yu et al.
Note that, in the following sections, we call the subset convolution which only computes the values for S ⊆ U with |S| ≤ k a k-layer subset convolution. As an extension, we consider the subset convolution for more than two func tions. For each S ⊆ U , let f1 ∗R · · · ∗R fm (S) = ∪m Si =S, m Si =|S| f1 (S1 ) · · · i=1 i=1 fm (Sm ), where {fi } are functions defined on 2U . Clearly, this can be computed by performing O(log k) fast subset convolutions. We can get a similar result to Lemma 4 for this generalized subset convolution with the same time complexity. In the following, we will not distinguish these two kinds of subset convolutions. For sets A and B, the set A[B] is the set of all functions f : B → A. Let U be a set of elements. Define Uk as the collection of all subsets of U with cardinality at most k. We denote ⊕ as the addition m over R[Uk ], i.e., for any fi ∈ R[Uk ], i = 1, . . . , m, ⊕ computes the sum i=1 fi , where R is the ring. In addition, we still denote the operator k-layer subset convolution over R as ∗R . A circuit C over (R[Uk ], ⊕, ∗R ) means that each operator gate in C is either an addition gate or a k-layer subset convolution gate over R[Uk ]. For sets A and B such that A has a 0 element, a singleton is an element f of A[B] such that f (x) = 0 for each element x ∈ B and x = b ∈ B. In the following, we will first present a new enumeration based algorithm for the exact multilinear k-monomial counting problem, and then we will give the proof for Theorem 1. Lemma 5. Let P (x1 , . . . , xn ) be a commutative polynomial with coefficients from R, given by an arithmetic circuit C. The sum n of coefficients of all multilinear k-terms in P can be computed in time O∗ ( ↓k |C|). Proof. First we replace each variable xi with a unique element ui . Denote the set of elements as U = {u1 , u2 , . . . , un }. Also denote Uk as the collection of all subsets of U with cardinality at most k. We prove the lemma by constructing a new circuit C over (R[Uk ], ⊕, ∗R) based on C. Then we prove that the new circuit C can correctly output n the coefficients of all the multilinear terms of degree at most k in P in O∗ ( ↓k |C|) time. The sum can be obtained by adding up the coefficients of all the multilinear k-terms in P . The new circuit C is constructed as follows: (i) For each input gate xi , i = 1, 2, . . . , n, adapt it for inputting a singleton fi ∈ R[Uk ] whose value is 1 for {ui } and 0 for other elements in Uk ; For each input gate outputting a constant number c, adapt it for inputting a singleton fi ∈ R[Uk ] whose value is c for ∅ and 0 for other elements in Uk . (ii) For each addition gate, replace it with an addition gate ⊕ defined on R[Uk ]. (iii) For each product gate, replace it with a k-layer subset convolution gate ∗R . The output value for each set S = {ui1 , . . . , uit } in Uk is the coefficient of its corresponding multilinear monomial xi1 · · · xit . We claim that C will correctly output coefficients of all multilinear monomials with degree at most k. This can be proved by showing that for each gate φ in C and its corresponding gate σ
Exact Parameterized Multilinear Monomial Counting
81
in C, the value for each set S = {ui1 , . . . , uit } ∈ Uk outputted by φ equals the coefficient of the multilinear monomial xi1 . . . xit in the polynomial generated by σ. It is unnecessary here to consider the non-multilinear monomials since the non-multilinear monomials generated by each gate will only lead to nonmultilinear monomials in the rest of the computation. Now, we assign each gate of C a unique integer from [1, |C|] such that for gates i and j, if i < j, there exists no directed edge from j to i, and each input gate will be assigned an integer less than that of any operator gate. Since the circuit is an acyclic graph, such an ordering exists. In the following we will use the assigned number to denote the corresponding gate. We prove our claim by induction according to the ordering. First for input gates, the claim is true according to the definition of the new input gates. Then for any addition gate λ in C , since the number assigned to each of its input gates is smaller than λ, by assumption, each of its input gates outputs the value for each set S = {ui1 , . . . , uit } ∈ Uk that is equal to the coefficient of the multilinear monomial xi1 · · · xit in the polynomial generated by the corresponding gate in C. Since the coefficient of each multilinear monomial xi1 · · · xit is obtained by summing up the coefficients of the same multilinear monomials in the inputting polynomials, by the definition of our new addition gate, the claim is true for λ. Finally, for any k-layer subset convolution gate ϑ in C and its corresponding product gate ϑ× in C, assume that the input gates of ϑ are ϑ1 , . . . , ϑm and the × corresponding input gates of ϑ× in C are ϑ× 1 , . . . , ϑm . Let fi be the function on Uk outputted by ϑi and Pi be the polynomial outputted by ϑ× i , 1 ≤ i ≤ m. Denote the coefficient of the multilinear monomial Y = xj1 · · · xjp in the polynomial generated by ϑ× as c(Y ) and denote the coefficient of Y in Pi as ci (Y ). Surely, Y can be a constant. Then for each multilinear monomial xi1 · · · xit , where t ≤ k, we have m c(xi1 · · · xit ) = Πi=1 ci (Yi ). (11) m Y =x ···x Πi=1 i i1 it
Since the number assigned to each of ϑ’s input gates is smaller than ϑ, by assumption, for each multilinear monomial Y = xj1 · · · xjp , ci (Y ) = fi (SY ), where p ≤ k and SY is the corresponding element set {uj1 , . . . ujp } of Y . Then c(xi1 · · · xit ) =
∪m i=1 Si ={ui1 ,...,uit },
m
i=1
m Πi=1 fi (Si ) |Si |=|S|
(12)
= f1 ∗R · · · ∗R fm ({ui1 , . . . uit }). Thus the subset convolution value for each set S = {ui1 . . . uit } computed by the k-layer subset convolution gate ϑ is equal to the coefficient of the multilinear monomial xi1 . . . xit computed by ϑ× . The claim is also true for the k-layer subset convolution gates. Hence, C will correctly output the coefficients of all multilinear monomials with degree at most k. As for the time complexity, first, the operations in each addition gate of C can n be done in time O( ↓k ); second, by Lemma 4, each k-layer subset convolution
82
D. Yu et al.
n ). Thus, the total time needed is gate can finish the computation in O∗ ( ↓k n n ∗ O∗ ( ↓k |C |) = O ( ↓k |C|).
Proof. (The Proof for our main result-Theorem 1) From the proof of Lemma 5, for both P and Q, we can construct circuits CP and CQ over (R[Ud ], ⊕, ∗R ) which output values for each set S = {ui1 , . . . , uit } equaling to the coefficients of the corresponding multilinear monomial n xi1 · · · xit in P and Q, respectively. By Lemma 5, this can be done in O∗ ( ↓d ) time. Let fP (S) and fQ (S) be the values for S outputted by P and Q, respectively. For each multilinear monomial Y = xj1 · · · xjp , we denote the coefficient of Y in P · Q as c(Y ), and denote the coefficients of Y in P and Q as cP (Y ) and cQ (Y ), respectively. Then for the multilinear monomial xi1 · · · xik , cP (Y1 ) · cQ (Y2 ). (13) c(xi1 · · · xik ) = Y1 ·Y2 =xi1 ···xik
We know that cP (Y1 ) = fP (SY1 ) and cQ (Y2 ) = fQ (SY2 ), where SYi is the corresponding element set of Yi , i = 1, 2. Then fP (S1 ) · fQ (S2 ). (14) c(xi1 · · · xik ) = S1 ∪S2 ={ui1 ,...uik },S1 ∩S2 =∅
Thus the sum c of coefficients of all multilinear k-monomials in P · Q is c= c(xi1 · · · xik ) = fP (S1 ) · fQ (S2 ) = fP fQ . (15) |S1 |+|S2 |=k,S1 ∩S2 =∅
Then by Lemma 3 and making use of the algorithm for computing the kdisjoint sum, the of coefficients of all multilinear k-terms in P · Q can be nsum ) time. Thus we obtain Theorem 1.
obtained in O∗ ( ↓d
4
A Polynomial Space Algorithm for Exact Multilinear k-Monomial Counting
In this section, we consider a polynomial space algorithm for exact multilinear k-monomial counting based on the circuit constructed in the proof of Lemma 5. The following Lemma 6 is proved in [14]. Lemma 6. (Theorem 5.1 in [14]) Let V be a set, and let C be a circuit over (R[2V ], ⊕, ∗R). Suppose C outputs f , all its inputs are singletons, and m is an integer such that f (V ) ≤ m. Then, given C and m, f (V ) can be computed using O∗ (2|V | ) time and O(|V ||C| log m) space. Theorem 2. Let P (x1 , . . . , xn ) be a commutative polynomial with coefficients from R, given by an arithmetic circuit C. The sum of coefficients of all multilinear k-terms in P can be computed in O∗ (2k nk ) time and polynomial space.
Exact Parameterized Multilinear Monomial Counting
83
Proof. As was done in Lemma 5, we associate each variable xi with a unique element ui and denote the set of elements as U . Then it is easy to find the sub circuit C for computing the polynomial P = P (x1 , . . . , xk , 0, . . . , 0). Let U be the set {u1 , u2 , . . . , uk }. Then by Lemma 5, we can construct a new circuit C based on C over (R[2U ], ⊕, ∗R ) with inputs being singletons, and the output is a function on 2U whose values correspond to the coefficients of all multilinear monomial in P . By Lemma 6, the coefficient of x1 · · · xk can be computed in O∗ (2k ) time and polynomial space. Similarly, we can compute the coefficients of other multilinear k-terms in P . Thus we get the result.
5
Applications
In this section, we show how the multilinear monomial counting technique presented in Theorem 1 can be applied to solving parameter counting problems. In particular, in Sections 5.1 and 5.2, we show that the multilinear monomial counting technique can be used to solve the #k-path and the #m-set k-packing problems with time complexities that match the state-of-the-art known results. 5.1
#k-Path
Definition 4. (#k-path) Given an n-vertices undirected graph G, the #k-path problem is to count the number of simple paths of length k in G. Theorem n 3. The number of k-paths in an n-vertices graph G can be obtained in O∗ ( k/2 ) time. Proof. Let A be the adjacency matrix of G, and let x1 , . . . , xn be variables. De→ − → fine a matrix B[i, j] = A[i, j]xi . Let 1 be the row n-vector of all 1s, and − x → − be the column vector defined by x [i] = xi . Define the k-walk polynomial to be → − → Pk (x1 , . . . , xn ) = 1 ·B k−1 · − x . This polynomial is given in [16] for solving the decision version of the k-path problem. Clearly, Pk is the sum of k-monomials representing the k-walks in G and only simple k-paths in G correspond to multilinear k-monomials. Note that each path corresponds to two multilinear k-monomials in Pk that are the same. Then the number of k-paths in G can be obtained by dividing the sum of coefficients of multilinear k-terms in Pk (x1 , . . . , xn ) by 2. In the following, we assume that k is even in order to make the analysis → − − → − → → simpler. Let P = 1 · B k/2 and Q = B k−k/2−1 · − x . It is easy to know that P → − − → is a row n−vector and Q is a column n-vector. Clearly, P · Q = Pk (x1 , . . . , xn ). → − → − Assume that P = (P1 . . . Pk ) and Q = (Q1 . . . Qk )T , where Pi and Qi are n-variate polynomials with degree at most k2 . Then Pk = P1 · Q1 + . . . + Pn Qn . → − → − Observe that both P and Q can be implemented by circuits of size O(k(m + → − → − n)). Assume that CP and CQ are the circuits for P and Q . It is quite easy to find the sub-circuits CP and CQ for computing P1 and Q1 . Then by Theorem 1, the sum of coefficients of all multilinear k-terms in Pi Qi can be obtained n in O∗ ( k/2 ) time. Similarly, we can get the sum of coefficients of multilinear k-terms in Pi Qi , 1 ≤ i ≤ n. Finally, by summing up the values in the above
84
D. Yu et al.
step for all Pi Qi , we can get the sum of coefficients of multilinear k-terms in Pk which canbe used to get the number of k-paths in G, and the total time needed n is O∗ ( k/2 ).
5.2
#m-Set k-Packing
Definition 5. (#m-set k-packing) Given a collection F of N sets, each containing m elements from a universe U of n elements, the #m-set k-packing is to count the number of collections F ⊆ F such that F is composed by k mutually disjoint sets. n Theorem 4. The number of m-set k-packings can be counted in O∗ (N mk/2 ) time. Proof. We will apply the polynomial presented in [12] for solving the decision version of the m-set k-packing problem which is constructed as follows: (i) assign variables X = {xi }, i = 1, 2, . . . , n to elements of U ; (ii) assign to the set Si ∈ F a degree m set-monomial Yi , defined as the product of thek variables corresponding to the elements of Si . Then define Pk = ( N i=1 Yi ) . Clearly, in Pk , each monomial Yi1 Yi2 · · · Yik represents a k−tuple of sets < Si1 , Si2 , · · · , Sik > and only those k−tuples whose sets compose a m−set k−packing are represented by multilinear mk−monomials. Note that each m-set k-packing corresponds to k! multilinear mk-monomials in Pk that are the same. Then the number of m-set k-packings can be obtained by dividing the sum of coefficients of all multilinear mk-terms in Pk by k!. In the following, for convenience, we assume that mk is even. The analysis is similar. N for odd numbers N Let P = ( i=1 Yi )k/2 and Q = ( i=1 Yi )k/2 . Clearly, the degrees of P, Q are at most mk 2 and Pk = P ·Q. Then P and Q can be implemented by circuits of size O(N ). By Theorem 1, the sum of multilinear mk-terms in Pk can be computed n in O∗ (N mk/2 ) time. Then the result is proved.
6
Conclusions
In this paper, by using a novel circuit design that utilizes k-layer subset convolution and by using the presented fast algorithm for k-disjoint sum, we have proposed new algorithms for the exact multiliner k-monomial counting problem, which can also be used to solve a variety of parameter counting problems. For this basic parameterized monomial counting problem, our results are superior to previous results given in [13]. Also, by reducing the #k-path problem and the #m-set k-packing problem to the exact multilinear k-monomial counting problem, we give algorithms that match the fastest known results presented in [2]. More importantly, as long as we can design an appropriate polynomial, our technique can be used to tackle a large collection of other parameter counting problems, such as the #k-tree problem and its directed counterpart the #k-vertex out-tree problem. For future work, one natural idea is to extend Theorem 1 to the case where the polynomial is the product of more than two lower degree polynomials. In
Exact Parameterized Multilinear Monomial Counting
85
addition, the following question is still open: Is there an algorithm for multilinear k-monomial counting that can break the nk barrier for general circuits? A number of counting problems will benefit from such an algorithm. Acknowledgements. This work was supported in part by Hong Kong RGCGRF grant 714009E, HKU Small Project Funding 21476015.47932.14200.420. 01, the National Basic Research Program of China Grant 2007CB807900, 2007CB807901, the National Natural Science Foundation of China Grant 61073174, 61033001, 61061130540, and the Hi-Tech research and Development Program of China Grant 2006AA10Z216.
References 1. Alon, N., Yuster, R., Zwick, U.: Color coding. Journal of the ACM 42(4), 844–856 (1995) 2. Bj¨ orklund, A., Husfeldt, T., Kaski, P., Koivisto, M.: Counting paths and packings in halves. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 578–586. Springer, Heidelberg (2009) 3. Bj¨ orklund, A., Husfeldt, T., Kaski, P., Koivisto, M.: Fourier meets m¨ obius: fast subset convolution. In: STOC, pp. 67–74 (2007) 4. Bj¨ orklund, A., Husfeldt, T., Kaski, P., Koivisto, M.: Trimmed moebius inversion and graphs of bounded degree. Theory Comput. Syst. 47(3), 637–654 (2010) 5. Chen, J., Lu, S., Sze, S.-H., Zhang, F.: Improved algorithms for path, matching, and packing problems. In: SODA, pp. 298–307 (2007) 6. Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. J. Symbolic Computation 9(3), 251–280 (1990) 7. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Berlin (1999) 8. Flum, J., Grohe, M.: The parameterized complexity of counting problems. SIAM J. Comput. 33, 892–922 (2004) 9. Jia, W., Zhang, C., Chen, J.: An efficient parameterized algorithm for m-set packing. J. Algorithms 50, 106–117 (2004) 10. Kennes, R.: Computational aspects of the Moebius transform of a graph. IEEE Transactions on Systems, Man, and Cybernetics 22, 201–223 (1991) 11. Kneis, J., M¨ olle, D., Richter, S., Rossmanith, P.: Divide-and-color. In: Fomin, F.V. (ed.) WG 2006. LNCS, vol. 4271, pp. 58–67. Springer, Heidelberg (2006) 12. Koutis, I.: Faster algebraic algorithms for path and packing problems. In: ICALP, pp. 575–586 (2009) 13. Koutis, I., Williams, R.: Limits and applications of group algebras for parameterized problems. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5555, pp. 653–664. Springer, Heidelberg (2009) 14. Lokshtanov, D., Nederlof, J.: Saving space by algebraization. In: STOC, pp. 321– 330 (2010) 15. Vassilevska, V., Williams, R.: Finding, minimizing, and counting weighted subgraphs. In: STOC, pp. 455–464 (2009) 16. Williams, R.: Finding paths of length k in O∗ (2k ) time. Inf. Process. Lett. 109(6), 315–318 (2009) 17. Yates, F.: The design and analysis of factorial experiments, Technical Communication No. 35, Commonwealth Bureau of Soil Science, Harpenden, UK (1937)
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms Kei Uchizawa, Takanori Aoki, Takehiro Ito, Akira Suzuki, and Xiao Zhou Graduate School of Information Sciences, Tohoku University, Aoba-yama 6-6-05, Sendai, 980-8579, Japan {uchizawa,takanori,takehiro,a.suzuki,zhou}@ecei.tohoku.ac.jp
Abstract. For a graph G = (V, E) and a color set C, let f : E → C be an edge-coloring of G which is not necessarily proper. Then, the graph G edge-colored by f is rainbow connected if every two vertices of G has a path in which all edges are assigned distinct colors. Chakraborty et al. defined the problem of determining whether the graph colored by a given edge-coloring is rainbow connected. Chen et al. introduced the vertex-coloring version of the problem as a variant, and we introduce the total-coloring version in this paper. We settle the precise computational complexities of all the three problems from two viewpoints, namely, graph diameters and certain graph classes. We also give FPT algorithms for the three problems on general graphs when parameterized by the number of colors in C; these results imply that all the three problems can be solved in polynomial time for any graph with n vertices if |C| = O(log n).
1
Introduction
Graph connectivity is one of the most fundamental graph-theoretic properties. In the literature, several measures for graph connectivity have been studied, such as requiring hamiltonicity, edge-disjoint spanning trees, or edge- or vertexcuts of sufficiently large size. Recently, there has been quite some interest in studying problems on colored graphs, due to their applications in areas such as computational biology, transportation and telecommunications [7]. In this paper, we study a new interesting concept of graph connectivity, called the rainbow connectivity, which was introduced by Chartrand et al. [3]. Let G = (V, E) be a graph with vertex set V and edge set E. We often denote by V (G) the vertex set of G and by E(G) the edge set of G. For a set C of colors, consider a mapping f : E → C, called an edge-coloring of G, which is not necessarily a proper edge-coloring. We denote by G(f ) the graph G edge-colored by f . Then, a path P in G(f ) connecting two vertices u and v in V is called a rainbow path between u and v if all edges of P are assigned distinct colors by f . Clearly, each edge (u, v) in G(f ) is a rainbow path between u and v. The edgecolored graph G(f ) is rainbow connected if G(f ) has a rainbow path between every two vertices in V ; such an edge-coloring f is called a rainbow edge-coloring
This work is partially supported by Grant-in-Aid for Young Scientists (B) 22700001.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 86–97, 2011. c Springer-Verlag Berlin Heidelberg 2011
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
c1
c2 c4
c2
c1
c1
c3
c2
c3 c2
c4
c4 c2
c1
c3
c3
c2 c5
c2
c1
(b)
(a)
c2 c3
c4 c3
c4
c1 c5
c2
c1
c3
c4
87
c3
(c)
Fig. 1. (a) A rainbow connected graph, (b) a rainbow vertex-connected graph, and (c) a rainbow total-connected graph
of G. Note that these rainbow paths are not necessarily edge-disjoint for pairs of vertices. For a given edge-coloring f of a graph G, the rainbow connectivity problem is to determine whether G(f ) is rainbow connected. For example, the edge-colored graph G(f ) in Fig.1(a) is rainbow connected. The concept of rainbow connectivity has been studied extensively in recent literature [2,3,4,6,9]. Chartrand et al. [3] originally introduced the problem of finding a rainbow edge-coloring of a given graph with the minimum number of colors. Chakraborty et al. [2] showed that this minimization problem is NP-hard, and that certain classes of graphs have constant upper bounds on the minimum number of colors. They defined rainbow connectivity in [2], and showed that the problem is strongly NP-complete. On the other hand, Chen et al. [5] introduced the vertex-coloring version of rainbow connectivity: a vertexcolored graph is rainbow vertex-connected if the graph has a path between every two vertices whose internal vertices are assigned distinct colors. (See Fig.1(b) as an example; a formal definition will be given in Section 3.) This variant is also known to be strongly NP-complete [5]. However, these complexity analyses are simply for general graphs, and hence it has been desired to clarify the complexity statuses more precisely. Moreover, any algorithm has not been obtained for the problems yet. In this paper, we introduce another variant, namely, the total-coloring version, and give precise complexity analyses for all the three problems from two Table 1. Summary of our results from the viewpoint of diameters, where “strong NPC” means “strong NP-completeness” Diameter 1
2
≥3
P [Theorem 2]
strong NPC [Theorem 2]
strong NPC
vertex
P [Theorem 4]
P [Theorem 4]
strong NPC [Theorem 4]
total
P [Theorem 7]
strong NPC [Theorem 7]
strong NPC
edge
88
K. Uchizawa et al.
Table 2. Summary of known and our results from the viewpoint of graph classes Graph class cacti edge
vertex
total
outerplanar
series-parallel
general
P [Theorem 3]
strong NPC [Theorem 1]
strong NPC
strong NPC [2]; FPT algorithm [Theorem 10]
P
P [Theorem 6]
strong NPC [Theorem 5]
strong NPC [5]; FPT algorithm [Theorem 11]
P [Theorem 9]
strong NPC [Theorem 8]
strong NPC
strong NPC; FPT algorithm [Theorem 12]
viewpoints: one is from the viewpoint of graph diameters, and the other is from the viewpoint of certain graph classes. (As in Fig.1(c), a “total-coloring” of a graph G is to assign colors to both the vertices and the edges of G; a formal definition will be given in Section 3.) From the viewpoint of diameters, we give dichotomy results for the three problems, as shown in Table 1, where the diameter of a graph G is the maximum number of edges in a shortest path between any two vertices in G. On the other hand, Table 2 summarizes known and our results from the viewpoint of graph classes. Our analyses clarify the boundaries on graph classes between tractability and strong NP-completeness: cacti form a graph class which is a subclass of outerplanar graphs, while outerplanar graphs form a graph class which is a subclass of series-parallel graphs; but, all these graphs are of treewidth two [1], and hence they are very close to each other. We remark that the strongly NP-complete proofs in [2] and [5] do not imply our results. We also give FPT algorithms for the three problems on general graphs when parameterized by the number of colors in C. For the parameter k = |C|, the algorithms run in O(k2k mn) time using O(k2k n) space, where n and m are the numbers of vertices and edges in a graph, respectively. Therefore, all the problems can be solved in polynomial time for general graphs if k = O(log n).
2
Complexity for Edge-Coloring Version
In this section, we precisely analyze complexity statuses of rainbow connectivity. In Section 2.1, we show that the problem is strongly NP-complete even for outerplanar graphs and also for graphs of diameter 2. In contrast, we show in Section 2.2 that the problem is solvable in polynomial time for cacti. 2.1
Strong NP-Completeness for Outerplanar Graphs
A graph G is outerplanar if it has a planar embedding such that all vertices of G are on the outer face of the embedding [1]. The main result of this subsection is the following theorem.
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
89
Theorem 1. Rainbow connectivity is strongly NP-complete even for outerplanar graphs. One can easily observe that rainbow connectivity is in NP. Therefore, we give a polynomial-time reduction from the 3-occurrence 3SAT problem [8] to our problem for outerplanar graphs. Given a 3CNF formula φ such that each variable appears at most three times in φ, the 3-occurrence 3SAT problem is to determine whether φ is satisfiable. This problem is known to be strongly NP-complete [8]. In what follows, we construct an outerplanar graph Gφ and an edge-coloring fφ of Gφ , as a corresponding instance, and prove that φ is satisfiable if and only if the edge-colored graph Gφ (fφ ) is rainbow connected. Suppose that the formula φ consists of n variables x1 , x2 , . . . , xn and m clauses C1 , C2 , . . . , Cm . [Graph Gφ ] We first make a variable gadget Xi for each variable xi , 1 ≤ i ≤ n, and a clause gadget Gj for each clause Cj , 1 ≤ j ≤ m. The variable gadget Xi for a variable xi is a cycle with a plane embedding which consists of six vertices ai , ui , vi , bi , v¯i , u ¯i labeled in clockwise order. (See Fig.2(a).) The clause gadget Gj for a clause Cj is defined as follows: first make a cycle with a plane embedding which consists of ten vertices pj , rj,1 , rj,2 , rj,3 , qj , qj , rj,3 , rj,2 , rj,1 , pj labeled in clockwise order, and then connect rj,1 to rj,1 , rj,2 to rj,2 , and rj,3 to rj,3 ; these three edges correspond to the three literals in Cj . (See Fig.2(b).) We now construct the graph Gφ corresponding to the formula φ, as follows. (See also Fig.3.) We first add to the graph all gadgets X1 , X2 , . . . , Xn and G1 , G2 , . . . , Gm together with new m + 1 vertices s1 , s2 , . . . , sm and t. We connect bi to ai+1 for every i, 1 ≤ i ≤ n − 1, and connect bn to p1 . For the sake of convenience, the vertex a1 is sometimes referred as sm+1 , and the vertex t as pm+1 . Then, for every j, 1 ≤ j ≤ m, we connect sj to sj+1 , and connect qj to pj+1 . This completes the construction of the corresponding graph Gφ . Clearly, Gφ is outerplanar.
ui
c i,2
vi
c i,1 ai
bi
c i,1 ui
c i,3 c i,2 (a) Xi
vi
rj,2
rj,1
c i,3 pj c'j
r'j,1
qj c5,2
c3,2
c2,1 p'j
rj,3
r'j,2
cj q'j
r'j,3
(b) Gj
Fig. 2. (a) Variable gadget Xi for a variable xi , and (b) clause gadget Gj for the clause Cj = (¯ x 2 ∨ x3 ∨ x ¯5 ), where x ¯2 is the first literal and both x3 and x ¯5 are the second literals in φ
90
K. Uchizawa et al.
Fig. 3. Graph Gφ
Before constructing the corresponding edge-coloring fφ of Gφ , we introduce some terms. For each variable gadget Xi , 1 ≤ i ≤ n, we call the path ai ui vi bi in Xi the i-th positive path, and call the path ai u ¯i v¯i bi in Xi the i-th negative path. In our reduction, the i-th positive path corresponds to xi = 1 and the i-th negative path corresponds to xi = 0. We denote the given formula by φ = ∧m j=1 (lj,1 ∨lj,2 ∨lj,3 ), where lj,1 , lj,2 and lj,3 are literals of x1 , x2 , . . . , xn contained in the j-th clause Cj . Remember that each variable xi , 1 ≤ i ≤ n, appears at most three times in φ. If a variable xi appears in clauses Cj1 , Cj2 and Cj3 with 1 ≤ j1 ≤ j2 ≤ j3 ≤ m, we call the literal of xi in Cj1 the first literal of xi , the literal of xi in Cj2 the second literal of xi , and the literal of xi in Cj3 the third literal of xi . If a clause has two or three literals of a same variable, the tie is broken arbitrarily. [Edge-coloring fφ of Gφ ] We now construct the corresponding edge-coloring fφ of Gφ so that the edgecolored graph Gφ (fφ ) satisfies the following conditions (A) and (B): (A) Gφ (fφ ) is rainbow connected if and only if Gφ (fφ ) has a rainbow path between s1 and t; and (B) Gφ (fφ ) has a rainbow path between s1 and t if and only if φ is satisfiable. Due to the page limitation, we only show the construction of fφ . We first explain our idea from the viewpoint of colors. In the edge-coloring fφ , each color is assigned to at most two edges. Each color cj , 1 ≤ j ≤ m, is assigned to the two edges (sj , sj+1 ) and (qj , qj ), while a new color cj is assigned to the two edges (pj , pj ) and (qj , pj+1 ), as illustrated in Fig.3. Since the edges (sj , sj+1 ) and (qj , pj+1 ), 1 ≤ j ≤ m, are cut-edges, such color assignments enforce that any rainbow path in Gφ (fφ ) between s1 and t must pass through at least one of the edges (rj,1 , rj,1 ), (rj,2 , rj,2 ) and (rj,3 , rj,3 ) in each clause gadget Gj , 1 ≤ j ≤ m. (Remember that these three edges correspond to the literals in the clause Cj .) On the other hand, each edge in the variable gadgets Xi , 1 ≤ i ≤ n, receives a distinct color; if a literal of xi is in a clause Cj , then the same color is assigned to one of the edges (rj,1 , rj,1 ), (rj,2 , rj,2 ) and (rj,3 , rj,3 ) in the clause gadget Gj .
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
91
For all the other edges, we assign (new) distinct colors, each of which is used exactly once in fφ . We now construct the edge-coloring fφ of Gφ more precisely. We first assign m distinct colors c1 , c2 , . . . , cm to the edges (s1 , s2 ), (s2 , s3 ), . . . , (sm , a1 ), that is, let fφ ((sj , sj+1 )) = cj for each j, 1 ≤ j ≤ m; remember that a1 = sm+1 . (See Fig.3.) We then assign colors to the edges in X1 , X2 , . . . , Xn , as follows. For each variable gadget Xi , 1 ≤ i ≤ n, we assign six distinct (new) colors ci,1 , ci,2 , ci,3 , c¯i,3 , c¯i,2 , c¯i,1 in clockwise order from (ai , ui ) to (¯ ui , ai ). (See Fig.2(a).) Then, the i-th positive path receives the three colors ci,1 , ci,2 and ci,3 , while the i-th negative path receives the three colors c¯i,1 , c¯i,2 and c¯i,3 . We now assign colors to the edges in each clause gadget Gj , 1 ≤ j ≤ m, as follows. (See Fig.2(b).) We assign a new color cj to the edge (pj , pj ), and the color cj to the edge (qj , qj ); note that cj is the same color assigned to the edge (sj , sj+1 ). For each index k, 1 ≤ k ≤ 3, we assign a color to the edge (rj,k , rj,k ), as follows: ⎧ ⎪ ⎪ c¯i,1 if lj,k is a positive literal and the first literal of xi ; ⎪ ⎪ ⎪ ⎪ c¯i,2 if lj,k is a positive literal and the second literal of xi ; ⎨ c¯i,3 if lj,k is a positive literal and the third literal of xi ; fφ ((rj,k , rj,k )) = ci,1 if lj,k is a negative literal and the first literal of xi ; ⎪ ⎪ ⎪ ⎪ c ⎪ i,2 if lj,k is a negative literal and the second literal of xi ; ⎪ ⎩ ci,3 if lj,k is a negative literal and the third literal of xi . Let fφ ((qj , pj+1 )) = cj for each j, 1 ≤ j ≤ m; note that cj is the same color assigned to the edge (pj , pj ). Let U be the set of all the other edges in Gφ that are not assigned colors yet, that is, U = {(bi , ai+1 ) | 1 ≤ i ≤ n − 1} ∪ {(bn , p1 )} ∪ {(pj , rj,1 ), (rj,1 , rj,2 ), (rj,2 , rj,3 ), (rj,3 , qj ) | 1 ≤ j ≤ m} ∪ {(pj , rj,1 ), (rj,1 , rj,2 ), (rj,2 , rj,3 ), (rj,3 , qj ) | 1 ≤ j ≤ m}. We finally assign a new color to each edge in U , which is depicted by a thick line in Figs. 2 and 3. Thus, each edge in U receives a color that is not assigned to any other edges in Gφ . This completes the construction of the corresponding edge-coloring fφ for Gφ . Theorem 1 clearly follows from Conditions (A) and (B) above. By adding a universal vertex to a graph, we have the following theorem, whose detailed proof is omitted from this extended abstract. Theorem 2. Rainbow connectivity is in P for graphs of diameter 1, while is strongly NP-complete for graphs of diameter 2. 2.2
Polynomial-Time Algorithm for Cacti
A graph G is a cactus if every edge is part of at most one cycle in G [1]. Rainbow connectivity is strongly NP-complete even for outerplanar graphs, and hence it cannot be solved even in pseudo-polynomial time unless P = NP. However, we have the following theorem.
92
K. Uchizawa et al.
Theorem 3. Rainbow connectivity is solvable in polynomial time for cacti. Proof. Let G = (V, E) be a given cactus with n vertices, and let f : E → C be a given edge-coloring of G. In this proof, we give an O(n2 )-time algorithm to determine whether the edge-colored graph G(f ) has a rainbow path between a given pair of vertices in V . Since there are O(n2 ) pairs of vertices in G, rainbow connectivity for cacti can be solved in time O(n4 ). The algorithm indeed constructs a 2SAT formula φ such that φ is satisfiable if and only if G(f ) has a rainbow path between the two vertices. The formula φ can be constructed in time O(n2 ), and is of size O(n2 ). Since 2SAT can be solved in time linear in the size of φ [8], our algorithm runs in time O(n2 ) for each pair of vertices. We first introduce some terms and notations. For a given pair of vertices s and t, consider an arbitrary (simple) path P in G from s to t, which does not necessarily correspond to a rainbow path in G(f ). Let R be the set of elementary cycles and bridges that contain at least one edge in P , and let m = |R|. We call either a cycle or a bridge in R simply a component. We call each component ri ∈ R, 1 ≤ i ≤ m, the i-th component according to the order from s to t along P . Since G is a cactus, it is easy to see that not only P but also every path from s to t goes through all m components r1 , r2 , . . . , rm in this order. Let vi be the vertex contained in both components ri and ri+1 for each index i, 1 ≤ i ≤ m − 1. (In other words, vi is the cut-vertex which separates the two components ri and ri+1 .) For the sake of convenience, let v0 = s and vm = t. Consider an arbitrary plane embedding of G. For each i, 1 ≤ i ≤ m, let Pi be the path from vi−1 to vi in clockwise order, and let P¯i be the path from vi−1 to vi in counter-clockwise order; if ri is a bridge, then Pi = P¯i . Since both vi−1 and vi are cut-vertices, any (simple) path between vi−1 and vi must be either Pi or P¯i . We now construct the corresponding 2SAT formula φ. Using m Boolean variables x1 , x2 , . . . , xm , we represent all the paths connecting s and t, as follows: for each i, 1 ≤ i ≤ m, we regard xi = 1 as choosing Pi , and xi = 0 as choosing P¯i . Then, any truth assignment a ∈ {0, 1}m clearly represents a path from s to t. We denote by Pa the path corresponding to a ∈ {0, 1}n. The 2SAT formula φ contains the following clauses: for each index i, 1 ≤ i ≤ m, (A.1) the clause xi is in φ if a color is assigned to at least two edges in P¯i ; and (A.2) the clause xi is in φ if a color is assigned to at least two edges in Pi , and, for every pair of indices k and l, 1 ≤ k < l ≤ m, (B.1) (xk ∨ xl ) is in φ if a color is assigned to both P¯k and P¯l ; (B.2) (xk ∨ xl ) is in φ if a color is assigned to both P¯k and Pl ; (B.3) (xk ∨ xl ) is in φ if a color is assigned to both Pk and P¯l ; and (B.4) (xk ∨ xl ) is in φ if a color is assigned to both Pk and Pl . Trivially, the clause xi given in (A.1) (or the clause xi given in (A.2)) is satisfied by a ∈ {0, 1}m if and only if Pa does not contain P¯i (respectively, Pi ). Similarly, one can easily observe that the clause (xk ∨ xl ) given in (B.1) is satisfied by a ∈ {0, 1}m if and only if the path Pa does not contain both P¯k and P¯l that contain a same color, and so on. It is now easy to see that, if φ can be satisfied by a truth assignment a ∈ {0, 1}m, then the path Pa corresponds to a rainbow path in G(f ) between s and t, and vice versa.
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
93
For each i, 1 ≤ i ≤ m, let |ri | be the number of edges in ri . Then, we can m 2 + O |r | construct the 2SAT formula φ in time O i=1 i k=l |rk | · |rl | =
2 m O ( i=1 |ri |) . Since G is a cactus, the number of edges in G is O(n) [1] and m hence we have i=1 |ri | = O(n). Therefore, we can construct φ in time O(n2 ). Clearly, the constructed formula φ is of size O(n2 ).
3
Complexity for Variants
In this section, we analyze complexity statuses of the vertex-coloring and totalcoloring versions of rainbow connectivity. However, we omit all proofs in this section due to the page limitation. [Vertex-coloring version] For a graph G = (V, E), let f : V → C be a vertex-coloring of G which is not necessarily proper. We denote by G(f ) the graph G vertex-colored by f . Then, a path P in G(f ) connecting two vertices u and v in V is called a rainbow vertex-path between u and v if all vertices of P , except for u and v, are assigned distinct colors by f . Note that we do not care about the colors assigned to the end-vertices u and v of P . The vertex-colored graph G(f ) is rainbow vertex-connected if G(f ) has a rainbow vertex-path between every two vertices in V . (See Fig.1(b).) For a given vertex-coloring f of a graph G, the rainbow vertex-connectivity problem is to determine whether G(f ) is rainbow vertex-connected. We first give our complexity analyses from the viewpoint of diameters, as in the following theorem. Theorem 4. Rainbow vertex-connectivity is in P for graphs of diameter at most 2, while is strongly NP-complete for graphs of diameter 3. We then give our complexity analyses from the viewpoint of graph classes. A graph is series-parallel if it contains no subgraph isomorphic to a subdivision of a complete graph K4 of 4 vertices [1]. Thus, a series-parallel graph is of treewidth 2. We have the following theorem. Theorem 5. Rainbow vertex-connectivity is strongly NP-complete for series-parallel graphs. In contrast to Theorems 1 and 8, the vertex-coloring version is in P for outerplanar graphs. Theorem 6. Rainbow vertex-connectivity is solvable in polynomial time for outerplanar graphs. [Total-coloring version] For a graph G = (V, E), let f : V ∪ E → C be a total-coloring of G which is not necessarily proper. We denote by G(f ) the graph G total-colored by f .
94
K. Uchizawa et al.
Then, a path P in G(f ) connecting two vertices u and v in V is called a rainbow total-path between u and v if all elements in V (P ) ∪ E(P ), except for u and v, are assigned distinct colors by f . Similarly as in the vertex-coloring version, we do not care about the colors assigned to the end-vertices u and v of P . The totalcolored graph G(f ) is rainbow total-connected if G(f ) has a rainbow total-path between every two vertices in V . (See Fig.1(c).) For a given total-coloring f of a graph G, the rainbow total-connectivity problem is to determine whether G(f ) is rainbow total-connected. We first give the following theorem from the viewpoint of diameters. Theorem 7. Rainbow total-connectivity is in P for graphs of diameter 1, while is strongly NP-complete for graphs of diameter 2. We then give our complexity analyses from the viewpoint of graph classes. Theorem 1 implies the following result. Theorem 8. Rainbow total-connectivity is strongly NP-complete even for outerplanar graphs. On the other hand, similarly as in the proof of Theorem 3, rainbow totalconnectivity for cacti can be reduced to 2SAT. Theorem 9. Rainbow total-connectivity is solvable in polynomial time for cacti.
4
FPT Algorithms
In Section 4.1, we first give an FPT algorithm for rainbow connectivity on general graphs when parameterized by the number of colors used in a given edgecoloring f . Then, in Section 4.2, we show that our FPT algorithm for rainbow connectivity can be extended for the two variants. Chakraborty et al. [2] mentioned that rainbow connectivity can be solved in polynomial time if the number of used colors is bounded by a fixed constant. However, not every polynomial-time algorithm depending on a fixed constant yields an FPT algorithm. 4.1
FPT Algorithm for Edge-Coloring Version
It is obvious that any rainbow connected graph G(f ) for an edge-coloring f is of diameter at most |C|, and hence the diameter of a given graph can be bounded by a fixed constant if |C| is a fixed constant. However, Theorem 2 says that bounding the diameter does not make the problem tractable. In this subsection, we give an FPT algorithm for rainbow connectivity. Theorem 10. For an edge-coloring f of a graph G using k colors, one can determine whether the edge-colored graph G(f ) is rainbow connected in time O(k2k mn) using O(k2k n) space, where n and m are the numbers of vertices and edges in G, respectively.
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
95
Theorem 10 immediately implies the following corollary. Corollary 1. Rainbow connectivity is solvable in polynomial time for general graphs G if |C| = O(log n), where n is the number of vertices in G. As a proof of Theorem 10, we give an algorithm to determine whether G(f ) has rainbow paths from a vertex s to all the other vertices. The algorithm runs in time O(k2k m) using O(k2k n) space. Then, Theorem 10 clearly holds. [Terms and ideas] We first introduce some terms. For a vertex v of a graph G = (V, E), we denote by N (v) the set of all neighbors of v (which does not include v itself), that is, N (v) = {w ∈ V | (v, w) ∈ E}. We remind the reader that a walk in a graph is a sequence of adjacent vertices and edges, each of which may appear more than once; a path is a walk in which each vertex appears exactly once. The length of a walk is defined as the number of edges in the walk. A walk W in G(f ) is called a rainbow walk if all edges of W are assigned distinct colors by an edge-coloring f of G. For a color set C with k colors, we denote by 2C the power set of C; the number of all subsets X ⊆ C in 2C is then 2k . We then give our idea. For a graph G = (V, E) and a color set C with |C| = k, let f : E → C be a given edge-coloring of G. We choose a vertex s ∈ V . We indeed give an algorithm to check if the edge-colored graph G(f ) has a rainbow walk W from s to each vertex v ∈ V \{s}; one can obtain a rainbow path between s and v, as the sub-walk of W . Since |C| = k, every rainbow walk is of length at most k. Therefore, our algorithm is based on a dynamic programming approach with respect to the lengths of walks from s: G(f ) has a rainbow walk from s to a vertex v with length exactly i if and only if there exists at least one vertex u in N (v) such that G(f ) has a rainbow walk from s to u with length exactly i − 1 in which the color f ((u, v)) is not assigned to any edge. Based on the idea above, we define a family Γs (i, v) ⊆ 2C , as follows. For an integer i, 1 ≤ i ≤ k, and a vertex v ∈ V , we define a family Γs (i, v) ⊆ 2C of sets X of colors, as follows: Γs (i, v) = {X ⊆ C | G(f ) has a rainbow walk W between s and v of length exactly i which uses all colors in X}. Since W is a rainbow walk and all colors in X are used in the i edges in W , we have |X| = i for each set X ∈ Γs (i, v). Note that Γs (i, v) = ∅ if G(f ) has no walk between s and v of length exactly i. Clearly, G(f ) has a rainbow path from s to a vertex v if and only if Γs (i, v) = ∅ for some integer i, 1 ≤ i ≤ k. By a dynamic programming approach, we compute the families Γs (i, v) from i = 1 to k for all vertices v ∈ V . Then, using the families Γs (i, v), it can be determined in time O(kn) whether G(f ) has rainbow paths from s to all vertices v ∈ V \ {s}. [Algorithm] We first compute the family Γs (1, v) for each vertex v ∈ V . Clearly, the walks with length exactly 1 from s are only the edges (s, v) for the vertices v in N (s).
96
K. Uchizawa et al.
Therefore, we have Γs (1, v) = {f ((s, v))}
(1)
for each vertex v ∈ N (s), and Γs (1, v) = ∅
(2)
for all the other vertices v ∈ V \ N (s). We then compute the family Γs (i, v) for an integer i ≥ 2 and each vertex v ∈ V . Suppose that we have already computed Γs (i − 1, u) for all vertices u ∈ V . Obviously, G(f ) has a rainbow walk from s to a vertex v with length exactly i if and only if, for some vertex u ∈ N (v), there exists a (non-empty) set Y ∈ Γs (i − 1, u) such that f ((u, v)) ∈ Y . Therefore, we can compute Γs (i, v) for a vertex v ∈ V , as follows: Γs (i, v) = Y ∪ {f ((u, v))} | u ∈ N (v), Y ∈ Γs (i − 1, u), f ((u, v)) ∈ Y . (3) [Proof of Theorem 10] Using Eqs. (1)–(3) one can correctly compute Γs (i, v), 1 ≤ i ≤ k, for all vertices v ∈ V . Thus, we now show that our algorithm runs in time O(k2k m), and uses O(k2k n) space. We first show that our algorithm uses O(k2k n) space. Since Γs (i, v) ⊆ 2C and Γs (i, v) contains only sets X of size |X| = i, one can easily observe that k k i=1 |Γs (i, v)| ≤ 2 for a vertex v ∈ V . We represent each subset X ⊆ C in Γs (i, v) by an array of length k. Therefore, we can represent the families Γs (i, v) using O(k2k n) space for all vertices v ∈ V and all integers i, 1 ≤ i ≤ k. We finally estimate the running time of our algorithm. By Eqs. (1) and (2) the families Γs (1, v) can be computed in time O(n) for v ∈ V . By Eq. all vertices k
(3) the family Γs (i, v) can be computed in time O d(v) · i · k for a vertex v and an integer i, because |N (v)| = d(v), |Γs (i − 1, u)| ≤ ki , the condition f ((u, v)) ∈ Y can be checked in O(1) time, and O(k) time is required to represent the obtained set X by an array of length k. Therefore, the families Γs (i, v) can be computed for vertices
v ∈ V and all integers i, 2 ≤ i ≤ k, in time all k k k i=2 v∈V O k · i · d(v) = O(k2 m). Using the families Γs (i, v), 1 ≤ i ≤ k, it can be determined in time O(kn) whether G(f ) has rainbow paths from s to all vertices v ∈ V \ {s}. Since G can be assumed to be a connected graph, n − 1 ≤ m and hence our algorithm takes time O(k2k m) in total. 4.2
FPT Algorithms for Two Variants
We finally show that the FPT algorithm in Section 4.1 can be extended for both the vertex-coloring and total-coloring versions. In the vertex-coloring version, similarly as in Section 4.1, we give an algorithm to determine whether a given vertex-colored graph G(f ) has rainbow vertexpaths from a chosen vertex s to all the other vertices. Note that, since the color
On the Rainbow Connectivity of Graphs: Complexity and FPT Algorithms
97
set C contains k colors, any rainbow vertex-path has at most k internal vertices. For an integer i, 1 ≤ i ≤ k, and a vertex v ∈ V , we thus define and compute the following family Γs (i, v) ⊆ 2C , instead of Γs (i, v) in Section 4.1: Γs (i, v) = {X ⊆ C | G(f ) has a rainbow vertex-path between s and v having exactly i internal vertices which use all colors in X}. Thus, one can easily obtain the following theorem. Theorem 11. For a vertex-coloring f of a graph G using k colors, one can determine whether the vertex-colored graph G(f ) is rainbow vertex-connected in time O(k2k mn) using O(k2k n) space, where n and m are the numbers of vertices and edges in G, respectively. Similar arguments establish the following theorem. Theorem 12. For a total-coloring f of a graph G using k colors, one can determine whether the total-colored graph G(f ) is rainbow total-connected in time O(k2k mn) using O(k2k n) space, where n and m are the numbers of vertices and edges in G, respectively. Theorems 11 and 12 immediately imply the following corollary. Corollary 2. Both rainbow vertex-connectivity and rainbow totalconnectivity are solvable in polynomial time for general graphs G if |C| = O(log n), where n is the number of vertices in G.
References 1. Brandst¨ adt, A., Le, V.B., Spinrad, J.P.: Graph Classes: A Survey. Society for Industrial and Applied Mathematics, Philadelphia (1999) 2. Chakraborty, S., Fischer, E., Matsliah, A., Yuster, R.: Hardness and algorithms for rainbow connection. J.Combinatorial Optimization 21, 330–347 (2011) 3. Chartrand, G., Johns, G.L., McKeon, K.A., Zhang, P.: Rainbow connection in graphs. Mathematica Bohemica 133, 85–98 (2008) 4. Chartrand, C., Johns, G.L., McKeon, K.A., Zhang, P.: The rainbow connectivity of a graph. Networks 54, 75–81 (2009) 5. Chen, L., Li, X., Shi, Y.: The complexity of determining the rainbow vertexconnection of graphs, arXiv:1101.3126v1 (submitted on January 17, 2011) 6. Caro, Y., Lev, A., Roditty, Y., Tuza, Z., Yuster, R.: On rainbow connectivity. The Electronic Journal of Combinatorics 15, R57 (2008) 7. Fellows, M.R., Guo, J., Kanj, I.: The parameterized complexity of some minimum label problems. J. Computer and System Sciences 76, 727–740 (2010) 8. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, San Francisco (1979) 9. Krivelevich, M., Yuster, R.: The rainbow connection of a graph is (at most) reciprocal to its minimum degree. J. Graph Theory 63, 185–191 (2010)
On Parameterized Independent Feedback Vertex Set Neeldhara Misra, Geevarghese Philip, Venkatesh Raman, and Saket Saurabh The Institute of Mathematical Sciences, Chennai, India {neeldhara,gphilip,vraman,saket}@imsc.res.in
Abstract. We investigate a generalization of the classical Feedback Vertex Set (FVS) problem from the point of view of parameterized algorithms. Independent Feedback Vertex Set (IFVS) is the “independent” variant of the FVS problem and is defined as follows: given a graph G and an integer k, decide whether there exists F ⊆ V (G), |F | ≤ k, such that G[V (G) \ F ] is a forest and G[F ] is an independent set; the parameter is k. Note that the similarly parameterized versions of the FVS problem — where there is no restriction on the graph G[F ] — and its connected variant CFVS — where G[F ] is required to be connected — have been extensively studied in the literature. The FVS problem easily reduces to the IFVS problem in a manner that preserves the solution size, and so any algorithmic result for IFVS directly carries over to FVS. We show that IFVS can be solved in time O(5k nO(1) ) time where n is the number of vertices in the input graph G, and obtain a cubic (O(k3 )) kernel for the problem. Note the contrast with the CFVS problem, which does not admit a polynomial kernel unless CoN P ⊆ N P/P oly.
1
Introduction
Feedback Vertex Set(FVS) is a classical NP-complete problem and has been extensively studied in all subfields of algorithms and complexity. In this problem we are given an undirected graph G and a positive integer k as input, and the goal is to check whether there exists a subset F ⊆ V (G) of size at most k such that G[V (G) \ F ] is a forest. This problem originated in combinatorial circuit design and found its way into diverse applications such as deadlock prevention in operating systems, constraint satisfaction and Bayesian inference in artificial intelligence. We refer to the survey by Festa, Pardalos and Resende [11] for further details on the algorithmic study of feedback set problems in a variety of areas like approximation algorithms, linear programming and polyhedral combinatorics. In this paper we introduce a variant of FVS, namely, Independent Feedback Vertex Set(IFVS) and study it in the realm of parameterized complexity. In IFVS, given a graph G and a positive integer k, the objective is to check whether there exists a vertex-subset F of size at most k such that G[V (G) \ F ] is a forest and G[F ] is an independent set. Parameterized complexity is a two-dimensional generalization of “P vs. NP” where, in addition to the overall input size n, one studies how a secondary B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 98–109, 2011. c Springer-Verlag Berlin Heidelberg 2011
On Parameterized Independent Feedback Vertex Set
99
measurement that captures additional relevant information affects the computational complexity of the problem in question. Parameterized decision problems are defined by specifying the input, the parameter and the question to be answered. The two-dimensional analogue of the class P is decidability within a time bound of f (k)nc , where n is the total input size, k is the parameter, f is some computable function and c is a constant that does not depend on k or n. A parameterized problem that can be decided in such a time-bound is termed fixed-parameter tractable (FPT). For general background on the theory see the textbooks by Downey and Fellows [8], Flum and Grohe [12] and Niedermeier [23]. A parameterized problem is said to admit a polynomial kernel if there is a polynomial time algorithm (the degree of polynomial is independent of k), called a kernelization algorithm, that reduces the input instance down to an instance with size bounded by a polynomial p(k) in k, while preserving the answer. This reduced instance is called a p(k) kernel for the problem. Kernelization has been at the forefront of research lately and many new results have appeared; see the surveys by Guo and Niedermeier [17] and Bodlaender [3]. Some of the most significant recent results are meta theorems for kernelization [4,15,19], use of probabilistic tools and Fourier analysis [1,18] and non-trivial applications of combinatorial min-max results [10,13,26]. FVS has been extensively studied in parameterized algorithms. The earliest known FPT-algorithms for FVS go back to the late 80’s and the early 90’s [2,9] and used the seminal Graph Minor Theory of Robertson and Seymour. Subsequently, several algorithms for FVS with running times of the form O(2O(k) nO(1) ) were designed using a technique known as iterative compression. After several rounds of improvement, the current best FPT-algorithm for FVS runs in time O(3.83k kn2 ) [5]. Our motivation for studying the independent variant of FVS is three-fold: – Somewhat surprisingly, the independent variant of FVS has not been considered in the literature until now. This is in stark contrast to the fact that the independent variants of other problems like Dominating Set — Independent Dominating Set [14,16,20] — and Odd Cycle Transversal — Independent Odd Cycle Transversal [24,21] — have been extensively investigated. – A simple polynomial time parameter preserving reduction — subdivide every edge once — shows that IFVS is a more general problem than FVS. So a fast FPT algorithm for IFVS directly implies an FPT algorithm for FVS which runs as fast, except for an additive polynomial factor for the transformation. – FVS admits an O(k 2 ) kernel [26], while its connected variant CFVS does not admit a kernel of any polynomial size (under certain complexity-theoretic assumptions) [22]. Our final motivation for studying IFVS was to find whether it has a polynomial kernel like FVS, or no polynomial kernel (under the same assumptions) like CFVS. A formal statement of the parameterized Independent Feedback Vertex Set problem is as follows:
100
N. Misra et al.
Independent Input: Parameter: Question:
Feedback Vertex Set(IFVS) A graph G = (V, E), and an integer k. k Does there exist a subset S of at most k vertices such that G[S] is an independent set, and G \ S induces a forest?
Our results. We obtain an FPT algorithm which solves IFVS in time O(5k nO(1) ), more succinctly represented as O (5k ) where the O notation hides polynomial factors in the running time. This is as fast as the previous best algorithm for FVS which runs in O (5k ) time [6] (The current fastest algorithm for FVS runs in O (3.83k ) time [5].). Our second result is a polynomial kernel for IFVS; we obtain a kernel of size O(k 3 ) for the problem. This is in contrast to the fact that Connected Feedback Vertex Set does not admit a polynomial kernel unless CoN P ⊆ N P/P oly [22]. Our kernelization procedure makes use of the q-expansion lemma, a generalization of Hall’s Theorem, with q set to k + 2. While the overall idea of our algorithm follows the established paradigm of solving FVS using iterated compression, we come up against some subtle differences. For instance, since we need to guarantee that the solution obtained is an independent set, we cannot, unlike with FVS, preprocess of our graph so that its minimum degree is 3. A transformation of the input graph to a graph with minimum degree 3 has played a crucial role in all previous algorithms for FVS. We overcome this handicap by devising a new measure and using an interesting polynomial time subroutine to obtain the FPT algorithm for IFVS.
2
An O(5k) Algorithm
We now describe an algorithm that solves the IFVS problem in O (5k ) time. The algorithm starts by exhaustively applying two reduction rules which get rid of vertices of small degree and consecutive vertices of degree two in the graph. Since a vertex of degree zero or one does not form part of any cycle, no minimal feedback vertex set contains such a vertex. This justifies the following rule: Reduction Rule 1. Delete all vertices of degree at most one in the input graph. In contrast to plain FVS — see, for example, the quadratic kernel argument due to Thomass´e [26] — the independence requirement of IFVS prevents us from freely bypassing every vertex of degree exactly two. However, it is safe to delete all but one of a sequence of two or more consecutive vertices of degree two: Reduction Rule 2. Let x, y be two adjacent vertices of degree exactly two in the input graph G, and a, b be the other neighbors of x, y, respectively. Delete the vertex x and add the edge {a, y}, as in Figure 1. Out of two adjacent vertices of degree two, at most one need be in any minimal IFVS. This implies that Reduction Rule 2 is safe.
On Parameterized Independent Feedback Vertex Set
101
Fig. 1. Bypassing a degree-two vertex which has another such vertex adjacent to it
Claim 1. []1 Let (G, k) be an input instance of IFVS, and let x, y, a, b be as in Reduction Rule 2. Let G be the graph obtained by applying the rule to G. Then (G, k) is a YES instance of IFVS if and only if (G , k) is a YES instance of IFVS. The algorithm applies these reduction rules exhaustively; in the following, we assume that the input graph G is reduced with respect to both these rules. The algorithm now checks in O (3.83k ) time whether G has an FVS of size at most k, by invoking as a subroutine the algorithm due to Chen et al. [5]. If the subroutine returns NO, then G does not have an IFVS of size at most k either, and so the algorithm returns NO. Otherwise, let F be an FVS of G of size at most k returned by the subroutine. The algorithm now passes G, F to a search routine, described below, which either says (correctly) that G has no IFVS of size at most k, or returns an IFVS X of G of size at most k. We now describe the search routine. The input to the search routine is a pair (G, F ⊆ V (G)) where F is an FVS of G of size at most k. The goal of the search routine is to output an IFVS X of G of size at most k, if it exists, or to report that no such IFVS exists. The search routine guesses the set Y = X ∩F ; 0 ≤ |Y | ≤ k. For this, the routine tries each subset Y ⊆ F of size at most k. If G[Y ] is not an independent set, then the routine rejects this guess. Otherwise, let N = F \ Y . Note that the remaining k − |Y | vertices in X are in H = V (G) \ F , so that the remaining task is to find an IFVS Z ⊆ H for the subgraph G[N ∪ H], such that no vertex in Z is adjacent to any vertex in Y . If G[N ] is not a forest, then the routine rejects this guess of Y . Otherwise, it deletes the vertices in Y and tries to find an IFVS Z ⊆ H of the required kind. For this, it first colors red those vertices in H which are adjacent to some vertex in Y , and all the other vertices in H white; red vertices are not to be picked in Z. Note that both G[N ] and G[H] are now forests. The routine branches on the vertices in G[H], as described in the three steps in Algorithms 1. 1
Due to space constraints, proofs of results labeled with a have been deferred to a full version of the paper.
102
N. Misra et al.
We use the following measure to bound the depth of the branching: μ = b + c − u, where: 1. b is the budget — the number of additional vertices that can be added to the IFVS being constructed. Initially, b = k − |Y | ≤ k. 2. c is the number of components (trees) in G[N ]. Initially, 1 ≤ c ≤ k. 3. u is the number of useful vertices in H. We say that a vertex in H is useful if it is not red, has degree exactly two in G, and both its neighbors are in N . Algorithm 1. Branch(G, H, N ), Step 1. See the main text for details. 1: if a vertex v in H has at least two neighbors in N and total degree at least three then 2: if v has two neighbors in the same tree in N then v must be picked in any solution 3: if v is red then 4: Stop and return NO. 5: else 6: pick v to be in the solution. 7: else 8: if v is red then 9: Move v from H to N. 10: else 11: Branch on v.
If a vertex v in H has two neighbors in any tree in N , then any FVS which is contained in H must contain v. Therefore, if at any point during the branching, there is a red vertex which has two neighbors in any tree in N , then the routine stops and returns NO as the answer. Further, if at any point the budget b or the measure μ becomes negative, the routine stops and returns NO as the answer; this is justified by Claim 3. “Picking a vertex v in H to be in the solution” consists of coloring all its white neighbors in H red, deleting v from the graph, reducing b by one, and applying Reduction Rules 1 and 2 to the resulting graph. Observe that the arguments for the correctness for Reduction Rules 1 and 2 go through even if one or more of the vertices involved are colored red (and therefore not available for selection into the IFVS being built). “Picking a vertex v in H to not be in the solution” consists of moving v from H to N . Algorithm 1. Branch(G, H, N ), Step 2 12: if in 13: 14: 15: 16:
a vertex v in H is a leaf in G[H] and its only neighbor w in H has a neighbor N then if w is red then Move w from H to N . else Branch on w.
On Parameterized Independent Feedback Vertex Set
103
“Branching on a vertex v” consists of the following: First pick v in the solution and recurse on the remaining problem. If this returns an FVS X of G of size at most k, then return X and stop. Otherwise, pick v to be not in the solution, recurse on the remaining problem, and return the answer. Algorithm 1. Branch(G, H, N ), Step 3 17: if a vertex v in H has at least two neighbors in H which are leaves in G[H] then 18: if v is red then 19: Move v from H to N . 20: else 21: Branch on v.
If none of the branches applies, then by Claim 2 below, every vertex in H has degree exactly two, and both its neighbors are in N . It is now sufficient for the algorithm to find a smallest set W ⊆ H of white vertices that forms an FVS — note that this set is already independent — of G[N ∪ H], if it exists, in polynomial time. For this, the algorithm moves all red vertices of H to N and then applies the polynomial-time algorithm due to Chen et al. [6, Lemma 6] which solves this problem in O(|V (G)|2 ) time. If there is no such set W , or if |W | > k − |Y |, then the search routine outputs NO; otherwise it outputs Y ∪ W as an IFVS of G of size at most k. Claim 2. [] Let G be a graph obtained by the search routine to which none of the branches applies, and let N, H be as in the description of the routine. Then every vertex in H has degree exactly two, and both its neighbors are in N . Recall that the search routine returns NO as the answer if, at any point during the branching, the budget b or the measure μ becomes negative. This is justified by the following claim. Claim 3. [] Consider a point where the search routine is applied to the graph G, and either the budget b or the measure μ has become negative. Let Y be the set of vertices chosen by the algorithm to be in the solution till this point, and let N, H be as in the description of the routine. Then there is no IFVS of G of size at most k which contains all the vertices in Y . The correctness of the algorithm follows from the above discussion. Observe that μ ≤ 2k at the start of the branching. We bound the running time by showing that μ decreases by at least one on each branch, to obtain: Theorem 1. [] The Independent Feedback Vertex Set problem can be solved in O (5k ) time.
3
A Cubic Kernel
In this section we describe a kernelization algorithm which yields a kernel of size O(k 3 ) for the IFVS problem. Given an instance (G, k) of IFVS, the kernelization
104
N. Misra et al.
algorithm applies a few reduction rules exhaustively. While applying some of the reduction rules, the algorithm colors certain vertices red to indicate that these vertices are not to be picked in any minimal IFVS of size at most k of the resulting graph. At the end of this process, the algorithm either solves the problem (giving either YES or NO as the answer), or it yields an equivalent vertex-colored instance (H , ); ≤ k whose size is bounded by O(k 3 ). If the procedure solves the problem, then the algorithm returns a trivial YES or NO instance, as the case may be, of constant size. Otherwise, as the last step, the algorithm adds a gadget to represent the colors of the vertices to obtain an equivalent uncolored instance (H, k ); k ≤ k of size O(k 3 ). For ease of notation we use (G, k) to denote the input to each reduction rule, and (H, k ) to denote the output. Note that, in general, (G, k) is not the same as the original input instance, and (H, k ) is not the final output instance. We also use the term “non-red IFVS” to denote an IFVS which contains no red vertex. The kernelization algorithm starts by exhaustively applying Reduction Rules 1 and 2 from the previous section to the input graph. Since the graph has no red vertices yet, every IFVS of the graph at this stage is non-red. The algorithm then exhaustively applies the following reduction rule to the resulting instance: Reduction Rule 3. Let u1 , u2 , . . . , ur be r ≥ k + 2 vertices of degree exactly two in the graph G such that N (ui ) = {a, b}; 1 ≤ i ≤ r. Delete the vertices u3 , u4 . . . , ur and color u1 , u2 red to obtain H. The resulting instance is (H, k). If neither of a, b is in an IFVS I, then at least k+1 of the vertices u1 , u2 , . . . , ur must be in I, or else a, b and the remaining ui s form a cycle in G[V (G) \ I]. Thus any solution must contain at least one of a, b, and so must exclude all of the ui s. We cannot safely delete all the ui s outright, because this will get rid of the cycles formed by these vertices “for free”. But we can delete all but two of the ui s; these two will “remember” the presence of these cycles. A formal version of this intuition justifies the following claim: Claim 4. [] Let (G, k) be an instance of IFVS, and let (H, k) be the instance obtained by applying Reduction Rule 3 to (G, k). Then G has a non-red IFVS of size at most k if and only if H has a non-red IFVS of size at most k. Our next reduction rule rules out the presence of too many vertex-disjoint cycles of a certain kind in the graph: Reduction Rule 4. From the graph G, construct an auxiliary graph G as follows. The vertex set of G is the same as that of G, and the edge {u, v} is present in G if and only if there are at least two vertices x, y in G such that N (x) = N (y) = {u, v}. Find the size m of a largest-size matching in G . If m ≥ k + 1, then return NO and stop. Otherwise return (G, k). Claim 5. [] Reduction Rule 4 is safe. We now take care of vertices which lie on many cycles which are otherwise disjoint.
On Parameterized Independent Feedback Vertex Set
105
Definition 1. Let v be a vertex in a graph G, and let ∈ N. An -flower passing through v is a set of distinct cycles in G such that each cycle contains v and no two cycles share any vertex other than v. The vertex v is said to be at the center of the flower. Reduction Rule 5. Let v be a vertex in the graph G which is at the center of a k + 1-flower. If v is red, then return NO and stop. Otherwise, color all neighbors of v red and delete v from G to obtain the graph H; the resulting instance is (H, k − 1). The correctness of this rule follows essentially from the fact that any vertex which is at the center of a k + 1-flower must be present in any FVS of the graph of size at most k: Claim 6. [] Let (G, k) be an instance of IFVS, and let (H, k−1) be the instance obtained by applying Reduction Rule 5 to (G, k). Then G has a non-red IFVS of size at most k if and only if H has a non-red IFVS of size at most k − 1. The next reduction rule takes care of boundary conditions; its correctness is self-evident. Reduction Rule 6. 1. Let v be a vertex in the graph G which has a self-loop. If v is red, then return NO and stop. Otherwise, color all neighbors of v red and delete v from G to obtain the graph H; the resulting instance is (H, k − 1). 2. If {x, y} is an edge with multiplicity more than two, then reduce its multiplicity to two. 3. If k = 0 and G is not a forest, then return NO and stop. 4. If k ≥ 0 and G is a forest, then return YES and stop. We now introduce a reduction rule which helps us bound the maximum degree of any vertex in the graph. To describe the intuition behind this rule, we need two known results. Firstly, as observed by Thomass´e, in a graph reduced with respect to Reduction Rules 5 and 6, we can find, in polynomial time, a small set of vertices that intersects every cycle which passes through any given vertex. More formally, Theorem 2. [25, Corollary 2.1] Let v be a vertex of a graph G, and let there be no self-loop at v. If there is no k + 1-flower passing through v, then there exists a set X ⊆ V (G) \ {v} of size at most 2k which intersects every cycle that passes through v, and such a set can be found in polynomial time. For a vertex v in G, we use Xv to denote a set of size at most 2k of the kind guaranteed to exist by the theorem. The second result that we need is an “expansion lemma” which is a generalization of Hall’s theorem for bipartite graphs. This was first observed by Thomass´e [25]; we use a stricter version due to Fomin et al. [13]. Consider a bipartite graph G with vertex bipartition A B. Given subsets S ⊆ A and T ⊆ B,
106
N. Misra et al.
we say that S has |S| q-stars in T if to every x ∈ S we can associate a subset Fx ⊆ N (x) ∩ T such that (a) for all x ∈ S, |Fx | = q; (b) for any pair of vertices x, y ∈ S, Fx ∩ Fy = ∅. Observe that if S has |S| q-stars in T then every vertex x in S could be thought of as the center of a star with its q leaves in T , with all these stars being vertex-disjoint. Further, a collection of |S| q-stars is also a family of q edge-disjoint matchings. The q-Expansion Lemma states a sufficient condition for a special kind of q-star to exist in a bipartite graph: Lemma 1 ([13]). [The q–Expansion Lemma] Let q be a positive integer, and let m be the size of the maximum matching in a bipartite graph G with vertex bipartition A B. If |B| > mq, and there are no isolated vertices in B, then there exist nonempty vertex sets S ⊆ A, T ⊆ B such that S has |S| q-stars in T and no vertex in T has a neighbor outside S. Furthermore, the sets S, T can be found in time polynomial in the size of G. These two results imply that if v is a vertex of sufficiently large degree in a graph reduced with respect to reduction rules Rules 1 to 6, then we can find, in polynomial time, a k +2-sized ”almost-flower” passing through v. More precisely, we can find a nonempty subset S ⊆ Xv such that for each s ∈ S there is a set Cs of k + 2 cycles whose only common vertices are s and v. Further, for any t ∈ S, t = s, v is the only vertex shared by cycles in Cs and Ct : Claim 7. [] Let (G, k) be an instance of IFVS where G is reduced with respect to Reduction Rules 1 to 6. If G has a vertex v with degree at least 4k + (k + 2)2k, then in polynomial time we can find a set S ⊆ V (G)\{v} and a set of components C of G \ S ∪ {v} such that 1. there is exactly one edge in G from v to each component in C, 2. each C ∈ C induces a tree, and 3. there exists a set of at least (k + 2) components in C corresponding to each s ∈ S such that these sets are pairwise disjoint, and there is an edge from each s ∈ S to each of its associated components. Given a vertex v and a set S as in Claim 7, it can be shown (See the proof of Claim 8 ) that if F is an FVS of size at most k and v ∈ / F , then S ⊆ F . This allows us to reduce the number of edges in the graph in the following way: Reduction Rule 7. Let v be a vertex in G, let S ⊆ V (G) \ {v}, and let C be a set of (not necessarily all) components of G \ S ∪ {v} which satisfy the conditions of Claim 7. Color the neighbors of v in the components in C red, and delete the edges between v and these newly reddened vertices. For each s ∈ S, if there does not exist a pair a, b of red vertices in G be such that N (a) = N (b) = {v, s}, then add two new red vertices a, b and the edges {v, a}, {a, s}, {s, b}, {b, v}. Let the resulting graph be H. The new instance is (H, k). Note that the above rule is quite similar to the reduction rule introduced by Thomass´e for obtaining a quadratic kernel for FVS [26]. The only difference here is that we need k + 2 “private” (in the sense stated in Claim 7) components
On Parameterized Independent Feedback Vertex Set
107
per vertex in S for the rule to apply, while the FVS reduction rule required only two such components per vertex in S. As shown below, this number contributes a multiplicative factor in the size of the final kernel. Hence our kernel has size O(k 3 ), while the size of the FVS kernel is quadratic in k. Let F be an FVS of a graph G and let A ⊆ F . If B ⊆ V (G) is such that |B| = |A| and B intersects exactly the same set of cycles in G as A does, then F = (F \ A) ∪ B is always an FVS of G of size |F |. But if F is an IFVS of G, then it is not always true that F is an IFVS of G. This is precisely the reason for the requirement of k + 2 components per vertex; these many components are needed before it can be argued that either v or all of S must be in every solution of size at most k. This latter fact is central to the correctness of this reduction rule: Claim 8. [] Let G, k, H be as in the description of Reduction Rule 7. Then G has a non-red IFVS of size at most k if and only if H has a non-red IFVS of size at most k. Each reduction rule can be applied in polynomial time, and each rule which changes the graph decrements the sum of the number of vertices and edges in the graph. Hence all the reduction rules can be exhaustively applied in polynomial time: Claim 9. [] By repeatedly applying Reduction Rules 1 to 7 to an input instance (G, k) of IFVS, in polynomial time we can either obtain a YES or NO answer, or an equivalent instance (H, k ) to which none of the rules applies. Starting from a YES instance, these reduction rules produce an instance of size O(k 3 ): Claim 10. [] Let (G, k) be an input instance of IFVS, and let (H, k ) be a colored graph obtained from (G, k) by exhaustively applying Reduction Rules 1 to 7. If (G, k) is a YES instance, then H has at most k + 16k 2 + 8(k + 2)k2 vertices and at most 20k 2 + 9(k + 2)k2 edges. This claim justifies the last reduction rule; it is easy to see that the rule can be applied in polynomial time. Reduction Rule 8. Let (G, k) be an instance of IFVS, and let (H, k ) be the instance obtained by exhaustively applying Reduction Rules 1–7. If H has more than k + 16k2 + 8(k + 2)k 2 vertices or more than 20k 2 + 9(k + 2)k 2 edges, then return NO and stop. Otherwise return (H, k ). Starting with an instance (G, k), at this point in the kernelization algorithm, we have either obtained a (correct) YES or NO answer, or we have an equivalent colored instance (G , k ) where k ≤ k and the size of G is bounded by O(k 3 ). In former case, the algorithm constructs a trivial YES or NO instance, respectively, and returns it. In the latter case, the algorithm “un-colors” the colored instance to obtain an instance of IFVS with no colors, and returns this instance.
108
N. Misra et al.
Claim 11. [] From a colored instance (G , k ) produced by the kernelization algorithm, an equivalent uncolored instance (H, k + 1) can be constructed in polynomial time by adding O(k3 ) vertices and edges. Putting all these together, we have: Theorem 3. Independent Feedback Vertex Set has a kernel of size O(k3 ).
4
Discussion and Conclusion
In this paper we investigated the parameterized complexity of a generalized version of the well known FVS problem, namely IFVS. We obtained an FPT algorithm which solves the problem in O (5k ) time, and a polynomial kernel of size O(k 3 ). This work adds to the study of the variants of parameterized FVS, which has yielded some interesting contrasts so far. Plain FVS, without any constraints, is FPT [5] and has a quadratic kernel [26]. The connected variant, CFVS, is FPT but does not admit any polynomial kernel unless CoN P ⊆ N P/P oly [22]. Adding to this picture, we show in this paper that the independent variant is FPT and admits a cubic kernel. A natural next question to ask is whether the directed versions of these problems are FPT. It is known that Directed Feedback Vertex Set (DFVS) is FPT [7]. In contrast, it turns out that Independent Directed Feedback Vertex Set (IDFVS) is unlikely to be FPT: Theorem 4. [] Given a directed graph G and a positive integer parameter k, it is W[1]-hard to find if there is a set S of at most k vertices in G such that (i) G[V (G) \ S] has no directed cycle and (ii) G[S] is an independent set. We leave open the parameterized complexity of Connected DFVS.
References 1. Alon, N., Gutin, G., Kim, E.J., Szeider, S., Yeo, A.: Solving max-r-sat above a tight lower bound. In: SODA, pp. 511–517 (2010) 2. Bodlaender, H.L.: On disjoint cycles. In: Schmidt, G., Berghammer, R. (eds.) WG 1991. LNCS, vol. 570, pp. 230–238. Springer, Heidelberg (1992) 3. Bodlaender, H.L.: Kernelization: New upper and lower bound techniques. In: Chen, J., Fomin, F.V. (eds.) IWPEC 2009. LNCS, vol. 5917, pp. 17–37. Springer, Heidelberg (2009) 4. Bodlaender, H.L., Fomin, F.V., Lokshtanov, D., Penninkx, E., Saurabh, S., Thilikos, D.M.: Meta kernelization. In: FOCS, pp. 629–638 (2009) 5. Cao, Y., Chen, J., Liu, Y.: On feedback vertex set new measure and new structures. In: Kaplan, H. (ed.) SWAT 2010. LNCS, vol. 6139, pp. 93–104. Springer, Heidelberg (2010) 6. Chen, J., Fomin, F.V., Liu, Y., Lu, S., Villanger, Y.: Improved Algorithms for Feedback Vertex Set Problems. Journal of Computer and System Sciences 74(7), 1188–1198 (2008)
On Parameterized Independent Feedback Vertex Set
109
7. Chen, J., Liu, Y., Lu, S., O’sullivan, B., Razgon, I.: A fixed-parameter algorithm for the directed feedback vertex set problem. Journal of the ACM 55(5), 21:1–21:19 (2008) 8. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, New York (1999) 9. Downey, R.G., Fellows, M.R.: Fixed parameter tractability and completeness. In: Complexity Theory: Current Research, pp. 191–225. Cambridge University Press, Cambridge (1992) 10. Fellows, M.R., Guo, J., Moser, H., Niedermeier, R.: A generalization of nemhauser and trotter’s local optimization theorem. In: STACS, pp. 409–420 (2009) 11. Festa, P., Pardalos, P.M., Resende, M.G.: Feedback set problems. In: Handbook of Combinatorial Optimization, pp. 209–258. Kluwer Academic Publishers, Dordrecht (1999) 12. Flum, J., Grohe, M.: Parameterized Complexity Theory. In: Texts in Theoretical Computer Science. An EATCS Series. Springer, Berlin (2006) 13. Fomin, F.V., Lokshtanov, D., Misra, N., Philip, G., Saurabh, S.: Hitting forbidden minors: Approximation and Kernelization. In: Proc. of the 28th Symposium on Theoretical Aspects of Computer Science, STACS (to appear, 2011), http://arxiv.org/abs/1010.1365 14. Fomin, F.V., Grandoni, F., Kratsch, D.: Solving connected dominating set faster than 2n . Algorithmica 52(2), 153–166 (2008) 15. Fomin, F.V., Lokshtanov, D., Saurabh, S., Thilikos, D.M.: Bidimensionality and kernels. In: SODA, pp. 503–510 (2010) 16. Guha, S., Khuller, S.: Approximation algorithms for connected dominating sets. Algorithmica 20(4), 374–387 (1998) 17. Guo, J., Niedermeier, R.: Invitation to data reduction and problem kernelization. SIGACT News 38(1), 31–45 (2007) 18. Gutin, G., Kim, E.J., Szeider, S., Yeo, A.: A probabilistic approach to problems parameterized above or below tight bounds. J. Comput. Syst. Sci. 77(2), 422–429 (2011) 19. Kratsch, S.: Polynomial kernelizations for MIN F+ Pi1 and MAX NP. In: STACS, pp. 601–612 (2009) 20. Lokshtanov, D., Mnich, M., Saurabh, S.: Linear kernel for planar connected dominating set. In: Chen, J., Cooper, S.B. (eds.) TAMC 2009. LNCS, vol. 5532, pp. 281–290. Springer, Heidelberg (2009) 21. Marx, D., O’Sullivan, B., Razgon, I.: Treewidth reduction for constrained separation and bipartization problems. In: STACS, pp. 561–572 (2010) 22. Misra, N., Philip, G., Raman, V., Saurabh, S., Sikdar, S.: FPT algorithms for connected feedback vertex set. In: Rahman, M. S., Fujita, S. (eds.) WALCOM 2010. LNCS, vol. 5942, pp. 269–280. Springer, Heidelberg (2010) 23. Niedermeier, R.: Invitation to Fixed-Parameter Algorithms. Oxford Lecture Series in Mathematics and its Applications, vol. 31. Oxford University Press, Oxford (2006) 24. Reed, B.A., Smith, K., Vetta, A.: Finding odd cycle transversals. Oper. Res. Lett. 32(4), 299–301 (2004) 25. Thomass´e, S.: A quadratic kernel for feedback vertex set. In: Proceedings of the 19th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2009), pp. 115–119. Society for Industrial and Applied Mathematics, Philadelphia (2009) 26. Thomass´e, S.: A 4k 2 kernel for feedback vertex set. ACM Transactions on Algorithms 6, 32:1–32:8 (2010)
Cograph Editing: Complexity and Parameterized Algorithms Yunlong Liu1 , Jianxin Wang2 , Jiong Guo3 , and Jianer Chen2,4 1
School of Mathematics and Computer Science, Hunan Normal University, Changsha 410013, P.R. China 2 School of Information Science and Engineering, Central South University, Changsha 410083, P.R. China 3 Universit¨ at des Saarlandes, Campus E 1.7, D-66123 Saarbr¨ ucken, Germany 4 Department of Computer Science and Engineering, Texas A&M University, College Station, TX 77843, USA
[email protected],
[email protected],
[email protected],
[email protected]
Abstract. Cograph Editing is to find for a given graph G = (V, E) a set of at most k edge additions and deletions that transform G into a cograph. The computational complexity of this problem was open in the past. In this paper, we show that this problem is NP-hard, and present a parameterized algorithm based on a refined search tree technique with a running time of O(4.612k + |V |4.5 )), which improves the trivial algorithm of running time O(6k + |V |4.5 ).
1
Introduction
A graph is a cograph if it can be generated from the single-vertex graph K1 by complementation and disjoint union. Equivalently, cographs are exactly the graphs containing no induced P4 (a cordless path with four vertices) [19]. In graph theory, cographs form an important and well-studied class of graphs. All complete graphs, complete bipartite graphs, threshold graphs, and Tur´an graphs are cographs. Many NP-complete problems on graphs are polynomial-time solvable, when the input is a cograph [5]. For a given graph G, Cograph Editing is to find a set of at most k edges to edit (add or delete) such that G can be modified into a cograph. The computational complexity of this problem was open in the past [2,13,16]. As pointed out in [18], Cograph Editing is fixed-parameter tractability. The parameterized version of this problem was defined as follows [18]. Parameterized Cograph Editing Input: An undirected graph G = (V, E) and an integer k ≥ 0.
This research was supported in part by the National Natural Science Foundation of China under Grant No.61070224 and No.61073036, the Research Project of Hunan Provincial Education Department under Grant No.10C0938, and the DFG Cluster of Excellence “Multimodal Computing and Interaction (MMCI)”.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 110–121, 2011. c Springer-Verlag Berlin Heidelberg 2011
Cograph Editing: Complexity and Parameterized Algorithms
111
Task: Find a set F of at most k edges and non-edges such that G = (V, (E\F )∪(F \ E)) belongs to cograph. (Adding the edges in F \ E and deleting the edges in F ∩ E result in a cograph). By Cai’s result [3], the parameterized Cograph Editing problem can be solved by a trivial search tree algorithm of running time O∗ (6k ). This algorithm identifies an induced P4 in the given graph and branches into all six possibilities of inserting or deleting one edge such that the P4 is eliminated (three cases of adding a new edge and three cases of deleting one existing edge). Recently, Guillemot et al. [9] presented a cubic vertex kernel for Cograph Editing. In addition, the edge editing problems for some special cographs, such as complete graphs and complete bipartite graphs, have been studied intensively by the parameterized approach [4,8,10]. In this paper, we first show that Cograph Editing is NP-complete, which answers an open problem from [2,13,16]. Based on a refined case study, an efficient parameterized algorithm with a running time of O(4.612k + |V |4.5 ) is presented, which significantly improves the previous trivial algorithm. Due to lack of space, some proofs are deferred to the full paper.
2
Preliminaries
In this section, we summarize related notations, definitions and lemmas that will be used in the paper. 2.1
Notations
We consider only simple and undirected graphs. For a graph G = (V, E), let n = |V | and m=|E|. For two vertices x and y, let (x, y) denote the edge between x and y. A subgraph of G induced by a set V ⊂ V is denoted by G[V ] = (V , E ), where E = {(u, v) | (u, v) ∈ E ∧ u, v ∈ V }. We denote with G = (V, E) the complement of G, where E = {(u, v) | (u, v) ∈ / E}. Adding an edge e to G and deleting an edge e from G are denoted by G + e and G − e, respectively. We use +e to denote the addition of edge e and use −e to denote the deletion of e. Moreover, given a set F of edge modifications, the graph resulting from applying F to G is denoted by GΔF . A set F of edge modifications is called a cograph edge-edition set for G if GΔF is a cograph. The set F is minimal if no proper subset of F is a cograph edge-edition set for G. Furthermore, the complement edge-edition set F of F = {+e1 , +e2 , . . . , +ei , −d1 , −d2 , . . . , −dj } is defined as F = {−e1 , −e2 , . . . , −ei , +d1 , +d2 , . . . , +dj }. 2.2
Spider Graphs
Following [1], a graph G is called a spider if the vertex set V (G) of G admits a partition into three sets S, K, and R such that: P1: |S| = |K| ≥ 2, the set S is a stable set, and the set K is a clique; P2: all vertices in R are adjacent to all vertices in K and to no vertex in S;
112
Y. Liu et al.
(a)
(b)
Fig. 1. A thin spider (a) and a thick spider (b) with |S| = |K| = 4 and |R| = 2
P3: there exists a bijection f : S → K such that exactly one of the following two statements holds: (i) for each vertex v ∈ S, N (v) ∩ K = {f (v)}; (ii) for each vertex v ∈ S, N (v) ∩ K = K \ {f (v)}. The triple (S, K, R) is called the spider-partition. If the condition of case P3(i) holds, then the spider G is called a thin spider, otherwise, G is a thick spider. Note that the complement of a thin spider is a thick spider and vice versa. Throughout this paper, the sets S, K, and R are called the feet, body, and head of the spider, respectively. Examples of spiders are given in Figure 1. 2.3
P4 -Sparse Graphs
A graph G is P4 -sparse if every induced subgraph with exactly five vertices contains at most one P4 [11]. This definition indicates a forbidden induced subgraph characterization that any 5-vertex subgraph induces two or more P4 ’s. On this basis, Nastos et al. [15] listed these forbidden subgraphs in Figure 2. To show the complementary relationship, we have adjusted the order of vertex labels in co-P5 , co-fork, and co-kite. Lemma 1. [12] For a graph G, the following conditions are equivalent: (i) G is a P4 -sparse graph; (ii) for every induced subgraph H of G with at least two vertices, exactly one of the following statements is satisfied: (a) H is disconnected; (b) H is disconnected; (c) H is a spider. It is easy to see that three pairs of subgraphs in Figure 2 are complementary to each other. In the following, we study the relationship of the edge modification sets for two complementary graphs. Theorem 1. Given a graph G with an edge modification set F , if F is a minimal cograph edge-edition set for G, then F is a minimal cograph edge-edition set for G. Proof. Let Gc be the cograph resulting from applying F to G and let Gc be the complement graph of Gc . Since the complement graph of a P4 is also a P4 , Gc is a cograph. Moreover, the opposite modifications in F can be used to modify the graph G, that is, the edges added to G are deleted from G and the edges deleted
Cograph Editing: Complexity and Parameterized Algorithms i
i i
j
h
l
u
l
j
i
h i
u
h
co-P5
l C5
i u
u
h
j co-fork
i
j
j
l
u
l
u
h kite
P5
113
j
h
l
l
u
j
h co-kite
fork
Fig. 2. Forbidden subgraphs for P4 -sparse graphs
from G are added to G. Consequently, the graph resulting from applying F to G is exactly the graph Gc . Therefore, F is a minimal cograph edge-edition set for G.
3
NP-Hardness
Natanzon et al. [16] summarized the complexity status of edge modification problems for 17 important graph classes. Later, Burzyn et al. [2] added other 11 classes. However, the complexity status of Cograph Editing has been left open in both work. Here, we show that Cograph Editing is NP-hard by observing that the reduction given for Cograph Deletion in [6, Theorem 3] works also for Cograph Editing. Theorem 2. Cograph Editing is NP-complete. Proof. The containedness is clear. For the hardness, we use the same reduction given in [6] from Exact 3-Cover to Cograph Deletion. Exact 3-Cover has as input a set S = {s1 , . . . , sn } with n = 3t for an integer t ≥ 0 and a collection C of 3-element subsets of S, that is, C = {S1 , . . . , Sm } where, for 1 ≤ i ≤ m, Si ⊆ S and |Si | = 3, and asks for a size-t subset C of C with S ∈C S = S. Here we only have to argue that the instance constructed by the reduction in [6] does not require any edge addition. For the sake of completeness, we give a brief description of the reduction in the following. Hereby, assume that Si = Sj for i = j and m > t. Let (G = (V, E), k) denote the instance to be constructed. First, we add a clique S = {s1 , . . . , sn } to G. Then, for every subset Si ∈ C, we construct a P3 -gadget Gi , which consists of three vertex subsets, Si , Xi , and Yi . Note that Si ⊆ S and, thus, forms a clique. Both Xi and Yicontain only new vertices and build cliques as well, Xi = 1 s 6 {x1i , . . . , xri } with r = 3t and Y i = {yi , . . . , yi } with s = 3m . And all possible 2 edges between Si and Xi and between Xi and Yi are present in Gi . Finally we set k := 3(m − t) · r + r − 3t. Next, we show the equivalence between the instances, that is, (S, C) is a yes-instance of Exact 3-Cover if and only if (G, k) is a yes-instance of Cograph Editing.
114
Y. Liu et al.
Given a subset C ⊆ C with |C | = t and S ∈C S = S, wecan easily construct a solution F for (G, k) which removes all edges between Xi and S with the only exception of the edges in the P3 -gadgets Gi which correspond to the subsets Si ∈ C . Moreover, F removes the edges between two elements s1 ∈ S and s2 ∈ S such that there is no S ∈ C with {s1 , s2 } ⊆ S . Observe that the resulting graph consists of m connected components, corresponding to the subsets in C. Moreover, each of these components is either a complete P3 -gadget or its subgraph induced by Xi ∪Yi . Therefore, the graph is P4 -free. Obviously, |F | = k. Suppose that we have a solution F with |F | ≤ k for G. It suffices to prove that there is no edge addition in F . Together with the proof in [6], this direction follows. Suppose that there is an edge (u, v) added by F . Let G = (V, E ) denote the graph resulting by applying F to G. Since S is clique in G, one of u and v must be from X i or Yi for some P3 -gadget Gi . First we show that u and v cannot be both from Yi . If this is not true, then assume u ∈ Yi for the P3 -gadget for a subset Si ∈ C and v ∈ Yj . Clearly, i = j. Since k < |Yj | = |Yi |, there must be a vertex y ∈ Yi and a vertex z ∈ Yj such that (u, z) ∈ / E , (v, y) ∈ / E, and (z, y) ∈ / E . Then we have a P4 in G . The same argument implies that we cannot have u ∈ Yi and v ∈ Xj . Next, we prove that u and v cannot be both from Xi . If not true, then assume u ∈ Xi and v ∈ Xj . Again, i = j. Then, by k < |Yi | = |Yj |, there must be a vertex y ∈ Yi which is in G adjacent to u but not adjacent to v. Analogously, there is a vertex z ∈ Yj which is adjacent to v but not to u. By the discussion above, (y, z) ∈ / E , we have then a P4 in G , a contradiction to the fact that F is a solution. Moreover, we prove the following claim. Claim. For every element s ∈ S, there is at most one Xi whose vertices are adjacent to s in G . Proof of Claim. Suppose that the claim is not true. Let u ∈ Xi and v ∈ Xj with i = j be two vertices adjacent to s ∈ S. Since k < |Yi | = |Yj |, we must have a set Y ⊆ Yi of vertices adjacent to u and a set Z ⊆ Yj of vertices adjacent to v / E , (y, v) ∈ / E, in G . As discussed above, for any y ∈ Y and z ∈ Z, (y, z) ∈ and (z, u) ∈ / E . We also know that (u, v) ∈ / E . Since F is a solution, (s, y) ∈ E and (s, z) ∈ E for all y ∈ Y and z ∈ Z. Note that all these edges must be added by F . However, since k < |Yi | = |Yj |, this is not possible. This proves the claim. The claim implies immediately that F contains at least 3(m − t) · r deletions of edges between Xi ’s and S. It remain only r − 3t edge modifications in F to be specified. Then we can conclude that every s ∈ S is adjacent to exactly one Xi such that there must be a P3 -gadget Gi in G containing both s and Xi . This excludes the possibility that F adds an edge between a vertex s ∈ S and a vertex x ∈ Xi such that s is not together with Xi in a P3 -gadget. Now, we are able to prove that there is no edge in G between vertices s1 , s2 ∈ S such that s1 is adjacent to Xi and s2 is adjacent to Xj in G for i = j. Suppose that there is such an edge. Let x1 ∈ Xi with (x1 , s1 ) ∈ E and x2 ∈ Xj with (x2 , s2 ) ∈ E . / E and (x2 , s1 ) ∈ / E . Moreover, we already By the above claim, (x1 , s2 ) ∈ know (x1 , x2 ) ∈ / E and have a P4 , a contradiction.
Cograph Editing: Complexity and Parameterized Algorithms
115
Finally, we continue with proving that F adds no edge (s, y) to G with s ∈ S and y ∈ Yj . Suppose not true. Let Gi denote the P3 -gadget whose Xi is in G adjacent to s and let u be a vertex in Xi that is adjacent to s in G . If j = i, then, by k < |Yi |, there is a subset Y ⊆ Yi whose vertices are adjacent to u in G and not adjacent to s. As shown above, (u, y) ∈ / E and (y, z) ∈ / E for any z ∈ Y . We have then a P4 in G , a contradiction. Consider now the case i = j. With all discussions above, we can conclude that the vertex set V (K) of every connected component K of G is a subset of the vertex set of a P3 -gadget Gi in G. Note that Gi is a P4 -free graph and thus, the subgraph of Gi induced by V (K) is cograph as well. This means that there is no edge modification needed for this subgraph. Thus, if there are edges inside of this subgraph added or deleted by F , then we can simply undo this edge modification, arriving at another solution with no edge addition. Hence, there is no edge between S and Yi ’s and between S and Xi ’s added. Altogether, there is no edge addition in F and the proof in [6] works for Cograph Editing.
4
A Parameterized Algorithm
In this section, we present an efficient parameterized algorithm for Cograph Editing. The basic strategy is as follows: edit the given graph to a P4 -sparse graph by a forbidden subgraph characterization, and then edit the resulting P4 -sparse graph to a cograph. Although this strategy is a variant of the one in [15], two novel techniques make our algorithm different from it. Firstly, since destroying a forbidden subgraph by editing is more complex than that only by deleting, we adopt some annotation rules to avoid complicated subcases. Secondly, an important observation for Cograph Editing is that, the cograph edge-edition set of a graph G is complementary to the cograph edge-edition set of G. Therefore, only three (instead of seven!) forbidden induced subgraphs given in Figure 2 are considered independently during editing the input graph to a P4 -sparse graph. 4.1
Editing P4 -Sparse Graphs to Cographs
We first show that editing a P4 -sparse graph to a cograph can be done in polynomial time. Since spider graphs are the basic components of P4 -sparse graphs, we consider first how to get a minimum cograph edge-edition set for spider graphs. Lemma 2. [15] Let G = (V, E) be a thin spider with body K = {k1 , . . . , k|K| } and feet S = {s1 , . . . , s|K| }, and (si , kj ) ∈ E if and only if i = j. Then, a minimum cograph edge-deletion set for G[K ∪S] is {−(si, ki ) | i = 1, . . . , |K|−1}. Based on lemma 2, we can get a similar lemma for the edge edition problem.
116
Y. Liu et al.
Lemma 3. Let G = (V, E) be a thin spider with body K = {k1 , . . . , k|K| } and feet S = {s1 , . . . , s|K| }, and (si , kj ) ∈ E if and only if i = j. Then, a minimum cograph edge-edition set for G[K ∪ S] is {−(si , ki ) | i = 1, . . . , |K| − 1}. Since thick spiders are complementary to thin spiders, the following lemma follows from Theorem 1 and Lemma 3. Lemma 4. Let G = (V, E) be a thick spider with body K = {k1 , . . . , k|K| } and feet S = {s1 , . . . , s|K| }, and (si , kj ) ∈ E if and only if i = j. Then, a minimum cograph edge-edition set for G[K ∪ S] is {+(si , ki ) | i = 1, . . . , |K| − 1}. Given a thin (or thick) spider graph G, we can easily get a minimum cograph edge-edition set F for G[K ∪ S] by employing Lemma 3 (or Lemma 4). Further, we extend these lemmas to the whole spider. Lemma 5. If F1 is a minimum cograph edge-edition set for G[K ∪ S], and F2 is a minimum cograph edge-edition set for G[R], then F1 ∪ F2 is a minimum cograph edge-edition set for G. Moreover, if the given graph is disconnected, we can consider the components separately. Lemma 6. Suppose that the input graph G consists of two connected components G1 = (V1 , E1 ) and G2 = (V2 , E2 ) with V1 ∩ V2 = ∅. Let F1 be a minimum cograph edge-edition set for G1 and F2 be a minimum cograph edge-edition set for G2 . Then, F1 ∪ F2 is a minimum cograph edge-edition set for G. Next, we present the algorithm for editing P4 -spare graphs to cographs. Theorem 3. Given a P4 -sparse graph G = (V, E), Algorithm EDP4 given in Figure 3 computes a minimum cograph edge-edition set for G in O(|V | + |E|) time. Proof. By Lemma 1, G can be decomposed into some spider graphs. Steps 1 and 2 in Algorithm EDP4 are to decompose the given P4 -spare graph recursively. Moreover, if G is disconnected, then the union of the cograph edge-edition sets for the connected components of G forms a solution for G according to Lemma 6. Otherwise, if G is disconnected, we first find a solution Q for G, and then set Q as the solution for G according to Theorem 1. For any spider graph G, Steps 4 and 5 find a minimum cograph edge-edition set for G[K ∪ S] according to Lemmas 3 and 4. In Step 6, the cograph edge-edition set for G[K ∪ S] can be combined with the edge-edition set for G[R] to get a complete solution to the cograph edge-edition problem on G, according to Lemma 5. Thus, Algorithm EDP4 is correct. Algorithm EDP4 can be implemented in O(|V | + |E|) time: Applying the modular decomposition [14] to G, we can identify the connected or co-connected components of G in O(|V |+|E|) time. Moreover, the spider structure of P4 -sparse graphs also can be identified in the same time bound [12].
Cograph Editing: Complexity and Parameterized Algorithms
117
Algorithm EDP4(G) Input: A P4 -sparse graph G = (V, E) Output: A cograph edge-edition set for G 1. If G is disconnected then Let C1 , . . . , Cp be the connected components of G; Recurse on each Ci and add EDP4(Ci ) to the solution set D; 2. If G is disconnected then Let C1 , . . . , Cp be the connected components of G ; Q=EDP4(C1 ) ∪ · · · ∪ EDP4(Cp ) ; Add the modifications in Q to the solution set D; 3. G is a spider with body K = {k1 , . . . , k|K| } and feet S = {s1 , . . . , s|K| } 4. If G is a thin spider then Notation: ki adjacent to sj if and only if i = j; Add −(ki , si ) to the solution set D for every i = 1, . . . , |K| − 1; 5. If G is a thick spider then Notation: ki adjacent to sj if and only if i = j; Add +(ki , si ) to the solution set D for every i = 1, . . . , |K| − 1; 6. Recurse on the head R of the spider. Return D ∪ EDP4(R) . Fig. 3. An algorithm for editing P4 -sparse graphs
4.2
Editing Graphs to P4 -Sparse Graphs
Assume that the input graph is not a P4 -sparse graph, that is, it contains at least one forbidden subgraph shown in Figure 2. In this subsection, we will show how to eliminate these forbidden subgraphs by using a search tree approach. According to Theorem 1, these seven forbidden induced subgraphs in Figure 2 can be reduced to three seminal subgraphs (C5 can also be reduced to P5 and coP5 ). The basic strategy is to destroy the P4 ’s in the subgraph by branching into six subcases, three of them adding one edge and the other three deleting one edge. As in [8], we annotate some vertex pairs in the graph with the labels “forbidden” and “permanent”. A forbidden vertex pair means that it is not allowed to have an edge between these two vertices; if the input graph has an edge here, then it must be deleted. In contrast, a permanent label enforces the addition of an edge between these two vertices, if not present in the input graph, and this edge cannot be deleted by any solution. There are two rules for annotating vertex pairs: (1) After an edge is deleted (or added), the corresponding vertex pair is labeled as forbidden (or permanent). (2) While branching on a P4 , we sort the six subcases in an arbitrary order. If one subcase adds (or deletes) an edge between a vertex pair, then all succeeding subcases annotate this vertex pair as forbidden (or permanent). These rules is trivially correct and can be implemented in constant time. Next, we present the branching rules. The branching rule for P5 (and co-P5 ) is depicted in Figure 4. The edge modifications applied by these cases are as follows: {−(j, h)}, {−(h, l)}, {−(l, u), −(i, j)}, {−(l, u), +(i, h)}, {−(l, u), +(i, l)}, {−(l, u), +(j, l)}, {+(h, u), −(i, j)}, {+(h, u), +(i, h)}, {+(h, u), +(j, l), +(i, u)},
118
Y. Liu et al. 21
i
22
j
h
u
l
i
23
j
h
u
l
24
i
j
h
u
l
i
j
h
u
l
2
i
1
i
j
h
l
j
h
l
u
i
j
h
l
h
l
u
j
4
h
l
u
h
i
u
l
i
h
u
l
6
u
j
h
l
u
i
j
h
l
j
l
u
i
j
h
h
l
u
j
h
l
u
i
j
i j
h
h
l
u
i
j
h
l
u
j
h
l
u
j
h
l
u
j
h
l
u
j
h
l
u
j
j
h
l
u
j
h
l
u
62
i
53
u
44 431
61
i
52
43
i
j
51
j 42
3
5
j
41
i
u
l
i i
i
h
u
63
54
i
i
u
l
441
i
541
i
631
i
Fig. 4. Branching on a P5 . All bold lines and dashed lines are annotated as permanent and forbidden, respectively. Moreover, the dashed lines on the P5 denote deleted edges, while the bold lines not on the P5 are added edges.
{+(h, u), +(i, l), +(i, u)}, {+(j, u), −(i, j)}, {+(j, u), +(i, l)}, {+(j, u), +(j, l)}, {+(j, u), +(i, h), +(i, u)}, {+(j, l), −(i, j)}, {+(j, l), +(i, l)}, {+(j, l), +(i, u), +(i, h)}. For co-P5 ’s we consider the same 17 subcases. However, the edge modifications of the subcases are the complement of modifications of the subcases for P5 ’s. Lemma 7. The branching rule shown in Figure 4 is correct and the corresponding branching number is less than 4.588. The branching rule for kites is depicted in Figure 5. The corresponding edge modifications are as follows: {−(l, u)}, {+(j, l)}, {+(j, u)}, {−(i, l), −(j, h)}, {−(i, l), −(h, l)}, {−(i, l), +(h, u), −(i, j)}, {−(i, l), +(h, u), +(i, h)}, {−(i, j), −(j, h)}, {−(i, j), −(h, l)}, {−(i, j), +(h, u), +(i, h)}, {+(i, u), +(h, u)}, {+(i, u), −(j, h), −(h, l)}, {+(i, u), +(i, h), −(j, h)}, {+(i, u), −(h, l), +(i, h)}. As in the case of P5 and co-P5 , co-kites can be handled in a similar way as kites. Lemma 8. The branching rule shown in Figure 5 is correct and the corresponding branching number is less than 4.434. The branching rule for forks (and co-forks) is shown in Figure 6. The corresponding edge modifications are as follows: {−(l, u)}, {−(h, l)}, {+(h, u)}, {−(i, h), −(j, h)}, {−(i, h), +(j, l)}, {−(i, h), +(j, u)}, {+(i, l), −(j, h)}, {+(i, l), +(j, l)}, {+(i, l), +(i, j), +(j, u)}, {+(i, u), −(j, h)}, {+(i, u), +(j, u)}, {+(i, u), +(j, l), +(i, j)}.
Cograph Editing: Complexity and Parameterized Algorithms
i
2
i
1
j
l
j u
l
j
h i
h j
i
3
u
l
u
l
u
h u
l h
i
4
u l h
u l
j
l
i
j
u l
j
u
i
h
uj
h
l
j
u
63
h
j
u
i
j
u
l
u
u
h
i
631
j
u
h
h
l h
l
622
u i
l
l
i
531
l
j
i
621
h 432
l
h u i
l h 62
i
h 431
61
u
h 53 j
u
i
i
h 52 j
i
43
j j
l
j
i
h 42 j
u
h
i
i
6
l
j
51
l
j
u
h
i
41
i
5
l
j
h
Fig. 5. Branching on a kite
i
i
1
2
h
l
j
i
h
u
l
j i h
i
i
51
h
j
j
u
l
h
l
j
h j
l
u
h
j
j
l
u
l
u
u
i 63
l
h j
i 531
h
j
i 53
u
l
u
l
u
i 62
h
i 43
h
j
i j
u
u
l
j
i l
h
u
61
h
52
i 42
l
j
i
u
6
h
u
l
j 41
l
u
l
i
5
h
h j
j i
4
3
u
l
u
l
u
i h
631
Fig. 6. Branching on a fork
j
h
119
120
Y. Liu et al.
Lemma 9. The branching rule shown in Figure 6 is correct and the corresponding branching number is less than 4.612. Finally, we consider C5 ’s, which can be reduced to the case of P5 ’s or co-P5 ’s. We choose one P4 in C5 and branch it into six subcases. Each of the resulting 6 graphs is either a P5 or a co-P5 . Then, we can apply the branching rule for P5 ’s and co-P5 ’s to these graphs. After eliminating duplicated subcases, we have altogether 40 subcases. Lemma 10. The branching rule for C5 is correct and has a branching number less than 4.151. The next theorem summarizes the findings from this and the previous subsections. Theorem 4. Cograph Editing can be solved in O(4.612k + |V |4.5 ) time. Proof. Given a graph G, we first verify whether it is a P4 -sparse graph. If G is not a P4 -sparse graph, then there exists at least one forbidden subgraph induced by five vertices in G. To destroy all these forbidden subgraphs, we apply the branching rules from Lemma 7 to Lemma 10. Thus, we can compute a P4 -sparse graph from G in O(4.612k (|V | + |E|)) time, since the search tree has a size bounded by 4.612k and the forbidden subgraphs can be found in O(|V | + |E|) time. Moreover, Cograph Editing admits a problem kernel with O(k 3 ) vertices [9]. Although the time of this kernelization algorithm is not specified in [9], we can analyse its time to O(n4.5 ). Its time is dominated by the time needed by the sunflower rule. For this rule, we count the number of P4 ’s, that contain one specified vertex pair as the unique common edge (or non-edge), mainly by finding a maximum matching on a bipartite graph in O(n2.5 ) time. Since there are at most n2 vertex pairs, the time for applying this rule exhaustively is O(n4.5 ). By employing the interleaving technique [17], the running time of computing a P4 -sparse graph from G can be improved to O(4.612k + |V |4.5 ). Since, by Theorem 3, the step from P4 -sparse graphs to cographs is linear-time doable, the theorem follows.
5
Conclusions
In this paper, we study the computational complexity and present a parameterized algorithm for Cograph Editing. We show that Cograph Editing is NP-hard, settling an open problem in [2,16]. There are still some edge edition problems, whose computational complexity is unknown, for instance, Trivially Perfect Editing and Threshold Editing [2,13,16]. Another possible research direction would be to use the automated approach from [7] to improve the running time of our parameterized algorithm.
Cograph Editing: Complexity and Parameterized Algorithms
121
References 1. Asdre, K., Nikolopoulos, S.D., Papadopoulos, C.: An optimal parallel solution for the path cover problem on P4 -sparse graphs. Journal of Parallel and Distributed Computing 67(1), 63–76 (2007) 2. Burzyn, P., Bonomo, F., Dur´ an, G.: NP-completeness results for edge modification problems. Discrete Applied Mathematics 154(13), 1824–1844 (2006) 3. Cai, L.: Fixed-parameter tractability of graph modification problems for hereditary properties. Information Processing Letters 58(4), 171–196 (1996) 4. Chen, J., Meng, J.: A 2k kernel for the cluster editing problem. In: Thai, M.T., Sahni, S. (eds.) COCOON 2010. LNCS, vol. 6196, pp. 459–468. Springer, Heidelberg (2010) 5. Corneil, G., Perl, Y., Stewart, L.K.: A linear recognition algorithm for cographs. SIAM Journal on Computing 14(4), 926–934 (1985) 6. El-Mallah, E.S., Colbourn, C.J.: The complexity of some edge deletion problems. IEEE Transactions on Circuits and Systems 35(3), 354–362 (1988) 7. Gramm, J., Guo, J., H¨ uffner, F., Niedermeier, R.: Automated generation of search tree algorithms for hard graph modification problems. Algorithmica 39(4), 321–347 (2004) 8. Gramm, J., Guo, J., H¨ uffner, F., Niedermeier, R.: Graph-modeled data clustering: Exact algorithms for clique generation. Theory of Computing Systems 38(4), 373– 392 (2005) 9. Guillemot, S., Paul, C., Perez, A.: On the (Non-)existence of polynomial kernels for Pl -free edge modification problems. In: Raman, V., Saurabh, S. (eds.) IPEC 2010. LNCS, vol. 6478, pp. 147–157. Springer, Heidelberg (2010) 10. Guo, J., H¨ uffner, F., Komusiewicz, C., Zhang, Y.: Improved algorithms for bicluster editing. In: Agrawal, M., Du, D.-Z., Duan, Z., Li, A. (eds.) TAMC 2008. LNCS, vol. 4978, pp. 445–456. Springer, Heidelberg (2008) 11. Ho` ang, C.T.: Perfect graphs. PhD Thesis, School of Computer Science. McGill University, Montreal (1985) 12. Jamison, B., Olariu, S.: Recognizing P4 -sparse graphs in linear time. SIAM Journal on Computing 21(2), 381–406 (1992) 13. Mancini, F.: Graph Modification Problems Related to Graph Classes. PhD Thesis, University of Bergen (2008) 14. McConnell, R.M., Spinrad, J.: Modular decomposition and transitive orientation. Discrete Mathematics 201(1-3), 189–241 (1999) 15. Nastos, J., Gao, Y.: A novel branching strategy for parameterized graph modification problems. In: Wu, W., Daescu, O. (eds.) COCOA 2010, Part II. LNCS, vol. 6509, pp. 332–346. Springer, Heidelberg (2010) 16. Natanzon, A., Shamir, R., Sharan, R.: Complexity classification of some edge modification problems. Discrete Applied Mathematics 113(1), 109–128 (2001) 17. Niedermeier, R., Rossmanith, P.: A general method to speed up fixed-parameter tractable algorithms. Information Processing Letters 73, 125–129 (2000) 18. Protti, F., Silva, M.D., Szwarcfiter, J.L.: Applying Modular Decomposition to Parameterized Cluster Editing Problems. Theory of Computing Systems 44, 91–104 (2009) 19. Seinsche, D.: On a property of the class of n-colorable graphs. Journal of Combinatorial Theory, Series B 16, 191–193 (1974)
Approximation Complexity of Complex-Weighted Degree-Two Counting Constraint Satisfaction Problems (Extended Abstract) Tomoyuki Yamakami Department of Information Science, University of Fukui 3-9-1 Bunkyo, Fukui 910-8507, Japan
Abstract. Constraint satisfaction problems have been studied in numerous fields with practical and theoretical interests. Recently, major breakthroughs have been made in the study of counting constraint satisfaction problems (or simply #CSPs). In particular, a computational complexity classification of bounded-degree #CSPs has been discovered for all degrees except for two, where the degree of an instance is the maximal number of times that each input variable appears in any given set of constraints. This paper challenges an open problem of classifying all degree-2 #CSPs on an approximate counting model and presents its partial solution by developing two novel proof techniques—T2 -constructibility and parametrized symmetrization—which are specifically designed to handle arbitrary constraints under approximation-preserving reductions. Our proof exploits a close relationship between complex-weighted degree2 #CSPs and Holant problems, which are a natural generalization of complex-weighted #CSPs. Keywords: counting CSP, bounded degree, Holant problem, signature, AP-reducibility, constructibility, symmetrization.
1
Bounded-Degree #CSPs
Constraint satisfaction problems (or CSPs, in short), which are composed of “variables” (on appropriate domains) and “constraints” among those variables, have been studied with practical and theoretical interests in various fields, including artificial intelligence, database theory, graph theory, and statistical physics. A decision version of CSPs asks whether, given a list of constraints on variables, there exists a variable assignment that satisfies all the constraints. Schaefer [11] first charted a whole map of the computational complexity of Boolean CSPs (i.e., CSPs with constraints on the Boolean domain) parametrized by a choice of constraint set. Of numerous variants of CSPs, counting CSPs (or #CSPs) ask how many variable assignments satisfy all given constraints. As a typical #CSP, the counting satisfiability problem (or #SAT) counts the total number of satisfiable assignments for each given logical formula. This problem #SAT is known to be computationally hard for Valiant’s class #P of counting functions. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 122–133, 2011. c Springer-Verlag Berlin Heidelberg 2011
Counting Constraint Satisfaction Problems
123
In the past two decades, a great progress has been observed in the study of #CSPs and their variants. The first major leap came in 1996 when Creignou and Hermann [5] discovered a precise classification of the computational complexity of every unweighted #CSP (i.e., a #CSP with Boolean-valued constraints). Their classification theorem asserts that, when constraints are limited to a fixed set F , every #CSP (denoted #CSP(F )) can be classified into one of the following two categories: polynomial-time computable problems or #P-hard problems. This statement is known as a dichotomy theorem on an exact counting model. In many real life problems, however, constraints often take real values rather than Boolean values. It is therefore imperative to expand the scope of constraints from Boolean values to real values. An early extension was made by Dyer, Goldberg, and Jerrum [9] to constraints with nonnegative rational values. After a series of work in a theory of signatures, Cai, Lu, and Xia [3] finally gave a most general form of classification theorem for complex-weighted #CSPs (i.e., #CSPs with complex-valued constraints). Another major progress has been reported in the area of the approximation complexity of #CSPs. Using a notion of approximation-preserving (AP) reducibility given in [7], Dyer, Goldberg, and Jerrum [10] determined the approximation complexity of every unweighted #CSP. Unlike the aforementioned exact-complexity classification, unweighted #CSPs are classified into three categories, which include an intermediate level between polynomial-time computable problems and #P-hard problems. Therefore, this so-called trichotomy theorem draws a clear contrast between approximation complexity and exact complexity. In 2010, the scope of this result was extended from unweighted #CSPs to complex-weighted #CSPs [13], provided that all unary constraints are freely available. Since unary constraints are less significant, they have been often assumed to be given for free (in, e.g., [3,4,6,8]) to obtain stronger classification theorems. For a clarity purpose, we use “∗” (asterisk) as in “#CSP∗ ” to highlight this particular use of free unary constraints. A recent extensive study has moved to target another important refinement of #CSPs—bounded-degree #CSPs—where the degree is the maximal number of times that each variable appears in any given set of constraints. A complete classification was lately given by Dyer, Goldberg, Jalsenius, and Richerby [8] to unweighted bounded-degree #CSP∗ s when the degree exceeds 2. Subsequently, their result was extended to complex-weighted #CSP∗ s of degree at least 3 [14]. A missing piece in a classification map is the approximation complexity of #CSP∗ s of degree exactly 2. Despite our efforts, nevertheless, degree-2 #CSPs have eluded from our understandings and it has remained open to discover a complete classification of their approximation complexity. In this paper, we give a partial solution to this open problem. Our solution exploits a fact that the computational complexity of #CSP∗ s is closely linked to that of Holant∗ problems, where Holant∗ problems were introduced by Cai et al. [2] to generalize a framework of #CSP∗ s (motivated and influenced by Valiant’s holographic reductions and algorithms [12]), provided that all unary constraints are given for free. In this framework, complex-valued constraints on
124
T. Yamakami
Boolean variables are called (complex-valued) signatures. In general, a Holant∗ problem asks to compute the total weights of the products of the values of signatures over all possible edge-assignments to an (undirected) input graph. It was noted in [14] that, degree-2 #CSP∗ (F )’s (denoted succinctly #CSP∗2 (F )’s) are “approximately” equivalent in complexity to Holant∗ (F )’s, i.e., Holant∗ problems whose signatures are limited to F . Recently, on an exact counting model, Cai, Lu, and Xia et al. [3] proved a dichotomy theorem for Holant∗ problems with symmetric signatures and later they extended this result to arbitrary signatures [4]. However, their proof arguments may not be carried over to an approximate counting model. This paper presents two approximation classification theorems for complexweighted degree-2 Boolean #CSP∗ s. Our major contributions are two fold: (1) we develop a systematic technique of handling arbitrary constraints and (2) we demonstrate two classification theorems regarding the approximation complexity of complex-weighted #CSP∗ s associated with particular types of constraints. To be more precise, in the first classification theorem, we first define a ternary constraint set SIG and prove that, for any constraint f outside of SIG, #CSP∗2 (f ) is at least as hard as #SAT. This result leaves our remaining task to focus only on ternary constraints residing within SIG. We then split SIG into three parts—SIG0 , SIG1 , and SIG2 —and, in the second classification theorem, we target SIG1 and give a complete classification to all degree-2 #CSP∗ s whose constraints are drawn from SIG1 . The other two sets will be handled in separate papers. The second classification theorem is roughly stated as follows: for any set F of constraints in SIG1 , if F is contained within a certain well-defined set DUP, then #CSP∗2 (F ) is solvable in polynomial time; otherwise, #CSP∗2 (F ) is computationally hard for #P under certain AP-reductions. In fact, we can precisely describe the requirements of constraints to be #P-hard. To prove the second theorem, in particular, we require new ideas and new technical tools: T2 -constructibility and parameterized symmetrization scheme, which will be explained in subsequent sections.
2
Fundamental Notions and Notations
Let N and C denote respectively the sets of all nonnegative integers and of all complex numbers. For each number n ∈ N, the notation [n] denotes the integer set {1, 2, . . . , n}. For any complex number α ∈ C, |α| (resp., arg(α)) denotes the absolute value (resp., argument) of α. For any positive integer k, Sk denotes the set of all permutations over [k]. For brevity, we express each permutation σ ∈ Sk as (a1 a2 . . . ak ), whenever σ(i) = ai holds for any index i ∈ [k]. 2.1
Signatures, #CSPs, and Holant Problems
The most fundamental concept in this paper is “signature” on the Boolean domain. Instead of the more conventional term “constraint,” we intend to use the term “signature” in accordance with our reference to Holant∗ problems. A
Counting Constraint Satisfaction Problems
125
(complex-valued) signature of arity k is a k-ary complex-valued function, that is, f is a map from {0, 1}k to C. Assuming the standard lexicographic order on {0, 1}k , we conveniently express f as a column-vector consisting of its output k values, which can be identified with an element in the space C2 . For instance, if f has arity 2, then f is expressed as (f (00), f (01), f (10), f (11)). A signature f is called symmetric if f ’s values depend only on the Hamming weight of its inputs. By contrast, an asymmetric signature is a signature that is not symmetric. When f is a k-ary symmetric signature, we use another notation f = [f0 , f1 , . . . , fk ], where each fi is the value of f on inputs of Hamming weight i. As special signatures, we define OR = [0, 1, 1], N AN D = [1, 1, 0], ON E3 = [1, 1, 0, 0] (at most one “1”), and EQk = [1, 0, . . . , 0, 1] (k − 1 zeros) for each number k ≥ 1. To simplify our further descriptions, it is better to introduce the following two special sets of signatures: U denotes the set of all unary signatures and DG denotes the set of all signatures f that are expressed by products of unary functions. A signature in DG is called degenerate. Clearly, U ⊆ DG holds. Let us define complex-weighted Boolean #CSP problems. Limited to each set F of signatures, a complex-weighted (Boolean) #CSP problem, denoted #CSP(F ), takes a finite set H of the form h, (xi1 , xi2 , . . . , xik ) over Boolean variables x1 , x2 , . . . , xn , where it outputs the value i1 , . . . , ik ∈ [n] and h ∈ F, and h(x , x , . . . , x ), where x = (xi1 , xi2 , . . . , xik ). i i i 1 2 k x1 ,x2 ,...,xn ∈{0,1} h,x ∈H The degree of an input instance to #CSP(F ) is the greatest number of times that any variable appears among its signatures. For any positive integer d, let #CSPd (F ) denote the restriction of #CSP(F ) to instances of degree at most d. We want to view #CSPs from a slightly different perspective, called a Holant framework. We pay our special attention to so-called Holant problems [2,3]. An input instance of a Holant problem, Holant(F ), is a signature grid Ω = (G, F , π) that contains an undirected graph G whose nodes are labeled by signatures in a finite subset F ⊆ F, specified by a labeling function π. It computes the sum of products of given signatures over all 0-1 edge-assignments. As a special case, we define a bipartite Holant problem, Holant(F1 |F2 ), (on a Boolean domain) that takes a signature grid Ω composed of a finite undirected bipartite graph, in which all nodes on its left-hand side have labels drawn from a finite subset of F1 and all nodes on the right-hand side have labels from a finite subset of F2 . We can treat #CSP(F ) (as well as #CSPd (F )) as a special case of bipartite Holant problem. In terms of Holant problems, #CSP(F ) coincides with Holant({EQk }k≥1 |F). For convenience, we interchangeably use these two different views of complex-weighted #CSP problems. This viewpoint redefines the degree of an instance to be just the maximum degree of nodes that appear on the left-hand side of a bipartite graph in the instance. Throughout this paper, we use the following abbreviations. For instance, we write #CSP(f, F , G) to mean #CSP({f } ∪ F ∪ G), and Holant(f, F , G) to mean Holant({f } ∪ F ∪ G). Moreover, we abbreviate #CSP(U, F ), #CSPd (U, F ), and Holant(U, F ) as #CSP∗ (F ), #CSP∗d (F ), and Holant∗ (F ), respectively. As an example of computationally-hard counting problems, we use a complexweighted version of the counting satisfiability problem, denoted #SATC , which
126
T. Yamakami
was introduced in [13], in which we compute the sum of all complex-weights of satisfying assignments, where the weight of an assignment σ is the product of all node weights chosen by σ. 2.2
FPC and AP-Reducibility
As a formal treatment, we take a view that #CSP∗ s are complex-valued functions mapping from {0, 1}∗ to C, and we follow notational conventions used in [13,14]. To step away from arguing which definition of “polynomial-time computable” complex numbers in the past literature is appropriate, we rather treat complex numbers simply as “objects” and apply only “primitive” operations (e.g., addition, multiplication, division, etc.) to manipulate those numbers. For simplicity, the execution time of an algorithm that handles those numbers is assumed to be proportional to the total number of primitive operations used by the algorithm. (See [1,2,3,13,14] for further justification.) Following our treatment of C, we define FPC as the collection of all complexvalued functions that can be computed deterministically in polynomial time. Notice that any complex number w can be expressed in a polar form as √ |w|ei arg(w) , where i = −1 and e is the base of natural logarithms. A randomized approximation scheme for (complex-valued) F is a randomized algorithm that takes a standard input x ∈ Σ ∗ (where Σ is an underlying alphabet) together with an error tolerance parameter ε ∈ (0, 1), and outputs values w with probability at least 3/4 for which 2− ≤ |w/F (x)| ≤ 2 and |arg(w/F (x))| ≤ , where we conventionally assume that, whenever |F (x)| = 0 or arg(F (x)) = 0, we instead require |w| = 0 or | arg(w)| ≤ . Furthermore, when a randomized approximation scheme for F runs in time polynomial in (|x|, 1/ε), we call it a fully polynomial-time randomized approximation scheme (or FPRAS) for F . Given two functions F and G, a polynomial-time approximation-preserving reduction (or AP-reduction) from F to G [7] is a randomized algorithm M that takes a pair (x, ε) ∈ Σ ∗ × (0, 1) as input, uses as oracle an arbitrary randomized approximation scheme N for G, and satisfies the following three conditions: (i) M is still a randomized approximation scheme for F ; (ii) every oracle call made by M is of the form (w, δ) ∈ Σ ∗ × (0, 1) with 1/δ ≤ poly(|x|, 1/ε) and its answer is the outcome of N on (w, δ); and (iii) the running time of M is upper-bounded by a certain polynomial in (|x|, 1/ε), which is not depending on the choice of N . If such an AP-reduction exists, then we also say that F is AP-reducible to G and we write F ≤AP G. If F ≤AP G and G ≤AP F , then F and G are said to be AP-equivalent and we use the notation F ≡AP G to express the AP-equivalence.
3
Main Theorems
We challenge an unsolved question of determining the approximation complexity of degree-2 #CSP∗ s with a help of two new powerful techniques, which can handle arbitrary ternary signatures. We will give a partial answer to this question
Counting Constraint Satisfaction Problems
127
by presenting two main theorems—Theorems 1 and 2—which are obtained by applying two new techniques to the degree-2 #CSP∗ s with arbitrary ternary signatures. 3.1
Symmetric Signatures of Arity 3
We begin with a short discussion on symmetric signatures of arity 3. In recent years, Holant∗ problems with symmetric signatures have been extensively discussed and a crucial progress was made by Cai, Lu, and Xia [3]. All Holant∗ (f )’s with symmetric signatures f are classified nicely into two classes: problems that are polynomial-time solvable or problems that are at least as hard as #SATC . In their classification, Cai et al. recognized two categories of ternary symmetric signatures. A ternary signature of the first category has the form [a, b, −a, −b] with two constants a, b ∈ C. In contrast, a ternary signature [a, b, c, d] of the second category satisfies the following condition: there exist two constants α, β ∈ C (not both zero) for which αa + βb − αc = 0 and αb + βc − αd = 0. For later convenience, we call this pair (α, β) the binding coefficients of the signature. To simplify our description, the notations Sig (1) and Sig (2) respectively represent the sets of all signatures of the first category and of the second category. Cai et al. then proved three key lemmas, which eventually lead to their final dichotomy theorem for symmetric Holant∗ problems. By a careful examination of their proofs, we find them valid on an approximate counting model, and therefore their lemmas become a foundation to our main theorems. For brevity, let B =def {(OR|EQ3 ), (N AN D|EQ3 ), (EQ2 |ON E3 )}. Lemma 1. Let f be any ternary non-degenerate symmetric signature and let g = [c0 , c1 , c2 ] be any non-degenerate signature. 1. If f is not in Sig (1) ∪ Sig (2) , then there exists a pair (h1 |h2 ) ∈ B such that Holant∗ (h1 |h2 ) ≤AP Holant∗ (f ). 2. If f ∈ Sig (1) , c0 + c2 = 0, and g ∈ {[λ, 0, λ] | λ ∈ C}, then there exists a pair (h1 |h2 ) ∈ B such that Holant∗ (h1 |h2 ) ≤AP Holant∗ (f, g). 3. Assume that f ∈ Sig (2) with its binding coefficients (α, β). If αc0 + βc1 − αc2 = 0 and g ∈ {[2αλ, βλ, 2αλ] | λ ∈ C}, then there exists a pair (h1 |h2 ) ∈ B such that Holant∗ (h1 |h2 ) ≤AP Holant∗ (f, g). Proof. We prove only (1). In this proof, we use a notion of T2 -constructibility and Lemma 4, which will be described in Section 4. Following an argument of Cai, Lu, and Xia [3], for given signatures f and g, we first choose a pair (h1 |h2 ) ∈ B so that Holant∗ (h1 |h2 ) is transformed into Holant∗ (f |h ), where h is a certain binary signature, by Valiant’s holographic transformation (see, e.g., [12]). Notice that an application of holographic transformation does not alter an output value of a Holant∗ problem on every instance. Hence, this transformation still works on our approximate counting model. Hence, we conclude that Holant∗ (h1 |h2 ) ≤AP Holant∗ (f |h ). We then choose a finite subset F ⊆ U so that h can be T2 constructed from signatures in F ∪ {f }. Therefore, by applying Lemma 4, we obtain the lemma. 2
128
3.2
T. Yamakami
Arbitrary Signatures of Arity 3
Now, we turn our attention to arbitrary signatures of arity 3 and their associated degree-2 #CSP∗ s. The dichotomy theorem of Cai et al. [3] for symmetric Holant∗ problems hinges on the two signature sets Sig (1) and Sig (2) . To aim at obtaining a similar classification for all ternary signatures, we wish to take a systematic approach with an introduction of two useful tools. Since these tools are not limited to a particular type of signatures, as a result, we can obtain a general classification of the approximation complexity of every degree-2 #CSP∗ . The first new technical tool is “symmetrization” of arbitrary signatures. Another new technical tool is a notion of T2 -constructibility that bridges between symmetrization and degree-2 #CSP∗ s. Throughout this section, let f be any ternary signature with complex components; in particular, we assume that f = (a, b, c, d, x, y, z, w). For this f , we introduce a simple form of symmetrization, denoted Sym(f ), as follows: f (x1 , x2 , z2 )f (y1 , y2 , x2 )f (z1 , z2 , y2 ). Sym(f )(x1 , y1 , z1 ) = x2 ,y2 ,z2 ∈{0,1}
Lemma 2. For any ternary signature f , Sym(f ) is a symmetric signature. Proof. It suffices to show that Sym(f )(x1 , y1 , z1 ) = Sym(f )(y1 , z1 , x1 ). To the above definition of Sym(f )(x1 , y1 , z1 ), we apply the following map: x2 → y2 , y2 → z2 , and z2 → x2 . We then obtain the definition of Sym(f )(y1 , z1 , x1 ). 2 A significant nature of the symmetrization Sym(·) is that Sym(·) behaves quite differently on Sig (1) and Sig (2) . Lemma 3. Let f be any ternary signature. (1) If f ∈ Sig (1) , then Sym(f ) is in DG. (2) If f ∈ Sig (2) , then Sym(f ) is in Sig (2) . Given a permutation σ ∈ S3 , we write fσ for the signature g defined by g(x1 , x2 , x3 ) = f (xσ(1) , xσ(2) , xσ(3) ) for any Boolean values x1 , x2 , x3 ∈ {0, 1}. Let us consider the symmetrization Sym(fσ ) of the signature fσ for any given permutation σ ∈ S3 over variable indices. Now, we introduce a fundamental signature set: SIG = {f | ∀σ ∈ S3 [Sym(fσ ) ∈ DG −→ Sym(fσ ) ∈ Sig (1) ∪ Sig (2) ]}. Our first theorem—Theorem 1—gives a simple classification of the approximation complexity of degree-2 #CSP∗ s whose signatures fall into outside of SIG. Theorem 1. For any ternary signature f , if f ∈ SIG, then #SATC ≤AP #CSP∗2 (f ). The proof of Theorem 1 requires a new notion of T2 -constructibility, and therefore the proof is postponed until Section 4. This theorem makes it sufficient to discuss only signatures residing within SIG. To analyze SIG, we roughly partition it into three parts. Let SIG0 be the set of all ternary signatures f
Counting Constraint Satisfaction Problems
129
for which Sym(fσ ) is always degenerate for every variable permutation σ ∈ S3 . Next, for each index i ∈ {1, 2}, let SIGi denote the set of all ternary signatures f such that, for a certain permutation σ ∈ S3 , both Sym(fσ ) ∈ Sig (i) and Sym(fσ ) ∈ DG hold. It is obvious by those definitions that SIG ⊆ SIG0 ∪ SIG1 ∪ SIG2 . Therefore, if we successfully classify all degree-2 #CSP∗ s whose signatures belong to each of SIGi ’s, then we immediately obtain the desired complete classification of all degree-2 #CSP∗ s. Since a whole analysis of SIG seems quite lengthy, this paper is focused only on SIG1 , i.e., SIG1 = {f | ∃σ ∈ S3 ∃a, b ∈ C s.t. Sym(fσ ) = [a, b, −a, −b] & a2 + b2 = 0}. Here, the condition a2 +b2 = 0 indicates that Sym(fσ ) is non-degenerate. We now introduce the following terminology: a ternary signature f is said to be SIG1 legal if Sym(f ) has the from [a, b, −a, −b] for certain numbers a, b satisfying a2 + b2 = 0. Using this terminology, it follows that f is in SIG1 iff fσ is in SIG1 -legal for a certain σ ∈ S3 . The second theorem—Theorem 2—deals with all signatures residing within SIG1 . To state the theorem, however, we need to introduce another signature set DUP. For our purpose, we give a quick explanation of the following abbreviation. Let f0 , f1 be two signatures of arity k − 1. The notation (f0 , f1 ) denotes the signature f defined as follows: f (0, x2 , . . . , xk ) = f0 (x2 , . . . , xk ) and f (1, x2 , . . . , xk ) = f1 (x2 , . . . , xk ) for all tuples (x2 , . . . , xk ) ∈ {0, 1}k−1 . Now, the basic signature set DUP is defined as the set of all ternary signatures f such that, with appropriate permutations σ of variable indices, fσ becomes of the form u(xσ(1) ) · (h, h), where u is in U and h is a certain binary signature. Now, the second theorem is stated as follows. Theorem 2. Let f be any ternary signature in SIG1 . If f is in DUP, then #CSP∗2 (f ) is in FPC . Otherwise, #CSP∗2 (f ) is AP-reduced from #SATC . Theorem 2 follows from two key propositions: Propositions 1–2. These propositions will be explained in Section 4.
4
T2 -Constructibility Technique
When dealing with complex numbers, it is, in general, not clear that Turing reductions between counting problems can be replaced by AP-reductions, because a number of “adaptive” queries made by the Turing reductions may violate certain requirements of AP-reductions stated in Section 2.2. For instance, a standard tool known as “polynomial interpolation” (which heavily relies on Turing reductions) is no longer applicable. To compensate the lack of such a tool, we introduce another technical tool, called T2 -constructability, which is a variant of T-constructibility [13]. Here, we use the following notations. Let f be any k-ary signature. For any index i ∈ [k] and any bit c ∈ {0, 1}, the notation f xi =c denotes the function g satisfying that g(x1 , . . . , xi−1 , xi+1 , . . . , xk ) = f (x1 , . . . , xi−1 , c, xi+1 , . . . , xk ).
130
T. Yamakami
For any two distinct indices i, j ∈ [k] with i < j, we denote by fxi =xj =∗ the function g defined as g(x1 , . . . , xi−1 , xi+1 , . . . , xj−1 , xj+1 , . . . , xk ) = xi ∈{0,1} f (x1 , . . . , xi−1 , xi , xi+1 , . . . , xj−1 , xi , xj+1 , . . . , xk ), where the second let f xi =∗ be the function g defined xi appears at the jth position. Moreover, by g(x1 , . . . , xi−1 , xi+1 , . . . , xk ) = xi ∈{0,1} f (x1 , . . . , xi−1 , xi , xi+1 , . . . , xk ). Let (g1 ·g2 )(x1 , . . . , xk ) = g1 (x1 , . . . , xm )g2 (xm , . . . , xk ) if g1 and g2 take sets of variables (x1 , . . . , xm ) and (xm , . . . , xk ), respectively, and satisfy 1 ≤ m ≤ m ≤ k. We say that a signature f of arity k is T2 -constructible (or T2 -constructed) from a set G of signatures if f can be obtained, initially from signatures in G, by recursively applying a finite number (possibly zero) of operations described below. 1. Permutation: for two indices i, j ∈ [k] with i < j, by exchanging two columns xi and xj with i < j in (x1 , . . . , xi , . . . , xj , . . . , xk ), transform g into g , which is defined by g (x1 , . . . , xi , . . . , xj , . . . , xk ) = g(x1 , . . . , xj , . . . , xi , . . . , xk ). 2. Pinning: for an index i ∈ [k] and a bit c ∈ {0, 1}, build g xi =c from g. 3. Projection: for an index i ∈ [k], build g xi =∗ from g. 4. Linked Projection: for two distinct indices i, j ∈ [k] with i < j, build g xi =xj =∗ from g. 5. Expansion: for an index i ∈ [k], introduce a new “free” variable, say, y and transform g into g , which is defined by g (x1 , . . . , xi , y, xi+1 , . . . , xk ) = g(x1 , . . . , xk ). 6. Exclusive Multiplication: from two signatures g1 of arity k and g2 of arity m, if {x1 , . . . , xk }∩{y1 , . . . , ym } = Ø, then build (g1 ·g2 )(x1 , . . . , xk , y1 , . . . , ym ), where g1 and g2 take variables (x1 , . . . , xk ) and (y1 , . . . , ym ), respectively. 7. Normalization: for a constant λ ∈ C − {0}, build λ · g from g, where λ · g is defined as (λ · g)(x1 , . . . , xk ) = λ · g(x1 , . . . , xk ). When f is T2 -constructible from G, we use the notation f ≤∗con G. In particular, whenever G is a singleton {g}, we often write f ≤∗con g instead of f ≤∗con {g}. Lemma 4. Let f be any signature of arbitrary arity and let F , G be any two signature sets. If f ≤∗con G, then #CSP∗2 (f, F ) ≤AP #CSP∗2 (G, F ). The proof of Lemma 4 is in essence the same as the proof of a similar statement concerning T-constructibility in [13]. A key property of Sym(f ) is its T2 constructibility from f . Lemma 5. For any ternary signature f , it holds that Sym(f ) ≤∗con f . Proof. To T2 -construct Sym(f ) from f , we first generate a product of f (x1 , x2 , z2 ), f (y1 , y2 , x2 ), and f (z1 , z2 , y2 ) using Exclusive Multiplication with all distinct variables. We then apply Linked Projection by identifying x2 , y2 , z2 with x2 , y2 , z2 , respectively. 2 By a direct application of Lemmas 4 and 5, we immediately obtain #CSP∗2 (Sym(f ), F ) ≤AP #CSP∗2 (f, F ) for any signature set F . For the proof of Theorem 1, we need the following AP-reducibility result.
Counting Constraint Satisfaction Problems
131
Lemma 6. For any pair (h1 |h2 ) in B, #SATC ≤AP Holant∗ (h1 |h2 ). Now, we present the proof of Theorem 1. Proof of Theorem 1. Let f be any ternary signature not in SIG. This means that there exists a permutation σ ∈ S3 for which Sym(fσ ) ∈ Sig (1) ∪ Sig (2) and Sym(fσ ) ∈ DG. Lemma 1(1) together with Lemma 6 leads to the conclusion that #SATC ≤AP Holant∗ (Sym(fσ )). Notice that Holant∗ (Sym(fσ )) ≡AP #CSP∗2 (Sym(fσ )). Since Sym(fσ ) ≤∗con fσ by Lemma 5, Lemma 4 implies that #CSP∗2 (Sym(fσ )) ≤AP #CSP∗2 (fσ ). Finally, because #CSP∗2 (fσ ) and #CSP∗2 (f ) are AP-equivalent to each other, we immediately obtain #SATC ≤AP #CSP∗2 (f ), as required. 2 The proof of Theorem 2 is composed of two propositions. The first proposition— Proposition 1—concerns the computability of degree-2 #CSP∗ s whose signatures are drawn from DUP. Proposition 1. For any subset F ⊆ DUP, it holds that #CSP∗2 (F ) is in FPC . Next, we state the second proposition. Proposition 2. Let f be any signature in SIG1 . If f is not in DUP, then there exists a non-degenerate symmetric signature g = [g0 , g1 , g2 ] such that g ≤∗con G ∪ {f }, where G is a finite subset of U, and (g0 = g2 ∨ g1 = 0) ∧ g0 + g2 = 0. With a help of Propositions 1–2, the proof of Theorem 2 can be succinctly described below. Proof of Theorem 2. If f is in DUP, then Proposition 1 places #CSP∗2 (f ) within FPC . Next, we assume that f ∈ DUP. By Proposition 2, there exists a non-degenerate symmetric signature g such that (i) g is neither of the form [a, b, −a] nor of the form [a, 0, a] for any two numbers a, b ∈ C and (ii) g ≤∗con G ∪ {f } for a certain finite set G ⊆ U. Lemma 1(2) ensures the existence of a pair (h1 |h2 ) ∈ B satisfying that Holant∗ (h1 |h2 ) ≤AP Holant∗ (f, g). Since Holant∗ (f, g) ≡AP #CSP∗2 (f, g), by Lemma 6, it follows that #SATC ≤AP #CSP∗2 (f, g). Since g ≤∗con G ∪ {f }, we obtain #CSP∗2 (f, g) ≤AP #CSP∗2 (f ). Combining those AP-reductions, we conclude that #SATC ≤AP #CSP∗2 (f ). 2 The remaining task is to prove Proposition 2. To achieve this goal, we need another new idea, called parametrized symmetrization, which will be explained in the following section.
5
Parametrized Symmetrization Technique
Toward the proof of Proposition 2, we need to produce a binary symmetric signature from an arbitrary ternary signature so that we can make use of Lemma 1(2). For this purpose, we will introduce an additional scheme of symmetrization. With this new scheme, we will present the proof of Proposition 2.
132
5.1
T. Yamakami
Parametrized Symmetrization Scheme
A parametrized symmetrization scheme produces an infinite set of univariate degree-2 polynomials. This scheme is simple and easy to apply in the proof of Proposition 2. For each fixed unary signature u = [1, ε] (where ∈ C), let us introduce SymL(f ) as a new signature defined as f (x1 , x2 , x3 )f (y1 , y2 , x3 )u(x1 )u(y1 ). SymL(f )(x2 , y2 ) = x1 ,x3 ,y1 ∈{0,1}
It is important to note that SymL(f ) ≤∗con {f, u}. To emphasize the parameter ε, we sometimes write SymL(f )ε , g0,ε , g1,ε , and g2,ε . Treating as an unknown, SymL(f ) becomes a polynomial of degree 2. Observe that SymL(f ) is a symmetric signature. By way of proof by contradiction, we show the following useful property of SymL(f ). Proposition 3. Let f be any ternary signature. Assuming that f ∈ DUP, for any permutation σ ∈ S3 and for all but finitely many numbers ε ∈ C, SymL(fσ )ε is non-degenerate. 5.2
Proof of Proposition 2
In Sections 3.2 and 5.1, we have introduced two schemes of symmetrization of arbitrary ternary signatures. These schemes are powerful enough to prove Proposition 2, which is a basis of the proof of Theorem 2 given in Section 4. Now, we present the proof of Proposition 2. Our goal is to prove that, for a given ternary signature f in SIG1 , SymL(fσ )ε becomes the desired g stated in the proposition for certain values ε and σ. We will describe this argument in more details. Let f be any signature in SIG1 and assume that f ∈ DUP. Without loss of generality, we fix the permutation (x1 x2 x3 ) and assume that Sym(f ) is nondegenerate and SIG1 -legal. Let Sym(f ) = [h0 , h1 , h2 , h3 ] and, for any given σ σ σ permutation σ, let SymL(fσ )ε = [g0,ε , g1,ε , g2,ε ]. Hereafter, we show that there exists a permutation σ ∈ S3 such that, for all but finitely many values ε ∈ C, σ σ σ σ σ g0,ε + g2,ε = 0 and g0,ε = g2,ε ∨ g1,ε = 0. Toward a contradiction, we assume otherwise; that is, σ (*) for every permutation σ and for almost all values ε, either (i) g0,ε + σ σ σ σ g2,ε = 0 or (ii) g0,ε = g2,ε ∧ g1,ε = 0.
Firstly, we claim that two conditions (i) and (ii) do not hold simultaneously. Assume that (i) and (ii) are true. This assumption immediately yields σ σ σ g0,ε = g1,ε = g2,ε = 0, which implies SymL(fσ )ε = [0, 0, 0]. This indicates that SymL(fσ )ε is degenerate, contradicting Proposition 3. Secondly, we nail down our assumption (*) to the following three cases so that each case can be discussed separately. [Case 1] The first case is that, for every permutation σ, there are at least three σ σ σ = g2,ε and g1,ε = 0. values ε such that g0,ε
Counting Constraint Satisfaction Problems
133
[Case 2] The second case is that there exist two distinct permutations σ and σ σ σ τ τ τ for which g0,ε = g2,ε ∧ g1,ε = 0 and g0,ε + g2,ε = 0. [Case 3] The third case is that, for every permutation σ, g0σ + g2σ = 0. By a rather straightforward, elementary argument, we can show that all the above cases lead to contradictions, and therefore we conclude that the assumption (*) does not hold. In other words, neither (i) nor (ii) holds for a certain permutation σ and almost all values ε. We then define the desired g (stated in the proposition) to be SymL(fσ )ε . For such g, Proposition 3 guarantees the non-degeneracy of g. The proof is now completed.
References 1. Cai, J., Lu, P.: Holographic algorithms: from arts to science. J. Comput. Syst. Sci. 77, 41–61 (2011) 2. Cai, J., Lu, P., Xia, M.: Holographic algorithms by Fibonacci gates and holographic reductions for hardness. In: Proceedings of FOCS 2008, pp. 644–653 (2008) 3. Cai, J., Lu, P., Xia, M.: Holant problems and counting CSP. In: Proceedings of STOC 2009, pp. 715–724 (2009) 4. Cai, J., Lu, P., Xia, M.: Dichotomy for Holant∗ problems of Boolean domain, http://pages.cs.wisc.edu/~ jyc/ 5. Creignou, N., Hermann, M.: Complexity of generalized satisfiability counting problems. Inf. Comput. 125, 1–12 (1996) 6. Dalmau, V., Ford, D.K.: Generalized satisfiability with limited occurrences per variable: A study through delta-matroid parity. In: Rovan, B., Vojt´ aˇs, P. (eds.) MFCS 2003. LNCS, vol. 2747, pp. 358–367. Springer, Heidelberg (2003) 7. Dyer, M., Goldberg, L.A., Greenhill, C., Jerrum, M.: The relative complexity of approximating counting problems. Algorithmica 38, 471–500 (2003) 8. Dyer, M., Goldberg, L.A., Jalsenius, M., Richerby, D.: The complexity of approximating bounded-degree Boolean #CSP. In: Proceedings of STACS 2010, pp. 323– 334 (2010) 9. Dyer, M., Goldberg, L.A., Jerrum, M.: The complexity of weighted Boolean #CSP. SIAM J. Comput. 38, 1970–1986 (2009) 10. Dyer, M., Goldberg, L.A., Jerrum, M.: An approximation trichotomy for Boolean #CSP. J. Comput. Syst. Sci. 76, 267–277 (2010) 11. Schaefer, T.J.: The complexity of satisfiability problems. In: Proceedings of FOCS 1978, pp. 216–226 (1978) 12. Valiant, L.G.: Holographic algorithms. SIAM J. Comput. 37, 1565–1594 (2008) 13. Yamakami, T.: Approximate Counting for Complex-Weighted Boolean Constraint Satisfaction Problems. In: Jansen, K., Solis-Oba, R. (eds.) WAOA 2010. LNCS, vol. 6534, pp. 261–272. Springer, Heidelberg (2011); An improved version is available at arXive:1007.0391 14. Yamakami, T.: A Trichotomy Theorem for the Approximate Counting of ComplexWeighted Bounded-Degree Boolean CSPs. In: Wu, W., Daescu, O. (eds.) COCOA 2010, Part I. LNCS, vol. 6508, pp. 285–299. Springer, Heidelberg (2010); An improved version is available at arXiv:1008.2688
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs Desh Ranjan1 , John Savage2 , and Mohammad Zubair1 1 2
Old Dominion University, Norfolk, Virginia 23529 Brown University, Providence, Rhode Island 02912
Abstract. Processors on most of the modern computing devices have several levels of memory hierarchy. To obtain good performance on these processors it is necessary to design algorithms that minimize I/O traffic to slower memories in the hierarchy. In this paper, we propose a new technique, the boundary flow technique, for deriving lower bounds on the memory traffic complexity of problems in a two-level memory hierarchy architectures. The boundary flow technique relies on identifying sub-computation structure corresponding to equal computations with a minimum number of boundary vertices, which in turn is related to the vertex isoperimetric parameter of a computation graph. We demonstrate that this technique results in stronger lower bounds for memory traffic on memory hierarchy architectures for well-known computation structures: the binomial computation graphs and FFT computation graphs.
1
Introduction
A number of important straight line computations such as matrix multiplication, FFT, and several financial computations are modeled using DAGs[20]. A DAG captures the data dependency at various stages of the computation and helps in analyzing performance on modern computer architectures, which is determined to a large extent by the memory traffic[11,21]. Given a DAG, the computation for DAG can be carried out in many different ways, essentially determined by the order in which computations corresponding to various vertices on the DAG are done. The fast memory in the memory hierarchy has limited capacity and for many large computations is not big enough to hold intermediate results during the computation. This forces the architecture to use slower memory for storing intermediate results. Different orderings results in different memory traffic to the slower memory [11]. The key in developing a high performance algorithm for a DAG is to identify the order that results in minimum memory traffic to the slower memory. To evaluate the effectiveness of different orderings and also to gain insight into the structure of the DAG and its relationship to the memory traffic, it is desirable to find minimum possible memory traffic to slower memory for any ordering. One approach to analyze memory traffic on advanced architectures with memory hierarchy is the use of red-blue pebbling game on a DAG which is formally described in[13,19,20]. A red pebble on a vertex of the graph indicates that the B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 134–145, 2011. c Springer-Verlag Berlin Heidelberg 2011
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
135
corresponding value is in the fast memory. The number of red-pebbles is determined by the size of the fast memory (σ0 in this paper). The computation rule in the red-blue pebble game is that a red pebble can be placed on vertex v only when all immediate predecessors of v have red pebbles on them. This corresponds to the notion that in a computation a value can be computed only if all the inputs needed to compute this value are available in the fast memory. As there is a limited supply of red pebbles, we can run out of red pebbles during the computation. In that case, we need to store intermediate outputs in the slow memory. This is modelled by placing a blue pebble on the red pebble. The input from the slow memory is modelled by placing a red pebble on blue pebble. The number of blue pebbles representing the storage in the slow memory is unlimited. A pebbling strategy for a DAG G is a sequence of placement of pebbles on the nodes of G satisfying the rules of the red-blue pebbling game that pebbles all vertices. We are interested in pebbling strategies that compute each vertex value exactly once. We call these non-repebbling strategies. All lower bound results presented here are for such strategies. At first glance this may seem to be a big restriction on class of pebbling strategies being considered. However, we note that the best known pebbling strategies for many well know computation graphs including the Binomial and FFT computation graphs are non-repebbling strategies. The main contribution of this paper is a new technique, the boundary flow technique, for deriving lower bounds on the memory traffic required by any non-repebbling strategy. The boundary flow technique relies on identifying subcomputation structure corresponding to equal computations with a minimum number of boundary vertices. The notion of finding minimum number of boundary vertices for a fixed size computation structure is related to determining the vertex isoperimetric parameter (VIP) of a graph [14,18], which in turn is related to separators in graphs. Graph separators have been used to establish lower bounds, for example[3,23,22,6,8]. For simplicity, in this paper we will only consider two levels of memory hierarchy. The results for two levels can be extended to multiple levels of memory hierarchy using the multiple-level memory hierarchy model outlined in [19]. (See also [20, Chapter 11].) We demonstrate that this technique results in stronger lower bounds for two well known computation structures namely, Binomial and FFT. The lower bound bound for memory traffic for both binomial and FFT computations have been studied before[1,13,20,17]. The use of red-blue pebbling game for studying lower bounds on I/O was introduced by Hong and Kung[13]. Using the notion of S-partition an Ω(n lg n))/ log σ0 I/O lower bound for the n-point FFT computation graph was provided in this paper without providing an exact constant. A simpler proof of this result was later provided in [1]. Building on [13] Savage developed the S-Span technique for proving I/O lower bounds in [20] and provided a lower bound that is n log n/4(log σ0 + 1) for an n-point FFT. Note that n log n is the number of non-input vertices in the n-point FFT. A careful reading shows that the constant associated with lower bound by Hong and Kung[13] is exactly the same as that in lower bound of Savage[20]. For the
136
D. Ranjan, J. Savage, and M. Zubair
Binomial computation graph, the first I/O lower bound results were presented in [21]. These were later improved in [17]. The table below summarizes these results. V ∗ in the table denotes the set of non-input vertices for the corresponding computation graph. We have presented simplified expressions for lower bounds so as to see the comparison clearly. All results reported in the table except those presented in this paper apply to all pebbling strategies including those that may use repebbling. However, no better results are obtained for non-repebbling strategies using the techniques in[13,20]. S-Span[20,21] Blue Pebble[17] This paper Binomial |V ∗ |/2σ0 |V ∗ |/σ0 3|V ∗ |/2σ0 ∗ FFT |V |/4 log σ0 NA 2|V ∗ |/ log σ0 Observe that for non-repebbling strategies our approach results in a lower bound that is roughly three times stronger than the one obtained using S-span approach for the binomial computation and a factor 3/2 better compared to the previously best known lower bound. For FFT computation, our results are roughly eight times stronger than the one obtained using S-span approach. Strengthening the lower bound by a constant factor, besides being of theoretical interest, is important for practical reasons. An attempt at deriving matching lower and upper bounds for the Binomial computation graph actually led us to algorithms, that were a factor of four to eight times better than the existing algorithms[17]. These factors may look small but are significant in terms of cost saving for applications with real time constraints, such as financial applications. Results that strengthen lower bounds by a constant factor are considered important. For example, a result that improved the lower bound on number of multiplications required to multiply two matrices from 2n2 to 2.5n2 appeared in [4]. These results are notoriously hard to establish as they require a deeper understanding of the structure of the problem. For example, it took 18 years to improve the lower bound for pancake sorting from 17n/16 to 15n/14 [9,12]. The rest of the paper is organized as follows. The required definitions and the memory hierarchy model that is used in developing memory complexity is discussed in Section 2. In Section 3 our new boundary flow technique for deriving improved lower bounds is presented. Subection 3.1 presents the basic boundary flow technique with a brief comparison with the techniques used before. Subsection 3.2 presents a general method to potentially obtain better lower bounds using the boundary flow technique. In Section 4 we apply the boundary flow technique to obtain better lower bounds for the Binomial and FFT computation graphs. Finally, in Section 5 we present our summary and conclusions.
2
Background
A computation graph is a directed acyclic graph G = (V, E). The vertices of G with in-degree zero are called the input vertices. The set of input vertices of G = (V, E) is denoted by Vinput . The vertices with out-degree zero are called the output vertices. The goal is to compute the values at the output vertices given the
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
137
values at the input vertices. The value at a vertex can be computed if and only if the value at all its predecessor vertices have been computed and are available. We say that the computation on G is complete if the values at all its output vertices have been computed. A computation structure is a parametric description of ˜ : Nk → computation graphs. Formally, a computation structure is a function G {G | G is a computation graph }, where k is the number of parameters used to describe G. Given a computation graph G, the computation on G can be carried out in many different ways. A computation scheme for a computation structure ˜ is an algorithm that completely specifies how to carry out the computation G ˜ for each G(t) where t ∈ Nk . An input in a two level memory hierarchy refers to a read from secondary memory, and an output refers to a write to the secondary memory. The I/O associated with a computation on a graph G is the total number of input and output operations used during the computation. We now define the memory traffic complexity for a single processor with 2-levels of memory hierarchy with σ ˆ = σ0 , σ1 where σ0 is the primary memory size, and σ1 is the secondary memory size. In this paper σ1 is not important as we assume an unlimited secondary memory size (unlimited supply of blue pebbles) but for sake of consistency of ˜ : Nk → {G | G is a compunotation with other related papers we use σ ˆ . Let G ˜ tation graph} be a computation structure. Let T1 (ˆ σ , G)(t) be the minimum I/O ˜ on input G(t) ˜ required by any computation scheme for G where t ∈ Nk . The ˜ : Nk → N as defined above is called the memory traffic comfunction T1 (ˆ σ , G) ˜ Correspondingly, let T N R (ˆ ˜ plexity of G. σ , G)(t) be the minimum I/O required 1 ˜ on input G(t) ˜ by any non-repebbling computation scheme for G where t ∈ Nk . ˜ : Nk → N as defined above is called the non-repebbling The function T1N R (ˆ σ , G) ˜ memory traffic complexity of G. Binomial and FFT Computation Graphs Binomial option valuation is a popular approach that values an option contract using a discrete time model [15,7]. The binomial option pricing computation is modelled by a directed acyclic pyramid graph Gb (n) with depth n and n + 1 leaves (see Figure 1). FFT computation graph occurs in many scientific and financial computations[2,5]. The n-point FFT computation is modelled by a directed acyclic graph Gf (n) with n(log n + 1) vertices. Note that in Gf (n), there are n input vertices with zero in-degree at level-1, and n output vertices with zero out-degree at level-(n + 1).
3
Boundary Flow Technique for Deriving Lower Bounds
In this section, we first outline the basic technique, which works by subdividing the pebbling into sub-pebblings of equal computations. We derive an I/O lower bound for each of the sub-pebblings by finding the minimum number of boundary vertices, which in turn is related to determining the vertex isoperimetric parameter of a graph. The overall I/O lower bound for the pebbling is
138
D. Ranjan, J. Savage, and M. Zubair
Fig. 1. The binomial graph Gb (n) with depth n and n + 1 = 8 leaves
obtained by summing the individual lower bounds. Later in the section we show how constrained VIP can help in deriving better bounds using the boundary flow technique. 3.1
Basic Technique
The boundary flow technique described here works for non-repebbling strategies. It works by subdividing the pebbling into sub-pebblings and then deriving an I/O lower bound for each of the sub-pebblings. The overall I/O lower bound for the pebbling is obtained by summing the individual lower bounds. The individual lower bounds for the sub-pebblings are related to the notion of boundary of a subset of vertices in a computation graph and the fact that the number of red pebbles is limited. Definition 1. Let G = (V, E) be a directed graph and S ⊆ V . Then out(S) = {u ∈ S | ∃v ∈ S¯ such that (u, v) ∈ E} in(S) = {u ∈ S¯ | ∃v ∈ S such that (u, v) ∈ E} boundary(S) = in(S) ∪ out(S). Note that in(S) ∩ out(S) = ∅. Hence |boundary(S)| = |in(S)| + |out(S)|. The following lemma relates the boundary to the minimum memory traffic required for pebbling a computation graph. Lemma 1. Let G = (V, E) be any computation graph and let P be any complete pebbling of G such that in P each vertex in V − Vinput is pebbled using the computation rule exactly once. Consider subdivision of the pebbling P into consecutive sequential sub-pebblings P1 , P2 , . . . , Ph . Let Vj be the set of vertices that are newly pebbled (i.e. red pebbled using the computation rule) in sub-pebbling Pj . Then the number of I/Os used in pebbling P to pebble G is at least h j=1
(|boundary(Vj )| − 2σ0 ).
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
139
Proof. Consider vertices in in(Vj ) at the start of sub-pebbling Pj (Figure 2). All of these vertices are predecessors to some vertices in Vj that will be pebbled during the jth sub-pebbling. Hence, we need to have red or blue pebbles on these |in(Vj )| vertices at the start of Pj . As we only have σ0 red pebbles, at least |in(Vj )| − σ0 of the vertices in in(Vj ) have only blue pebbles when Pj starts. Each such vertex leads to at least one input operation during sub pebbling Pj . Similarly, consider vertices in out(Vj ). All of these vertices are predecessors to vertices that will be pebbled in some kth sub-pebbling Pk , where k > j. Thus, we need to have red or blue pebbles on these |out(Vj )| vertices at the end of the jth sub-pebbling. Note this statement is valid only for non-repebbling strategies. As we have only σ0 red pebbles, we need to use at least |out(V (j)| − σ0 blue pebbles. Each blue pebble on a vertex of Vj is a result of an output operation during the sub-pebbling Pj . Hence during the sub-pebbling Pj we do at least |in(Vj )| − σ0 + |out(Vj )| − σ0 I/Os. This establishes the lemma. V1
V2
Vh
P1
P2
Ph
Fig. 2. Subdivision of pebbling P into sub-pebblings Pi s. Vi is the set of new vertices pebbled in Pi .
Next we look at how to obtain lower bound for the boundary size, |boundary(Vj )|, for a fixed size |Vj |. The notion of boundary of a set of vertices of a graph has been extensively studied especially in the context of expander graphs[14]. Isoperimetric parameter of a graph is a way of capturing the notion of the minimum boundary of subgraphs (of the graph) of a fixed size. In context of computation graphs, the boundary of a set of vertices S captures the input and output requirements for completing the pebbling (computation) of the set S. In deriving lower bounds for I/O we focus on a sub pebbling step where we pebble a set of vertices S. We then use the isoperimetric parameter of the graph to derive the lower bound for the boundary size of S, and consequently find the I/O lower bound for the sub pebbling. Definition 2. The vertex isoperimetric parameter for a directed graph G = (V, E) is: ζ(M, G) = min {|boundary(S)| : |S| = M } S⊆V
˜ be a computation structure. Then for any integer M > 0 Theorem 1. Let G ˜ satisfies the ˜ T1N R (ˆ σ , G), the non-repebbling memory traffic complexity for G, following lower bound: ˜ ˜ T1N R (ˆ σ , G)(t) ≥ |V − Vinput |/M (ζ(M, G(t)) − 2σ0 ).
140
D. Ranjan, J. Savage, and M. Zubair
˜ = (V, E). SubProof. Consider any non-repebbling strategy P for the DAG G(t) divide the pebbling P into consecutive sequential sub-pebblings P1 , P2 , . . . , Ph , ˜ where in each sub-pebbling we pebble M new vertices of G(t) using the computation rule except possibly Ph . That defines at least |V − Vinput |/M sub-pebblings in which M computation steps occur. From Lemma 1 and definition of vertex isoperimetric parameter, the number of I/O is at least ˜ |V − Vinput |/M (ζ(M, G(t)) − 2σ0 ). Hence, ˜ ˜ T1N R (ˆ σ , G)(t) ≥ |V − Vinput |/M (ζ(M, G(t)) − 2σ0 ). A basic difference between the boundary flow technique and the techniques of Hong-Kung and Savage is that in the boundary flow technique the partition into sub-pebblings is done in a way such that in each sub-pebbling an equal number of new vertices are pebbled. The sub-dvision in Hong-Kung and Savage is done in a way such that each sub-pebbling has an equal number of I/O operations. This different way of partitioning is key to deriving better lower bounds. 3.2
Constrained VIP for Deriving Better Bounds
To obtain better bounds it is sometimes useful to define the vertex isoperimetric parameter for a subset of vertices of a directed graph. This is best illustrated with the help of binomial computation graph. In this graph almost all vertices are “internal” vertices, and then there are vertices at the “fringes” of the computation graph which constitute a very small fraction (which goes to zero as size of the binomial graph increases) of the total number of vertices (see Figure 3). If we use the ζ(M, G) for the entire graph the set of M vertices that results in minimum boundary size is rooted at the top vertex and is aligned with the two slanted edges (see Figure 4). The boundary size for these M vertices is √ roughly 2M . This result is non-optimal because this minimum boundary size is obtained only at the fringes and is not representative of minimum boundary size for typical subsets of size M . A typical subset of size M in this graph consists of only of internal vertices. For these subsets of size M the set that gives minimum boundary looks quite different - in fact a hexagonal arrangement of internal vertices gives the minimum boundary size (see Figure 4). For a set of M √ internal vertices, one can show that the minimum boundary size is roughly 12M . Hence, to derive strong lower bounds it is better to find isoperimetric parameter of the computation graph over a subset of dominating vertices (“internal” vertices), and then take into account separately the effect of the vertices at the fringes of the computation graph. Definition 3. The vertex isoperimetric parameter for a directed graph G = (V, E) over a subset A ⊆ V is: ζ(M, G, A) = min {|boundary(S)| : |S| = M } S⊆A
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
141
Vertices at fringes of the computation graph
Internal vertices of the computation graph
Fig. 3. Binomial computation graph with fringe and internal vertices
Set including vertices at fringes and having minimum boundary size
Set including only internal vertices and having minimum boundary size
Fig. 4. Sets with minimum boundaries with fixed number of vertices. Hexagonal shape gives minimum boundary when only internal vertices are allowed. Triangular shape shown gives minimum boundary when all vertices all allowed.
142
D. Ranjan, J. Savage, and M. Zubair
Definition 4. Let G = (V, E) be a computation graph. Let Vinput denote the set of input vertices of G (i.e. vertices with in-degree 0). A partition Vinput ,Vint ,Vext of V is called I -partition if there is no edge (u, v) ∈ E such that u ∈ Vext and v ∈ Vint . Definition 5. Let G = (V, E) be a computation graph. Let Vinput denote the set of input vertices of G. Let Vinput ,Vint ,Vext be an I -partition of V . Then for S ⊆ Vext we define Γ (S, G) = {u ∈ Vint | ∃v ∈ S such that (u, v) ∈ E}. Using these definitions, we can state the following lemma. Lemma 2. Consider a computation graph G = (V, E). LetVinput , Vint , Vext beany I -partition of V . Let S ⊆ V − Vinput and Sint = S Vint and Sext = S Vext . Then, |boundary(S) ≥ ζ(|Sint |, G, Vint ) − |Γ (Sext , G)|. Because of space constraint proof of this lemma is omitted here and can be found in full manuscript[16]. The theorem stated below follows directly from this lemma. ˜ be a computation structure and let P be any non-repebbling Theorem 2. Let G ˜ strategy for the computation graph G(t) = (V, E). Let Vinput ,Vint , Vext be any I -partition of V and let M > 0 be any integer. Consider subdivision of the pebbling P into consecutive sequential sub-pebblings P1 , P2 , . . . , Ph , where in each sub-pebbling Pi we pebble exactly M new vertices in Vint except possibly Ph . Let (i) (i) Sint ⊆ Vint denote this subset of M vertices and Sext ⊆ Vext denote the new ˜ external vertices of G(t) pebbled in sub-pebbling P . Then the number of I/O s ˜ required by P to pebble G(t) is at least |Vint |/M
˜ Vint ) − 2σ0 ) − |Vint |/M (ζ(M, G(t),
(i)
˜ |Γ (Sext , G(t))|.
i=1
4 4.1
Memory Traffic Complexity Binomial Computation Graph
For the binomial computation graph Gb (n) = (V, E), we define the following I -partition(Figure 3): Vinput = {u ∈ V | in − degree(u) = 0} Vint = {u ∈ V | in-degree(u) = 2 and out -degree(u) = 2} Vext = V − Vint − Vinput .
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
143
We first need to find the VIP for the binomial computation graph over a subset of internal vertices. Our VIP result for binomial computation graph is similar to a recently solved, long-standing honeycomb conjecture, which states a hexagonal grid represents the best way to divide a surface into regions of equal area with the least total perimeter [10]. Somewhat counter-intuitively, we have shown that the lowest boundary to area ratio in a binomial computation graph (which can be easily mapped to a grid) over a subset of internal vertices is obtained by a hexagonal structure[18]. More precisely, we prove the following: Theorem 3 ([18]). For any integer c > 0, ζ(3c2 + 3c + 1, Gb , Vint ) ≥ 6c + 3. The “shape” of pebbled vertices that realizes the above bound turns out to be a hexagon. The theorem is interesting in its own right and a complete proof of this theorem is quite involved. A manuscript of the proof is available at [18]. Applying Theorem 2 and selecting c = (2/3)σ0 , we have the following result (for keeping the expression simple, we assume that the primary memory size, σ0 , is such that c = (2/3)σ0 is an integer): Theorem 4. The non-repebbling memory traffic complexity of Gb (n) system satisfies (n − 2)(n − 1)/2 NR T1 (ˆ σ , Gb )(n) ≥ (2σ0 + 3) − (2n + 1). (4/3)σ02 + 2σ0 + 1 Due to space limitation the proof of this theorem is omitted here and can be found in full manuscript[16]. 4.2
FFT Computation Graph
We first introduce the necessary notations. Definition 6. We identify vertices in Gf (n) with its level number and its position on this level. For 1 ≤ i ≤ lg n + 1, 1 ≤ j ≤ n, v(i, j) denotes is the j th vertex on the ith level. For 1 ≤ j ≤ n, we refer to the set of vertices {v(i, j) | 1 ≤ i ≤ lg n + 1} as Column(j). Note that, if j = j then Column(j) and Column(j ) are disjoint. Definition 7. We say that a vertex u is an ancestor of a vertex v if there is a directed path from u to v. We include u also in the set of ancestors of u. We need the lemma below to complete our proof. Lemma 3.
∀ x, y 2x + 2y ≥ 21+ (x+y)
(x+y) 2
.
Proof. Since each of 2x , 2y and 21+ 2 is non-negative and (2x + 2y )2 = (2x − (x+y) 2y )2 + [21+ 2 ]2 the inequality follows trivially.
144
D. Ranjan, J. Savage, and M. Zubair
Lemma 4. Let U ⊂ Gf (n) with |U | ≥ k log2 4k for some k ≥ 1/4. Then |out(U )| ≥ k. Because of space constraint proof of this lemma is omitted here and can be found in full manuscript[16]. Lemma 5. Let U ⊂ Gf (n) − {v(1, j) | 1 ≤ j ≤ n } with |U | ≥ k log2 4k for some k > 1/4. Then |in(U )| ≥ k. Proof. The proof follows easily by observing that (i) the graph GR f (n)obtained by reversing all edges of Gf (n) is isomorphic to Gf (n) (ii) for any U ⊂ (Gf (n) − {v(1, j) |1 ≤ j ≤ n }), outGR (U ∪ inGf (n) (U )) ⊆ f (n) inGf (n) (U ). Using Lemma 4 and Lemma 5, we can state the following theorem. Theorem 5. The VIP for Gf (n) with M ≥ k log 4k satisfies ζ(M, Gf (n)) ≥ 2k. Applying Theorem 1 and selecting k = σ0 log 2σ0 , we have the following result. Theorem 6. The non-repebbling memory traffic complexity of Gf (n) on a 2level memory hierarchy system satisfies n log n T1N R (ˆ σ , Gf )(n) ≥ (2σ0 log 2σ0 − 2σ0 ). (σ0 log 2σ0 ) log(4σ0 log 2σ0 )
5
Conclusion
We presented a new technique for deriving lower bounds on memory traffic for computations that can be represented by a DAG. We demonstrated the effectiveness of this technique on two important computation structures. We improved the best known lower bound for a binomial computation graph by a factor of 3/2. For an FFT computation graph, we improved the bound by a factor of 8 to obtain a nearly optimal lower bound. There is a gap of a factor of 4/3 between the upper bound and lower bound for binomial computation graph. The bounds derived in this paper assumes non-repebbling strategies, which form an important class of strategies. It is of interest to see whether these bounds also hold for pebbling strategies that allow re-pebbling.
References 1. Aggarwal, A., Vitter, J.S.: The input/output complexity of sorting and related problems. Commun. ACM 31(9), 1116–1127 (1988) 2. Benhamou, E.: Fast Fourier Transform for discrete Asian options. In: Computing in Economics and Finance. Society for Computational Economics, vol. 6 (April 2001)
Strong I/O Lower Bounds for Binomial and FFT Computation Graphs
145
3. Bezrukov, S.: Edge isoperimetric problems on graphs. Bolyai Math. Series, pp. 157–197. 4. Bshouty, N.H.: A lower bound for matrix multiplication. In: FOCS 1988: Proceedings of the 29th Annual Symposium on Foundations of Computer Science, pp. 64–67 (1988) 5. Carr, P., Madan, D.: Option valuation using the Fast Fourier Transform (1998) 6. Chen, Z., Fu, B., Tang, Y., Zhu, B.: A ptas for a disc covering problem using width-bounded separators. J. Comb. Optim. 11(2), 203–217 (2006) 7. Cox, J.C., Ross, S.A., Rubinstein, M.: Option pricing: A simplified approach. Journal of Financial Economics 7(3), 229–263 (1979) 8. Fu, B.: Theory and application of width bounded geometric separators. J. Comput. Syst. Sci. 77(2), 379–392 (2011) 9. Gates, W.H., Papadimitriou, C.H.: Bounds for sorting by prefix reversal. Discrete Mathematics 27, 47–57 (1979) 10. Hales, T.C.: The honeycomb conjecture. Discrete & Computational Geometry 25(1), 1–22 (2001) 11. Hennessy, J.L., Patterson, D.A.: Computer Architecture: A Quantitative Approach. Morgan Kaufmann, San Francisco (2007) 12. Heydari, M.H., Sudborough, I.H.: On the diameter of the pancake network. J. Algorithms 25, 67–94 (1997) 13. Hong, J.-W., Kung, H.T.: I/O complexity: The red-blue pebble game. In: Proc. 13th Ann. ACM Symp. on Theory of Computing, pp. 326–333 (1981) 14. Hoory, S., Linial, N., Wigderson, A.: And an Overview. Expander graphs and their applications. Bull. Amer. Math. Soc. 43, 439–561 (2006) 15. Kwok, Y.K.: Mathematical Models of Financial Derivatives. Springer, Singapore (1998) 16. Ranjan, D., Savage, J., Zubair, M.: Strong i/o lower bounds for binomial and fft computation graphs (2011), http://www.cs.odu.edu/~zubair/papers/ ranjanFM11.pdf 17. Ranjan, D., Savage, J., Zubair, M.: Upper and lower I/O bounds for pebbling rpyramids. In: Iliopoulos, C.S., Smyth, W.F. (eds.) IWOCA 2010. LNCS, vol. 6460, pp. 107–120. Springer, Heidelberg (2011) 18. Ranjan, D., Zubair, M.: Vertex isoperimetric parameter of a computation graph (2010), http://www.cs.odu.edu/~zubair/papers/hexagonIJFCS.pdf 19. Savage, J.E.: Extending the Hong-Kung model to memory hierarchies. In: Du, D.Z., Li, M. (eds.) Computing and Combinatorics. LNCS, pp. 270–281. Springer, Heidelberg (1995) 20. Savage, J.E.: Models of Computation: Exploring the Power of Computing. Addison Wesley, Reading (1998) 21. Savage, J.E., Zubair, M.: Cache-optimal algorithms for option pricing. ACM Trans. Math. Softw. 37(1), 1–30 (2010) 22. Thompson, C.D.: A complexity theory for VLSI. PhD thesis, Pittsburgh, PA, USA (1980) 23. Yackel, J., Meyer, R., Christou, I.: Minimum-perimeter domain assignment. Mathematical Programming 78, 283–303 (1997), doi:10.1007/BF02614375
Spin Systems on Graphs with Complex Edge Functions and Specified Degree Regularities Jin-Yi Cai1,2, and Michael Kowalczyk3 1
Computer Sciences Department University of Wisconsin — Madison, Madison, WI 53706, USA 2 Beijing University, Beijing, China
[email protected] 3 Mathematics and Computer Science Department Northern Michigan University, Marquette, MI 49855, USA
[email protected]
Abstract. Let k ≥ 1 be an integer and h =
h(00) h(01) h(10) h(11)
, where h(01) =
h(10), be a complex-valued (symmetric) function h on domain {0, 1}. We introduce a new technique, called a syzygy, and prove a dichotomy theorem for the following class of problems, specified by k and h: Given an arbitrary k-regular graph G each edge is attached the = (V, E), where function h, compute Z(G) = σ:V →{0,1} {u,v}∈E h(σ(u), σ(v)). Z(·) is known as the partition function of the spin system, also known as graph homomorphisms on domain size two, and is a special case of Holant problems. The dichotomy theorem gives a complete classification of the computational complexity of this problem, depending on k and h. The dependence on k and h is explicit. We also extend this classification to graphs with deg(v), for all v ∈ V , belonging to a specified set of degrees. Keywords: Holographic algorithms, dichotomy theorem, interpolation, counting complexity
1
Introduction
This paper is the culmination of a sequence of previous results [10, 11, 18]. We finally resolve the complexity ofthe following class of problems: Let k ≥ 1 be h(00) h(01) an integer and h = h(10) h(11) , where h(01) = h(10), be a complex-valued (symmetric) function h on domain {0, 1}. Given an arbitrary k-regular graph G = (V, E), where is attached the function h, compute the partition each edge function Z(G) = σ:V →{0,1} {u,v}∈E h(σ(u), σ(v)). The name partition function comes from physics, where 0-1 vertex assignments are called spins, and the edge function values h(σ(u), σ(v)) correspond to local interactions between particles. There is a long history in the statistical physics community in the study of “Exactly Solved Models” [1, 19]. In the language of modern complexity theory, physicists’ notion of an “Exactly Solvable” system
Supported in part by NSF grant CCF-0830488.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 146–157, 2011. c Springer-Verlag Berlin Heidelberg 2011
Spin Systems with Complex Edge Functions
147
corresponds to systems with polynomial time computable partition functions. A central question is to identify what “systems” can be solved “exactly” and what “systems” are “difficult”. In physics, there is no rigorous definition of being “difficult”, but complexity theory supplies the proper notion—#P-hardness. Dichotomy theorems (i.e., every problem in a class is either in P or #P-hard) have been given in many cases in complexity theory [2–9, 12–17], and is a very active research area. The class of problems studied in this paper can be viewed as graph homomorphisms on domain size two with arbitrary edge functions but restricted to k-regular graphs (as we only consider undirected graphs, the edge function is symmetric h(01) = h(10)). It should be emphasized that the restriction on input graphs being k-regular makes the complexity classification more challenging to achieve, due to hardness proofs. Thus the dichotomy theorem in this paper is not a consequence of a previous dichotomy on graph homomorphisms. This class of problems is also related to the study of holographic algorithms; indeed we will use holographic algorithms to prove tractability in the planar case. Our main theorem is Theorem 3. It gives a complete classification valid for complex-valued (symmetric) edge functions h over k-regular graphs. Depending on k and h, Z(G) is either (1) #P-hard even for planar graphs; or (2) #P-hard for general (non-planar) graphs, but solvable in polynomial time for planar graphs; or (3) solvable in polynomial time for general graphs. The dependence on k and h is explicit. Furthermore, we show that in case (2) the problem is solvable in polynomial time over k-regular planar graphs, by exactly the theory of holographic algorithms using matchgates [20]. We also extend this classification to graphs with specified vertex regularities, namely deg(v), for all v ∈ V , belonging to a specified set of degrees. Previously a classification for 3-regular graphs with real-valued edge functions was achieved in [11]. This was extended in [18] to complex-valued edge functions. In [10] we managed to extend to k-regular graphs, but we could only prove it for real-valued edge functions. In this paper we achieve a final dichotomy, valid for all k and for all complex-valued edge functions h. The main new technique we introduce in this paper is the notion of a syzygy. In Astronomy the term syzygy is used to describe a linear alignment of three or more celestial bodies. In Module Theory of Commutative Algebra, the term is used to define a similar concept of alignment and cancellation. We will exhibit an analogous phenomenon in our combinatorial constructions in the proof of our dichotomy theorem. Certain triples of combinatorial constructions will have associated algebraic quantities which interact and cancel in remarkable ways that seem to defy any straightforward explanation; and yet this cancellation is the key to our proof of the dichotomy theorem. We omit some details and some of the proofs due to space constraints. 1.1
Overview of Techniques and Results
As we will explain in Section 2, we may make the simplifying assumption that a1 h = 1 b , where a, b ∈ C. We will use the notation Holk (a, b) to describe the
148
J.-Y. Cai and M. Kowalczyk
computational problem of evaluating Z(G) on any k-regular input graph G. If we restrict G to be any k-regular planar graph, then we use the notation Pl-Holk (a, b) for this problem. It is known that Holk (a, b) and Pl-Holk (a, b) are tractable under certain conditions [10]: Theorem 1. Let a, b ∈ C, X = ab, and Y = ak + bk where k ≥ 3 is an integer. If any of the following four conditions are true, then Holk (a, b) and Pl-Holk (a, b) are both solvable in P: 1. 2. 3. 4.
X X X X
=1 = 0 and Y = 0 = −1 and Y = 0 = −1 and Y 2 = 4X k
If Y 2 = 4X k then Pl-Holk (a, b) is solvable in P. It turns out that these are the only tractable cases (if k ≤ 2, then Holk (a, b) is trivially computable), so the main aim of this paper is to prove that if none of the tractability conditions of Theorem 1 hold, then Holk (a, b) is #P-hard (and similarly for Pl-Holk (a, b)). Once the technical groundwork has been laid out, the problem of proving #P-hardness of Holk (a, b) for some a, b, and k amounts to showing the existence of a suitable recursive gadget, which is associated with a certain kind of transition matrix, with entries depending on a, b, and k. Essentially, a recursive gadget having transition matrix M ∈ C2×2 is sufficient to prove #P-hardness of Holk (a, b) if it has the following properties: 1. tr(M ) = 0, 2. det(M ) = 0, tr2 (M ) 3. det(M / R+ . ) ∈ What remains, then, is to find a collection of recursive gadgets that are sufficient to prove #P-hardness for all settings of a, b, and k not addressed by Theorem 1. This is not a trivial task, however. Previous results based on similar techniques have relied on symbolic computation [11] or pairs of gadgets with special properties such as Eigenvalue Shifted Pairs (ESP) [18], in order to form an explicit set of gadgets that, in every case, has at least one member which satisfies the above properties. While the ESP technique extends naturally to k-regular graphs when k is odd, the technique does not seem to work when k is even. Since symbolic computation only applies for small fixed k, it is also of little help. To address this, we introduce a new technique — a trio of gadget families (see Figure 1), with remarkably intertwined algebraic properties that produce a simple and surprisingly general result. We call this gadget family a syzygy. We illustrate this phenomenon in Lemma 5.
2
Background and Notation
Although much of the work in this paper deals with regular graphs, it is often more convenient to work in terms of bipartite graphs; any k-regular graph
Spin Systems with Complex Edge Functions
(a) Gadget M1
(b) Gadget M2
149
(c) Gadget M3
Fig. 1. Recursive gadgets for even k. The gadgets are pictured here for k = 4, but are generalized to all even k ≥ 4 by adding length-2 cycles to the degree-4 vertices.
with vertex assignments is interchangeable with a certain bipartite (2, k)-regular graph with edge assignments. A signature grid Ω = (G, F , π) consists of a labeled graph G = (V, E) where π labels each vertex v ∈ V with a function fv ∈ F . We consider all edge assignments ξ : E → {0, 1}; fv takes inputs from its incident edges E(v) at v and outputs values in C.The counting problem on the instance Ω is to compute HolantΩ = ξ:E→{0,1} v∈V fv (ξ |E(v) ). Suppose G is a bipartite graph (U, V, E) such that each u ∈ U has degree 2. Furthermore suppose each v ∈ V is labeled by an Equality function =k where k = deg(v). Then any non-zero term in HolantΩ corresponds to a 0-1 assignment σ : V → {0, 1}. In fact, we can merge the two incident edges at u ∈ U into one edge eu , and label this edge eu by the function fu . This gives an edge-labeled graph (V, E ) where E = {eu : u ∈ U }. For an edge-labeled graph (V, E ) where e ∈ E has label ge , HolantΩ = σ:V →{0,1} e=(v,w)∈E ge (σ(v), σ(w)). If each ge is the same complex-valued symmetric function g, then this is the partition function Z(G) which we are studying in this paper. A symmetric function g : {0, 1}k → C can be denoted as [g0 , g1 , . . . , gk ], where gi is the value of g on inputs of Hamming weight i. They are also called signatures. Frequently we will revert back to the bipartite view: for (2, k)-regular bipartite graphs (U, V, E), if every u ∈ U is labeled g = [g0 , g1 , g2 ] and every v ∈ V is labeled r = [r0 , r1 , . . . , rk ], then we also use #[g0 , g1 , g2 ] | [r0 , r1 , . . . , rk ] to denote the holant problem. A main component of the dichotomy theorem of this paper is to classify #[x, y, z] | =k , for any x, y, z ∈ C. If y = 0 then this is easily computable in P, so we assume y = 0. The problem #[x, y, z] | =k has the same complexity as #[x/y, 1, z/y] | =k , hence we can normalize [x, y, z] so that y = 1. We will also denote Holk (a, b) = #[a, 1, b] | =k , or Pl-Holk (a, b) to denote #[a, 1, b] | =k when restricted to planar graphs as input. More generally, If G and R are sets of signatures, and vertices of U (resp. V ) are labeled by signatures from G (resp. R), then we also use #G | R to denote the bipartite holant problem. The main dichotomy theorem of this paper classifies problems of the form #[x, y, z] | R where R is any set of Equality signatures of various arities. Signatures in G are called generators and signatures in R are called recognizers. Throughout this paper, all (2, k)-regular bipartite graphs are arranged with generators on the degree-2 side and recognizers on the degree-k side. Signatures from F are available at each vertex as part of an input graph. Instead of a single vertex, we can use graph fragments to generalize this notion. An F -gate Γ is a pair (H, F ), where H = (V, E, D) is a graph with some
150
J.-Y. Cai and M. Kowalczyk
dangling edges D (the gadgets in Figure 1 are examples). Other than these dangling edges, an F -gate is the same as a signature grid. The role of dangling edges is similar to that of external nodes in Valiant’s notion [20], however we allow more than one dangling edge for a node. In H = (V, E, D) each node is assigned a function in F (we do not consider “dangling” leaf nodes at the end of a dangling edge among these), E are the regular edges, and D are the dangling edges. Then we can define a function for this F -gate: Γ (y1 , y2 , . . . , yq ) = (x1 ,x2 ,...,xp )∈{0,1}p H(x1 , x2 , . . . , xp , y1 , y2 , . . . , yq ), where p = |E|, q = |D|, (y1 , y2 , . . . , yq ) ∈ {0, 1}q denotes an assignment on the dangling edges, and H(x1 , x2 , . . . , xp , y1 , y2 , . . . , yq ) denotes the value of the F -gate on an assignment of all edges, i.e., the product of evaluations at every vertex of H, for (x1 , x2 , . . . , xp , y1 , y2 , . . . , yq ) ∈ {0, 1}p+q . We will also call this function the signature of the F -gate Γ . An F -gate can be used in a signature grid as if it is just a single node with the same signature. In this paper we will designate dangling edges as either leading edges or trailing edges. Each F -gate in Figures 1, 3, and 5 is pictured with leading edges protruding from the top and any trailing edges from the bottom. Suppose an F -gate has n leading edges and m trailing edges. Then the signature of the F gate can be organized as a 2n by 2m matrix M , where the row is indexed by the {0, 1}-assignment to the leading edges and the column is indexed by the {0, 1}-assignment to the trailing edges. If the number of trailing edges in one F -gate matches the number of leading edges in another, then a new F -gate can be formed by merging these edges, and the associated matrix is obtained by multiplying the two original matrices together. In particular, an F -gate with only leading edges would be viewed as a column vector, and then merging with an F gate with a matching number of trailing edges corresponds to pre-multiplication by the associated matrix. In this way we can view an F -gate with n leading edges and m trailing edges as transforming F -gates with arity-m signatures into F -gates with arity-n signatures. The F -gates in this paper will transform symmetric signatures to symmetric signatures. This implies that there exists an which operates directly on column vectors equivalent n + 1 by m + 1 matrix M written in symmetric signature notation. We will henceforth identify the matrix with the F -gate itself. The constructions in this paper are based upon three M different types of bipartite F -gates which we call starter gadgets, recursive gadgets, and finisher gadgets. An arity-r starter gadget is an F -gate with no trailing edges, r leading edges, and internally all leading edges are incident with degree2 vertices. An arity-r recursive gadget is an F -gate with r trailing edges and r leading edges. Internally, we also require that all leading edges of a recursive gadget are incident with degree-2 vertices, while all trailing edges are incident with degree-k vertices. Finally, an F -gate is an arity-r finisher gadget if it has r trailing edges and 2 leading edges; every finisher gadget must have degree-k vertices internally incident with its trailing and leading edges. We also require that the corresponding 3 by r + 1 matrix has rank 2 and all zeros in the middle row. These three gadget types are defined in such a way because the trailing edges of each recursive gadget and finisher gadget will be merged with the leading edges
Spin Systems with Complex Edge Functions
151
of some recursive gadget or starter gadget, thus the construction preserves the bipartite structure of the signature grid it is embedded in. In the same way, we also need to ensure that the leading edges of finisher gadgets connect externally to vertices of degree 2 in order to preserve the bipartite structure of the graph. Throughout this paper, we denote X = ab and Y = ak + bk , and we assume that a, b ∈ C. In all cases our gadgets have signature [a, 1, b] assigned to the degree-2 vertices and signature =k assigned to the degree-k vertices. We use Mi to denote the (recurrence matrices of the) gadgets displayed in Figures 1, 3, and 5 with the vertex signatures assigned as described. We use ≤T to denote a polynomial time Turing reduction.
3
Interpolation Technique
In this section we develop the interpolation technique we use to derive most of the hardness results. It can be viewed as an improvement on the unary recursive construction from [11, 18]. Our construction addresses a parity issue in the earlier construction; it is not possible to construct an F -gate with a single dangling edge on a regular graph with even degree, so we develop a way around this obstacle, while preserving the use unary recursive gadgets. This circular construction is displayed in Figure 2. We start with the following lemma, which follows more or less directly from Lemma 3.1 of [18]. Lemma 1. Suppose {mt }t≥0 is a series of pairwise linearly independent column vectors in C3 . Let F , F , and F ∈ C×3 be three matrices, each of rank 2, where ≥ 2 and the intersection of the row spaces of F , F , and F is trivial {0}. Then for every n, there exists some F ∈ {F , F , F }, and some S ⊆ {F mt : 0 ≤ t ≤ n3 }, such that |S| ≥ n and vectors in S are pairwise linearly independent. Lemma 2. Suppose that the following gadgets can be built using complex-valued signatures from a finite generator set G and a finite recognizer set R. 1. A unary recursive gadget with nonsingular recurrence matrix M , for which there is no positive integer t and d ∈ C such that M t = dI. 2. A binary starter gadget with nondegenerate signature [z0 , z1 , z2 ], such that z z AM t is symmetric for all t ≥ 0 where A = 0 1 . z1 z2 3. Three finisher gadgets with matrices F1 , F2 , F3 ∈ C3×3 , where the intersection of the row spaces of F1 , F2 , and F3 is the zero vector. Then for any x, y ∈ C, #G | R ∪ {[x, 0, y]} ≤T #G | R. Proof. Assume we have oracle access to queries of the form #G | R. Let F = G ∪ R. The construction begins with gadget A: designate one dangling edge to be the “fixed” leading edge, and call this F -gate N0 . Recursively, F -gate Nt+1 is defined to be Nt connected to gadget M in such a way that the trailing edge of M is merged with the non-fixed leading edge of Nt . Then F -gate Gt is defined to be
152
J.-Y. Cai and M. Kowalczyk
Fi A
M
M
...
M
(a) Circular construction
(b) A starter gadget, A
(c) A recursive gadget, M
Fig. 2. Circular construction
Nt connected to one of the finisher gadgets, with the trailing edges of the finisher gadget merged with the leading edges of Nt (see Figure 2). Now we analyze the construction with respect to a given bipartite signature grid Ω for the holant problem #G | R ∪ {[x, 0, y]}, with underlying graph G = (V, E). Let Q ⊆ V be the set of vertices with [x, 0, y] signatures, and let n = |Q|. Note that for t > t there is no scalar λ ∈ C such that λAM t = AM t , otherwise since A and M 1/(t−t ) t−t are both nonsingular, we get (λ M) = I, which by assumption cannot be true. So the F -gates defined by any such AM t and AM t have symmetric signatures, and these signatures are pairwise linearly independent. For every t ≥ 0, let mt denote the (symmetric) signature of AM t written as a column vector in C3 . By Lemma 1 there exists some 1 ≤ j ≤ 3 such that at least n + 2 of the first (n + 2)3 + 1 vectors of the form Fj mt are pairwise linearly independent. We use this finisher gadget Fj in the construction, so that the signature of Gt is Fj mt , which we denote by [Xt , 0, Yt ] (recall that the middle row of a finisher gadget matrix is all zeros, so the middle term of the signature Gt is also zero). At most one such Yt can be zero, so there exists a subset S of these signatures for which each Yt is nonzero and |S| = n + 1. We will argue using only the existence of S, so there is no need to algorithmically “find” such a set, and for that matter, one can try out all three finisher gadgets without any need to determine which finisher gadget is “the correct one” beforehand. If we replace every element of Q with a copy of Gt , we obtain an instance of #G | R (note that the correct bipartite signature structure is preserved), and we denote this new signature grid by Ωt . Although HolantΩt is a sum of exponentially many terms, each nonzero term has the form bXti Ytn−i for some i, and for some b ∈ C which does not depend on Xt or Yt . Then for some ci ∈ C the sum can be rewritten as ci Xti Ytn−i . HolantΩt = 0≤i≤n
Since each signature grid Ωt is an instance of #G | R, HolantΩt can be solved exactly using the oracle. Carrying out this process for every t ∈ {0, 1, . . . , (n + 2)3 }, we arrive at a linear system where the ci values are the unknowns. ⎡ ⎢ ⎢ ⎢ ⎣
HolantΩ0 HolantΩ1 .. . HolantΩ(n+2)3
⎤
⎡
⎥ ⎢ ⎥ ⎢ ⎥=⎢ ⎦ ⎣
X00 Y0n X10 Y1n .. .
X01 Y0n−1 X11 Y1n−1 .. .
··· ··· .. .
X0n Y00 X1n Y10 .. .
n−1 0 n 1 n 0 X(n+2) 3 Y(n+2)3 X(n+2)3 Y(n+2)3 · · · X(n+2)3 Y(n+2)3
⎤⎡
⎤ c0 ⎥ ⎢ c1 ⎥ ⎥⎢ ⎥ ⎥ ⎢ .. ⎥ . ⎦⎣ . ⎦ cn
Spin Systems with Complex Edge Functions
153
For 0 ≤ i ≤ n, let ti be such that S = {[Xt0 , 0, Yt0 ], [Xt1 , 0, Yt1 ], . . . , [Xtn , 0, Ytn ]}, and let [xi , 0, yi ] = [Xti , 0, Yti ]. Then we have a subsystem ⎤ ⎡ 0 0 1 −1 ⎤⎡ ⎤ ⎡ −n c0 x0 y0 x0 y0 · · · xn0 y0−n y0 · HolantΩ0 ⎢ y1−n · HolantΩ1 ⎥ ⎢ x01 y10 x11 y −1 · · · xn1 y −n ⎥ ⎢ c1 ⎥ 1 1 ⎥⎢ ⎥ ⎢ ⎥ ⎢ ⎥=⎢ . ⎢ .. .. .. ⎥ ⎢ .. ⎥ . .. . ⎣ ⎦ ⎦ ⎣ ⎣ . . ⎦ . . . . −n 0 0 1 −1 n −n cn yn · HolantΩn xn yn xn yn · · · xn yn The matrix above has entry (xr /yr )c at row r and column c. Due to pairwise linear independence of [xr , 0, yr ], xr /yr is pairwise distinct for 0 ≤ r ≤ n. Hence this is a Vandermonde system of full rank. Therefore the initial feasible linear system has full rank and we can solve it for the ci values. With these values in hand, we can calculate HolantΩ = 0≤i≤n ci xi y n−i directly, completing the reduction. For every recursive gadget presented in this paper, the existence of a corresponding binary starter gadget is trivial, as condition (2) of Lemma 2 follows directly by creating symmetry in the underlying graph (see Figure 2, for example), and from the fact that the recursive gadget satisfying condition (1) must already be nonsingular. Also, we can construct an explicit set of finisher gadgets which is completely general, in the sense that if our finisher gadgets do not satisfy condition (3) for some a, b ∈ C, then Pl-Holk (a, b) is in P. This set of finisher gadgets is {M5 M8i , M7 M8i , M6 M4i }0≤i≤2 . Once we have obtained recursive gadgets to satisfy condition (1), it can be shown that the interpolation of signatures of the form [∗, 0, ∗] permits a reduction from counting Vertex Cover (#VC) on k-regular graphs (in other words, #[0, 1, 1] | =k ), which is known to be #P-hard for k ≥ 3, even when restricted to planar graphs as input [10, 21]. The idea is a modification of Lemma 3.3 in [18].
(a) M4
(b) M5
(c) M6
(d) M7
(e) M8
Fig. 3. Gadgets used to construct the general-purpose finisher gadget set. For various k, the thick edges are replaced by any number of pairs of edges in parallel.
Lemma 3. Suppose that (a, b) ∈ C2 − {(a, b) : ab = 1} − {(0, 0)} and let G and R be finite signature sets where [a, 1, b] ∈ G, =k ∈ R, and k ≥ 3. Further assume that #G | R∪{[xi , 0, yi ] : 0 ≤ i < m} ≤T #G | R for any xi , yi ∈ C and m ∈ Z+ . Then #G ∪ {[0, 1, 1]} | R ≤T #G | R, and #G | R is #P-hard. Proof. Since #[0, 1, 1] | =k is #P-hard for k ≥ 3, we only need to show how to simulate the generator signature [0, 1, 1]. Respectively, Gadgets 1, 2, and 3
154
J.-Y. Cai and M. Kowalczyk
θ (a) Gadget 1
γ
θ
γ
ρ
(b) Gadget 2
γ
θ
γ
ρ
(c) Gadget 3
Fig. 4. Gadgets used to simulate the [0,1,1] signature
(Figure 4) can be used to simulate generator signatures [b−1 , 1, 2b], [0, 1, 5/(2a)], and [0, 1, 1] in the cases where ab = 0, ab = −1, and both ab = 0 and ab = −1 (when ab = 0, we assume without loss of generality that a = 0 and b = 0). To carry this out, we set θ = [b, 0, b−1 ] in Gadget 1; θ = [1/(6a), 0, −a/24] and γ = [−3/a, 0, a] in Gadget 2; and θ = (ab + 1)(1 − ab)−1 [1, 0, −a2 ], γ = [−a−2 , 0, b−1 (1 + ab)−1 ], and ρ = (ab − 1)−1 [−b, 0, a] in Gadget 3 — all unlabeled vertices are assigned the generator signature [a, 1, b]. This results in a chain of reductions to simulate [0, 1, 1] in all cases (i.e. Gadget 2 simulates a signature to be used as a generator signature in Gadget 1, which in turn simulates a generator signature to be used in Gadget 3, and Gadget 3 simulates [0, 1, 1]). From all of this, we can derive the following. Theorem 2. Suppose that the following gadgets can be built using generator [a, 1, b] and recognizer =k , where k ≥ 3, X = 1, and ak = bk . 1. A planar unary recursive gadget with nonsingular recurrence matrix M , whose eigenvalues have distinct norm. 2. A planar binary starter gadget with nondegenerate signature [z0 , z1 , z2 ], such z z 0 1 that AM k is symmetric for all k ≥ 0 where A = . z1 z2 Then Pl-Holk (a, b) is #P-hard.
4
Classification of Complex Signatures
Now we show that Holk (a, b) is #P-hard unless Theorem 1 indicates it is in P. This is done by constructing recursive gadgets for k-regular graphs for all k ≥ 3, and applying Theorem 2. A dichotomy for Holk (a, b) is already known when X and Y are both real [10], so we only need to consider the case where X and Y are not both real. We consider even k and odd k separately. Since odd k ≥ 3 can be handled using ESPs and natural generalizations of other gadgets found in [18], we omit this case. We will focus on even k ≥ 4, which is the more interesting setting. We will use the following result (see [18]). Lemma 4. If both roots of the complex polynomial x2 + Bx + C have the same 2 norm, then B|C| = BC and B 2 C = B C. If further B = 0 and C = 0, then Arg(B 2 ) = Arg(C).
Spin Systems with Complex Edge Functions
155
We want to construct recursive gadgets for all even k ≥ 4, provided X = 1 and that X and Y are not both real (note that this excludes X = −1 with Y = ±2, which is tractable for even k). To this end, we come to rely on the power of a syzygy in the next key lemma. The almost miraculous cancellation of non-trivial factors is the key to proving hardness. Just as remarkable, it provides all of the recursive gadgets we need (aside from the special case X = 0, which we omit here). Lemma 5. Suppose X ∈ / {0, 1}, and it is not the case that X and Y are both real. Then either gadget M1 , M2 , or M3 (see Figure 1) has nonzero eigenvalues with distinct norm. Proof. We start by calculating the trace and determinant of all three gadgets. tr(M1 ) = 2X k/2 + Y tr(M2 ) = 2X k/2−1 + Y tr(M3 ) = (2X k/2 + Y )(2X k/2−1 − X k/2 + X k/2−2 + Y ) det(M1 ) = X k/2−1 (X − 1)(2X k/2 + Y ) det(M2 ) = X k/2−2 (X − 1)(X k/2−1 + X k/2+1 + Y ) det(M3 ) = X k−3 (X − 1)2 (2X k/2 + Y )(X k/2−1 + X k/2+1 + Y ) Note that if X = −1 then Y ∈ / R, det(M1 ) = 0, tr(M1 ) = 0, and
tr2 (M1 ) det(M1 )
=
2X k/2 +Y (X−1)X k/2−1
∈ / R so we are done by Lemma 4; thus we will assume that X = −1 throughout. We claim that if any one of these traces or determinants is zero, then one of the other two gadgets has nonzero eigenvalues with distinct norm. For instance, if Y = −2X k/2 , then tr(M2 ) = −2(X − 1)X (k−2)/2 and det(M2 ) = (X −1)3 X k−3 so by Lemma 4, if gadget M2 had eigenvalues with equal norm then we would have Arg(4X) = Arg(X −1) and X, Y ∈ R. Similarly, if Y = −2X k/2−1 then tr(M3 ) = −2(X − 1)2 X k−3 (1 + X) and det(M3 ) = 2(X − 1)4 X 2k−5 (1 + X) and Lemma 4 implies that gadget M3 has eigenvalues with unequal norm since Arg(2(1+X)) = Arg(X) and X, Y ∈ R otherwise. If Y = −X k/2+1 −X k/2−1 then tr(M1 ) = −(X − 1)2 X (k−2)/2 and det(M1 ) = −(X − 1)3 X k−2 and by Lemma 4 gadget M1 has eigenvalues with unequal norm because otherwise Arg(1 − X) = Arg(1) and X, Y ∈ R. Finally, if Y = −2X k/2−1 + X k/2 − X k/2−2 then tr(M1 ) = (X − 1)X (k−4)/2 (1 + 3X) and det(M1 ) = (X − 1)2 X k−3 (1 + 3X) and again by Lemma 4 gadget M1 has eigenvalues with unequal norm since Arg(1 + 3X) = Arg(X) and X, Y ∈ R otherwise. Now we may assume that each trace and determinant is nonzero. If all three gadgets fail to have eigenvalues with distinct norm, then Lemma 4 intr2 (M) + dicates that det(M for each M ∈ {M1 , M2 , M3 }. Supposing this is the ) ∈ R 2 tr2 (M1 ) (M3 )det(M2 )det(M1 ) 2X k/2 +Y = det(M ∈ R and tr tr2 (M1 )tr2 (M2 )det(M3 ) = X k/2−1 (X−1) 1) k/2−2 k/2−2 (2X k/2−1 −X k/2 +X k/2−2 +Y )2 (X 2 −1) 2 (X 2 −1) = (1 − X2X k/2−1 ) , hence X2X k/2−1 ∈ R. This (2X k/2−1 +Y )2 +Y +Y
case, we observe that
remarkable cancellation in the three gadgets’ failure conditions is crucial. Fix X∈ / {0, ±1}, and this defines two lines on the Y -plane as r and s vary over R: Y = −2X k/2 + r · X k/2−1 (X − 1) and Y = −2X k/2−1 + s · X k/2−2 (X 2 − 1).
156
J.-Y. Cai and M. Kowalczyk
Fig. 5. Recursive gadgets for Holk (a, b). Each gadget here is shown for fixed degree k, but all generalize to higher degrees by adding length-2 cycles to the recognizer vertices.
Together, after canceling a common factor X k/2−2 (X − 1), these two equations imply that (r − s − 2)X = s ∈ R, meaning that X ∈ R unless s = 0. But if s = 0 then we have Y = −2X k/2−1 , violating the assumption that tr(M2 ) = 0. Thus we have X ∈ R and also Y = −2X k/2−1 + s · X k/2−2 (X 2 − 1) ∈ R. Although Pl-Holk (a, b) is in P when ak = bk (equivalently, Y 2 = 4X k ), it turns out that Holk (a, b) is #P-hard in this case — except for the tractable subcases X ∈ {0, ±1}. This can be proved using the gadgets pictured in Figure 5. Skipping these details, we arrive at the following dichotomy. Theorem 3. If any of the following five conditions is true, then Holk (a, b) and Pl-Holk (a, b) are both solvable in P: 1. 2. 3. 4. 5.
k≤2 X=1 X = 0 and Y = 0 X = −1 and Y = 0 X = −1 and Y 2 = 4X k
If Y 2 = 4X k then Pl-Holk (a, b) is solvable in P. If none of these conditions apply, then Holk (a, b) (or Pl-Holk (a, b)) is #P-hard. Using Theorem 3, a significantly stronger result can be proved with moderately more effort. This involves holographic reductions, interpolation using gadgets, direct gadget reductions, and strengthening the tractability side of Theorem 1. Theorem 4. Let S ⊆ Z+ be nonempty, let R = {=k : k ∈ S}, and let d = gcd(S). Then #[a, 1, b] | R is #P-hard for all a, b ∈ C, both for input restricted to planar graphs and for unrestricted input, except in the following cases, for which the problem is in P: 1. 2. 3. 4. 5.
R ⊆ {=1 , =2 }. ab = 1. a = b = 0. ab = −1 and a4d = 1. the input is restricted to planar graphs and ad = bd .
Additionally, #[a, 0, b] | R is in P for all a, b, ∈ C.
Spin Systems with Complex Edge Functions
157
References 1. Baxter, R.: Exactly solved models in statistical mechanics. Academic Press, London (1982) 2. Bulatov, A.A.: A dichotomy theorem for constraint satisfaction problems on a 3-element set. J. ACM 53(1), 66–120 (2006) 3. Bulatov, A.A.: The complexity of the counting constraint satisfaction problem. Electronic Colloquium on Computational Complexity (ECCC) 14(093) (2007), http://eccc.hpi-web.de/eccc-reports/2007/TR07-093/index.html 4. Bulatov, A.A.: The complexity of the counting constraint satisfaction problem. In: Aceto, L., Damg˚ ard, I., Goldberg, L.A., Halld´ orsson, M.M., Ing´ olfsd´ ottir, A., Walukiewicz, I. (eds.) ICALP 2008, Part I. LNCS, vol. 5125, pp. 646–661. Springer, Heidelberg (2008) 5. Bulatov, A.A., Dalmau, V.: Towards a dichotomy theorem for the counting constraint satisfaction problem. Inf. Comput. 205(5), 651–678 (2007) 6. Bulatov, A.A., Grohe, M.: The complexity of partition functions. Theor. Comput. Sci. 348(2-3), 148–186 (2005) 7. Cai, J.Y., Chen, X.: A decidable dichotomy theorem on directed graph homomorphisms with non-negative weights. In: FOCS, pp. 437–446 (2010) 8. Cai, J.Y., Chen, X., Lu, P.: Graph homomorphisms with complex values: A dichotomy theorem. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010. LNCS, vol. 6198, pp. 275–286. Springer, Heidelberg (2010) 9. Cai, J.Y., Chen, X., Lu, P.: Non-negative weighted #CSPs: An effective complexity dichotomy, arXiv 1012.5659 (2010) 10. Cai, J.Y., Kowalczyk, M.: A dichotomy for k-regular graphs with {0, 1}-vertex assignments and real edge functions. In: Kratochv´ıl, J., Li, A., Fiala, J., Kolman, P. (eds.) TAMC 2010. LNCS, vol. 6108, pp. 328–339. Springer, Heidelberg (2010) 11. Cai, J.Y., Lu, P., Xia, M.: A computational proof of complexity of some restricted counting problems. Theor. Comput. Sci. 412(23), 2468–2485 (2011) 12. Creignou, N., Khanna, S., Sudan, M.: Complexity classifications of boolean constraint satisfaction problems. SIAM Monographs on Discrete Mathematics and Applications (2001) 13. Dyer, M., Richerby, D.: An effective dichotomy for the counting constraint satisfaction problem, arXiv 1003.3879 (2010) 14. Dyer, M.E., Goldberg, L.A., Jerrum, M.: The complexity of weighted boolean CSP. SIAM J. Comput. 38(5), 1970–1986 (2009) 15. Dyer, M.E., Goldberg, L.A., Paterson, M.: On counting homomorphisms to directed acyclic graphs. J. ACM 54(6) (2007) 16. Dyer, M.E., Greenhill, C.S.: The complexity of counting graph homomorphisms. Random Struct. Algorithms 17(3-4), 260–289 (2000) 17. Goldberg, L.A., Grohe, M., Jerrum, M., Thurley, M.: A complexity dichotomy for partition functions with mixed signs. SIAM J. Comput. 39(7), 3336–3402 (2010) 18. Kowalczyk, M., Cai, J.Y.: Holant problems for regular graphs with complex edge functions. In: Marion, J.Y., Schwentick, T. (eds.) STACS, pp. 525–536 (2010) 19. Temperley, H.N.V., Fisher, M.E.: Dimer problem in statistical mechanics — an exact result. Philosophical Magazine 6, 1061–1063 (1961) 20. Valiant, L.G.: Holographic algorithms. SIAM J. Comput. 37(5), 1565–1594 (2008) 21. Xia, M., Zhang, P., Zhao, W.: Computational complexity of counting problems on 3-regular planar graphs. Theor. Comput. Sci. 384(1), 111–125 (2007)
Quantum Algorithm for the Boolean Hidden Shift Problem Dmitry Gavinsky, Martin Roetteler, and J´er´emie Roland NEC Laboratories America, Inc. {dmitry,mroetteler,jroland}@nec-labs.com
Abstract. The hidden shift problem is a natural place to look for new separations between classical and quantum models of computation. One advantage of this problem is its flexibility, since it can be defined for a whole range of functions and a whole range of underlying groups. In a way, this distinguishes it from the hidden subgroup problem where more stringent requirements about the existence of a periodic subgroup have to be made. And yet, the hidden shift problem proves to be rich enough to capture interesting features of problems of algebraic, geometric, and combinatorial flavor. We present a quantum algorithm to identify the hidden shift for any Boolean function. Using Fourier analysis for Boolean functions we relate the time and query complexity of the algorithm to an intrinsic property of the function, namely its minimum influence. We show that for randomly chosen functions the time complexity of the algorithm is polynomial. Based on this we show an average case exponential separation between classical and quantum time complexity. A perhaps interesting aspect of this work is that, while the extremal case of the Boolean hidden shift problem over so-called bent functions can be reduced to a hidden subgroup problem over an abelian group, the more general case studied here does not seem to allow such a reduction.
1
Introduction
Hidden shift problems have been studied in quantum computing as they provide a framework that can give rise to new quantum algorithms. The hidden shift problem was first introduced and studied in a paper by van Dam, Hallgren and Ip [vDHI06] and is defined as follows. We are given two functions f , g that map a finite group G to some set with the additional promise that there exists an element s ∈ G, the so-called shift, such that for all x it holds that g(x) = f (x+s). The task is to find s. Here the group G is additively denoted, but the problem can be defined for non-abelian groups as well. The great flexibility in the definition allows to capture interesting problems ranging from algebraic problems such as the shifted Legendre symbol [vDHI06], over geometric problems such as finding the center of shifted spheres [CSV07, Liu09] and shifted lattices [Reg04], to combinatorial problems such as graph isomorphism [CW07]. Notable here is a well-known connection between the hidden subgroup problem for the dihedral group, a notoriously difficult instance which itself has B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 158–167, 2011. c Springer-Verlag Berlin Heidelberg 2011
Quantum Algorithm for the Boolean Hidden Shift Problem
159
connections to lattice problems and average case subset sum [Reg04] and a hidden shift problem over the cyclic group Zn where the functions f and g are injective [Kup05, MRRS07, CvD07]. It is known [FIM+ 03, Kup05] that the hidden shift problem for injective functions f, g : G → S that map from an abelian G to a set S is equivalent to hidden subgroup problem over the semi-direct product between G and Z2 , where the action of Z2 on G is given by the inverse. We would like to point out that the functions studied here are Boolean functions (i.e., G = Zn2 ) and therefore far from being injective. Even turning them into injective quantum functions, as is possible for bent functions [R¨ ot10], seems not to be obvious in this case. Another recent example of a non-abelian hidden shift problem arises in a reduction used to argue that the McEliece cryptosystems withstands certain types of quantum attacks [DMR10]. In this paper we confine ourselves to the abelian case and in particular to the case where G = Zn2 is the Boolean hypercube. The resulting hidden shift problem for Boolean functions, i.e., functions that take n bits as inputs and output just 1 bit, at first glance looks rather innocent. However, to our knowledge, the Boolean case was previously only addressed for two extreme cases: a) functions which mark precisely one element and b) functions which are maximally apart from any affine Boolean function (so-called bent functions). In case a), the problem of finding the shift is the same as unstructured search, so that the hidden shift can be found by Grover’s algorithm [Gro96] and the query complexity is known √ to be tight and is given by Θ( 2n ). In case b) the hidden shift can be discovered in one query using an algorithm that was found by one of the co-authors [R¨ ot10], provided that the dual of the function can be computed efficiently, where the definition of the dual is via the Fourier spectrum of the function which in this case can be shown to be flat in absolute value. If no efficient implementation of the dual is known then still a quantum algorithm exists that can identify the hidden shift in O(n) queries. The present paper can be thought of as a generalization of this latter algorithm to the case of Boolean functions other than those having a flat spectrum. This is motivated by the quite natural question of what happens when the extremal conditions leading to the family of bent functions are relaxed. In this paper we address the question of whether there is a broader class of functions for which hidden shifts of a function can be identified. The first obvious step in direction of a generalization is actually a roadblock: Grover’s search problem [Gro96] can also be cast as a hidden shift problem. In this case the corresponding class of Boolean functions are the delta functions, i.e., f, g : {0, 1}n → {0, 1}, where g(x) = f (x + s) and f (x) is the function that takes value 1 on input (0, . . . , 0) and 0 elsewhere and g(x) is the function that takes the value 1 on input s and 0 elsewhere. Grover’s algorithm [Gro96] allows √ to find s in time O( 2n) on a quantum computer (which is also the fastest possible [BV97]). Thus, the following situation emerges for the quantum and the classical query complexities of these two extremal cases: for bent functions the classical query
160
D. Gavinsky, M. Roetteler, and J. Roland
√ complexity1 is Ω( 2n ) and the quantum query complexity2 is O(n). For delta functions the√classical query complexity is Θ(2n ) and the quantum query complexity is Θ( 2n ). For a general Boolean function the hidden shift problem can be seen as lying somewhere between these two extreme cases. This is somewhat similar to how the so-called weighing matrix problem [vD02] interpolates between the BernsteinVazirani problem [BV97] and Grover search, and how the generalized hidden shift problem [CvD07] interpolates between the abelian and dihedral hidden subgroup problems. However, apart from these two extremes, not much is known about the query complexity of the hidden shift problem for general Boolean functions. The main goal of this work was to understand the space between these two extremes. We show that there is a natural way to “interpolate” between them and to give an algorithm for each Boolean function whose query complexity depends only on properties of the Fourier spectrum of that function. Prior work. As far as hidden shifts of Boolean functions are concerned, besides the mentioned papers about the bent case and the case of search, very little was known. The main technique previously used to tackle hidden shift problem was by computing a suitable convolution. However, in order to maintain unitarity, much of target function’s features that we want to compute the convolution with had to be “sacrificed” by requiring the function to become diagonal unitary, leading to a renormalization of the diagonal elements, an issue perhaps first pointed out by [CM04]. No such renormalization is necessary if the spectrum is already flat which corresponds to the case of the Legendre symbol [vDHI06] (with the exception of one special value at 0) and the case of bent functions which was considered in [R¨ ot10]. Our results. We introduce a quantum algorithm that allows us to sample from vectors that are perpendicular to the hidden shift v according to a distribution that is related to the Fourier spectrum of the given Boolean function f . If f is bent, then this distribution is uniform which in turn leads to a unique characterization of v from O(n) queries via a system of linear equations. For general f more queries might be necessary and intuitively the more concentrated the Fourier spectrum of f is, the more queries have to be made: in the extreme case of a (±1 valued) delta function f the spectrum is extremely imbalanced and concentrated almost entirely on the zero Fourier coefficient which corresponds to the case of unstructured search for which our algorithm offers no advantage over Grover’s algorithm. For general f we give an upper bound on the number of queries in terms of the influence γf of the function f , where the influence is defined as γf = minv (Prx [f (x) = f (x + v)]). 1
2
Note that the query complexity depends crucially on how the functions f and g can be accessed: the stated bounds hold for the case where f and g are given as black-boxes. If f is a known bent function, then it is easy to see that the classical query complexity becomes O(n). A further improvement is possible in case the so-called dual bent function f is accessible via another black-box: in this case the quantum query complexity becomes constant [R¨ ot10].
Quantum Algorithm for the Boolean Hidden Shift Problem
161
From a simple application of the Chernoff bound it follows that it is extremely unlikely that a randomly chosen Boolean function will give rise to a hard instance for our quantum algorithm. This in turn gives rise to our main result of the paper (Theorem 2 in Section 4): Theorem (Average case exponential separation). Let (Of , Og ) be an instance of a Boolean hidden shift problem (BHSP) where g(x) = f (x + v) and f and v are chosen uniformly at random. Then there exists a quantum algorithm which finds v with bounded error using O(n) queries and in O(poly(n)) time whereas any classical algorithm needs Ω(2n/2 ) queries to achieve the same task. This result can be interpreted as an exponential quantum-classical separation for the time and query complexity of an average case problem. Finally, we would like to comment on the relationship between the problem considered in this paper and the abelian hidden subgroup problem. It is interesting to note, yet not particularly difficult to see, that the case of a hidden shift problem for bent functions can be reduced to that of an abelian hidden subgroup problem. The hiding function in this case is a quantum function, i. e., it takes values in the set of quantum states rather than just basis states. For the case of a non-bent function, including the cases of random functions considered here, the same direct correspondence to the hidden subgroup problem over an abelian group no longer exists, i. e., even though there is no obvious group/subgroup structure present in the function f , the algorithm can still identify the hidden shift v.
2
Preliminaries
Definition 1 (Boolean Hidden Shift Problem). Let n ≥ 1 and let f, g : Zn2 → Z2 be two Boolean functions such that the following conditions hold: – if for some t ∈ Zn2 it holds that f (x) = f (x + t) for all x ∈ Zn2 , then t = 0; – for some s ∈ Zn2 it holds that g(x) = f (x + s) for all x ∈ Zn2 . If f and g are given by two oracles Of and Og , we say that the pair (Of , Og ) defines an instance of a hidden shift problem (BHSP) for the function f . The value s ∈ Zn2 that satisfies g(x) ≡ f (x + s) is the solution of the given instance of the BHSP. We also consider the {+1, −1}-valued function F corresponding to the function f and view it as a function over R, that is, F : Zn2 → R : x → (−1)f (x) .
(1)
The arguments of these functions are assumed to belong to Zn2 , and their inner n product is defined accordingly, i.e., u, v = i=1 ui · vi . We also denote by χu (·) the elements of the standard Fourier basis corresponding to Zn2 , that is, χu (v) = (−1)u,v for every u, v ∈ Zn2 . We will see that the complexity of the BHSP depends on the notion of influence.
162
D. Gavinsky, M. Roetteler, and J. Roland
Definition 2 (Influence). For any Boolean function f over Zn2 and n-bit string v, we call γf,v = Prx [f (x) = f (x + v)] the influence of v over f , and γf = minv γf,v the minimum influence over f . The following lemma relates the influence over a Boolean function f to the Fourier spectrum of its {+1, −1}-valued analog F , see also [GOS+ 09, Fact 11, p. 14]. 2 Lemma 1. γf,v = u:v,u=1 F(u) . We give a proof of this lemma in Appendix A for completeness.
3
Our Algorithm
Theorem 1. There exists a quantum algorithm that solves an instance of BHSP √ defined over the function f using expected O(n/ γf ) oracle queries. The algorithm takes expected time polynomial in the number of queries.
|0
Z Of
|0
⊗n
H
⊗n
Og H ⊗n
⎫ ⎪ ⎪ ⎪ ⎬ measure ⎪ ⎪ ⎪ ⎭
Fig. 1. Quantum circuit for the Sampling Subroutine
Proof. The algorithm relies on the Sampling Subroutine described in Fig. 1, where H denotes the standard Hadamard gate, Z is a phase gate acting on one qubit as Z : |b → (−1)b |b , and Of is the oracle for f acting on n + 1 qubits as Of : |b |x → |b ⊕ f (x) |x (similarly for Og ). The algorithm works as follows: Quantum algorithm 1. Set i = 1 2. Run the Sampling Subroutine. Denote by (bi , ui ) the output of the measurement. 3. If Span{uk |k ∈ [i]} = Zn2 , increment i → i+1 and go back to step 2. Otherwise set t = i and continue. 4. Output “s”, where s is the unique solution of ⎧ ⎪ ⎨ u1 , s = b1 ; ... ⎪ ⎩ ut , s = bt .
Quantum Algorithm for the Boolean Hidden Shift Problem
163
Obviously, this algorithm makes O(t) quantum queries to the oracles and its complexity is polynomial in t + n. The quantum state before the measurement is Of 1 1 1 H ⊗n Z |0|0⊗n −→ √ |0|x −→ √ |f (x)|x −→ √ (−1)f (x) |f (x)|x 2n x 2n x 2n x Og 1 −→ √ (−1)f (x) |f (x) ⊕ g(x)|x 2n x F (x) + F (x + s) F (x) − F (x + s) 1 1 = √ |0 |x + √ |1 |x n n 2 2 2 2 x x 1 + χu (s) 1 − χu (s) H ⊗n −→ |0 F (u)|u + |1 F (u)|u. (2) 2 2 u u
Its measurement therefore always returns a pair (bi , ui ) ∈ {0, 1} × {0, 1}n where ui , s = bi . Moreover, since by construction Span{ui|i ∈ [t]} = Zn2 , the system of equations in step 4 accepts a unique solution that can only be the hidden shift s, thus the final answer of our algorithm is always correct. We now show that the algorithm terminates in bounded expected time. We need to prove that repeatedly sampling using the procedure in step 2 yields n linearly independent vectors ui , therefore spanning Zn2 , after a bounded expected number of trials t. Let (B, U ) be a pair of random variables describing the measurement outcomes for the Sampling Subroutine, and DfU denote the marginal distribution of U . From the right-hand side of (2) it is clear that 2 DfU (u) ≡ F (u) . Note that this distribution does not depend on g. Let di be the dimension of Span{uk |k ∈ [i]}. By construction, we have d1 = 1, dt = n and di+1 equals either di or di + 1. Let us bound the probability that di+1 = di +1, or, equivalently, that ui+1 ∈ / Span{uk |k ∈ [i]}. This probability can only decrease as di increases, so let us consider the worst case where di = n−1. In that case, there exists some v ∈ Zn2 \{0} such that Span{uk |k ∈ [i]} is exactly the subspace orthogonal to v. Then, the probability that ui+1 distributed according to DfU does not lie in this subspace (and hence di+1 = di + 1) is given by Pr [ v, u = 1] =
u∼DfU
2 F (u) = γf,v ,
u:v,u=1
which follows from Lemma 1. Therefore, for any i, the probability that di+1 = di + 1 is at least γf = minv γf,v , and the expected number of trials before it happens is at most 1/γf . Since di must be incremented n times, the expected total number of trials t is at most n/γf . Using quantum amplitude amplification, we can obtain a quadratic improvement over this expected running time. Indeed, instead of repeating the Sampling Subroutine O(1/γf ) times until we obtain a sample u not in the subspace
164
D. Gavinsky, M. Roetteler, and J. Roland
spanned by the previous samples, we can use quantum amplitude amplification, √ which achieves the same goal using only O(1/ γf ) applications of the quantum circuit in the Sampling Subroutine (see [BHMT02, Theorem 3]). We therefore obtain a quantum algorithm that solves the problem with success probability 1 √ and an expected number of queries O(n/ γf ). In case a lower bound on γf is known, we have the following corollary: Corollary 1. There exists a quantum algorithm that solves an instance of BHSP defined over the function f , with the promise that √ γf ≥ δ, with success probability at least 1 − ε and using at most O(n log(1/ε)/ δ) oracle queries. The algorithm takes expected time polynomial in the number of queries. Proof. This immediately follows from Markov’s inequality, since it implies that the algorithm in Theorem 1 will still succeed with constant probability even √ when we stop after a time Θ(n/ γf ) if it has not succeeded so far.
4
Classical Complexity of Random Instances of BHSP
In this section we show that a uniformly chosen instance of BHSP is exponentiallyhard classically with high probability. Lemma 2. A classical algorithm solving a uniformly random instance of BHSP with probability at least 1/2 makes Ω(2n/2 ) oracle queries. Proof. Consider a classical algorithm Acla that makes tcla queries to the oracles Af and Ag and with probability at least 1/2 returns the unique s satisfying g(x) ≡ f (x + s) (cf. Definition 1). For notational convenience we assume that Acla only makes duplicated queries (f (x), g(x)). This can at most double the total number of oracle calls. Consider the uniform distribution of f : Zn2 → Z2 and s ∈ Zn2 , and let an input instance of BHSP be chosen accordingly. Let (X1 , . . . , Xtcla ) be random variables representing the queries made by Acla . Then by the correctness assumption, the values f (X1 ), g(X1 ), . . . , f (Xtcla ), g(Xtcla ) can be used to predict s with probability at least 1/2. First we observe that if, after k queries, it holds that Xi − Xj = s for every i, j ∈ [k], then even conditionally on the values of f (X1 ), g(X1 ), . . . , f (Xk ), g(Xk ) every s ∈ / {Xi − Xj |i, j ∈ [k]} has exactly the same probability to occur. More precisely, if Sk = {Xi − Xj |i, j ∈ [k]} and Ek is the event that s ∈ Sk , we have Pr [s = s0 |¬Ek ] =
2n
1 1 ≤ n − |Sk | 2 − k2
(3)
for any s0 ∈ / Sk and 0 ≤ k ≤ tcla . In other words, modulo “s ∈ / Sk ” the actual values of f and g at points {Xi |i ∈ [k]} provide no additional information about s, and the best the algorithm can do in that case is a random guess, which succeeds with probability at most 1/(2n − k 2 ).
Quantum Algorithm for the Boolean Hidden Shift Problem
165
Now let us analyze the probability that Stcla = {Xi − Xj |i, j ∈ [tcla ]} contains s, that is, Pr [Etcla ]. Since |Sk+1 | − |Sk | ≤ k, we have by the union bound Pr [Ek+1 |¬Ek ] ≤
Pr [s = s0 |¬Ek ] ≤
s0 ∈Sk+1
k . 2n − k 2
Consequently, Pr [Etcla ] ≤
tcla −1
k=0 k 2n − t2cla
≤
2n
t2cla . − t2cla
Finally, we can bound the probability that the algorithm succeeds after tcla oracle queries as Pr [Acla succeeds] = Pr [Acla succeeds|Etcla ] · Pr [Etcla ] + Pr [Acla succeeds|¬Etcla ] · Pr [¬Etcla ] ≤ Pr [Etcla ] + Pr [Acla succeeds|¬Etcla ] ≤ which is larger than 1/2 only if tcla ∈ Ω 2n/2 , as required.
t2cla + 1 , 2n − t2cla
We are now ready to state our main theorem which is an exponential quantumclassical separation for an average case problem. Theorem 2 (Average case exponential separation). Let (Of , Og ) be an instance of a Boolean hidden shift problem (BHSP) where g(x) = f (x + v) and f and v are chosen uniformly at random. Then there exists a quantum algorithm which finds v with bounded error using O(n) queries and in O(poly(n)) time whereas any classical algorithm needs Ω(2n/2 ) queries to achieve the same task. Proof. For a fixed v and randomly chosen f , consider the 2n−1 mutually independent events “f (x) = f (x + v)”. By definition of γf,v and the Chernoff n bound, the probability that γf,v < 1/3 is at most e−Ω(2 ) . Since this is doubleexponentially small in n we obtain from an application of the union bound to the 2n possible values of v that if f : Zn2 → Z2 is chosen uniformly at random then n Prf [γf < 1/3] ∈ e−Ω(2 ) . We now apply Corollary 1 for constant γf to obtain a quantum algorithm that uses at most O(n) queries and outputs the correct hidden shift v with constant probability of success (i.e., ε is chosen to be constant). Combining this with the exponential lower bound from Lemma 2 implies that there is an exponential gap between the classical and quantum complexity of the BHSP defined over a random Boolean function.
5
Discussion and Open Problems
We presented a quantum algorithm for the Boolean hidden shift problem that is based on sampling from the space of vectors that are orthogonal to the hidden
166
D. Gavinsky, M. Roetteler, and J. Roland
shift. It should be noted that our algorithm reduces to one of the two algorithms given in [R¨ ot10] in case the function is a bent function. We related the running time and the query complexity of the algorithm to the minimum influence of the function and showed that for random functions these complexities are polynomial. This leads to an average case exponential separation between the classical and quantum time complexity for Boolean functions. An interesting question is whether these methods can be generalized and adapted for the case of nonBoolean functions also. Furthermore, we conjecture that the complexity of our quantum algorithm is optimal up to polynomial factors for any function. Acknowledgments. The authors acknowledge support by ARO/NSA under grant W911NF-09-1-0569. We wish to thank Andrew Childs, Sean Hallgren, Guosen Yue and Ronald de Wolf for fruitful discussions.
References [BHMT02] Brassard, G., Høyer, P., Mosca, M., Tapp, A.: Quantum amplitude amplification and estimation. In: Lomonaco Jr., S.J., Brandt, H.E. (eds.) Quantum Computation and Quantum Information: A Millennium Volume. Contemporary Mathematics Series, vol. 305, pp. 53–74. American Mathematical Society, Providence (2002) [BV97] Bernstein, E., Vazirani, U.: Quantum complexity theory. SIAM Journal on Computing 26(5), 1411–1473 (1997); Earlier version in Proc. STOC 1993, pp. 11–20 [CM04] Curtis, D., Meyer, D.A.: Towards quantum template matching, vol. 5161, pp. 134–141. SPIE, San Jose (2004) [CSV07] Childs, A., Schulman, L.J., Vazirani, U.: Quantum algorithms for hidden nonlinear structures. In: Proceedings of the 48th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2007), pp. 395–404 (2007) [CvD07] Childs, A., van Dam, W.: Quantum algorithm for a generalized hidden shift problem. In: Proceedings of the 18th Symposium on Discrete Algorithms (SODA 2007), pp. 1225–1232 (2007) [CW07] Childs, A., Wocjan, P.: On the quantum hardness of solving isomorphism problems as nonabelian hidden shift problems. Quantum Information and Computation 7(5-6), 504–521 (2007) [vD02] van Dam, W.: Quantum algorithms for weighing matrices and quadratic residues. Algorithmica 34, 413–428 (2002) [vDHI06] van Dam, W., Hallgren, S., Ip, L.: Quantum algorithms for some hidden shift problems. SIAM Journal on Computing 36, 763–778 (2006); Earlier version in Proc. SODA 2003, pp. 489–498 [DMR10] Dinh, H., Moore, C., Russell, A.: The McEliece cryptosystem resists quantum Fourier sampling attacks (2010) [FIM+ 03] Friedl, K., Ivanyos, G., Magniez, F., Santha, M., Sen, P.: Hidden translation and orbit coset in quantum computing. In: Proceedings of the 35th Annual ACM Symposium on Theory of Computing (STOC 2003), pp. 1–9 (2003)
Quantum Algorithm for the Boolean Hidden Shift Problem [GOS+ 09]
[Gro96]
[Kup05]
[Liu09]
[MRRS07]
[Reg04] [R¨ ot10]
A
167
Gopalan, P., O’Donnell, R., Servedio, R., Shpilka, A., Wimmer, K.: Testing Fourier Dimensionality and Sparsity. In: Albers, S., MarchettiSpaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5555, pp. 500–512. Springer, Heidelberg (2009); Long version: Carnegie Mellon University Technical Report (2009), Computer Science Department, Paper 1162 Grover, L.K.: A fast quantum mechanical algorithm for database search. In: Proceedings of the 28th Annual ACM Symposium on Theory of Computing (STOC 1996), pp. 212–219. ACM, New York (1996) Kuperberg, G.: A subexponential-time quantum algorithm for the dihedral hidden subgroup problem. SIAM Journal on Computing 35(1), 170–188 (2005) Liu, Y.-K.: Quantum algorithms using the curvelet transform. In: Proceedings of the 41st Annual ACM Symposium on Theory of Computing (STOC 2009), pp. 391–400. ACM, New York (2009) Moore, C., Rockmore, D., Russell, A., Schulman, L.: The power of strong Fourier sampling: quantum algorithms for affine groups and hidden shifts. SIAM Journal on Computing 37(3), 938–958 (2007) Regev, O.: Quantum computation and lattice problems. SIAM Journal on Computing 33(2), 738–760 (2004) R¨ otteler, M.: Quantum algorithms for highly non-linear Boolean functions. In: Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2010), pp. 448–457 (2010)
Proof of Lemma 1
Lemma 1. γf,v =
u:v,u=1
2 F (u) .
v (x) def Proof. Let us consider the following function F = F (x) − F (x + v). Its Fourier transform reads v (u) = E [F (x) · χu (x) − F (x + v) · χu (x)] = (1 − χu (v)) · F (u). F x
Therefore, we have 2 2 1 1 2 F v (u) F (u) = (1 − χu (v)) · F(u) = 4 4 u∈Zn u∈Zn u:v,u=1 2 2 1 2 = E Fv (x) = Pr [F (x) = F (x + v)] = γf,v , x 4 x
where in the second line we have used Parseval’s identity.
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma for Satisfiability Jochen Messner and Thomas Thierauf Aalen University, 73430 Aalen, Germany {jochen.messner,thomas.thierauf}@htw-aalen.de
Abstract. Recently, Moser and Tardos [MT10] came up with a constructive proof of the Lov´ asz Local Lemma. In this paper, we give another constructive proof of the lemma, based on Kolmogorov complexity. Actually, we even improve the Local Lemma slightly.
1
Introduction
The Lov´asz Local Lemma applied to the satisfiability problem states that a kk CNF formula is satisfiable if each clause has common variables with at most 2e −1 other clauses. The original proof of the Local Lemma was non-constructive: it didn’t give a hint on how to efficiently compute a satisfying assignment of the given formula. Starting with a paper by Beck [Bec91] there appeared a series of papers [Alo91, Sri08, Mos08] that came up with constructive proofs of the lemma, with stronger bounds on the clause neighborhood however. Then Moser [Mos09] made a big step ahead and came up with a randomized algorithm that finds a satisfying assignment if the neighborhood of each clause is bounded by 2k /8. In his conference talk on [Mos09], Moser presented an ingeniously simple argument for this bound, which lends itself to presentation in terms of Kolmogorov complexity (see [For09]). Thereafter, Moser and Tardos [MT10] improved this to the k bound claimed by the Local Lemma, 2e − 1, with a different proof however that uses involved probabilistic arguments. The main contribution of this paper is to provide again a constructive proof for the Local Lemma via Kolmogorov complexity (Section 4). Actually, for certain values of k we even improve the Local Lemma slightly and show in Section 5 a k bound somewhat better than 2 e−1 . Our method also applies to the more general conflicting neighborhood setting, also called the lopsided version, with the same bounds. In the next section we give a more detailed introduction to the Local Lemma for satisfiability. In Section 3 we introduce the concepts and tools we use, like Kolmogorov complexity, binary entropy bounds on binomial coefficients, and the number of d-ary trees.
Research supported by DFG grant TH 472/4-1.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 168–179, 2011. c Springer-Verlag Berlin Heidelberg 2011
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
2
169
The Lov´ asz Local Lemma
Throughout this paper, ϕ is a k-CNF formula with n variables and m clauses, where every clause has exactly k ≥ 2 variables. The variables of a clause are the variables that occur in a clause, positive or negative. A literal is a variable or the negation of a variable. We define a dependence relation or neighborhood relation Γ = Γϕ on the clauses of ϕ as follows: for clauses C = D, (C, D) ∈ Γ
if C and D have a common variable.
For satisfiability, it often suffices to consider the conflicting neighborhood relation or lopsided relation Γ = Γϕ , (C, D) ∈ Γ
if C has a literal whose negation occurs in D.
We also write D ∈ Γ (C) for (C, D) ∈ Γ , respectively D ∈ Γ (C) for (C, D) ∈ Γ . The neighborhood graphs Gϕ and Gϕ are given by the m clauses as nodes and Γ and Γ as edges, respectively. Crucial parameters in the following are the maximum degrees dϕ = maxC |Γ (C)| and dϕ = maxC |Γ (C)|. Clearly we have Γ ⊆ Γ , and therefore dϕ ≤ dϕ . The Lov´asz Local Lemma shows that if Γ (resp. Γ ) is not too dense then ϕ is satisfiable. In its symmetric form the formulation is given by an upper bound on the maximal degree dϕ , respectively dϕ . Moreover the symmetric form only applies to k-CNF formulas ϕ where every clause C has exactly k ≥ 2 variables. Therefore, when we make a random assignment to the variables, every clause has the same probability of being not satis1fied, namely 2−k . We will consider only the symmetric version of the Lemma in the following (see also [GMSW09] for an overview on the symmetric version). The Local Lemma was introduced by Erd˝ os and Lov´asz [EL75]. The generalization to the conflicting neighborhood setting, the lopsided version, is due to Erd˝ os and Spencer [ES91]. The version presented here uses the improved bounds from [ASE92] for dϕ and from [McD97] for dϕ . Theorem 1 (Symmetric Local Lemma). Let ϕ be a k-CNF formula. Then ϕ is satisfiable if 2k dϕ ≤ − 1. e Here e denotes the Euler number. Moser and Tardos [MT10] obtained a constructive proof of Theorem 1, i.e. they showed that one can efficiently compute a satisfying assignment for ϕ provided that ϕ fulfills the conditions in the theorem. Their algorithm to compute a satisfying assignment of a k-CNF-formula ϕ is randomized and goes as follows. Search(ϕ) Pick a random assignment for the variables of ϕ while there is a clause in ϕ that is not satisfied do . Choose an unsatisfied clause C . Reassign the variables in C independently at random output the satisfying assignment
170
J. Messner and T. Thierauf
We can use any deterministic way to choose an unsatisfied clause in the whileloop, for example the smallest one according to some fixed ordering of the clauses. Clearly, there is a chance that Search(ϕ) runs forever. However if dϕ ≤ 2k e
− 1, the expected running time is linear in m, and when it halts, it has computed a satisfying assignment [MT10]. A very good exposition of the result is from Spencer [Spe10]. He considers the non-lopsided version and in fact, gives a slightly better bound on d = dϕ to guarantee satisfiability, namely (d + 1)d+1 ≤ 2k . dd Note that
(1)
d (d + 1)d+1 1 = (d + 1) 1 + < (d + 1)e . dd d k
Therefore d ≤ 2e − 1 implies inequality (1). In Section 4 we show how to obtain Theorem 1, i.e. the lopsided version, but with the bound (1). In Section 5 we improve the bound and show for d = dϕ that algorithm Search will still find a satisfying assignment for ϕ if dd ≤ 2k − 1. (d − 1)d−1
(2)
A similar calculation as above shows that inequality (2) holds if d ≤
2k −1 e .
Theorem 2. Let ϕ be a k-CNF formula. If 2k − 1 (3) e then ϕ is satisfiable, and Search finds a satisfying assignment for ϕ in expected time O(m). dϕ ≤
Let us mention a bound shown by Gebauer et al. [GMSW09] with a nonconstructive argument: ϕ is satisfiable if dϕ ≤ 3(k − 1)/2 .
(4)
This is a very weak bound for larger k. However, it is pretty good for small k. To give an impression for these bounds, the table below shows the maximal integral values for dϕ that we get from the above bounds for k = 2, . . . , 10. k 2k /e − 1 Eq. (1) 2 e−1 Eq. (2) 2 0 1 1 1 3 1 2 2 3 4 4 5 5 6 5 10 11 11 11 6 22 23 23 23 7 46 46 46 47 8 93 93 93 94 9 187 187 187 188 10 375 376 376 376 k
3(k − 1)/2 2 3 5 6 8 9 11 12 14
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
171
For k = 2, bound (4) is better than ours and it is not known whether Search efficiently finds satisfying assignments for ϕ in 2-CNF with dϕ = 2. But clearly, this case is not our main focus because 2-SAT is efficiently solvable anyway. Already for k = 3 we achieve the same bound as in (4), but now with a constructive argument. That is, we show that Search efficiently finds satisfying assignments in this case. k Let us also note that the new bound 2 e−1 is larger by one than the bound 2k /e − 1 for infinitely many k. To see this, observe that (2k /e) + (1 − 1/e) ≥ 2k /e + 1 if a 1 appears in the binary expansion of 1/e at position −(k + 1). Is further improvement possible? Trivially, the formula ϕ in k-CNF with k variables that contains all possible 2k clauses is unsatisfiable and we have dϕ = dϕ = 2k − 1 in this case. Therefore the bound dϕ ≤ 2 is optimal for k = 2. For k ≥ 3 the optimal bounds are not known. Using a construction from [Geb09] it is shown in [GST11] that for some constant c there are unsatisfiable k-CNF formulas ϕ with dϕ ≤ 2k ( 1e + √ck ). This shows that the factor 1/e in inequality (3) cannot be replaced by a larger constant factor. However there is still room for additive improvements. Note that the constructions in [Geb09, GST11] aim at bounds that are formulated in terms of asymptotic expressions in k so it is not immediately clear what they yield for small values of k. In Section 6 we briefly discuss that the construction in [Geb09, GST11] will not yield unsatisfiable kCNFs with dϕ < 2k − 1 for k = 3 and k = 4. On the other hand for k ≥ 5 there are unsatisfiable k-CNFs ϕ with dϕ = dϕ < 2k − 1.
3
Preliminaries
Kolmogorov Complexity. For an algorithm A that computes a function A : {0, 1}∗ → {0, 1}∗ and a fixed pairing function ·, · let KA (x | y) = min({|w| | A( y, w ) = x} ∪ {∞}) . Since there are at most 2l − 1 strings w ∈ {0, 1}∗ of length less than l, we have for any l ∈ R, all y ∈ {0, 1}∗, and any set S ⊆ {0, 1}∗ |{x ∈ S | KA (x | y) ≥ l}| ≥ |S| − 2l + 1 . This implies that for any c ∈ R |{x ∈ S | KA (x | y) ≥ log |S| − c}| ≥ |S| − 2log |S|−c + 1 > (1 − 2−c )|S| .
(5)
In particular KA (x | y) ≥ |x| for some x ∈ {0, 1}s (let c = 0 and S = {0, 1}s ). It is known that there are (universal) algorithms U such that for every A there is a constant cA such that KU (x | y) ≤ KA (x | y) + cA We fix such a U and denote KU (x | y) by K(x | y). Let us briefly write K(x | y, z) instead of K(x | y, z ). See e.g. [LV08] for more details on Kolmogorov complexity.
172
J. Messner and T. Thierauf
Binomials and Entropy. By h we denote the the binary entropy, h(p) = −p log p − (1 − p)log(1 − p) for 0 < p < 1. We use following well known upper bound for ds s (see e.g. [Sch01]). For d ≥ 2, and s ≥ 1 ds < 2dh(1/d)s . (6) s The number of d-ary trees. An important tool in our argument below is an estimate on the number of d-ary trees with s nodes, denoted by Td (s). We consider here trees like in the usual computer science data structure for d-ary trees where each node has reserved d slots for its subtrees, and subtrees can be empty. For example, the number of d-ary trees with two nodes is Td (2) = d, and the number of trees with zero or one node is Td (0) = Td (1) = 1. Well known is the case of binary trees, i.e. when d = 2, where T2 (s) are the Catalan numbers, 1 2s T2 (s) = . s+1 s In general, Td (0) = 0 and for s > 0 the numbers Td (s) obey the recursion Td (s) = Td (s1 )Td (s2 ) · · · Td (sd ), s1 +s2 +...+sd =s−1
because a d-ary tree has one node as root and the remaining s − 1 nodes are split into d subtrees of the root, where each subtree is again a d-ary tree. In closed form Td (s) is given by the Fuss-Catalan numbers (see [GKP94]) 1 ds Td (s) = . (d − 1)s + 1 s Actually we consider not only trees, but forests that consists of up to m d-ary trees (in m slots). Let us call this a (d, m)-forest. The number Fd,m (s) of such forests with s nodes is given by (see [GKP94]) m ds + m Fd,m (s) = . ds + m s For example, the number of (d, m)-forests with one node is Fd,m (1) = m, because there are m (root-) slots where the node could sit. Using inequality (6) we have for d ≥ 2 and s, m ≥ 1 1 m (d + m/s)s Fd,m (s) = < 2(ds+m)h( d+m/s ) ds + m s 1
< 2(ds+m)h( d ) .
4
(7)
The Kolmogorov Argument
The core of the Kolmogorov argument is to reconstruct the random bits used by Search using a description that is as small as possible. The size of this description will then give a bound on the running time of Search.
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
4.1
173
The LOG
The sequence of clauses that is chosen by algorithm Search during the execution of the while-loop is called the LOG [MT10]. Clearly, the LOG depends on the random choices in each iteration. Also, the LOG could be an infinite sequence in the case that Search doesn’t halt. Therefore we cut off the LOG after a finite number of iterations: let s ≥ 1 be some integer and assume that Search makes ≥ s iterations, then the LOG up to this point is a sequence of clauses (C1 , . . . , Cs ). Note that Search consumes exactly n + ks random bits up to this point: n for the initial assignment and k for each iteration. Lemma 1. Given the the LOG (C1 , . . . , Cs ) and the assignment α after iteration s, we can reconstruct the random bits used by Search. Proof . The random bits used by Search can be obtained by going the LOG backwards, starting with Cs , and computing the assignments αi after iteration i. At the beginning, αs = α. Search chooses clause Ci in iteration i because Ci is violated before. Since clauses are disjunctions, there is precisely one assignment of the variables occuring in Ci that makes Ci false. Moreover, αi differs from αi−1 only in the values assigned to the variables in Ci . This uniquely describes αs−1 . Finally we get the assignment α0 at the beginning and, on the way, we have computed all the random bits used to reassign variables. Fix an ordering of the m clauses. Then each clause is determined by its rank i ∈ [m] in this ordering. Hence we can code the LOG with s log m bits, and an assignment can be encoded by n bits. Thus by Lemma 1 the random bits can be described with n + s log m bits, given ϕ. However, this encoding is too long for our purpose. (It only implies that ϕ is satisfiable for m < 2k .) A crucial observation is that we don’t need the precise LOG: we call two clauses C and D independent if they have no opposite literals in common i.e. (C, D) ∈ / Γϕ . We claim that when we permute the LOG by sequentially swapping independent pairs of neighboring clauses, we still can reconstruct the random bits used by Search. Lemma 2. Given a sequence of clauses (D1 , . . . , Ds ) obtained by starting with the LOG and swapping adjacent independent clauses several times, and the assignment α after iteration s, we can reconstruct the random bits used by Search. (j)
Proof . Let (C1 , . . . , Cs ) be the LOG and let αi ∈ {0, 1} denote the j-th assignment given to xi by Search, for 0 ≤ j ≤ si , where si is the number of (0) clauses in the LOG that contain xi . Hence αi is the initial assignment to xi , (s ) (s ) (s ) and αi i is assignment to xi after iteration s. That is, (α1 1 , . . . , αn n ) = α, the n and ks = i=1 si . In the proof of Lemma 1 we went the LOG backwards and computed the (j) assignments in previous iterations. In terms of the αi , what we did is to define 0, if xi in Cs , (si −1) αi = 1, if xi in Cs .
174
J. Messner and T. Thierauf
Then this step is repeated recursively on the LOG (C1 , . . . , Cs−1 ) with si − 1 instead of si . Now let us swap two independent clauses Cj and Cj+1 in the LOG, i.e. we consider the permuted LOG (C1 , . . . , Cj−2 , Cj , Cj−1 , Cj+1 , . . . , Cs ). Then the (j) above reconstruction algorithm still produces the same values αi : this is obvious for the variables that occur in only one of the two clauses. If Cj and Cj+1 have variable xi in common, then we have 0, if xi in Cj and Cj+1 , (l−1) (l−2) αi = αi = 1, if xi in Cj and Cj+1 , (l)
where l is the number of times the variable xi appears in C1 , . . . , Cj , i.e. αi is the assignment to xi after iteration j. Note that we don’t have the case xi in Cj and xi in Cj+1 or vice versa, since (Cj , Cj+1 ) ∈ Γϕ . Inductively, we can swap independent pairs of clauses several times and still (j) get the same values αi for 1 ≤ i ≤ n, 1 ≤ j ≤ si . To reconstruct the random bit string used by Search we start Search using (j) the values αi for the successive assignments to the variables. Recall that the choice of the next clause in Search is deterministic. This yields the assignment to the clauses and in turn the random bits, and also the original LOG produced by the algorithm. 4.2
Witness Forests
From the LOG we will next define a witness forest (cf. the witness trees in [MT10]). Our final algorithm to reconstruct the random bits used by Search will have a coding of these witness forests as input. From the witness forest we will not directly get the LOG of Search, but a permutation of the LOG as described in Lemma 2. By Lemma 2, this suffices for our purpose. We construct the witness forest of a LOG (C1 , . . . , Cs ) iteratively by inserting Cj for j = 1, . . . , n into the initially empty forest. To insert Cj proceed as follows: (i) If there is a node in the forest labeled with a clause D ∈ {Cj } ∪ Γϕ (Cj ), then select a node in the forest with such a label that is at the lowest level in the forest and append to it a node with label Cj as child. (ii) Otherwise create a new tree in the forest that consists of a node as root with label Cj . The witness forest has the following important properties: 1. It is a (d + 1, m)-forest for d = dϕ : (i) there are at most m roots, one for each clause of ϕ, and (ii) each node has at most d + 1 children. The children of a node with label Ci have labels from {Ci } ∪ Γϕ (Ci ). Recall that dϕ = maxj |Γϕ (Cj )|. 2. If Cj ∈ {Ci } ∪ Γϕ (Ci ) and i < j then the node added for Cj is lower in the tree than the node added for Ci . 3. If Ci and Cj are in the same depth of the forest, then they are independent.
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
175
Therefore, if we output the labels of the nodes by increasing depth in any order, we obtain a sequence (D1 , . . . , Ds ) of clauses that can be obtained from the LOG by swapping independent clauses. The next observation is crucial: we don’t need to store the labels of the nodes, because we can compute the labels from the precise structure of the forest! Namely, we can use the order of the clauses as they appear in ϕ as an order on the clauses. This induces an order on all the sets Γϕ (Ci ). Hence, in the witness forest, we can think of every node as having d + 1 slots reserved in a certain order, one for each child to come. That is, we can for example distinguish the tree with a node with label, say, C1 with a child with label C2 from the tree where the child of C1 has label C3 . Similar, for the potential roots of the trees, we have m slots reserved. When Ci becomes the root of a tree, we put it at slot j, if j is the rank of Ci in the order of all clauses. Therefore, if we know the precise structure of the forest, we can reconstruct the labels of the nodes. Since we can enumerate all (d + 1, m)-witness forests with s nodes we can encode a witness forest by its index in the enumeration which, by inequality (7), needs log Fd+1,m (s) < ((d + 1)s + m)h(1/(d + 1)) bits. Lemma 3. Given s and ϕ, and the index of a (d + 1, m)-witness forest representing the LOG and the assignment after iteration s we can reconstruct the random bits used by Search. 4.3
Putting Things Together
Now we have all the tools for the Kolmogorov complexity argument. Theorem 3. Let ϕ be a formula in k-CNF and d = dϕ . If (d + 1)d+1 ≤ 2k dd then Search finds a satisfying assignment for ϕ in expected time O(m). Proof . Assume that Search makes ≥ s iterations of the while-loop. Fix a Kolmogorov random string w ∈ {0, 1}n+ks with K(w | ϕ, s) ≥ n + ks − c
(8)
for some constant c > 0, and let Search use the bits of w as its random bits. That is, the first n bits are used for the initial assignment and k bits each are used to replace the assignment of the clause variables in each iteration of the while-loop. By Lemma 3 we can construct w from the assignment after iteration s and an index of the witness forest. Hence, for some constant cA > 0, K(w | ϕ, s) ≤ n + log Fd+1,m (s) + cA 1 < n + ((d + 1)s + m) h + 1 + cA . d+1
176
J. Messner and T. Thierauf
Combined with inequality (8) this implies 1 1 k − (d + 1) h s < mh + c + cA + 1 . d+1 d+1 d+1
An easy calculation shows that the assumption (d+1) ≤ 2k is equivalent to dd
1 0 < k − (d + 1)h d+1 for integral d ≥ 2. Therefore we get s<
mh
1 d+1
+ c + cA + 1
= O(m). 1 k − (d + 1)h d+1
(9)
This shows that the algorithm halts after this number of iterations and then outputs a satisfying assignment. Using inequality (5) it follows that (8) (and therefore (9)) holds for a fraction of 1 − 2−c of the possible strings w. Now assume that w is chosen at random by the algorithm and let S be the random variable denoting the number of iterations of Search. We have just shown that for any c ≥ 0
⎡ ⎤ 1 m h d+1 + c + cA + 1
⎦ ≥ 1 − 2−c . Pr ⎣S < (10) 1 k − (d + 1) h d+1 Hence, at this point we can already conclude that Search finds a satisfying assignment with high probability in O(m) steps. In a straightforward way it follows that this is also the expected time, i.e. E[S] = O(m).
5
An Improvement
In the previous section we said that the trees in the witness forest are (d + 1)ary trees for d = dϕ , because the children of a node with label C can be from {C} ∪ Γϕ (C), a set of size ≤ d + 1. However, by the construction of the trees, no node will actually have d + 1 children: if a node with label C has a child with label C this is its only child, because the labels of the other children would be dependent on C. Moreover, we can easily avoid that a node with label C has a child with label C: this happens only when Search picks as the next random assignment for C the same assignment as it had before. We modify Search such that the chosen clauses will get satisfied. Modified-Search(ϕ) Pick a random assignment for the variables of ϕ while there is a clause in ϕ that is not satisfied do . Choose an unsatisfied clause C . Choose a random i ∈ {1, . . . , 2k − 1} . Assign variables in C by the i-th satisfying assignment for C output the satisfying assignment
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
177
Note that Search and Modified-Search are essentially identical algorithms: if Search chooses an unsatisfied clause C and accidentally reassigns the variables such that C stays unsatisfied, it will choose C again in the next iteration, because the selection method is deterministic. This will be repeated until the reassignment satisfies C. The expected number of iterations until this happens is 2k /(2k − 1) ≤ 2. Then both algorithm proceed again the same way. Lemma 4. Let (C1 , . . . , Cs ) be the LOG of a run of Modified-Search over s iterations. Then in the witness forest constructed from (C1 , . . . , Cs ) no node will have a child with the same label. Proof . If a clause C is picked more than once in a run of Modified-Search we have C = Ci = Cj for some i < j. Let y be a literal in C that is satisfied after iteration i and consider the smallest l, such that i < l ≤ j and either y or y is in Cl . Actually it can not be the case that y is in Cl since the assignments in the iterations i, . . . , l satisfy y, and the algorithm only picks unsatisfied clauses. Thus y is in Cl and therefore l < j and Cl ∈ Γϕ (C). This shows that in the constructed witness tree, the node added for Cj is lower in the tree than the one for Cl which is again lower than the one for Ci . So Cj is not a child of Ci . Since there are fewer (d, m)-forests than (d + 1, m)-forests, we can improve the bounds given in Theorem 3. On the other hand, in s iterations ModifiedSearch uses random sequences w = w0 w1 , where w0 ∈ {0, 1}n and w1 ∈ {1, . . . , 2k − 1}s . Since there are only 2n (2k − 1)s such sequences we just can guarantee the existence of a w with K( w | ϕ, s) ≥ n + s log(2k − 1), where · is a suitable binary encoding of these sequences. Theorem 4. Let ϕ be a formula in k-CNF and d = dϕ . If dd ≤ 2k − 1. (d − 1)d−1 then Search and ModifiedSearch find a satisfying assignment for ϕ in expected time O(m). Proof . Due to linearity of expectation, the expected number of iterations of Search on ϕ is 2k /(2k − 1) times the expected number of iterations of ModifiedSearch. Therefore it suffices to show that ModifiedSearch will find a satisfying assignment for ϕ with O(m) expected number of iterations. Assume that ModifiedSearch makes at least s iterations of the while-loop. Fix a random sequence w = w0 w1 , where w0 ∈ {0, 1}n and w1 ∈ {1, . . . , 2k − 1}s such that K( w | ϕ, s) ≥ n + s log(2k − 1) − c (11) We can reconstruct w from the (d, m)-witness forest defined by the LOG of Modified-Search. Hence for some cA ≥ 0 K( w | ϕ, s) ≤ n + log Fd,m (s) + cA 1 < n + (ds + m)h + 1 + cA . d
178
J. Messner and T. Thierauf
Combined with (11) this implies 1 1 k log(2 − 1) − d h s < mh + c + cA + 1 . d d d
d k Note that (d−1) − 1 is equivalent to 0 < log(2k − 1) − d h d−1 ≤ 2 integral d ≥ 2. Therefore we get m h d1 + c + cA + 1 = O(m). s< log(2k − 1) − d h 1d
Now we proceed as in the proof of Theorem 3.
6
1 d
for
Some Remarks on Unsatisfiable k-CNF Formulas
Let l(k) denote the maximum number l such that all k-CNF formulas ϕ where dϕ ≤ l are satisfiable. The Lov´asz Local Lemma is a lower bound on l(k). The best known upper bounds on l(k) are due to Gebauer et.al. [Geb09, GST11]. Note that every unsatisfiable k-CNF formula ϕ yields the upper bound l(k) ≤ dϕ . A trivial upper bound is l(k) ≤ 2k − 1, because the formula in k variables that consists of all the 2k possible k-clauses is clearly unsatisfiable. In [Geb09, GST11], the construction of unsatisfiable formulas is based on special binary trees: A (k, d)-tree is a binary tree T such that (i) each inner node has two children (ii) every leaf of T has depth ≥ k, and (iii) every subtree of T contains ≤ d leaves of depth ≤ k. From a (k, d)-tree T [Geb09] constructs an unsatisfiable (k+1)-CNF formula ϕ such that dϕ = dϕ ≤ (k + 1)d, (12) and therefore l(k + 1) ≤ (k + 1)d
− 1. In [GST11] it is shown that there exist 2k (k, d)-trees with d = 2e + O √1k . Hence we have l(k) ≤ 1e + o(1) 2k . k k
This shows that the 2e -term in the local lemma is already optimal. We observe that for k = 3 and k = 4 the construction does not allow an improvement over the trivial bound 2k − 1: Proposition 1. For k ≥ 1 there is no (k, k)-tree. Proof . Let T be a (k, d)-tree. Consider a node v of height k in T . The subtree rooted at v has ≥ k inner nodes and therefore ≥ k + 1 leaves of depth ≤ k. From a (2, d)-tree we get a 3-CNF formula ϕ such that dϕ = 3d by equation (12). By Proposition 1 we have d ≥ 3, and hence, if a (2, 3)-tree exists, dϕ = 9. But the trivial upper bound is already 7. Similarly, if a (3, 4)-tree exists, we get a formula ϕ such that dϕ = 16 by equation (12), but the trivial upper bound is 15. On the other hand one can construct a (4, 6)-tree in a straightforward way, which yields an unsatisfiable 5-CNF ϕ with dϕ = dϕ ≤ 5 · 6 = 30. By replacing each clause Ci ∈ ϕ by two clauses Ci ∨ yi and Ci ∨ y i , where yi is a new variable for each clause, one obtains an unsatisfiable 6-CNF formula ϕ
A Kolmogorov Complexity Proof of the Lov´ asz Local Lemma
179
with dϕ ≤ 2·30+1 = 61. Iterating this procedure we get an unsatisfiable k-CNF formula ϕ with dϕ = dϕ ≤ 2k−5 · 31 − 1 < 2k − 1 for all k ≥ 5. Proposition 2. l(k) < 2k − 1 for k ≥ 5. Acknowledgments. Thanks to Patrick Scharpfenecker and Uwe Sch¨ oning for helpfull discussions. The reviewers helped to clarify the presentation of the paper.
References [Alo91]
Alon, N.: A parallel algorithmic version of the Local Lemma. Random Structures and Algorithms 2(4), 367–378 (1991) [ASE92] Alon, N., Spencer, J., Erd˝ os, P.: The probabilistic method. Wiley, Chichester (1992) [Bec91] Beck, J.: An algorithmic approach to the Lov´ asz Local Lemma. Random Structures and Algorithms 2(4), 343–366 (1991) [EL75] Erd˝ os, P., Lov´ asz, L.: Problems and results on 3-chromatic hypergraphs and some related questions. In: Hajnal, A., S´ os, V. (eds.) Infinite and Finite Sets, pp. 609–627. North-Holland, Amsterdam (1975) [ES91] Erd˝ os, P., Spencer, J.: Lopsided Lov´ asz Local Lemma and latin transversals. Discrete Applied Mathematics 30, 151–154 (1991) [For09] Fortnow, L.: A Kolmogorov complexity proof of the Lov´ asz Local Lemma. Computational Complexity Blog (2009), http://blog.computationalcomplexity.org/2009/06/ kolmogorov-complexity-proof-of-lov.html [Geb09] Gebauer, H.: Disproof of the neighborhood conjecture with implications to SAT. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 764–775. Springer, Heidelberg (2009) [GKP94] Graham, R., Knuth, D., Patashnik, O.: Concrete Mathematics, 2nd edn. Addison-Wesley, Reading (1994) [GMSW09] Gebauer, H., Moser, R., Scheder, D., Welzl, E.: The Lov´ asz Local Lemma and satisfiability. In: Albers, S., Alt, H., N¨ aher, S. (eds.) Efficient Algorithms. LNCS, vol. 5760, pp. 30–54. Springer, Heidelberg (2009) [GST11] Gebauer, H., Szab´ o, T., Tardos, G.: The Local Lemma is tight for SAT. In: 22nd ACM-SIAM Symp. on Discrete Algorithms, pp. 664–674 (2011) [LV08] Li, M., Vit´ anyi, P.: An introduction to Kolmogorov complexity and its applications, 3rd edn. Springer, Heidelberg (2008) [McD97] McDiarmid, C.: Hypergraph coloring and the Lov´ asz Local Lemma. Discrete Mathematics 167/168, 481–486 (1997) [Mos08] Moser, R.A.: Derandomizing the Lov´ asz Local Lemma more efficiently. Technical report (2008), http://arxiv.org/abs/0807.2120 [Mos09] Moser, R.A.: A constructive proof of the Lov´ asz Local Lemma. In: 41th Symposium on Theory on Computing (STOC), pp. 343–350 (2009) [MT10] Moser, R., Tardos, G.: A constructive proof of the general Lov´ asz Local Lemma. Journal of the ACM 57(2), 11:1–11:15 (2010) [Sch01] Sch¨ oning, U.: Algorithmik. Spektrum Akademischer Verlag, Heidelberg (2001) [Spe10] Spencer, J.: Robin Moser makes Lov´ asz Local Lemma algorithmic! (2010), http://cs.nyu.edu/spencer/moserlovasz1.pdf [Sri08] Srinivasan, A.: Improved algorithmic versions of the Lov´ asz Local Lemma. In: 9th ACM-SIAM Symp. on Discrete Algorithms, pp. 611–620 (2008)
Proper n-Cell Polycubes in n − 3 Dimensions Andrei Asinowski1 , Gill Barequet2 , Ronnie Barequet3 , and G¨ unter Rote4 1 Dept. of Mathematics Technion—Israel Institute of Technology Haifa 32000, Israel
[email protected] 2 Dept. of Computer Science Technion—Israel Institute of Technology Haifa 32000, Israel
[email protected] 3 Dept. of Computer Science Tel Aviv University Tel Aviv 69978, Israel
[email protected] 4 Institut f¨ ur Informatik Freie Universit¨ at Berlin Takustraße 9, D-14195 Berlin, Germany
[email protected]
Abstract. A d-dimensional polycube of size n is a connected set of n cubes in d dimensions, where connectivity is through (d − 1)-dimensional faces. Enumeration of polycubes, and, in particular, specific types of polycubes, as well as computing the asymptotic growth rate of polycubes, is a popular problem in discrete geometry. This is also an important tool in statistical physics for computations related to percolation processes and branched polymers. In this paper we consider proper polycubes: A polycube is said to be proper in d dimensions if the convex hull of the centers of its cubes is d-dimensional. We prove a formula for the number of polycubes of size n that are proper in (n − 3) dimensions. Keywords: Lattice animals, polyominoes, directed trees.
1
Introduction
A d-dimensional polycube of size n is a connected set of n cubical cells on the lattice Zd , where connectivity is through (d− 1)-faces. Two (fixed) polycubes are considered equivalent if one can be transformed into the other by a translation. A polycube is called proper in d dimensions if the convex hull of the centers of all its cubes is d-dimensional. While in the mathematical literature these objects are called polycubes (polyominoes in two dimensions), they are usually referred to as (strongly-embedded) lattice animals in the literature of statistical physics. Following Lunnon [7], we denote by DX(n, d) the number of n-cell polycubes that are proper in d dimensions. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 180–191, 2011. c Springer-Verlag Berlin Heidelberg 2011
Proper n-Cell Polycubes in n − 3 Dimensions
181
Counting polycubes (or animals) is a long-standing problem in discrete geometry, originating in statistical physics [3]. To-date, no formula is known for Ad (n), the number of polycubes of size n in d dimensions, for any fixed value of d, let alone for the general case. Klarner [5] showed that the limit λ2 = limn→∞ n A(n) exists. Thirty two years have passed until Madras [8] proved the convergence of the sequence A2 (n + 1)/A2 (n) to λ2 (and, in fact, a similar claim in any fixed dimension d), as n tends to infinity. Thus, λ2 is the growth rate limit of polyominoes. Its exact value has remained elusive till these days. The currently bestknown lower and upper bounds on λ2 are 3.9801 [1] and 4.6496 [6], respectively. Much less is known in higher dimensions, let alone in a general dimension d. Significant progress has been obtained along the years in the literature of statistical physics, although the computations usually relied on unproven assumptions or on formulae which were interpolated empirically from a few known values of 79 317 18321 123307 1 Ad (n). The expansion ln λd = ln σ + 1 − σ2 − 24σ 2 − 24σ 3 − 320σ 4 − 240σ 5 + O( σ 6 ), where σ = 2d − 1, is provided by Gaunt and Peard [4]. This 1/d-expansion (of the free energy of animals, in their terminology), is partly based on so-called “diagonal formulae,” that is, formulas for DX(n, n − k), where k > 0 is a small constant. It turned out that this expansion is consistent with the main result obtained by Barequet et al. [2], namely, that the growth-rate limit of the number of polycubes in d dimensions is asymptotically 2ed − o(d), conjectured to 31e asymptotically be (2d − 3)e − 48d + O( d12 ). In the literature of statistical physics, formulae for DX(n, n − k) are interpolated for 1 ≤ k ≤ 6 (see [9], and also [2, p. 265] for a discussion of how to derive these formulae from the former reference). It is rather easy to show, using Cayley trees, that DX(n, n − 1) = 2n−1 nn−3 . In [2] it was proven rigorously, for the first time, that DX(n, n − 2) = 2n−3 nn−5 (n − 2)(2n2 − 6n + 9). The proof uses a case analysis of the possible structures of spanning trees of the polycubes, and the various ways in which cycles can be formed in their cell-adjacency graphs. In this paper we present a nontrivial extension of this proof, and find the explicit formula for DX(n, n − 3), the number of polycubes consisting of n cells, that are proper in d = n − 3 dimensions. We use a similar approach of counting spanning trees of polycubes, yet the reasoning and the calculations are significantly more involved. Our main result is, thus, the following theorem. Theorem 1 DX(n, n−3) = 2n−6 nn−7 (n−3)(12n5 −104n4 +360n3 −679n2 +1122n−1560)/3.
2
Overview of the Method
Denote by Pn the family of polycubes under consideration. Let P ∈ Pn , and denote by γ(P ) the directed graph with labeled edges that is constructed as follows: The vertices of γ(P ) correspond to cells of P ; two vertices of γ(P ) are connected by an edge if the corresponding cells of P are adjacent; an edge has label i (1 ≤ i ≤ n − 3) if the corresponding cells have different
182
A. Asinowski et al.
i-coordinate (that is, their common (d − 1)-dimensional face is perpendicular to the xi axis) and the direction of the edge is from the lower to the higher cell (with respect to the xi direction). See Figure 1 for an example. 1
1 2 x3 x2
1
2 1
2
2 3
1
1
2 3
1
1
3
x1
(a) Polycube
(b) Adjacency graph
(c) Two spanning trees
Fig. 1. A polycube P , the corresponding graph γ(P ), and spanning trees of γ(P )
It is clear that P → γ(P ) is an injection. Thus, it suffices to count the graphs obtained from the members of Pn in this way. We shall accomplish this task by counting their spanning trees. Consider a spanning tree of γ(P ). It has n − 1 edges labeled by numbers from the set {1, 2, . . . , n − 3}; all these labels actually are present, otherwise the polycube is not proper. Thus, either there are two edge labels (say, i and j) that appear twice, or there is one edge label (say, i) that appears three times. In the former case we distinguish members of such pairs by labeling them i, i and j, j , while in the latter—by labeling them i, i , i (see Figure 1(c)). Whenever we consider a spanning tree of γ(P ), we assume that its repeated labels are distinguished this way. In contrast, when considering γ(P ), repeated labels are assumed not to be distinguished (as in Figure 1(b)). Observation 2. Every label must occur an even number of times in any cycle of γ(P ). In addition, the number of cycles in γ(P ), as well as the length of each such cycle, are limited due to the limited multiplicity of labels. Therefore, we must have the following: Observation 3. There are three possible cases concerning the structure of γ(P ): 1. γ(P ) is a tree itself. The number of such tree-like polycubes in Pn will be denoted by X. 2. γ(P ) has exactly one cycle. The number of such polycubes in Pn will be denoted by Y. The length of this cycle in γ(P ) is either 4 or 6. 3. γ(P ) has two 4-cycles. The number of such polycubes in Pn will be denoted by Z. In this case, the two cycles are either edge-disjoint or have exactly one common edge, thus forming a 6-cycle with a chord. Indeed, all other possibilities (say, more than two 4-cycles, several 6-cycles, or an 8-cycle) are excluded: They would cause γ(P ) to have a spanning tree with too many repeated labels.
Proper n-Cell Polycubes in n − 3 Dimensions
183
Thus, DX(n, n − 3) = X + Y + Z. In order to find the formulae for X, Y, Z, we shall count those directed trees with n − 1 labeled edges with two pairs of repeated labels or with one triple of repeated labels, which are actually spanning trees of γ(P ) for some polycube P ∈ Pn . Note that: – If a tree with two pairs of repeated labels, i, i and j, j , is a spanning tree of γ(P ) for some polycube P ∈ Pn , then the trees obtained by exchanging i and i and/or j and j are also spanning trees of γ(P ). Similarly, if a tree with a triple of repeated labels, i, i , i , is a spanning tree of a γ(P ), then the trees obtained by permuting i, i and i are also spanning trees of γ(P ). – In particular, if γ(P ) itself is a tree with two pairs of repeated labels, then it has four spanning trees.1 If γ(P ) is a tree with a triple of repeated labels, then it has six spanning trees. – The situation may be more complicated when γ(P ) is not a tree at all. There are polycubes P such that γ(P ) has both types of spanning trees: those with two pairs of repeated labels and those with a triple of repeated labels. (Such a polycube is shown in Figure 1.) In the next section we characterize all substructures that are present in some trees with labeled edges due to the fact that the number of cells is greater than the number of dimensions. By analyzing this substructures, we will be able to compute how many of such trees actually represent polycubes. Then, in the following sections, we develop formulae for the numbers of all possible spanning trees of the polycubes, and then derive the actual number of polycubes.
3
Distinguished Structures
Our plan is to count polycubes by counting spanning trees of their adjacency graphs, taking into account possible multiplicities. In the reasoning below we shall consider several small structures, which may be contained in the spanning trees that we count. These structures are listed in Figure 2, and they are interesting for the following reason. For each labeled tree, we can attempt to build the corresponding polycube. Two things may happen: (a) We may get coinciding cells, like in patterns A or I (shown by dotted frames around these points). Such a tree is invalid and does not correspond to a polycube. (b) Two cells which are not connected by a tree edge may be adjacent, like in pattern B or C (indicated by dotted lines). Such a tree may correspond to a valid polycube, but it deserves special attention because the polycube has cycles in its cell-adjacency graph and, therefore, its spanning tree is not unique. A distinguished structure is defined as a subtree that is responsible for the presence of two coinciding or adjacent cells, as explained above. More precisely, a structure is the union of all paths (edges plus incident vertices) that run between two coinciding or adjacent cells. 1
Recall that repeated labels are not distinguished in γ(P ), but they are distinguished in its spanning tree.
184
A. Asinowski et al.
a Consider a distinguished struci i i ture that leads to coinciding cells. i Similarly to Observation 2, we see A B that for every label on the path bej i j tween two vertices that correspond a i i j i j to such cells, repetitions of this laC D bel occur on this path an even numa i i j ber of times (which can be only 2). j j j i i Moreover, in this case, these two E F edges are directed in opposite orij i j i j entations. Due to the limited numi i a b a i j j ber of repeated labels, we get only i j G H I two possibilities corresponding to i j i a a j a path of length 2 and a path of j a i i j length 4 (see structures A and I in i j i j J K L Figure 2). a a Consider now a structure that i i i i i i i i i i i leads to a non-existing adjacency. i M N O P This clearly results in an (even) cya b a cle with one edge removed. By i i i i Observation 3, the length of such i i b Q R a cycle can be only either 4 or 6. A reasoning similar to that above leads us to two possibilities: strucFig. 2. Distinguished structures used in tures B and C in Figure 2. the counting Thus, the distinguished structures are A, I, B, C, and other structures that contain several occurrences of these “basic” structures.2 The number of occurrences is limited, since each occurrence uses up some repeated labels. The enumeration of the distinguished structures is, thus, a finite task. Figure 2 gives the complete list. It may happen that a distinguished structure is disconnected, like D, E, or G. We consider the components of a structure as edge-connected components; thus, it is permitted that the two parts in D, E, or G share a vertex. The structures C, . . . , L occur only in trees with two pairs of repeated labels, while the structures M, . . . , R occur only in trees with one triple of repeated labels. In contrast, A and B occur in both kinds of trees. Next, we clarify the notation and conventions used in Figure 2. Each pattern in Figure 2 stands actually for several substructures that may differ in edge directions or the precise choice of labels from i, i , i or j, j . The edges labeled i and i (respectively, i, i , and i ) are all directed either according to black or to white arrows, and the same holds for j and j . The directions of j, j are independent of those of i, i . The labels a, b are assumed to be unrelated to any of the other labels i, i , i , j, j appearing in each pattern. For example, a in pattern
2
Notice that I itself contains two occurrences of B.
Proper n-Cell Polycubes in n − 3 Dimensions
185
B is distinct from i and i (but it could be another repeated label—say, j or j ). Where a or b appear in patterns C, . . . , L, they are automatically distinct from i, i , j, j . Finally, in the remaining patterns M, . . . , R, a and b are automatically distinct from i, i , i . Variations of the same label, say, i and i , can be permuted, or replaced by other variations of the same label, like i, i or i , i . In counting directed trees with n − 1 labeled edges, which have subgraphs as in Figure 2, two lemmas will be used. Lemma 1 was proved in [2]; we will here relate it to a result from the literature. Lemma 1. [2] The number of ordered sequences T = (τ1 , . . . , τk ) of k ≥ 1 rooted trees with a total of n − k edges and distinct edge labels 1, . . . , n − k is nn−k−1 k. Proof. Consider such a sequence T with n vertices. For i = 1, . . . , k, denote the root of the component τi by n − k + i. For any vertex v which is not a root, set its label to be equal to the label of the first edge in the path from v to the root. Now we have a forest T on n labeled vertices, with roots labeled by n − k + 1, n−k +2, . . . , n. The correspondence T ↔ T is clearly a bijection. The number of forests on n labeled vertices with k roots, whose labels belong to a specified set, is known to be nn−k−1 k, see Stanley [10, p. 25, Proposition 5.3.2]. (Stanley provides two proofs of this, both of them differing from that in [2].) The other lemma is a direct application of the previous lemma. Lemma 2. The number of ordered sequences T˜ = (τ1 , . . . , τk ) of k ≥ 1 trees, s.t. τ1 has two distinguished roots (which may coincide) and all other trees have one root, with a total of n − k edges and distinct edge labels 1, . . . , n − k, is nn−k . Proof. Consider a sequence T as in Lemma 1, and mark an arbitrary vertex as the extra root, obtaining M = nn−k k sequences T˜ . The component of T˜ with two roots is any of τ1 , . . . , τk , with equal probability. Therefore, the number of sequences T˜ in which the component with two roots is τ1 is M/k = nn−k . We now introduce two functions that count directed ordered sequences. Let F1 (k) count ordered sequences (τ1 , . . . , τk ) of k ≥ 1 directed rooted trees with a total of n − k edges and distinct edge labels 1, . . . , n − k. Similarly, let F2 (k) count ordered sequences (τ1 , . . . , τk ) of k ≥ 1 directed trees, such that τ1 has two distinguished roots (which may coincide) and all other trees have one root, with a total of n − k edges and distinct edge labels 1, . . . , n − k. By fixing directions to the edges, we obtain the following corollary of Lemmas 1 and 2. Corollary 1 1. F1 (k) = 2n−k nn−k−1 k. 2. F2 (k) = 2n−k nn−k . Finally, we will use Corollary 2, which follows directly from a result in [2]. Lemma 3. [2, Lemma 2] The number of directed trees with n vertices and n−1 distinct edge labels 1, . . . , n − 1 is 2n−1 nn−3 , for n ≥ 2.
186
A. Asinowski et al.
Let T22 denote the number of directed trees with n vertices and labeled edges, with two pairs of repeated labels.3 Similarly, let T3 denote the number of directed trees with n vertices and labeled edges, with one triple of repeated labels. Corollary 2 n−1 n−3 1. T22 = n−3 2 n . 2 2. T3 = (n − 3)2n−1 nn−3 . Let us turn to the enumeration of occurrences of A, . . . , R from Figure 2 in directed trees with n vertices and edges labeled 1, 2, . . . , n − 3, and with repeated labels as explained above. For C, D, E, . . ., we denote by C, D, E, . . . the number of occurrences of these structures in such trees. Recall that the structures C, . . . , L occur only in trees with two pairs of repeated labels, while the structures M, . . . , R occur only in trees with one triple of repeated labels. In contrast, A and B occur in both kinds of trees. Therefore, for A and B we shall consider both cases (two pairs of repeated labels, and one triple of repeated labels), denoting the corresponding numbers by A22 , A3 , and B22 , B3 . For some cases we shall explain in detail how the formula is obtained; all other calculations are based on a similar reasoning. We begin with counting occurrences of A22 , B22 , C, . . . , L in directed trees with two pairs of repeated labels. By an occurrence of a pattern U in a tree T , we mean a pair (S, T ), where S is a subset of edges of T that form a the pattern U . 1. A22 = (n − 3) · (n − 4) · 2 · F1 (3) = 6(n − 3)(n − 4)2n−3 nn−4 . Here, we have the factors (n − 3) for choosing the repeated label (i, i ) that makes the configuration and (n − 4) for choosing the second repeated label in the tree, a factor 2 for directing the edges i and i (i.e., both according to the black or white arrows), and F1 (3) for sequences of three trees that can be attached to the vertices. At this stage, the three vertices are distinguishable from each other, and therefore we count sequences of three trees. The same will be true for all other patterns. 2. B22 = (n − 3) · (n − 4) · 2 · (n − 3) · 2 · F1 (4) = (n − 3)2 (n − 4)2nnn−5 . Here, the factors (n − 3), (n − 4), and 2 are the same as above, an additional factor (n − 3) is for choosing label a, an additional factor 2 is for directing the edge a, and F1 (4) is for sequences of four trees that can be attached to the vertices. 3. C = n−3 · (n − 5) · 4 · 2 · 4 · F1 (6) = 3(n − 3)(n − 4)(n − 5)2n−1 nn−7 . 2 Here, the factor n−3 is for choosing the repeated labels, (n − 5) is for 2 choosing edge a, a factor 4 is for choosing which edge among i, i , j, j is attached to the head of edge a, and, once this choice is made, a factor 2 is for choosing which of the complementary label is attached to the tail of a (e.g., if the first choice is i, then the second choice can be only j or j ), an additional factor 4 is for directing i, i and j, j , and F1 (6) is for sequences of six trees that can be attached to the vertices. 3
Recall again that repeated labels in trees are distinguished.
Proper n-Cell Polycubes in n − 3 Dimensions
187
· 4 · F2(5) ·9 = 9(n − 3)(n − 4)2n−4 nn−5 . 4. D = n−3 2 and 4 are as in the previous case. The factor 3 · 3 = 9 Here, the factors n−3 2 stands for choosing the pair of vertices through which the components are connected: one vertex is chosen on each component. The factor F2 (5) is for sequences of five trees that can be attached to the vertices (one of which connects the components of the configuration). 5. E = (n − 3) · (n − 4) · (n − 5) · 8 · F2(6) · 12 = 3(n − 3)(n − 4)(n − 5)2n−1nn−6 . As above, we have the factors (n − 3), (n − 4), and (n − 5) for choosing the repeated labels and the edge a, a factor 8 for directing for directing i, i , j, j , and a. The factor 3 · 4 = 12 stands for choosing the pair of vertices through which the components are connected. The factor F2 (6) stands for sequences of six trees that can be attached to the vertices (one of which connects the two components of the configuration). 6. F = (n − 3) · (n − 4) · 2 · 2 · 4 · F1 (5) = 5(n − 3)(n − 4)2n−1nn−6 . n−3 7. G = 2 ·(n−5)·(n−6)·16·F2(7)·16 = (n−3)(n−4)(n−5)(n−6)2nnn−7 . (6) = 3(n − 3)(n − 4)(n − 5)2n−2 nn−7 . 8. H = n−3 2 · (n − 5) · 4 · 4 · F1 n−3 9. I = 2 · 4 · 4 · F1 (5) = 5(n − 3)(n − 4)2n−2 nn−6 . 10. J = (n − 3) · (n − 4) · (n − 5) · 2 · 4 · 4 · F1 (6) = 3(n − 3)(n − 4)(n − 5)2n nn−7 . 11. K = (n − 3) · (n − 4) · (n − 5) · 4 · 4 · F1 (6) = 3(n − 3)(n − 4)(n − 5)2n−1 nn−7 . 12. L = (n − 3) · (n − 4) · (n − 5) · 2 · 4 · 4 · F1(6) = 3(n − 3)(n − 4)(n − 5)2n · nn−7 . Next, we count occurrences of A3 , B3 , M, . . . , R in directed trees with one triple of repeated labels. 13. A3 = (n − 3) · 3 · 2 · F1 (3) = 9(n − 3)2n−2 nn−4 . Here, the factor (n − 3) is for choosing the repeated label (i, i , and i ), the factor 3 is for choosing two labels from {i, i , i }, the factor 2 is for directing these edges, and F1 (3) is for sequences of three trees attached to the vertices. 14. B3 = (n − 3) · 3 · (n − 4) · 2 · 2 · F1 (4) = 3(n − 3)2 2nnn−5 . Here, we have the factors (n − 3) and 3 as in the previous case, an additional factor (n − 4) for choosing the edge a (which is not a repetition of i), a factor 2 for directing the edges i and i , an additional factor 2 for choosing which edge with repeated label is attached to the head of edge a, and F1 (4) for sequences of four trees attached to the vertices. 15. M = (n − 3) · 2 · F1 (4) = (n − 3)2n−1 nn−5 . 16. N = (n − 3) · 3 · 2 · F1 (4) = 3(n − 3)2n−1 nn−5 . As above, the factor (n − 3) is for choosing the repeated label (i, i , and i ), the factor 3 is for choosing which of these labels is found between the two others, the factor 2 is for directing these edges, and F1 (4) is for sequences of four trees attached to the vertices. 17. O = (n − 3) · (n − 4) · 2 · 3 · 2 · F1 (5) = 15(n − 3)(n − 4)2n−3 nn−6 . As in previous cases, the factor (n − 3) is for choosing the repeated label (i, i , and i ), (n − 4) is for choosing the edge a, the factor 2 is for choosing whether one or two edges with repeated labels are attached to the head of a, the factor 3 is for choosing which edge (or edges, depending on the previous choice) among i, i , i is (resp., are) attached to the head of a, the factor 2 is for directing the edges i, i , i , and F1 (5) is for sequences of five trees attached to the vertices.
188
A. Asinowski et al.
18. P = (n − 3) · (n − 4) · 2 · 3 · 2 · 2 · F1 (5) = 15(n − 3)(n − 4)2n−2 nn−6 . 19. Q = (n − 3) · 3 · (n − 4) · (n − 5) · 2 · 4 · F1 (6) = 9(n − 3)(n − 4)(n − 5)2n−2 nn−7 . 20. R = (n − 3) · 3 · (n − 4) · (n − 5) · 2 · 4 · F1 (6) = 9(n − 3)(n − 4)(n − 5)2n−2 nn−7 .
4
Polycubes with a Tree Structure
We split the counting according to the combinations of repeated labels. Two pairs of repeated labels. Denote by X22 the number of polycubes P ∈ Pn , such that γ(P ) is a tree that has two pairs of repeated labels. By Corollary 2.1, the total number of directed trees with n vertices directed labeled edges, with n−1and two pairs of repeated labels, is T22 = n−3 nn−3 . Such a tree corresponds 2 2 to a tree-like polycube in Pn unless it contains a subtree of type A, . . . , J. Thus, subtrees of types A, B, or C are all that we need to exclude. However, each of D, . . . , J includes two subtrees of the type A, B, or C, and these are counted twice in the sum A22 + B22 + C. Therefore, the number of trees which do not lead to tree-like polycubes is A22 + B22 + C − D − E − F − G − H − I − J (Each of the patterns K and L contains exactly one subtree of type A, B, or C,4 and hence, they are correctly accounted for.) Dividing by 4 (since each such polycube is represented by four trees), we obtain that X22 = (T22 − A22 − B22 − C + D + E + F + G + H + I + J) /4 = 2n−6 nn−7 (n − 3)(n − 4)(4n4 − 28n3 + 97n2 − 200n + 300).
(1)
One triple of repeated labels. Denote by X3 the number of polycubes P ∈ Pn , such that γ(P ) is a tree that has one triple of repeated labels. By Corollary 2.2, the total number of directed trees with n vertices and directed labeled edges, with one triple of repeated labels, is T3 = (n − 3)2n−1 nn−3 . Such a tree corresponds to a polycube in Pn unless it has a subtree of type either A or B. In addition, all of M, . . . , R include (at least) two subtrees of the types A or B. The types M and O even include three subtrees of the types A or B. Therefore, by applying the inclusion-exclusion principle, and dividing by 6 (since each such polycube is represented by six trees), we obtain that X3 = (T3 − (A3 + B3 ) + (3M + N + 3O + P + Q + R) − (M + O)) /6 = 2n−3 nn−7 (n − 3)(2n4 − 21n3 + 106n2 − 282n + 360)/3. In total, we have X = X22 + X3 .
4
In fact, the pattern C is contained in no other distinguished structure.
(2)
Proper n-Cell Polycubes in n − 3 Dimensions
5
189
Polycubes with One Cycle
As mentioned above, if γ(P ) has only one cycle, then the length of this cycle must be either 4 or 6. Assume first that γ(P ) has one 4-cycle whose edges are labeled i, j, i, j. Then, either γ(P ) has another edge with the label i or j, or it has no such edge; in the latter case γ(P ) has another pair of edges with a repeated label which is distinct from i and j. Denote, therefore, the number of polycubes of the former type by Y23 , and the latter type by Y222 . Each graph of the first type has two spanning trees with two pairs of repeated edge labels and two spanning trees with a triple of repeated edge labels. Each graph of the second type has four spanning trees with two pairs of repeated edge labels. Denote by T122 the total number of spanning trees of these graphs (of both types), which have two pairs of repeated labels, and by T13 the number of spanning trees of these graphs (necessarily of the first type), which have one triple of repeated labels. Then, we have T122 = 4(2Y23 + 4Y222 ) and T13 = 6(2Y23 ).
(3)
Spanning trees with two pairs of repeated labels. All these spanning trees have a single occurrence of B as a subtree. Thus, the number of occurrences of B in all such trees is B22 . From this number we have to subtract the number of occurrences of the forbidden subtrees E, F , and I; the number of spanning trees of graphs that have two edge-disjoint 4-cycles (that is, G); and also the number of spanning trees (with two pairs of repeated labels) of graphs that have two 4-cycles with a common edge (that is, H, J, K, and L). Notice that in B22 , trees with I, G, H, or J are counted twice. Therefore, T122 = B22 − E − F − 2I − 2G − 2H − 2J − K − L = 2n−1 nn−6 (n − 3)(n − 4)(2n2 − 13n + 25).
(4)
Spanning trees with one triple of repeated labels. In this case, possible spanning trees have a subtree B (recall that a is neither i, i , nor i ). The number of occurrences of B in all such trees is B3 . From this number we have to subtract the number of occurrences of the forbidden subtrees O and P , and the number of spanning trees (with a triple of repeated labels) of graphs that have two 4-cycles with a common edge (that is, Q and R). Note that in B3 , trees with O, Q, or R are counted twice. Therefore, T13 = B3 − 2O − P − 2Q − 2R = 3 · 2n−1 nn−7 (n − 3)(n − 4)(2n2 − 11n + 30). By solving the system (3–5), we obtain Y23 = 2n−3 nn−7 (n − 3)(n − 4)(2n2 − 11n + 30), Y222 = 2n−5 nn−7 (n − 3)(n − 4)(n − 5)(2n2 − 7n + 12).
(5)
190
A. Asinowski et al.
Polycubes with a 6-cycle. Denote the number of polycubes in Pn that have only one cycle of length 6 by Y . We have n−3 Y = · 4 · F1 (6) = 2n−4 nn−7 (n − 3)(n − 4)(n − 5). 3 In order to establish this quantity, we do not need to consider spanning trees. Notice that the cells of a 6-cycle always form a 2 × 2 × 2 cube with two opposite cells removed, as in . Thus, n−3 counts the dimensions in which the cube 3 lies, the factor 4 counts ways to remove two reciprocal cells, and F1 (6) counts ways to attach six trees to the remaining six cells. In total, we have Y = Y23 + Y222 + Y .
6
Polycubes with Two Cycles
Again, we do not consider spanning trees. Two 4-cycles without a common edge. The number of polycubes P ∈ Pn , such that γ(P ) has two 4-cycles without a common edge, is 1 n−3 n−5 Z = · · ·16·F2 (7) = 2n−6 nn−7 (n−3)(n−4)(n−5)(n−6). 2 2 2 n−5 In this case, 12 n−3 is the number of ways to choose the dimensions in 2 2 which the “squares” lie (note that these pairs of dimensions are disjoint, otherwise γ(P ) would have a spanning tree with four repeated labels). The factor 4 · 4 = 16 is the number of ways to choose a pair of vertices through which the squares will be connected, and F2 (7) is the number of ways to connect them by trees. Two 4-cycles with a common edge. The number of polycubes P ∈ Pn , such that γ(P ) has two 4-cycles with a common edge, is n−3 Z = · 12 · F1 (6) = 3 · 2n−4 nn−7 (n − 3)(n − 4)(n − 5). 3 The cells of two 4-cycles with a common edge form a 2 × 2 × 2 cube with two adjacent cells removed, as in . Thus, n−3 counts the dimensions in which 3 the cube lies. There are 12 ways to remove two adjacent cells, and there are F1 (6) ways to attach six trees to the remaining six cells. In total, we have Z = Z +Z .
Proper n-Cell Polycubes in n − 3 Dimensions
7
191
Epilogue
Finally, in order to complete the proof of Theorem 1, we have DX(n, n − 3) = X + Y + Z = X22 + X3 + Y23 + Y222 + Y + Z n−6
=2
n−7
n
n−3
+2
4
+Z
3
(n − 3)(n − 4)(4n − 28n + 97n2 − 200n + 300)
nn−7 (n − 3)(2n4 − 21n3 + 106n2 − 282n + 360)/3
+ 2n−3 nn−7 (n − 3)(n − 4)(2n2 − 11n + 30) + 2n−5 nn−7 (n − 3)(n − 4)(n − 5)(2n2 − 7n + 12) + 2n−4 nn−7 (n − 3)(n − 4)(n − 5) + 2n−6 nn−7 (n − 3)(n − 4)(n − 5)(n − 6) + 3 · 2n−4 nn−7 (n − 3)(n − 4)(n − 5) = 2n−6 nn−7 (n − 3)(12n5 − 104n4 + 360n3 − 679n2 + 1122n − 1560)/3.
8
Conclusion
In this paper we prove rigorously the formula for DX(n, n − 3). Manual computation of DX(n, n − k), for k > 3, seems infeasible since the case distinctions become significantly more tedious, and so one will probably need a computer program to automatically analyze all cases. As mentioned in the introduction, diagonal formulae up to k = 6 were interpolated by Peard and Gaunt [9].
References 1. Barequet, G., Moffie, M., Rib´ o, A., Rote, G.: Counting polyominoes on twisted cylinders. Integers (Electronic Journal) 6, 22–37 (2006) 2. Barequet, R., Barequet, G., Rote, G.: Formulae and growth rates of highdimensional polycubes. Combinatorica 30, 257–275 (2010) 3. Broadbent, S.R., Hammersley, J.M.: Percolation processes: I. Crystals and mazes. Proc. Cambridge Philosophical Society 53, 629–641 (1957) 4. Gaunt, D.S., Peard, P.J.: 1/d-expansions for the free energy of weakly embedded site animal models of branched polymers. J. of Physics A: Mathematical and General 33, 7515–7539 (2000) 5. Klarner, D.A.: Cell growth problems. Canadian J. of Math. 19, 851–863 (1967) 6. Klarner, D.A., Rivest, R.L.: A procedure for improving the upper bound for the number of n-ominoes. Canadian J. of Mathematics 25, 585–602 (1973) 7. Lunnon, W.F.: Counting multidimensional polyominoes. The Computer Journal 18, 366–367 (1975) 8. Madras, N.: A pattern theorem for lattice clusters. Annals of Combinatorics 3, 357–384 (1999) 9. Peard, P.J., Gaunt, D.S.: 1/d-expansions for the free energy of lattice animal models of a self-interacting branched polymer. J. Phys. A: Math. Gen. 28, 6109–6124 (1995) 10. Stanley, R.: Enumerative Combinatorics, vol. 2. Cambridge Univ. Press, Cambridge (1999)
Largest Area Convex Hull of Axis-Aligned Squares Based on Imprecise Data Ovidiu Daescu1, , Wenqi Ju2,3 , Jun Luo3, , and Binhai Zhu4, 1
Department of Computer Science, University of Texas at Dallas, USA Institute of Computing Technology, Chinese Academy of Sciences, China Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences, China 4 Department of Computer Science, Montana State University, USA
[email protected], {wq.ju,jun.luo}@siat.ac.cn,
[email protected] 2
3
Abstract. Data collected from real world are often imprecise. A few algorithms were proposed recently to compute the convex hull of maximum area when the axis-aligned squares model is used to represent imprecise input data. If squares are non-overlapping and of different sizes, the time complexity of the best known algorithm is O(n7 ). If squares are allowed to overlap but have the same size, the time complexity of the best known algorithm is O(n5 ). In this paper, we improve both bounds by a quadratic factor, i.e., to O(n5 ) and O(n3 ), respectively.
1
Introduction
Data stored and processed by computers are often imprecise. The reasons for imprecise data are various and include privacy protection[1], error from devices [12], [14], noise, and other uncertainties [13]. Algorithms for computing a convex hull of a set of points or other geometric objects have been studied for several decades because convex hulls are useful in many application domains, such as pattern recognition [2], data mining [4], stock cutting and allocation [6], image processing [5], etc. There are many algorithms for computing convex hulls [3, 7–9, 11]. Those algorithms are based on the assumption that input data is precise. However, in the presence of imprecise properties of data, those algorithms do not work anymore. One representation of imprecise data uses the axis-aligned square model that means one point p is represented by an axis-aligned square S and p could appear anywhere in S. Under this model, L¨ offler et al. [10] have studied the following problems:
Daescu’s research was partially sponsored by NSF awards CNS-1035460. This work is supported by Shenzhen Key Laboratory of High Performance Data Mining (grant no. CXB201005250021A) and Shenzhen Fundamental Research Project (grant no. JC201005270342A and grant no. JC201005270334A). This research is partially supported by NSF of China under grant 60928006 and by the Open Fund of Top Key Discipline of Computer Software and Theory in Zhejiang Provincial Colleges at Zhejiang Normal University.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 192–203, 2011. c Springer-Verlag Berlin Heidelberg 2011
Largest Area Convex Hull of Axis-Aligned Squares
193
Problem 1. Given a set of non-overlapping axis-aligned squares, choose a point in each square such that the area of the convex hull of the resulting point set is maximized. Problem 2. Given a set of n equal size axis-aligned squares, choose a point in each square such that the area of the convex hull of the resulting point set is maximized. L¨offler et al. [10] present an O(n7 ) time algorithm for Problem 1 and an O(n5 ) time algorithm for Problem 2. In this paper, we improve the results of the problems to O(n5 ) and O(n3 ) respectively.
2
Previous Work
In this section, we briefly describe the main idea of the algorithms in [10] and present some notations and lemmas from [10] that are needed in this paper. Ignoring boundary cases (which can be easily handled), there are four extreme vertices on a convex hull: topmost vertex pt , leftmost vertex pl , rightmost vertex pr , and bottommost vertex pb . They divide a convex hull into four parts which are the top left chain, the top right chain, the bottom left chain, and the bottom right chain. For a square S, let S tl , S tr , S bl , and S br represent the top left corner, the top right corner, the bottom left corner, and the bottom right corner, respectively. If we extend the four edges of S to four lines, those four lines divide the plane into eight regions, excluding S itself. We refer to the region to the north, east, south, west, northeast, southeast, southwest, and northwest of S as S N , S E , S S , S W , S N E , S SE , S SW , and S N W , respectively. The following two lemmas are applicable for both problems: Lemma 1. [10] There is an optimal solution where every extreme point lies at a corner of some square. Lemma 2. [10] All vertices on the top left chain are top left corners of some squares, and similar for the other three chains. 2.1
O(n7 ) Algorithm for Problem 1
In [10], L¨ offler et al. show that the extreme vertices on the optimal convex hull may not come from the corresponding extreme squares. Their solution is to try all possible O(n4 ) combinations of four extreme vertices. Once four extreme vertices are fixed, the optimal convex hull can be computed in O(n3 ) time using the algorithm for computing the largest area convex hull of parallel line segments [10]. Therefore the total running time of their algorithm is O(n7 ). In this paper, we show that we need to check only O(n2 ) possible combinations for four extreme vertices. Then, the computation time comes down to O(n5 ).
194
O. Daescu et al.
pt S1tl
S5tr
pl pr S2bl
pb
S4br
Fig. 1. Illustration of P1524 . The dashed line segments are the parts of convex chains we have not computed yet and they are not parts of P1524 .
2.2
O(n5 ) Algorithm for Problem 2
In Problem 2, the squares have equal size. The corresponding four extreme vertices come from four extreme squares: topmost square St , leftmost square Sl , rightmost square Sr , and bottommost square Sb respectively. We call the other squares except the extreme ones S1 , S2 , ... , Sn−4 , and assume they are sorted in non-decreasing order by the x-coordinates of their bottom left corners. Abusing notation slightly, we also denote S0tl = pl , S0tr = pt , S0bl = pl , and S0br = pb . The authors [10] use a dynamic programming algorithm to compute the optimal convex hull. If h, i, j, k are distinct and belong to {0, 1, ...., n − 4}, Phijk is the area of the region which is bounded by the line segments Shtl pt , Sitr pr , Sjbl pb , Skbr pr and the four chains such that only one corner of every square serves as a vertex at most, and such that Phijk is maximal (see Figure 1). The first chain is goes from pl to Shtl via a number of the top left corners of the squares Sm1 with m1 < h, the second chains goes from pt to Sitr via a number of the top right corners of the squares Sm2 with m2 < i, the third chain goes from pl to Sjbl via a number of the bottom left corners of the squares Sm3 with m3 < j and the fourth chain goes from pb to Skbr via a number of the bottom right corners of the squares Sm4 with m4 < k. We then have the following properties. If h > i, j, k, Phijk can be computed in linear time by using the structures Pmijk where Phijk = maxm
h, j, k Phijk can be computed in linear time by ustr tr ing the structures Phmjk where Phijk = maxm h, i, k Phijk can be computed in linear time by using the structures bl bl Phimk where Phijk = maxm<j;m=h,i,k (Phimk + Sm Sj pb ). If k > h, i, j, Phijk can be computed in linear time by using the structures Phijm where Phijk = br br maxm
Largest Area Convex Hull of Axis-Aligned Squares
195
p
p St H
St H p
p H
H (a)
(b)
Fig. 2. Illustration for Lemma 4. (a) p is inside H. (b) p is a vertex of H.
The following lemma is only applicable for Problem 2: Lemma 3. [10] An extreme square in the input set contributes one of the extreme points of the optimal solution.
3
O(n5 ) Algorithm for Problem 1
Lemma 4. One of the corners of the topmost square must be a vertex of the optimal convex hull. Similar results hold for the other extreme square. Proof. Suppose that no corners of St are on the optimal convex hull H. There are two cases: 1. St is totally inside H. This is not possible since St is the topmost square. 2. H goes through St . Suppose that point p ∈ St \ {Stbl ∪ Stbr } is the chosen point for constructing H. Then we can move p to p that is one of the two top corners of St while keeping the other vertices of H unchanged, such that the area of the resulting convex hull H is no less than the area of H (see Figure 2). 2 Using a similar argument, we obtain the following lemma: Lemma 5. For a square S, if pt is below the top edge of S, then one of the bottom corners of S must appear on the optimal convex hull. Lemma 6. If the top left corner of a square S is used as a vertex of the optimal convex hull, there is no other vertex on the optimal convex hull lying in the region S N W . Similar results hold for the top right corner, bottom right corner, and bottom left corner, if selected as vertices of the optimal convex hull. Proof. According to Lemma 2, if the top left corner of a square S is used as a vertex of the optimal convex hull, then the top left corner of S is on the top left chain of the convex hull. Due to convexity, there cannot be any other vertex on the convex hull lying in the region S N W . 2 Now we show that there are only O(n2 ) possible combinations for four extreme vertices. We assume that the four extreme vertices are not from four extreme
196
O. Daescu et al. pt
pl
St
pr Sr
Sl pb
Fig. 3. Stbl and Srtl are on H and pr and pt are in SrN
squares, which is the most difficult case. According to Lemma 4, if pt does not come from St then Stbl must appear on the bottom left chain of the optimal convex hull H or Stbr must appear on the bottom right chain of H. Without loss of generality, we assume Stbl is on the bottom left chain of H. There are seven possibilities for the locations of the other three extreme vertices. 1. If Srtl is on the top left chain of H, according to Lemma 6, pt must be in SrN . The point pr could be in SrN or SrS . In this case, we assume that pr is in SrN (see Figure 3; we analyze the case of pr in SrS in the second case). According to Lemma 6, pl should be in StW or StN W . Since St is the topmost square, pl could only be in StW . Since only the bottom left chain and top left chain of H are in StW , two right corners of Sl cannot be on H. According to Lemma 4, one left corner of Sl must appear on H and it must be the leftmost vertex of H. Lemma 7. If Stbl and Srtl are on H and pr is in SrN , then there are only O(n) possible combinations of locations of pt and pr . Proof. First we sort the squares in SrN according to their top edge position from top to bottom. Let the sorted squares be the set Φ1 = {St1 , St2 , ..., Stm }. For any two squares Sti and Stj , i < j if and only if the top edge of Sti is above the top edge of Stj . If top edges of Sti and Stj are in the same horizontal line, i < j if and only if the left edge of Sti is to the left of tl tr left edge of Stj . If we select St1 or St1 as pt , then the squares that could E SE S contribute their right corners as pr are in St1 ∪ St1 ∪ St1 . Now we are going E to prove that for the squares that have top edges in St1 , only the one with rightmost right edge could contribute its right corners as pr . Let square SX be the square such that its right edge is the rightmost edge among all right E edges of squares with top edges in St1 (see Figure 4). Suppose that pr comes E and the right from another square SY such that the top edge of SY is in St1 edge of SY is to the left of the right edge of SX . According to Lemma 5, we know one of the left corners of SX must appear on H. However, there is no E left chain of H in St1 . Therefore one of the right corners of SX is on H and it must be pr . So if one of the top corners of St1 is chosen as pt , the candidate squares that could contribute their right corners as pt are the squares that S SE have their right edges in St1 ∪ St1 and SX . There are O(n) such candidate squares denoted as ΨSt1 .
Largest Area Convex Hull of Axis-Aligned Squares pt St1
197
SX SY
Sr pb
Fig. 4. There are only O(n) possible pair locations of pt and pr pt pl Sl
St∗ St
Sr pb
pr
Fig. 5. Stbl and Srtl are on H, pt is in SrN and pr is in SrS
If we choose one of the top corners of St2 as pt , according to Lemma 5, one of the bottom corners of St1 must appear on H. However, since there is no bl br bottom left chain of H in SrN , St1 cannot be on H and St1 must appear on the bottom right chain of H. According to Lemma 6, the squares in ΨSt1 , except SX , cannot contribute any right corners as pt . Therefore, |ΨSt1 ∩ ΨSt2 | ≤ 1. Similarly, we can prove |ΨSti ∩ ΨSt(i+1) | ≤ 1 where 1 ≤ i ≤ m − 1. Therefore, there are only O(n) possible combinations of locations of pt and pr . 2 Since in this case there are only two choices for pl , O(n) possible combinations of locations of pt and pr , and O(n) choices for pb , there are only O(n2 ) possible combinations of locations of all four extreme points. 2. If Srtl is on the top left chain of H and pt is in SrN and pr is in SrS , then pl must be one of the two left corners of Sl and pt must be one of the two top corners of St (see Figure 5). Let the topmost square in SrN be St∗ . Since there is no bottom chain of H in SrN , the bottom corners of St∗ cannot be on H. According to Lemma 5, pt must be one of two top corners of St∗ . Therefore there are only O(n2 ) possible combinations of locations of all four extreme points. 3. Srtl is on the top left chain of H and pt is in StW (see Figure 6). This is not possible. The top left chain is the chain connecting pl and pt which is in StW , and Srtl is on the top left chain, therefore the top edge of Sr is in StW and the right edge of Sr is to the left of St . A contradiction.
198
O. Daescu et al. pt St
Sr
pl
Fig. 6. Srtl is on the top left chain of H and pt is in StW pt pl Sl
pr
St Sr
pb
Sb
Fig. 7. Srbl is on the bottom left chain of H, pt is to the right of the right edge of St and pr is in SrN pt
pl Sl
St Sr pr pb
Fig. 8. Srbl is on the bottom left chain of H and pt is to the right of right edge of St . pr is in SrS
4. Srbl is on the bottom left chain of H, pt is to the right of right edge of St and pr is in SrN (see Figure 7). Similar to the second case, we can prove that pl must come from Sl and pb must come from Sb . Therefore there are only O(n2 ) possible combinations of locations of all four extreme points. 5. Srbl is on the bottom left chain of H, pt is to the right of right edge of St and pr is in SrS (see Figure 8). Similar to the first case, we can prove there are only O(n) possible combinations of locations of pb and pr , resulting in O(n2 ) possible combinations of locations of all four extreme points. 6. Srbl is on the bottom left chain of H and pt and pl are in StW . Similar to the first and second cases, we can prove that there are only O(n) possible combinations of locations of pl and pt , and pb must come from Sb . Therefore in total there are O(n2 ) possible combinations of locations of all four extreme points. 7. Srbl is on the bottom left chain of H, pt and pl are in StW , and pb and pr are in SrS . Similar to the first case, we can prove that there only O(n) possible combinations of locations of pl and pt and O(n) possible combinations of locations of pb and pr , resulting in O(n2 ) possible combinations of locations of all four extreme points.
Largest Area Convex Hull of Axis-Aligned Squares
199
Theorem 1. The largest area convex hull of imprecise input based on the nonoverlapping axis-aligned squares can be computed in O(n5 ) time.
4
O(n3 ) Algorithm for Problem 2
Without loss of generality, we assume that the input squares are unit squares and there are only four extreme squares. (Due to space limitation, we omit degenerate cases where there are more than four extreme squares, which can be handled easily.) According to Lemma 5 and Lemma 3, there are at most sixteen combinations of (four) extreme points. Assuming four extreme points are fixed, we construct the convex hull as follows: use pl , pt , and all top left corners of all non-extreme squares to construct the top left chain in O(n log n) time. The other three convex chains are constructed in a similar way. Therefore, we can construct at most sixteen such convex hulls in O(n log n) time. We refer to those those convex hulls as a set of CHorigin . A non-extreme square with at least two corners as vertices of one such convex hull is called an invalid square. If we use a line l to sweep the convex hull in any fixed direction, the length of the intersecting line segment between l and the convex hull is a unimodal function, which first increases and then decreases. We denote the increasing region as l+ and the deceasing region as l− . In this paper, l is fixed to vertical, horizontal, positive 45 degree, and negative 45 degree lines, denoted as |, −, /, \, respectively. For an invalid square S, if S tl and S bl appear on (a convex hull in) CHorigin , we call it SlN ear . Similarly, the other three possible invalid squares are denoted as StN ear , SbN ear , and SrN ear . However if only S tl and S br appear on CHorigin , there are two cases: if the diagonal line through S tl and S br is on \+ region, then we denote the invalid square as SblN ear , otherwise as StrN ear . Similarly we define StlN ear , and SbrN ear . Therefore, we have eight types of invalid squares in total. Since squares can overlap, one square could have more than two corners appearing on CHorigin . This means one square could be SlN ear and StN ear at the same time. Let x.a and y.a be the x and y coordinates of point a. Lemma 8. (a) There is no part of a non-extreme square to the left of the left edge of SlN ear , to the right of the right edge of SrN ear , to the top of the top edge of StN ear , and to the bottom of the bottom edge of SbN ear . (b) There is no part of an non-extreme square to the left of the left edge of SblN ear and below the bottom edge of SblN ear . Similar claims hold for StrN ear , StlN ear , and SbrN ear . Proof. We prove the first case for (a). The other three cases for SrN ear , StN ear , and SbN ear have similar proofs. Assume that there is a non-extreme square S1 to the left of the left edge of SlN ear . According to Lemma 2, the left edge of SlN ear appears on |+ . If we draw a line l through the left edge of S1 , since l is to the left of left edge of SlN ear , the length of the intersection line segment between l and CHorigin should be less than one. Thus, at least one of the two left corners of S1 is out of CHorigin , which contradicts the way we constructed CHorigin .
200
O. Daescu et al.
l2
SblN ear
l1 S1
l1
SblN ear
S1
pl pb
l2
pl
(a)
pb
(b)
Fig. 9. Illustration for lemma 8
For (b), we prove that no part of a non-extreme square is to the left of the left edge of SblN ear . The other cases have similar proofs. Suppose that there is a non-extreme square S1 to the left of the left edge of SblN ear . Let l1 be the line tl br tl br through SblN ear and SblN ear , and let l2 be the line through S1 and S1 . There are two subcases: 1. S1tl is to the left of l1 and to the left of left edge of SblN ear (see Figure 9(a)). Then l2 is to the left of l1 . Furthermore l1 is on the region of \+, then √ the length of the intersection line segment of l2 with CHorigin is less than 2, which means at least one vertex of S1tl and S1br is out of CHorigin . This contradicts the way we construct CHorigin . 2. S1tl is to the right of l1 and to the left of the left edge of SblN ear (see Figtl ure 9(b)). Then l2 is to the right of l1 . However, since y.S1tl > y.SblN ear tl tl tl and x.S1 < x.SblN ear , S1 appears on the top left chain of CHorigin while tl SblN ear does not appear on the top left chain of CHorigin . This contradicts the definition of SblN ear . 2 From Lemma 8, we know that there exists at most one invalid square for each type of invalid square and some pairs of invalid squares cannot co-exist. For example, SlN ear and SblN ear cannot appear simultaneously since both require that there are no non-extreme squares appearing to the left of their left edges. Thus we have the following corollary. Corollary 1. The following pairs of invalid squares cannot co-exist: {SlN ear , SblN ear }, {SlN ear , StlN ear }, {SrN ear , SbrN ear },{SrN ear , StrN ear }, {StN ear , StlN ear }, {StN ear , StrN ear }, {SbN ear , SblN ear }, {SbN ear , SbrN ear }, {StlN ear , SblN ear }, {SblN ear , SbrN ear }, {SbrN ear , StrN ear } and {StrN ear , StlN ear }. Lemma 9. If any of SlN ear , StN ear , SbN ear , and SrN ear appear on CHorigin , then the four extreme vertices of CHorigin cannot appear on the optimal convex hull simultaneously.
Largest Area Convex Hull of Axis-Aligned Squares
201
Proof. Without loss of generality, we assume that SlN ear appears on CHorigin and pl = Slbl . Suppose that the four extreme vertices of CHorigin are the four extreme vertices of the optimal convex hull CHopt . Due to the way we construct CHorigin , there are no other corners of non-extreme squares above the tl bl bl line through Slbl and SlN ear and below the line through Sl and SlN ear . Theretl bl fore at least one of SlN ear and SlN ear are outside of CHopt . There are two cases: tl bl tl 1. One of SlN ear and SlN ear is the vertex of CHopt . Suppose that SlN ear is the bl vertext of CHopt and SlN ear is outside of CHopt (the other case is similar). Then we construct a new convex hull CH with all vertices of CHopt plus bl bl SlN ear . Since SlN ear is outside of CHopt , Area(CH ) > Area(CHopt ). For tl bl the vertices of CH , only SlN ear and SlN ear come from the same square. Then we substitute Slbl with Sltl in CH and construct a new convex hull CH . According to Lemma 8, no part of a non-extreme square is to the left of the left edge of SlN ear . Then, the neighbor vertex of Sltl on the bottom left tl bl chain of CH is still Slbl . Because SlN ear and SlN ear appear on CHorigin and bl bl tl CH we have y.SlN ear < y.Sl < y.SlN ear . Since all squares are unit squares, tl tl tl y.SlN ear < y.Sl which implies that SlN ear is inside CH . Then CH covers all squares and the vertices of CH are from distinct squares. Moreover, we have Area(CH ) ≥ Area(CH ) > Area(CHopt ). This contradicts the fact CHopt is the largest area convex hull. tr br tl 2. One of SlN ear and SlN ear is the vertex of CHopt . Then both SlN ear and bl tr SlN ear are outside of CHopt . Suppose that SlN ear is the vertex of CHopt (the other case is similar). Then we construct a new convex hull CH with all tl tl vertices of CHopt plus SlN ear . Since SlN ear is outside of CHopt , Area(CH ) > Area(CHopt ). Now we substitute pt with the other top corner of St and construct a new convex hull CH . Similar to the first case, we can prove that CH is a valid convex hull and Area(CH ) ≥ Area(CH ) > Area(CHopt ). This contradicts the fact that CHopt is the largest area convex hull.
Similar results also hold for StN ear , SrN ear , and SbN ear .
2
Assume that we already know CHopt and its four extreme vertices pl , pr , pb , pt . According to Lemma 9, if we use pl , pr , pb , pt to construct a convex hull in the set of CHorigin , then this convex hull has no SlN ear , StN ear , SbN ear , and SrN ear . Therefore, at least one of the sixteen convex hulls in the set of CHorigin has no SlN ear , StN ear , SbN ear , and SrN ear . We divide the sixteen convex hulls in the set of CHorigin into three subsets: 1 1. Set of CHorigin : convex hulls with SlN ear , StN ear , SbN ear , and/or SrN ear . 2 2. Set of CHorigin : convex hulls without SlN ear , StN ear , SbN ear , and/or SrN ear but with SblN ear , StrN ear , StlN ear , and/or SbrN ear . 3 : convex hulls without any invalid square. 3. Set of CHorigin 1 since according to Lemma 9, the four We can ignore the set of CHorigin 1 extreme vertices of the convex hulls in CHorigin cannot appear on the optimal 3 convex hull simultaneously. For the set of CHorigin , we just compute the area of
202
O. Daescu et al. l2
pt StrN ear
pr
l1 SblN ear
pl
pb
Fig. 10. CHorigin with SblNear and StrNear
each of them in O(n log n) time and get the largest one. The only type we need 2 to take care of is the set of CHorigin . According to Corollary 1, only SblN ear and StrN ear , or StlN ear and SbrN ear can co-exist. Without loss of generality, we assume that only SblN ear and StrN ear appear on CHorigin . Let l1 be the line tl br tl br through SblN ear and SblN ear and let l2 be the line through StrN ear and StrN ear (see Figure 10). The line l1 is parallel with l2 and l1 is to the left of l2 . The convex tl tl chain between SblN ear and StrN ear is part of the top left chain of CHorigin and br br the convex chain between SblN ear and StrN ear is part of the bottom right chain of CHorigin and they are between l1 and l2 . Therefore, pl , pb , pt , pr cannot appear in the area between l1 and l2 , pl , pb appear to the left of l1 and pt , pr appear to the right of l2 , due to convexity. Furthermore, according to Lemma 8, no part of a non-extreme square is to the left of the left edge of SblN ear and below the bottom edge of SblN ear . Since squares could overlap, the only corner of a nonextreme square that could exist to the left of l1 is a bottom left corner and it is in the bottom left triangle of SblN ear , thus it cannot be a vertex on bottom left chain of CHorigin . Then, there is no other vertex of CHorigin between pl and pb . Similarly there is no other vertex of CHorigin between pt and pr . This means that the top right chain and the bottom left chain are just a line segment and they are fixed. The corners that cause invalid squares can only be the top left corner and the bottom right corner. Then the problem can be reduced to the following problem: given four extreme vertices and n − 4 same size parallel (45◦ or −45◦) line segments as imprecise input, compute the largest area convex hull. This can be solved in O(n3 ) time [10]. Theorem 2. Given a set of n equal size axis-aligned squares, the problem of choosing a point in each square such that the area of the convex hull of the resulting point set is maximized can be solved in O(n3 ) time.
5
Conclusions
In this paper, we presented an O(n5 ) time algorithm to compute the convex hull of maximum area modeled on non-overlapping axis-aligned squares. The key contribution was to prove that there are only O(n2 ) possible combinations
Largest Area Convex Hull of Axis-Aligned Squares
203
of locations of four extreme points. We also presented an O(n3 ) time algorithm for computing the convex hull of maximum area modeled on overlapping axisaligned unit squares. Both our algorithms improve over previous results by an O(n2 ) factor.
References 1. Beresford, A.R., Stajano, F.: Location Privacy in Pervasive Computing. IEEE Pervasive Computing 2(1), 46–55 (2003) 2. Akl, S.G., Toussaint, G.T.: Efficient convex hull algorithms for pattern recognition applications. In: Int. Joint Conf. on Pattern Recognition, pp. 483–487 (1978) 3. Bhattacharya, B.K., El-Gindy, H.: A new linear convex hull algorithm for simple polygons. IEEE Trans. Inform. Theory 30, 85–88 (1984) 4. B˝ ohm, C., Kriegel, H.: Determining the convex hull in large multidimensional databases. In: Kambayashi, Y., Winiwarter, W., Arikawa, M. (eds.) DaWaK 2001. LNCS, vol. 2114, pp. 298–306. Springer, Heidelberg (2001) 5. Taubman, D.: High Performance Scalable Image Compression. IEEE Transactions on Image Processing 9, 1158–1170 (2000) 6. Freeman, H., Shapira, R.: Determining the minimum-area encasing rectangle for an arbitrary closed curve. Communications of the ACM 18(7), 409–413 (1975) 7. Graham, R.L.: An efficient algorithm for determining the convex hull of a finite planar set. Information Processing Letters 26, 132–133 (1972) 8. Graham, R.L., Yao, F.F.: Finding the convex hull of a simple polygon. J. Algorithms 4, 324–331 (1984) 9. Lee, D.T.: On finding the convex huff of a simple polygon. Internat. J. Comput. Inform. Sci. 12, 87–98 (1983) 10. L¨ offler, M., van Kreveld, M.: Largest and Smallest Convex Hulls for Imprecise Points. Algorithmica 56(2), 235–269 (2010) 11. Melkman, A.: On-Line Construction of the Convex Hull of a Simple Polyline. Information Processing Letters 25, 11–12 (1987) 12. Pfoser, D., Jensen, C.S.: Capturing the uncertainty of moving-objects representations. In: Proceedings of the 6th International Symposium on Advances in Spatial Databases, pp. 111–132 (1999) 13. Cheng, R., Kalashnikov, D.V., Prabhakar, S.: Querying Imprecise Data in Moving Object. IEEE Transactions on Environments, Knowledge and Data Engineering 16(9), 1112–1127 (2004) 14. Sistla, P.A., Wolfson, O., Chamberlain, S., Dao, S.: Querying the uncertain position of moving objects. In: Etzion, O., Jajodia, S., Sripada, S. (eds.) Dagstuhl Seminar 1997. LNCS, vol. 1399, pp. 310–337. Springer, Heidelberg (1998)
Improved Algorithms for the Point-Set Embeddability Problem for Plane 3-Trees Tanaeem M. Moosa and M. Sohel Rahman Department of CSE, BUET, Dhaka-1000, Bangladesh [email protected], [email protected] http://www.buet.ac.bd/cse
Abstract. In the point set embeddability problem, we are given a plane graph G with n vertices and a point set S with n points. Now the goal is to answer the question whether there exists a straight-line drawing of G such that each vertex is represented as a distinct point of S as well as to provide an embedding if one does exist. Recently, in [15], a complete characterization for this problem on a special class of graphs known as the plane 3-trees was presented along with an efficient algorithm to solve the problem. In this paper, we use the same characterization to devise an improved algorithm for the same problem. Much of the efficiency we achieve comes from clever uses of the triangular range search technique.
1
Introduction
A planar graph is a graph that can be embedded in the plane, i.e., it can be drawn on the plane in such a way that its edges intersect only at their endpoints. A planar graph already drawn in the plane without edge intersections is called a plane graph or planar embedding of the graph. A straight-line drawing Γ of a plane graph G is a graph embedding in which each vertex is drawn as a point and each edge is drawn as straight line segments (as opposed to curves, etc.). Given a plane graph G with n vertices and a set S of n points in the plane, a point-set embedding of G on S is a straight-line drawing of G such that each vertex is represented as a distinct point of S. The problem of computing a point-set embedding of a graph, also referred to as the point-set embeddability problem in the literature, has been extensively studied both when the mapping of the vertices to the points is chosen by the drawing algorithm and when it is partially or completely given as part of the input. There exists a number of results of the point-set embeddability problem on different graph classes in the literature [4,10,12,17]. A number of variants of the original problem have also been studied in the literature. For example in [1,8], a variant of the pointset embeddability problem has been studied, where the vertex set of the given graph and the given set of points are divided into a number of partitions and a particular vertex subset is to be mapped to a particular point subset. Other variants have also been studied with great interest [13,9].
Tanaeem Moosa is currently working at Google Inc.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 204–212, 2011. c Springer-Verlag Berlin Heidelberg 2011
Point-Set Embeddability Problem for Plane 3-Trees
205
Very recently, Nishat et al. [15] studied the point set embeddability problem on a class of graphs known as the plane 3-tree. Plane 3-trees belong to an interesting class of graphs and recently a number of different drawing algorithms have been presented in the literature on plane 3-trees [2,14,15]. In this paper, we follow up the work of [15] and improve upon their result from an algorithmic point of view. In [15], Nishat et al. presented an O(n2 log n) time algorithm that can decide whether a plane 3-tree G of n vertices admits a point-set embedding on a given set of n points or not and compute a point-set embedding of G if such an embedding exists. In this paper, we show how to improve the running time of the above algorithm. In particular, we take their algorithmic ideas as the building block of our algorithm and with some non trivial modifications we achieve a running time of O(n4/3+ log n). The efficiency of our algorithm comes mainly from clever uses of triangular range search and counting queries [18,7,6] and bounding the number of such queries. The rest of this paper is organized as follows. Section 2 presents some definitions and preliminary results. In Section 3 we present our main result. We briefly conclude in Section 4.
2
Preliminaries
In this section we present some preliminary notations, definitions and results that we use in our paper. We follow mainly the definitions and notations of [16]. We start with a formal definition of the straight-line drawing. Definition 1 (Straight-Line Drawing). Given a plane graph G, a straightline drawing Γ (G) of G is a drawing of G where vertices are drawn as points and edges are drawn as connecting lines. The problem we handle in this paper is formally defined as follows. Problem 1 (Point-Set Embeddability). Let G be a plane graph of n vertices and S be a set of n points on plane. The point-set embeddability problem wants to find a straight-line drawing of G such that the vertices of G are mapped to the points of S. Finding a point-set embedding for an arbitrary plane graph is proved to be NPComplete [5], even for some restricted subclasses. On the other hand, polynomial time algorithm exists for finding point-set embedding for outerplanar graphs or trees [11,4]. An interesting research direction in the literature is to investigate this problem on various other restricted graph classes. One such interesting graph class, known as the plane 3-tree, is formally defined below. Definition 1 (Plane 3-Tree). A plane 3-tree is a triangulated plane graph G = (V, E) with n vertices such that either n = 3, or there exists a vertex x such that the graph induced by V − {x} is also a plane 3-tree. As has been mentioned above, the very recent work of Nishat et al. [15] proved that finding point-set embedding is polynomially solvable if the input is restricted
206
T.M. Moosa and M. Sohel Rahman
to a Plane 3-Tree. Since a plane 3-tree is triangulated, its outer face has only 3 vertices, known as the outer vertices. The following two interesting properties of a plane 3-tree with n > 3 will be required later. Proposition 1 ([3]). Let G be a plane 3-tree with n > 3 vertices. Then, there is a node x with degree 3 whose deletion will give a plane 3-tree of n − 1 vertices. Proposition 2 ([3]). Let G be a plane 3-tree with n > 3 vertices. Then, there exists exactly 1 vertex (say, p) that is a common neighbor of all 3 outer vertices. For a plane 3-tree G, the vertex p (as defined in Proposition 2) is referred to as the representative vertex of G. For a plane graph G, and a cycle C in it, we use G(C) to denote the subgraph of G inside C (including C). In what follows, if a cycle C is a triangle involving the vertices x, y and z, we will often use xyz and G(xyz) to denote C and G(C). The following interesting lemma was recently proved in [15] and will be useful later in this paper. Lemma 1 ([15]). Let G be a plane 3-tree of n > 3 vertices and C be any triangle of G. Then, the subgraph G(C) is a plane 3-tree. We now define an interesting structure related to a plane 3-tree, known as the representative tree. Definition 2 (Representative Tree). Let G be a plane 3-tree with n vertices with outer vertices a, b and c and representative vertex p (if n > 3). The representative tree T of G is an ordered tree defined as follows: – If n = 3, then T is an single vertex. – Otherwise, the root of T is p and its subtrees are the representative trees of G(apb), G(bpc) and G(cpa) in that order. Note that, the representative tree T has n = n − 3 internal nodes, each internal node having degree 3. Also, note that the outer vertices of G are named as a, b and c respectively in counter-clockwise order around p. Therefore, the representative tree T of a plane 3-tree G is unique as per Definition 2. Now consider a plane 3-tree G and its representative tree T . Assume that G is a subgraph of G and T is a subtree of T . Then, G is referred to as the corresponding subgraph of T if and only if T is the representative tree of G . There is an O(n) time algorithm to construct the representative tree from a given plane graph [15]. Given a set of points S, we use the symbol PS (xyz) to denote the set of points that are inside the triangle xyz. We use the symbol NS (xyz) to denote size of the set PS (xyz). We will extensively use the triangular range search and counting queries in our algorithm. Below we formally define these two types of queries. Problem 2 (Triangular Range Search). Given a set S of points that can be preprocessed, we have to answer queries of the form SetQuery(S, abc), where the query returns PS (abc).
Point-Set Embeddability Problem for Plane 3-Trees
207
Problem 3 (Triangular Range Counting). Given a set S of points that can be preprocessed, we have to answer queries of the form CountQuery(S, abc), where the query returns NS (abc). In what follows, we will follow the following convention: If an algorithm has preprocessing time f (n) and query time g(n), we will say its overall running time is f (n), g(n).
3
Algorithms
In this section, we present our algorithm which is based on the algorithm of [15]. In what follows we shall refer to the algorithm of [15] as the NMR algorithm. To simplify the description, we first assume that the points of S are in general positions, i.e., no three points of S are collinear. Also, we will assume for the time being that triangular range search has running time f (|S|), g(|S|) + and triangular range counting has running time f (|S|), g(|S|), where S is the input set and is the output size for triangular range search. We will finally use the actual running times during the analysis of the algorithm. The following lemmas were proved in [15] and will be useful in our algorithm. Lemma 2 ([15]). Let G be a plane 3-tree of n vertices and S be a set of n points. If G admits a point-set embedding on S, then the convex hull of S contains exactly three points in S. Lemma 3 ([15]). Let G be a plane 3-tree of n vertices with a, b and c being the three outer vertices of G, and let p be the representative vertex of G. Let S be a set of n points such that the convex hull of S contains exactly three points. Assume that G has a point-set embedding Γ (G) on S for a given mapping of a, b and c to the three points of the convex-hull of S. Then p has a unique valid mapping. The steps of the algorithm is presented below: Step: 1 Like the NMR algorithm, at first we find the convex hull of the points of S. By Lemma 2 the convex hull should have 3 points, otherwise no embedding exists. Step: 2 At this step, we preprocess the points of S for triangular range search and triangular range counting. Step: 3 Now, for each of the possible 6 mappings of the outer vertices of G to the three points of the convex hull, we perform Steps 4 to 6 (recursively). Step: 4 Assume that at the beginning of this step, we are considering the representative (sub)tree T and the corresponding graph is G (obviously a subgraph of G). Let the three outer vertices of G are a , b and c and the representative vertex of it is p . Note that, initially, G = G, T = T and the outer vertices and the representative vertex are a, b, c and p respectively. Assume that the number of internal nodes in T is n . Note that, number of vertices in the corresponding graph G is n +3. If n = 0
208
T.M. Moosa and M. Sohel Rahman
then embedding is trivially possible and this step returns immediately terminating the recursion. Otherwise, the following step is executed to check whether an embedding is indeed possible. Step: 5 Let the root of T be r. Also let the three children of r be r1 , r2 and r3 and the number of internal nodes in the subtrees rooted at r1 , r2 and r3 be n1 , n2 and n3 respectively. Note that n = n1 + n2 + n3 + 1. Let the three outer vertices a , b and c of G are mapped to points x, y and z of S. Now, we find a point u in S such that NS (xuy) = n1 , NS (yuz) = n2 , and NS (zux) = n3 . By Lemma 3, u is unique if it exists. To find u, all the points of S lying within the triangle xyz are checked in the NMR algorithm. We however, find u in a more efficient and clever manner as follows. Without loss of generality we can assume that n2 ≤ min(n1 , n3 ). In order to find u, we first find points v1 and v2 on the line yz such that NS (xv1 y) = n1 and NS (xv2 z) = n3 . Note carefully that, in line yz, v1 appears closer to y than v2 ; otherwise there will not be n points inside the triangle xyz. We will use a binary search and triangular range counting queries to find v1 , v2 as follows. We first choose the mid point w of the line yz. Then we compute NS (xwy) using a triangular range counting query. If NS (xwy) = n1 we are done and we assign v1 = w. Otherwise, if NS (xwy) > n1 (NS (xwy) < n1 ), then we choose the mid point w of the line yw (wz). Then we perform similar checks on xw y. The point v2 can also found similarly. Clearly, there always exist such points with rational co-ordinate having denominator at most than N 21 and steps of binary search is bounded by O(log N ), where N is the maximum absolute value of a point of S in any coordinate. Step: 6 With points v1 and v2 at our disposal, we now try to find point u. Note that the point u cannot be inside either xv1 y or xv2 z. This is because if u is in xv1 y then NS (xuy) < NS (xv1 y) = n1 implying NS (xuy) < n1 , a contradiction. A similar argument is possible for xv2 z. So, we must have u ∈ PS (xv1 v2 ). Also note that NS (xv1 v2 ) = NS (xyz) − NS (xv1 y) − NS (xv2 z) = n − n1 − n3 = n2 +1. Using triangular range search we now find the points PS (xv1 v2 ). To find u, we now simply check whether any of these points satisfies the requirement NS (xuy) = n1 , NS (yuz) = n2 , and NS (zux) = n3 . If no such point exists, then we return stating that it will be impossible to embed the graph on the points. Otherwise we find a point u, which is mapped to vertex p. Now Steps 4 to 6 are recursively executed for all three subtrees. 3.1
Analysis
Naive implementation of NMR algorithm runs in O(n3 ) time [15]. By sorting all points of S according the polar angle with respect to each point of S and 1
Because intersection point of two lines both having integer coordinate can not have larger denominator.
Point-Set Embeddability Problem for Plane 3-Trees
209
employing some non-trivial observations, this algorithm can be made to run in O(n2 ) time [15]. Note that, the O(n2 ) algorithm assumes that the points of S are at general positions. If this assumption is removed, NMR algorithm runs in O(n2 log n) time. Now we analyze our modified algorithm. Step 1 is executed once and can be done in O(n log n) time. Step 2 is executed once and can be done in f (|S|) time. Steps 4 to 6 are executed recursively. Step 4 basically gives us the terminating condition of the recursion. We focus on Step 5 and Step 6 separately below. In Step 5, we find out the two points v1 and v2 using binary search and triangular range counting queries. Time required for this step is O(g(|S|) log N ). Note carefully that both the parameters |S| and N does not change in recursion. Also, it is easy to see that, overall, Step 5 is executed once for each node in T . Hence, the overall running time of this step is O(g(|S|)n log N ). Now we focus on Step 6. Time required for triangular range search in Step 6 is O(g(|S|) + n2 ). In this step we also need O(n2 ) triangular range counting queries which add up to O(g(|S|)n2 ) time. Recall that, n2 ≤ min(n1 , n3 ), i.e., n2 is the number internal nodes of the subtree having the least number of internal nodes. Hence, we have n2 ≤ n /3. Now, the overall running time of Step 6 can be expressed using the following recursive formula: T (n ) = T (n1 ) + T (n2 ) + T (n3 ) + n2 g(|S|)), where n2 ≤ min(n1 , n3 ). Now we have the following theorem: Theorem 1. The overall running time of Step 6 is O(g(|S|) n log n). Proof. First, assume that T (n) ≤ c(n log n)g(|S|), c ≥ 1. Then we have, T (n ) = T (n1 ) + T (n2 ) + T (n3 ) + n2 g(|S|) ≤ c(n1 log n1 )g(|S|) + c(n2 log n2 )g(|S|) + c(n3 log n3 )g(|S|) + n2 g(|S|) n )g(|S|) + c(n3 log n )g(|S|) + c × n2 g(|S|) 2 = c(n1 log n )g(|S|) + c(n2 (−1 + log n ))g(|S|) + c(n3 log n )g(|S|) + cn2 g(|S|) < c(n1 log n )g(|S|) + c(n2 log
= cg(|S|)(−n2 + (n1 + n2 + n3 ) log n + n2 ) = cg(|S|)n log n
This completes the proof.
Based on the above discussion, total time required for this algorithm is O(n log n + f (|S|) + ng(|S|) log N + ng(|S|) log n) = O(f (|S|) + n g(|S|)(log n + log N )). Now we are ready to replace f (|S|) and g(|S|) with some concrete values. To the best of our knowledge, the best result of triangular range search and counting queries is due to Chazelle et al. [7]. In particular, Chazelle et al. proposed a solution for the triangular range search queries in [7] with time complexity O(m1+ ), O(n1+ /m1/2 ), where n < m < n2 . Using this result the running time of our algorithm becomes O(m1+ + (log n + log N )n2+ /m1/2 ), which reduces to O(n4/3+ + (log n + log N )n4/3+ ) if we choose m = n4/3 . Finally, we can safely ignore the log N component from our running time as follows. Firstly, the log N component becomes significant only when N is doubly
210
T.M. Moosa and M. Sohel Rahman
exponential in n or larger, which is not really practical. Secondly, while we talk about the theoretical running time of algorithms, we often ignore the inherent O(log N ) terms assuming that two (large) numbers can be compared in O(1) time. For example, in comparison model, since sorting n (large) numbers having maximum value N requires Θ(n log n) comparisons we usually say that sorting requires Θ(n log n) time. Essentially, here, we ignore the fact that comparing two numbers actually requires Ω(log N ) time. Notably, the algorithm of [15] also has an hidden O log N term since it requires O(n2 ) comparisons each of which actually requires O(log N ) time. One final note is that for instances where the log N term does have significant effect, we can in fact get rid of the term using standard techniques to transform a counting algorithm into a ranking algorithm at the cost of a log n time increase in the running time. Similar techniques are also applicable for the algorithm of [15]. So, we have the following theorem. Theorem 2. The point set Embeddability problem can be solved in O(n4/3+ log n) time if the input graph is a plane 3-tree and S does not contain any three points that are collinear. 3.2
For Points Not in General Positions
So far we have assumed that the points of S are in general positions, i.e., no three points in S are collinear. We now discuss how to get around this assumption. Note that, the algorithm of Nishat et al [15] shows improved performance of O(n2 ) when the points of S are in general positions. Now, if we remove our assumption, then we may have more than two points that are collinear. In this case, the only only modification needed in our algorithm is in Step 5. Now, the problem is that the two points v1 and v2 could not be found readily as before. More specifically, even if Step 5 returns that v1 and v2 do not exist, still u may exist. Now note that, in Step 5, we want to find out v1 and v2 to ensure that NS (xv1 v2 ) = n2 + 1, where n2 = min(n1 , n3 ), i.e., n2 ≤ n /3. Since, we have to check each points of PS (xv1 v2 ) (to find u), the above bound of n2 ≤ n /3 provides us with the required efficiency in our algorithm. To achieve the same efficiency, we now slightly modify Step 5. Suppose we are finding v1 (v2 ). We now try to find v1 (v2 ) such that the NS (xv1 y) > n1 (NS (xv2 z) > n3 ) and v1 (v2 ) is as near as possible to B (C) on the line BC. Let us assume that we need I iterations now to find v1 (v2 ). We have the following bound for I. Lemma 4. I is bounded by O(log N ) Proof. There may not be any point candidate of v1 (v2 ) which has integer coordinates. But as x can be intersection of two lines, each of which goes through two points of S, there may exists a point candidate of v1 having denominator less than N 2 or there is none. Either way, to find such a point or to be sure no such point exists we only need precision less than 1/N 2 . Therefore, O(log N ) iterations are sufficient.
Point-Set Embeddability Problem for Plane 3-Trees
211
Again, the argument presented at the end of Section 3.1 about the component log N applies here as well. Therefor, the result of Theorem 2 holds even the points of S are not in general positions. So, we restate our stronger and more general result as follows. Theorem 3. The point set Embeddability problem can be solved in O(n4/3+ log n) time if the input graph is a plane 3-tree.
4
Conclusion
In this paper, we have followed up the work of [15] and presented an algorithm to solve the point-set embeddability problem in O(n4/3+ log n) time, where N is the maximum absolute value of a point of S in any coordinate. This improves the recent O(n2 log n) time result of [15]. Whether this algorithm can be improved is an interesting open problem. Additionally, an o(n4/3 ) algorithm could be an interesting avenue to explore, which, however, does not seem to be likely with our current technique. Since there are Ω(n) nodes in the tree, any solution that uses triangular range search to check validity at least once for each node in the tree would require Ω(n) calls to triangular range query. Lower bound for triangular range search is shown to be Ω(m), Ω(n/m1/2 ) [6], which suggests an Ω(n4/3 ) lower bound for our algorithm using triangular range search.
References 1. Badent, M., Giacomo, E.D., Liotta, G.: Drawing colored graphs on colored points. In: Dehne, F., Sack, J.-R., Zeh, N. (eds.) WADS 2007. LNCS, vol. 4619, pp. 102– 113. Springer, Heidelberg (2007) 2. Biedl, T., Vel´ azquez, L.R.: Drawing planar 3-trees with given face-areas. In: Eppstein, D., Gansner, E.R. (eds.) GD 2009. LNCS, vol. 5849, pp. 316–322. Springer, Heidelberg (2010) 3. Biedl, T.C., Vel´ azquez, L.E.R.: Drawing planar 3-trees with given face-areas. In: Eppstein, D., Gansner, E.R. (eds.) GD 2009. LNCS, vol. 5849, pp. 316–322. Springer, Heidelberg (2010) 4. Bose, P.: On embedding an outer-planar graph in a point set. Comput. Geom. 23(3), 303–312 (2002) 5. Cabello, S.: Planar embeddability of the vertices of a graph using a fixed point set is NP-hard. J. Graph Algorithms Appl. 10(2), 353–363 (2006) 6. Chazelle, B.: Lower bounds for off-line range searching. Discrete & Computational Geometry 17(1), 53–65 (1997) 7. Chazelle, B., Sharir, M., Welzl, E.: Quasi-optimal upper bounds for simplex range searching and new zone theorems. Algorithmica 8, 407–429 (1992) 8. Giacomo, E.D., Didimo, W., Liotta, G., Meijer, H., Trotta, F., Wismath, S.K.: k-colored point-set embeddability of outerplanar graphs. J. Graph Algorithms Appl. 12(1), 29–49 (2008) 9. Giacomo, E.D., Liotta, G., Trotta, F.: On embedding a graph on two sets of points. Int. J. Found. Comput. Sci. 17(5), 1071–1094 (2006)
212
T.M. Moosa and M. Sohel Rahman
10. Ikebe, Y., Perles, M.A., Tamura, A., Tokunaga, S.: The rooted tree embedding problem into points in the plane. Discrete & Computational Geometry 11, 51–63 (1994) 11. Ikebe, Y., Perles, M.A., Tamura, A., Tokunaga, S.: The rooted tree embedding problem into points in the plane. Discrete & Computational Geometry 11, 51–63 (1994) 12. Kaneko, A., Kano, M.: Straight line embeddings of rooted star forests in the plane. Discrete Applied Mathematics 101(1-3), 167–175 (2000) 13. Kaneko, A., Kano, M.: Semi-balanced partitions of two sets of points and embeddings of rooted forests. Int. J. Comput. Geometry Appl. 15(3), 229–238 (2005) 14. Mondal, D., Nishat, R.I., Rahman, M., Alam, J.: Minimum-area drawings of plane 3-trees. In: Proceedings of the 22nd Canadian Conference on Computational Geometry (CCCG 2010), pp. 191–194 (2010) 15. Nishat, R.I., Mondal, D., Rahman, M. S.: Point-set embeddings of plane 3-trees. In: Brandes, U., Cornelsen, S. (eds.) GD 2010. LNCS, vol. 6502, pp. 317–328. Springer, Heidelberg (2011) 16. Nishizeki, T., Rahman, M. S.: Planar graph drawing. World Scientific Pub. Co. Inc., Singapore (2004) 17. Pach, J., Wenger, R.: Embedding planar graphs at fixed vertex locations. Graphs and Combinatorics 17(4), 717–728 (2001) 18. Paterson, M.S., Yao, F.F.: Point retrieval for polygons. Journal of Algorithms 7(3), 441–447 (1986)
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line Aritra Banik, Bhaswar B. Bhattacharya, and Sandip Das Indian Statistical Institute, Kolkata 700108, India {aritrabanik,bhaswar.bhattacharya}@gmail.com, [email protected]
Abstract. The one-round discrete Voronoi game, with respect to a npoint user set U, consists of two players Player 1 (P1) and Player 2 (P2). At first, P1 chooses a set F1 of m facilities following which P2 chooses another set F2 of m facilities, disjoint from F1 , where m = O(1) is a positive constant. The payoff of a player i is defined as the cardinality of the set of points in U which are closer to a point in Fi than to every point in Fj , for i = j. The objective of both the players in the game is to maximize their respective payoffs. In this paper, we address the case where the points in U are located along a line. We show that if the sorted order of the points in U along the line is known, then the optimal strategy of P2, given any placement of facilities by P1, can be computed in O(n) time. We then prove that for m ≥ 2 the optimal strategy of P1 in the one-round discrete Voronoi game, with the users on a line, can be computed in O(nm−λm ) time, where 0 < λm < 1, is a constant depending only on m.
1
Introduction
The main objective in any facility location problem is to judiciously place a set of facilities serving a set of users such that certain optimality criteria are satisfied. Facilities and users are generally modeled as points in the plane. The set of users (demands) is either discrete, consisting of finitely many points, or continuous, i.e., a region where every point is considered to be a user. We assume that the facilities are equally equipped in all respects, and a user always avails the service from its nearest facility. Consequently, each facility has its service zone, consisting of the set of users that are served by it. For a set U of users, finite or infinite, and a set F of facilities, define for every f ∈ F, U(f, F) as the set of users in U that are served by the facility f . Competitive facility location is concerned with the favorable placement of facilities by competing market players, and has been studied in several contexts ([8,9,12]). In such a scenario, when the users choose the facilities based on the nearest-neighbor rule, the optimization criteria is to maximize the cardinality or the area of the service zone depending on whether the demand region is discrete or continuous, respectively. For continuous demand regions, this reduces to the problem of maximizing the area of the Voronoi regions point sets. Dehne et al. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 213–224, 2011. Springer-Verlag Berlin Heidelberg 2011
214
A. Banik, B.B. Bhattacharya, and S. Das
[7] addressed the problem of finding a new point q amidst a set of n existing points F such that the Voronoi region of q is maximized, and studied the case when the points in F are in convex position. For the same problem, Cheong et al. [5] gave a near-linear time algorithm that locates the new optimal point approximately, when the points in F are in general position. A variation of this problem, involving maximization of the area of Voronoi regions of a set of points placed inside a circle, has been recently considered by Bhattacharya [2]. In the discrete user case, the analogous problem is to place a set of new facilities amidst a set of existing ones such that the number of users served by the new facilities is maximized. The problem of placing only one new facility has been addressed by Cabello et al. [4] and is referred to as the MaxCov problem. The 2-MaxCov problem, which considers the problem of placing two new facilities, has been studied by Bhattacharya and Nandy [3]. A game-theoretic analogue of the competitive problems is a situation where two players place two disjoint set of facilities in a demand region. A player p is said to own a part of the demand region that is closer to p than to the other player, and the player which finally owns the larger area is the winner of the game. The area a player owns at the end the game is called the payoff of the player. This type of Voronoi games has been studied in the literature for continuous demand regions. In the one-round game the first player places n facilities following which the second player places another n facilities in the demand region. In the n-round game the two players place one facility each alternately for n rounds in the demand region. Ahn et al. [1] studied a one-dimensional Voronoi game, where the demand region is a line segment. They showed that when the game takes n rounds, the second player always has a winning strategy that guarantees a payoff of 1/2 + ε, with ε > 0. However, the first player can force ε to be arbitrarily small. On the other hand, in the one-round game with n facilities, the first player always has a winning strategy. The one-round Voronoi game in R2 was studied by Cheong et al. [6], for a square-shaped demand region. In this case, the second player always has a winning strategy. Fekete and Meijer [10] studied the two-dimensional oneround game played on a rectangular demand region with aspect ratio ρ. However, in none of the above cases, the optimal strategy of the two players, that is, the strategy that maximizes the respective payoffs of the players is known. Similar competitive facility location problems, where the universe is modeled by a graph with weighted edges inducing distances, are also studied in the literature. Weighted nodes of the graph represent users and their demands, which are to be served by the competitive facilities. In the (r, p)-centroid problem [11], the two competitors sequentially place p and r facilities, respectively, on the edges of the given graph such that their individual payoffs are maximized. Although winning strategies for various versions of the Voronoi game have been studied, algorithms for determining the optimal strategies of the players are not known. In this paper, we initiate the study of devising algorithms for obtaining optimal strategies of the players for a Voronoi game where the users are a discrete (finite) set of points. The one-round discrete Voronoi game consists
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line
215
of a finite user set U, with |U| = n, and two players Player 1 (P1) and Player 2 (P2) each having m = O(1) facilities. At first, P1 chooses a set F1 of m facilities following which P2 chooses another set F2 of m facilities, disjoint from F1 . The objective of both the players is to maximize their respective payoffs. For any two disjoint sets F and S, with |F | = |S| = m, define U(F , S) = f ∈S U(f, F ∪ S), and ν(F ) = maxS |U(F , S)|, where the maximum is taken over all sets S, with |S| = m. With these notations, the One-Round (m, n) Discrete Voronoi Game can be formally described as follows: One-Round (m, n) Discrete Voronoi Game: Given a set U of n users and two players P1 and P2 having m facilities each, P1 chooses a set F1 of m facilities following which P2 chooses a set F2 of m facilities, disjoint from F1 , such that: (a) maxS |U(F1 , S)| is attained at S = F2 , where the maximum is taken over all sets S, with |S| = m; (b) minF ν(F ) is attained at F = F1 , where the minimum is taken over all sets F , with |F | = m. Given any placement F by P1, the quantity ν(F ) = maxS |U(F , S)| is the optimal payoff of P2. The placement F2 at which the above maximum is attained is the optimal strategy of P2, given P1 has placed the facilities at F . Similarly, minF ν(F ) is the optimal payoff of P1, and the placement F1 by P1 at which the minimum is attained is called the optimal strategy of P1. In this paper, we study the One-Round (m, n) Discrete Voronoi Game when the users in U are located along a single straight line and the two players are also restricted to place their facilities along the same straight line. Henceforth, we shall call this variant of the discrete Voronoi game as the G(m, n) game. We begin by showing that if the sorted order the users in U along the line is known, then the optimal strategy of P2, given any placement of P1, in the G(m, n) game can be found out in O(n) time. Clearly, if m = 1, the optimal strategy of P1 is to place the facility at the median of U. For m ≥ 2, we give O(nm+1 ) time algorithm for obtaining the optimal strategy of P1, which we then improve to provide a O(nm−λm ) time algorithm, where 0 < λm < 1, is a constant depending only on m.
2
Optimal Strategy of P2
In this section we give an algorithm for determining the optimal strategy for P2, given any placement by P1. Let U = {u1 , u2 , . . . , un } be a set of n users placed along a line . Assume that the sorted order of the users in U along is known. Moreover, let F = {f1 , f2 , . . . , fm } be the placement by P1 along . Consider any placement S by P2, with |S| = m. If minf ∈F |u − f | = mins∈S |u − s|, for some user u ∈ U, then we shall assume that u is served by the facility in F . In order to find the optimal strategy of P2, we need to find a set So of m points, disjoint from F , along such that |U(F , S)| is maximized at S = So , where the maximum is taken over all sets S having |S| = m. Note that we are allowed to place facilities on the users but the positions of every two different facility points must be distinct.
216
A. Banik, B.B. Bhattacharya, and S. Das
Suppose f1 < f2 < . . . < fm is the sorted order of the facilities along the line . Define f0 = −M and fm+1 = M , where M is such that U ∪ F ⊂ [−M, M ]. Note that if P2 places a facility s in the interior of the interval [fi , fi+1 ], for some i ∈ {0, 1, . . . , m}, then s can serve only those users in U which lie in the interval [fi , fi+1 ]. We now have the following observation which can be verified easily: Observation 1. For every fi ∈ F , P2 can place two new facilities s and s in interior of [fi , fi+1 ], such that U({s, s }, F ∪ {s, s }) = U ∩ (fi , fi+1 ). This observation implies that by placing two facilities in the interior of some interval Ji , P2 can serve all the users in the interior of the interval Ji = [fi , fi+1 ]. Therefore, P2 incurs no extra gain by placing more than two facilities in the interior of some interval Ji , for i ∈ {0, 1, . . . , m}. Associated with each interval Ji , we define the following two quantities: ai : This denotes the number of users in U which lie in the interior of the interval [fi , fi+1 ]. That is, ai = |U ∩(fi , fi+1 )|. Note that when P2 places two facilities in Ji optimally, P2 serves all the ai users of Ji . (Observation 1). bi : This denotes the maximum number of users P2 can serve by placing a single new facility in the interval [fi , fi+1 ]. Note that b0 = a0 and bm = am . For i ∈ {1, 2, . . . , m − 1}, bi the maximum number of users in Ji that can be covered by an open interval of length |Ji |/2. If the users in U are assumed to be sorted then this can be determined in O(ai ) time by a simple linear scan. Let A = {ai |i ∈ {0, 1, 2, . . . , m}} and B = {bi |i ∈ {0, 1, 2, . . . , m}}. For i ∈ {1, 2, . . . , m} let ci = ai − bi . Observation 2. bi ≥ ci for every i ∈ {0, 1, 2, . . . , m}. Proof. For i = 0 or i = m, c0 = cm = 0, and the result is immediate. Therefore, suppose i ∈ {1, 2, . . . , m − 1}. Note that since ai = bi + ci , to prove the above observation it suffices to show that bi ≥ ai /2. Observe that either |U ∩ (fi , fi +f2 i+1 ]| ≥ ai /2 or |U ∩ [ fi +f2 i+1 , fi+1 )| ≥ ai /2. Without loss of f +f generality assume that |U ∩ (fi , i 2 i+1 ]| ≥ ai /2. Let u be the user in [fi , fi+1 ] nearest to fi . If P2 places a facility at s = u, then the number of users served by s is clearly greater than or equal to ai /2. Now, since bi is the maximum number of users P2 can acquire from the interval [fi , fi+1 ] by placing a single facility, it follows that bi ≥ ai /2, and the result follows. Since the sorted order m of the users in U is known, the values in the set B can be obtained in O( i=1 ai ) = O(n) time. The sorted order of the facilities in F along can be found out in O(m log m), and so the values in A can also be computed in O(n) time. Therefore, the sorted order of the numbers in B ∪ C can be found in O(n) time, where C = {ci |i ∈ {0, 1, 2, . . . , m}}. Once the sorted order in B ∪ C is known, we select the largest m values from the set. Now, since bi ≥ ci for every i ∈ {0, 1, 2, . . . , m}, it can be ensured that among the largest m elements in B ∪ C, no ci is selected without selecting the corresponding bi . If for some i ∈ {0, 1, 2, . . . , m} only bi is selected, then P2
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line
217
places only one facility in the interval Ji at the point where it can serve bi users in U. If for some i ∈ {0, 1, 2, . . . , m} both bi and ci are selected, then P2 places two new facilities in the interval Ji as described in Observation 1. Clearly, the placement by P2 obtained in this way, gives the optimal strategy for P2, and we summarize this result in the following theorem: Theorem 1. The optimal placement by P2, in the G(m, n) game, given any placement by P1, can be obtained in O(n) time, when the sorted order of the users along the line is known.
3
Optimal Strategy of P1
It is easy to see that if m = 1, that is, every player places one facility, then the optimal strategy of P1 is to place the facility at the median of the set of users U, which can be obtained in O(n) time. In this section we shall prove a combinatorial result, which will be used to obtain a characterization of the optimal placement by P1. Using this characterization we shall provide an algorithm for determining the optimal placement by P1, when m ≥ 2. 3.1
An Important Lemma
Let U = {u1 , u2 , . . . , un } be the set of users sorted along the line and M ∈ be such that U ⊂ [−M, M ]. For any two points x1 , x2 ∈ denote by a([x1 , x2 ]) the total number of users in (x1 , x2 ). Also, let b([x1 , x2 ]) be the maximum number of users in (x1 , x2 ) that can be covered by an open interval of length |x2 − x1 |/2. For any fixed point x ∈ and an integer k define x(k) ∈ to be the largest value such that b([x, x(k)]) = k. Note that if a([x, M ]) < k, x(k) does not exist. If a([x, M ]) = k, then according to the definition x(k) goes to infinity. To avoid this, we define x(k) = x + 2|M − x|, whenever a([x, M ]) = k. In this subsection, we will prove that if a([x, M ]) > k, then x(k) always exists and can be obtained in O(n) time. We begin with the following simple observation: Observation 3. Let x be any point on the line and J = [ua , ua+k ] be any closed interval on , with ua > x. Consider the point y on such that y = x+2|J|. Then for all points z ≥ max{ua+k , y}, b([x, z]) ≥ k. Proof. Note that the interval J contains k + 1 users in U. This implies that there exists an ε > 0 such that the open interval J = (ua −ε, ua+k −ε) contains exactly k users in U, and ua − ε > x. Moreover, as |J | = |J| = |y − x|/2 ≤ |z − x|/2, we have b([x, z]) ≥ k. Using the above observation we now prove the following lemma, which will be very important for obtaining the optimal strategy of P1: Lemma 1. Let k be any fixed positive integer, and x1 ∈ be such that a([x1 , M ]) > k. Then there exists a point x2 ∈ such that x2 > x1 and b([x1 , x2 ]) = k. In this case, the maximum value x1 (k) ∈ such that b([x1 , x1 (k)]) = k also exists, and can be computed in O(a([x1 , x1 (k)])) = O(n) time.
218
A. Banik, B.B. Bhattacharya, and S. Das
Proof. For any i such that ui > x1 , define Ji = [uκ(i) , uκ(i)+k ], where |uκ(i)+k − uκ(i) | =
min
x1 ≤uj ≤ui uj+k ≤un
|uj+k − uj |.
Note that each Ji contains k + 1 users in U. Let di = x1 + 2|Ji |. It is easy to see that for all i such that ui−1 > x1 , we have di ≤ di−1 . Now, the following two different cases may arise: Case 1: For all ui ≥ x1 , di ≥ ui+k . This implies that dn = dn−k ≥ un and the minimum length closed interval containing k + 1 users is [uκ(n) , uκ(n)+k ]. Therefore, by Observation 3, we get x1 (k) = dn . Observe that given di−1 , the number di can be determined in constant time. Thus, x1 (k) can be determined in O(a([x, x1 (k)])) time. Case 2: There exists some j ≤ n such that dj < uj+k . Let jo be the minimum index j for which this holds. Now, as djo < ujo +k , from Observation 3, we have b([x1 , ujo +k ]) ≥ k. Let Jr = [ur , ur+k ] be the minimum length closed interval containing k + 1 users and contained in [x1 , ujo +k ). Clearly, r < jo , and this implies that djo ≤ dr . Moreover, as jo is the minimum index such that djo < ujo +k , it follows that ur+k ≤ dr . Observation 3 now implies that b([x1 , dr ]) ≥ k. We again have the following two cases: ur x1
ur+k Jr
(a)
dr
ujo+k
x1
ujo
djo
dr ujo+k
(b)
Fig. 1. Illustration for the proof of Lemma 1: (a) Case 2.1, and (b) Case 2.2
Case 2.1: dr < ujo +k (refer to Fig. 1(a)). Observation 3 implies that b([x1 , dr ]) ≥ k. Observe that for all x > dr , there exists an ε > 0 such that the open interval (ur − ε, ur+k + ε) contains k + 1 users in U, and |ur+k −ur +2ε| ≤ |x−x1 |/2. This implies that b([x1 , x]) ≥ k+1. Suppose, if possible, b([x1 , dr ]) > k. This means that there exist an open interval G ⊂ [x1 , dr ] such that |G ∩ U| ≥ k + 1 and |G| ≤ |dr − x1 |/2. Hence, there exists a closed interval H ⊂ G contained in [x1 , dr ] containing k+1 points of U , with |H| < |G| ≤ |dr − x1 |/2. This closed interval H contradicts the minimality of the interval Jr . This proves that b([x1 , dr ]) = k and b([x1 , x]) ≥ k + 1, for all x > dr , implying that in this case x1 (k) = dr . Case 2.2: dr ≥ ujo +k (refer to Fig. 1(b)). We know that b([x1 , ujo +k ]) ≥ k and b([x1 , x]) ≥ k+1, for all x > ujo +k . Suppose, if possible, b([x1 , ujo +k ]) > k. This means that there exist an open interval G ⊂ [x1 , ujo +k ) such that |G∩ U| ≥ k + 1 and |G| < |ujo +k − x1 |/2. Hence, there exists a closed interval H = [uq , uq+k ] ⊂ G ⊂ [x1 , ujo +k ) containing k + 1 points of U , with |uq+k − uq | < |G| ≤ |ujo +k − x1 |/2. This implies that dq < ujo +k < dr . This implies that |H| = |uq+k −uq | < |ur+k −ur | = |Jr |, which contradicts the minimality of the interval Jr . This proves that b([x1 , ujo +k ]) = k and b([x1 , x]) ≥ k + 1, for all x > ujo +k , implying that in this case x1 (k) = ujo +k .
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line
3.2
219
A Characterization of the Optimal Placement by P1
In this section we propose a simple characterization for the optimal placement by P1. Using this and Lemma 1, we then propose an algorithm for determining the optimal placement by P1. } by Lemma 2. There always exists an optimum placement F = {f1 , f2 , . . . , fm P1, such that f1 ∈ U, and for all i ∈ {2, 3, . . . , m} fi ∈ U or fi = fi−1 (k), for some 0 ≤ k ≤ a([fi−1 , un ]).
b([fi−1 , fi ]) = k fi−1
fi−1 (k) = fi fi
u(fi )
fi+1
b([fi−1 , fi ]) = k
Fig. 2. Illustration for the proof of Lemma 2
Proof. Note that there always exists an optimal placement F = {f1 , f2 , . . . , fm } by P1 such that [fi , fi+1 ] ∩ U = ∅. We start with any such optimal solution F . Suppose f1 ∈ (uj−1 , uj ), for some j ∈ {2, 3, . . . , n}. Then F \{f1 } ∪ {uj } is also a placement by P1 such that ν(F ) = ν(F \{f1 } ∪ {uj }). Therefore, define f1 = uj ∈ U. Let i ∈ {2, 3, . . . , m} be the smallest index i ≥ 2 such that fi ∈ F does not belong to U and not equal fi−1 (k), for all 0 ≤ k ≤ a([fi−1 , un ]). Thus, let u(fi ) be the user in the interval [fi , fi+1 ] which is closest to the facility fi . Assume that b([fi−1 , fi ]) = k. Note that since [fi , fi−1 (k)] is the maximum length such that b([fi , fi−1 (k)]) = k, it follows that fi−1 (k) > fi . Define fi be u(fi ) or fi−1 (k), depending on whichever is closer to the point fi (see Figure 2). Now, observe b([fi−1 , fi ]) = b([fi−1 , fi ]) = k and a([fi−1 , fi ]) = a([fi−1 , fi ]). Moreover, as [fi , fi+1 ] ⊂ [fi , fi+1 ] we have b([fi , fi+1 ]) ≤ b([fi , fi+1 ]) and a([fi , fi+1 ]) ≤ a([fi , fi+1 ]). From the strategy of P2 described in Section 2, it can now be easily shown that that ν(F \{fi } ∪ {fi }) ≤ ν(F ). From the optimality of F , it follows that ν(F \{fi } ∪ {fi }) = ν(F ). The lemma now follows by applying the same argument on the set F \{fi} ∪ {fi }, which is also an optimal strategy for P1. Using this fact we can devise a simple algorithm for obtaining the optimal strategy of P1. This is explained in the following theorem: Theorem 2. The optimal placement by P1 in the game G(m, n) can be obtained in O(nm+1 ) time. Proof. From Lemma 2, it can be concluded that the number of possible placements by P1 that needs to be checked for finding the optimal placement is O(nm ).
220
A. Banik, B.B. Bhattacharya, and S. Das
From Lemma 1, we know that for each such placement F = {f1 , f2 , . . . , fm }, fi (k) can be computed in a([fi , fi (k)]) time. Hence, every placement by P1 that needs to be checked can be obtained in O(n) time. Given a placement by P1, the optimal placement by P2 can be obtained in O(n) time (from Theorem 1). Therefore, the placement by P1 that minimizes the payoff of P2 can be obtained in O(nm+1 ) time.
4
Improving the Algorithm for the Optimal Strategy of P1
In this section we shall investigate into the structure of the game G(m, n) more carefully and propose an improved algorithm for obtaining the optimal strategy for P1. As before, let U = {u1 , u2 , . . . , un } be the set of users in the sorted order along the line . Let M be such that U ⊂ [−M, M ]. For any placement F = {f1 , f2 , . . . , fm } define the (m + 1) × 1 payoff vector P F as follows: ⎞ ⎛ (b([−M, f1 ]), c([−M, f1 ])) ⎟ ⎜ (b([f1 , f2 ]), c([f1 , f2 ])) ⎟ ⎜ ⎟ ⎜ , f ]), c([f , f ])) (b([f 2 3 2 3 ⎟ ⎜ PF = ⎜ ⎟, .. ⎟ ⎜ . ⎟ ⎜ ⎝ (b([fm−1 , fm ]), c([fm−1 , fm ])) ⎠ (b([fm , M ]), c([fm , M ])), that is, the i-th element of the payoff vector for 2 ≤ i ≤ m is (b([fi−1 , fi ]), c([fi−1 , fi ])), and the first and the last element of P F is (b([−M, f1 ]), c([−M, f1 ])) and (b([fm , M ]), c([fm , M ])), respectively. We denote the transpose of a vector P by P . By a (m + 1) × 1 vector of ordered pairs we mean a vector P = ((b1 , c1 ), (b2 , c2 ), . . . , (bm+1 , cm+1 )) = ((bi , ci ))1≤i≤m+1 , m+1 where bi , ci are non-negative integers with i=1 bi + ci = O(n). With this notation, we have the following definition: Definition 1. An (m + 1) × 1 vector of order pairs P = ((bi , ci ))1≤i≤m+1 , is said to be feasible if there exists a placement F = {f1 , f2 , . . . , fm } of facilities on the line such that (i) b1 ≥ b([−M, f1 ]), bm+1 ≥ b([fm , M ]), and bi ≥ b([fi−1 , fi ]), for 2 ≤ i ≤ m − 1, (ii) b1 + c1 ≥ a([−M, f1 ]), bm+1 + cm+1 ≥ a([fm , M ]), and bi + ci ≥ a([fi−1 , fi ]), for 2 ≤ i ≤ m − 1. The placement F of facilities on the line is said to satisfy the vector P . A vector of ordered pairs is said to be infeasible if it is not feasible. Interpreting this in terms of the game, a vector P = ((bi , ci ))1≤i≤m+1 is feasible if there exist a placement F = {f1 , f2 , . . . , fm } by P1 such that P2 can serve at most bi users in [fi−1 , fi ] by placing one facility, and can serve at most bi + ci users by placing two facilities in the interval [fi−1 , fi ].
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line
221
The following observation is now immediate from the definition: Observation 4. If the vector P = ((bi , ci ))1≤i≤m+1 is infeasible then the vector Q = ((βi , γi ))1≤i≤m+1 is also infeasible, whenever βi ≤ bi and γi ≤ ci for all 1 ≤ i ≤ m+1. Lemma 3. The feasibility of any vector of ordered pairs P = ((bi , ci ))1≤i≤m+1 can be determined in O(n) time. Moreover, if P is feasible, then a placement F = {f1 , f2 , . . . , fm } of facilities on the line that satisfies P can also be obtained in O(n) time. Proof. Define f1 = ub1 +1 . For any i ≥ 2, define fi ∈ U to be such that a([fi−1 , fi ]) = bi + ci , and fi = fi−1 (bi ). For all 2 ≤ i ≤ m + 1 define fi to be fi−1 or fi−1 depending on whichever is closer to fi−1 . If for some 1 ≤ i ≤ m + 1, fi is not well defined, then we define fi = M . Denote F = {f1 , f2 , . . . fm }. Given fi−1 it takes constant time to determine fi . From Lemma 1 we know that it is possible to find fi = fi−1 (bi ) in O(a([fi−1 , fi ])) time. Therefore, the set F can m be constructed in O( m a([f , f ])) = O( i−1 i i=2 i=2 bi ) = O(n) time. Note that if a([fm , M ]) ≤ bm + cm , then by the construction F satisfies P and it is feasible. Next, we claim that if a([fm , M ]) > bm + cm , then P is infeasible. If possible, suppose P is feasible and assume F˜ = {f˜1 , f˜2 , . . . f˜m } satisfies P . This implies that a([f˜m , M ]) ≤ bm + cm . Hence, |M − f˜m | < |M − fm |. This implies that f˜m > fm . Let j be the smallest index such that f˜j > fj . Note that f˜1 ≤ f1 = ub1 +1 . Define f0 = f˜0 = −M and fm+1 = f˜m+1 = M . Then f˜j−1 ≤ fj−1 , which implies ∈U that [fj−1 , fj ] ⊂ [f˜j−1 , f˜j ]. Now we know that fj is either of the form fj−1 = fj−1 (bj ). We consider these two cases separately: or of the form fj−1 Case 1: fj = fj−1 ∈ U . Then as f˜j > fj−1 ∈ U , bj + cj = a([fj−1 , fj−1 ]) < a([f˜j−1 , f˜j ]), F˜ does not satisfy P . Case 2: fj = fj−1 = fj−1 (bj ). Then from f˜j > fj−1 , fj−1 ≤ f˜j−1 , and the max imality of fj−1 (bj ), we get bj ≤ b([fj−1 , fj−1 ]) < b([fj−1 , f˜j ]) ≤ b([f˜j−1 , f˜j ]). Hence F˜ does not satisfy P .
Hence, we have proved that in linear time it is possible to determine whether a vector of order pairs P is feasible or not. Let F = {f1 , f2 , . . . , fm } be any placement by P1. As before, let P F be the payoff vector and define multisets BF = {b([−M, f1 ]), b([f1 , f2 ]), . . . , b([fm , M ])}, and CF = {c([−M, f1 ]), c([f1 , f2 ]), . . . , c([fm , M ])}. Clearly, F satisfies P F and so P F is feasible. Define ν1 (F ), ν2 (F ), . . . , νm (F ) as follows: ν1 (F ) = max{BF ∪ CF } ν2 (F ) = max{(BF ∪ CF )\{ν1 (F )}} .. . νm (F ) = max{(BF ∪ CF )\{ν1 (F ), ν2 (F ), . . . , νm−1 (F )}}
(1)
Let R F be the vector of ordered pairs obtained from P F by replacing all elements of (BF ∪CF )\{ν1 (F ), ν2 (F ), . . . , νm−1 (F ), νm (F )} by the element νm (F ).
222
A. Banik, B.B. Bhattacharya, and S. Das
Then by the definition of feasibility, R F is feasible. Moreover, if F satisfies RF , m then the optimal payoff of P2 given P1 has placed at F is ν(F ) ≤ i=1 νi (F ). For non-negative integers i1 ≥ i2 ≥ . . . ≥ im , let A(i1 , i2 , . . . , im ) be the multiset of 2m + 2 elements where each ik is repeated once, for 1 ≤ k ≤ m − 1, and im is repeated m + 3 times. Define S(i1 , i2 , . . . , im ) to be the class of submultisets of A(i1 , i2 , . . . , im )×A(i1 , i2 , . . . , im ) of cardinality m+1. Every element of S(i1 , i2 , . . . , im ) being a multiset of order m + 1 can be considered as an (m + 1) × 1 vector of ordered pairs. For every such vector P ∈ S(i1 , i2 , . . . , im ), P ) as the collection of all (m + 1) × 1 vectors of ordered pairs denote by π(P P ), where obtained by permuting the rows of P . Define M(i1 , i2 , . . . , im ) = π(P the union is taken over all P ∈ S(i1 , i2 , . . . , im ). We say that the class M(i1 , i2 , . . . , im ) is feasible if there exists some vector in M(i1 , i2 , . . . , im ) which is feasible. The class M(i1 , i2 , . . . , im ) is said to be infeasible if none of the vectors in the class M(i1 , i2 , . . . , im ) is feasible. The weight of the class M(i1 , i2 , . . . , im ) is defined m k=1 ik . Observe, if P ∈ M(i1 , i2 , . . . , im ) P is feasible and F satisfies , then the payoff of P2, when P1 places at F , is m ν(F ) ≤ k=1 ik . For every placement F by P1, there exists a vector P ∈ M(ν1 (F ), ν2 (F ), . . . , νm (F )) such that P is feasible. Therefore, by Observation 4 if for given nonnegative integers ν1 ≥ ν2 ≥ . . . ≥ νm , M(ν1 , ν2 , . . . , νm ) is infeasible, then there cannot exist any placement F by P1 with νi = νi (F ), for all 1 ≤ i ≤ m. With these observations, we now have the following lemma: Lemma 4. Suppose M(i1 , i2 , . . . , im ) is the minimum weight feasible class. If P ∈ M(i1 , i2 , . . . , ik ) is feasible and F satisfies P , then F is an optimal placement by P1. Proof. If possible, suppose F is not moptimal. Then there exits some other placement F by P1, with ν(F ) = i=1 νi (F ) < ν(F ). Then from the discussions preceding the lemma, the class M(ν1 (F ), ν2 (F ), . . . , νm (F )) is feasible. This contradicts the minimality of the weight of the class M(i1 , i2 , . . . , im ), as m m ν (F ) = ν(F ) < ν(F ) ≤ i=1 i k=1 ik . Note that as the number of elements in any class M(i1 , i2 , . . . , im ), depends only on m, from Lemma 3 we can determine whether a class M(i1 , i2 , . . . , im ) is feasible or not in O(n) time. Therefore, to obtain the optimal placement by P1, it suffices to find the minimum feasible class M(i1 , i2 , . . . , im ). Using the results developed in this section, we now propose a technique for finding the minimum feasible class. We begin by studying the case where the players place two facilities each, that is, m = 2. We then extend this to the general case where the two players each place m facilities simultaneously. 4.1
m=2
Construct the n × n symmetric matrix A = ((aij )) as follows:
i + j if the class M(i, j) is feasible aij = ∞ otherwise
Optimal Strategies for the One-Round Discrete Voronoi Game on a Line
223
Suppose n = 2p is even. Then it is possible to partition A into 4 sub-matrices A 1 , A 2 , A 3 , A 4 each of which are of order p × p as follows: A1 A2 A= A3 A4 We say that the element aij is feasible if the class M(i, j) is feasible. Now, our objective is to find the minimum feasible element in the matrix A . We have the following two cases depending upon whether the app is feasible or not: Case 1: app is feasible. In this case, any feasible element aij of A 4 has more weight than the weight of app . Therefore, we report the weight of class M(p, p), discard the submatrix A 4 . Case 2: app is infeasible. Then any element aij of A 1 will be not be feasible (follows from Observation 4). Therefore, the submatrix A 1 can be discarded. In both of the above two cases, one of the 4 submatrices can be discarded. Applying this technique to the remaining 3 of the 4 submatrices and proceeding recursively, we can find the minimum weight feasible class. The same technique can be applied to the case when n = 2p + 1 is odd. Let T (n) denote the time complexity of determining the minimum weight feasible class in the n × n matrix A . As it takes O(n) time to determine whether a class M(i, j) is feasible or not, the time T (n), required to obtain the minimum weight feasible class, satisfies the following recurrence equation: T (n) = 3T (n/2 ) + O(n). This solves to T (n) = O(n1.59 ), and we have the following theorem: Theorem 3. The optimal placement by P1, in the game G(2, n) can be obtained in O(n1.59 ) time. 4.2
Extending to the General Case
The arguments described in the previous subsection can be extended to the general case, where each player places m facilities. We construct the m-dimensional n × n × . . . × n symmetric matrix A = ((ai1 i2 ...im )) as follows:
m i=1 ik if the class M(i1 , i2 , . . . , im ) is feasible ai1 i2 ...im = ∞ otherwise As before, we can subdivide A into 2m submatrices, and depending upon whether the class M(n/2 , n/2 , . . . , n/2 ) is feasible or not, one of these submatrices can be discarded at each stage. Let T (n) denote the time complexity of determining the minimum weight feasible class in the matrix A. As it takes O(n) time to determine whether a class M(i1 , i2 , . . . , im ) is feasible or not, T (n) satisfies the following recurrence equation: T (n) = (2m − 1)T (n/2 ) + O(n). This solves to T (n) = O(nm−λm ), where λm = m − log2 (2m − 1) ∈ (0, 1) is a constant that depends only on m. Hence, we have the following theorem: Theorem 4. The optimal placement by P1, in the G(m, n) game, with m ≥ 2, can be obtained in O(nm−λm ) time, where 0 < λm < 1, is a constant depending only on m.
224
5
A. Banik, B.B. Bhattacharya, and S. Das
Conclusions
In this paper, we have initiated the study of optimal strategies for the one-round discrete Voronoi game, when the users are restricted to lie on a line. Analogous to the continuous demand case, there are several other problems that arise in the context of discrete Voronoi games. Determining the optimal strategies in the n-round discrete Voronoi game is an open problem. This appears to be quite difficult, even when the users are assumed to be located on a line. Considering the generalizations of both the one-round and the n-round discrete games in R2 is also an interesting area to study.
References 1. Ahn, H.-K., Cheng, S.-W., Cheong, O., Golin, M., van Oostrum, R.: Competitive facility location: the Voronoi game. Theor. Comput. Sci. 310, 457–467 (2004) 2. Bhattacharya, B.B.: Maximizing Voronoi regions of a set of points enclosed in a circle with applications to facility location. J. Math. Model. Algor. 9(4), 375–392 (2010) 3. Bhattacharya, B.B., Nandy, S.C.: New variations of the reverse facility location problem. In: Proc. 22nd Canadian Conference on Computational Geometry, pp. 241–244 (2010) 4. Cabello, S., Miguel Di´ az-B´ an ˜ez, J., Langerman, S., Seara, C., Ventura, I.: Facility location problems in the plane based on reverse nearest neighbor queries. Eur. J. Operations Research 202(1), 99–106 (2010) 5. Cheong, O., Efrat, A., Har-Peled, S.: On finding a guard that sees most and a shop that sells most. Discrete Computational Geometry 37, 545–563 (2007) 6. Cheong, O., Har-Peled, S., Linial, N., Matouˆsek, J.: The one-round Voronoi game. Discrete and Computational Geometry 31(1), 125–138 (2004) 7. Dehne, F., Klein, R., Seidel, R.: Maximizing a Voronoi region: the convex case. Int. Journal of Computational Geometry and Applications 15, 463–475 (2005) 8. Eiselt, H.A., Laporte, G.: Competitive spatial models. Eur. J. Operations Research 39, 231–242 (1989) 9. Eiselt, H.A., Laporte, G., Thisse, J.F.: Competitive location models: A framework and bibliography. Transportation Science 27, 44–54 (1993) 10. Fekete, S.P., Meijer, H.: The one-round Voronoi game replayed. Comput. Geom. Theory Appl. 30(2), 81–94 (2005) 11. Spoerhase, J., Wirth, H.-C.: (r, p)-centroid problems on paths and trees. Theor. Comput. Sci. 410(47-49), 5128–5137 (2009) 12. Tobin, R., Friesz, T., Miller, T.: Existence theory for spatially competitive network facility location models. Annals of Operations Research 18, 267–276 (1989)
Computing the Girth of a Planar Graph in Linear Time Hsien-Chih Chang and Hsueh-I Lu Department of Computer Science and Information Engineering, National Taiwan University [email protected], [email protected] www.csie.ntu.edu.tw/~ hil
Abstract. The girth of a graph is the minimum weight of all simple cycles of the graph. We study the problem of determining the girth of an n-node unweighted undirected planar graph. The first non-trivial algorithm for the problem, given by Djidjev, runs in O(n5/4 log n) time. Chalermsook, Fakcharoenphol, and Nanongkai reduced the running time to O(n log2 n). Weimann and Yuster further reduced the running time to O(n log n). In this paper, we solve the problem in O(n) time.
1
Introduction
Let G be an edge-weighted simple graph, i.e., G does not contain multiple edges and self-loops. We say that G is unweighted if the weight of each edge of G is one. A cycle of G is simple if each node and each edge of G is traversed at most once in the cycle. The girth of G, denoted girth(G), is the minimum weight of all simple cycles of G. For instance, the girth of each graph in Figure 1 is four. As shown by, e.g., Bollob´ as [4], Cook [10], Chandran and Subramanian [8], Diestel [12], Erd˝ os [16], and Lov´asz [27], girth is a fundamental combinatorial characteristic of graphs related to many other graph properties, including degree, diameter, connectivity, treewidth, and maximum genus. We address the problem of computing the girth of an n-node graph. Itai and Rodeh [20] gave the best known algorithm for the problem, running in time O(M (n) log n), where M (n) is the time for multiplying two n × n matrices [11]. In the present paper, we focus on the case that the input graph is undirected, unweighted, and planar. Djidjev [13] gave the first non-trivial algorithm for the case, running in O(n5/4 log n) time. The min-cut algorithm of Chalermsook, Fakcharoenphol, and Nanongkai [7] reduced the time complexity to O(n log2 n), using the max-flow algorithms of, e.g., Gorradaile and Klein [5] or Erickson [17]. Weimann and Yuster [33] further reduced the running time to O(n log n). Linear-time algorithms for an undirected
See [9] for a full version of this extended abstract. Corresponding author. This author also holds joint appointments in the Graduate Institute of Networking and Multimedia and the Graduate Institute of Biomedical Electronics and Bioinformatics, National Taiwan University. Address: 1 Roosevelt Road, Section 4, Taipei 106, Taiwan, ROC. Research supported in part by NSC grant 98-2221-E-002-079-MY3.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 225–236, 2011. c Springer-Verlag Berlin Heidelberg 2011
226
H.-C. Chang and H.-I. Lu 2
2 0
1 1 1
1 2
2
1 2
2 1
2
(a)
2
(b)
(c)
Fig. 1. (a) A planar graph G with nonnegative integral edge weights. (b) The expanded version expand(G) of G. (c) A contracted graph G with expand(G ) = expand(G).
unweighted planar graph were known only when the girth of the input graph is bounded by a constant, as shown by Itai and Rodeh [20], Vazirani and Yannakakis [32], and Eppstein [15]. We give the first optimal algorithm for any undirected unweighted planar graph. Theorem 1.1. The girth of an n-node undirected unweighted planar graph is computable in O(n) time. Related work. The O(M (n) log n)-time algorithm of Itai and Rodeh [20] also works for directed graphs. The best known algorithm for directed planar graphs, due to Weimann and Yuster [33], runs in O(n3/2 ) time. The O(n log2 n)-time algorithm of Chalermsook et al. [7] also works for undirected planar graphs with nonnegative weights. The recent max-flow algorithm of Italiano, Nussbaum, Sankowski, and Wulff-Nilsen [21] improved the running time of Chalermsook et al. to O(n log n log log n). See, e.g., [1, 2, 14, 19, 21–23, 25, 28, 30, 34] for work related to girths and min-weight cycles in the literature. Overview. To compute girth(G0 ) for the input n-node planar graph G0 , we turn G0 into an m-node “contracted” (see §2.1) graph G with positive integral edge weights such that m ≤ n and girth(G ) = girth(G0 ), as done by Weimann and Yuster [33]. If the “density” (see §2.1) of G is Ω(log2 m), we can afford to use the algorithm of Chalermsook et al. [7] (see Lemma 2.1) to compute girth(G ). Otherwise, by girth(G ) = O(log2 m), as proved by Weimann and Yuster (see Lemma 2.2), and the fact G has positive integral weights, we can further transform G to a Θ(m)-node O(log2 m)-outerplane graph G with O(1) degree, O(log2 m) density, and O(log2 m) maximum weight such that girth(G) = girth(G ). The way we reduce the “outerplane radius” (see §2.2) is similar to those of Djidjev [13] and Weimann and Yuster [33]. In order not to increase the outerplane radius, our degree-reduction operation (see §2.2) is different from that of Djidjev [13]. Although G may have zero-weight edges and may no longer be contracted, it does not affect the correctness of the following approach for computing girth(G). A cycle of a graph is non-degenerate if some edge of the graph is traversed exactly once in the cycle. Let u and v be two distinct nodes of G. Let g(u, v) be the minimum weight of any simple cycle of G that contains u and v. Let d(u, v) be the distance of u and v in G. For any edge e of G, let d(u, v; e) be
Computing the Girth of a Planar Graph in Linear Time
227
the distance of u and v in G \ {e}. If e(u, v) is an edge of some min-weight path between u and v in G, then d(u, v) + d(u, v; e(u, v)) is the minimum weight of any non-degenerate cycle containing u and v that traverses e(u, v) exactly once. In general, d(u, v) + d(u, v; e(u, v)) could be less than g(u, v). However, if u and v belong to a min-weight simple cycle of G, then d(u, v) + d(u, v; e(u, v)) = g(u, v) = girth(G). Computing the minimum d(u, v)+d(u, v; e(u, v)) over all pairs of nodes u and v in G is too expensive. However, computing d(u, v)+d(u, v; e(u, v)) for all pairs of nodes u and v in a small node set S of G leads to a divide-and-conquer procedure for computing girth(G). Specifically, since G is an O(log2 m)-outerplane graph, there is an O(log2 m)-node set S of G partitioning V (G) \ S into two nonadjacent sets V1 and V2 with roughly equal sizes. Let C be a min-weight simple cycle of G. Let G1 (respectively, G2 ) be the subgraph of G induced by V1 ∪ S (respectively, V2 ∪ S). If V (C) ∩ S has at most one node, the weight of C is the minimum of girth(G1 ) and girth(G2 ). Otherwise, the weight of C is the minimum d(u, v) + d(u, v; e(u, v)) over all O(log4 m) pairs of nodes u and v in S. Edges e(u, v) and distances d(u, v) and d(u, v; e(u, v)) in G can be obtained via dynamic programming from edges e(u, v) and distances d(u, v) and d(u, v; e(u, v)) in G1 and G2 for any two nodes u and v in an O(log3 m)-node superset “Border (S)” (see §4) of S. The above recursive procedure (see Lemma 5.3) is executed for two levels. The first level (in the proofs of Lemmas 3.1 and 5.3) reduces the girth problem of G to girth and distance problems of graphs with O(log30 m) nodes. The second level (in the proofs of Lemmas 5.5 and 6.1) further reduces the problems to girth and distance problems of graphs with O((log log m)30 ) nodes, each of whose solutions can thus be obtained directly from an O(m)time pre-computable data structure (see Lemma 5.4). Just like Djidjev [13] and Chalermsook et al. [7], we rely on dynamic data structures for planar graphs. Specifically, we use the dynamic data structure of Klein [24] (see Lemma 5.2) that supports point-to-point distance queries. We also use Goodrich’s decomposition tree [18] (see Lemma 4.2), which is based on the link-cut tree of Sleator and Tarjan [31]. The interplay among the densities, outerplane radii, and maximum weights of subgraphs of G is crucial to our analysis. Although it seems unlikely to complete these two levels of reductions in O(m) time, we can fortunately bound the overall time complexity by O(n). The rest of the paper is organized as follows. Section 2 gives the preliminaries and reduces the girth problem on a general planar graph to the girth problem on a graph with O(1) degree and poly-logarithmic maximum weight, outerplane radius, and density. Section 3 gives the framework of our algorithm, which consists of three tasks. Section 4 shows Task 1. Section 5 shows Task 2. Section 6 shows Task 3. Section 7 concludes the paper.
2
Preliminaries
All logarithms throughout the paper are to the base of two. Unless clearly specified otherwise, all graphs are undirected simple planar graphs with nonnegative integral edge weights. Let |S| denote the cardinality of set S. Let V (G)
228
H.-C. Chang and H.-I. Lu
consist of the nodes of graph G. Let E(G) consist of the edges of graph G. Let |G| = |V (G)| + |E(G)|. By planarity of G, we have |G| = Θ(|V (G)|). Let wmax (G) denote the maximum edge weight of G. For instance, if G is as shown in Figures 1(a) and 1(b), then wmax (G) = 2 and wmax (G) = 1, respectively. Let w(G) denote the sum of edge weights of graph G. Therefore, girth(G) is the minimum w(C) over all simple cycles C of G. Lemma 2.1 (Chalermsook et al. [7]). If G is an m-node planar graph with nonnegative weights, then it takes O(m log2 m) time to compute girth(G). 2.1
Expanded Version, Density, and Contracted Graph
The expanded version of graph G, denoted expand(G), is the unweighted graph obtained from G by the following operations: (1) For each edge (u, v) with positive weight k, we replace edge (u, v) by an unweighted path (u, u1 , . . . , uk−1 , v); and (2) for each edge (u, v) with zero weight, we delete edge (u, v) and merge u and v into a new node. For instance, the graph in Figure 1(b) is the expanded version of the graphs in Figures 1(a) and 1(c). One can verify that the expanded version of G has w(G) − |E(G)| + |V (G)| nodes. Define the density of G to be density(G) = |V (expand(G))|/|V (G)|. For instance, the densities of the graphs in Figures 1(a) and 1(c) are 32 and 95 , respectively. A graph is contracted if the two neighbors of any degree-two node of the graph are adjacent in the graph. For instance, the graphs in Figures 1(a) and 1(b) are not contracted and the graph in Figure 1(c) is contracted. Lemma 2.2 (Weimann and Yuster [33, Lemma 3.3]) 1. Let G0 be an n-node unweighted biconnected planar graph. It takes O(n) time to compute an m-node biconnected contracted planar graph G with positive integral weights such that G0 = expand(G) and m ≤ n. 2. If G is a biconnected contracted planar graph with positive integral weights, then girth(G) ≤ 36 · density(G). 2.2
Outerplane Radius and Degree Reduction
A plane graph is a planar graph equipped with a planar embedding. The outerplane depth of a node v in a plane graph G, denoted depth G (v), is the positive integer such that v becomes external after peeling depth G (v) − 1 levels of external nodes from G. The outerplane radius of G, denoted radius(G), is the maximum outerplane depth of any node in G. A plane graph G is r-outerplane if radius(G) ≤ r. Let v be a node of plane graph G with degree d ≥ 4. Let u1 be a neighbor of v in G. For each i = 2, 3, . . . , d, let ui be the i-th neighbor of v in G starting from u1 in clockwise order around v. Let reduce(G, v, u1 ) be the plane graph obtained from G by the following steps: (1) adding a zero-weight path (v1 , v2 , . . . , vd ), (2) replacing each edge (ui , v) by edge (ui , vi ) with w(ui , vi ) = w(ui , v), and (3) deleting node v.
Computing the Girth of a Planar Graph in Linear Time
2.3
229
Proving the Theorem by the Main Lemma
To prove Theorem 1.1, it suffices to ensure the following lemma. Lemma 2.3. If G is an O(1)-degree plane graph satisfying the equation wmax (G) + radius (G) = O(density (G)) = O(log2 |G|),
(1)
then girth(G) can be computed from G in O(|G| + |expand(G)|) time. Proof (of Theorem 1.1, sketch). Assume without loss of generality that the input n-node graph G0 is biconnected. Let G be an m-node biconnected contracted planar graph with expand(G) = G0 and m ≤ n that can be computed from G0 in O(n) time, as ensured by Lemma 2.2(1). If n > m log2 m, by Lemma 2.1, it takes O(m log2 m) = O(n) time to compute girth(G). The theorem is proved. The rest of the proof assumes m ≤ n ≤ m log2 m. We first equip the m-node graph G with a planar embedding, which is obtainable in O(m) time (see, e.g., [6]). Initially, we have |V (expand(G))| = n, n |V (G)| = m, and density(G) = m = O(log2 m). We update G in three O(m + n)-time stages. We also maintain |V (G)| = Θ(m), |V (expand(G))| = Θ(n), girth(G) = girth(G0 ), and the planarity of G. Stage 1: Bounding the maximum weight of G. We repeatedly replace the weight of each edge e with w(e) > 36 · density(G) down to 36 · density(G). Lemma 2.2(2) ensures girth(G) ≤ 36 · density(G) throughout the stage. Stage 2: Bounding the outerplane radius of G. For each positive integer j, let Vj consist of the nodes with outerplane depths j in G. For each integer i ≥ 0, let Gi be the plane subgraph of G induced by the union of Vj with 36 · i · density(G) < j ≤ 36 · (i + 2) · density(G). Let G be the plane graph formed by the disjoint union of all the plane subgraphs Gi such that the external nodes of each Gi remain external in G . By Lemma 2.2(2), we have girth(G ) = girth(G). Stage 3: Bounding the degree of G. For each node v of G with degree four or more, we find a neighbor u of v in G whose outerplane depth in G is minimized, and then replace G by reduce(G, v, u). At the end of the third stage, G may contain zero-weight edges and may no longer be biconnected and contracted. However, the resulting G is of degree at most three, has nonnegative weights, and satisfies Equation (1). The theorem then follows from Lemma 2.3. The rest of the paper proves Lemma 2.3.
3
Dissection Tree, Nonleaf Problem, and Leaf Problem
This section shows the framework of our proof for Lemma 2.3. Let G[S] denote the subgraph of G induced by node set S. Let T be a rooted binary tree such that each member of V (T ) is a subset of V (G). To avoid confusion, we use “nodes” to specify the members of V (G) and “vertices” to specify the members of V (T ). Let Root(T ) denote the root vertex of T . Let Leaf (T ) consist of the
230
H.-C. Chang and H.-I. Lu 2
4 2
3 1
2 2
1
1 10 2
2
8 2
7 1
6 2
5
(a)
10 1 2
12
2
7
2
2
S
11
3 5
1
10
7
9
8
1
2
5
5
6
10
7
10
9
(b)
2
7
3
7
4
7
10 11
10
12 2
11 1
2
2
8
1
2
8
1
L
10 2
2
4
10
10
8
12
(c)
Fig. 2. (a) A weighted plane graph G. (b) A dissection tree T of G with S = {7, 8} and Border (S) = {2, 7, 8, 10}. (c) Graph G[Below (S)].
leaf vertices of T . Let Nonleaf (T ) consist of the nonleaf vertices of T . For each vertex S of T , let Below (S) denote the union of the vertices in the subtree of T rooted at S. Therefore, if S is a leaf vertex of T , then Below (S) = S. Also, Below (Root (T )) consists of the nodes of G that belong to some vertex of T . For each nonleaf vertex S of T , let Lchild (S) and Rchild (S) denote the two children of S in T . Therefore, if S is a nonleaf vertex of T , then Below (S) = S ∪ Below (Lchild (S)) ∪ Below (Rchild (S)). Node set S dissects node sets V1 and V2 in G if any node in V1 \ S and any node in V2 \ S are not adjacent in G. We say that T is a dissection tree of G if the following properties hold. • Property 1: Below (Root (T )) = V (G). • Property 2: The following statements hold for each nonleaf vertex S of T . (a) S ⊆ Below (Lchild (S)) ∩ Below (Rchild (S)). (b) S dissects Below (Lchild (S)) and Below (Rchild (S)) in G. For instance, Figure 2(b) is a dissection tree of the graph in Figure 2(a). For any subset S of V (G), any two distinct nodes u and v of S, and any edge e of G, let dS (u, v; e) denote the distance of u and v in G[Below (S)] \ {e} and let dS (u, v) denote the distance of u and v in G[Below (S)]. Observe that if eS (u, v) is an edge in some min-weight path between u and v in G[Below (S)], then dS (u, v) + dS (u, v; eS (u, v)) is the minimum weight of any non-degenerate cycle in G[Below (S)] containing u and v that traverses eS (u, v) exactly once. For instance, let G and T be shown in Figures 2(a) and 2(b). If S = {7, 8}, then G[Below (S)] is as shown in Figure 2(c). We have dS (7, 10; (7, 8)) = 10 and dS (7, 10) = 7. Since (7, 8) is an edge in a min-weight path (7, 8, 12, 11, 10) between nodes 7 and 10, the minimum weight of any non-degenerate cycle in G[Below (S)] containing nodes 7 and 10 that traverses (7, 8) exactly once is 17. Definition 3.1. For any dissection tree T of graph G, the nonleaf problem of (G, T ) is to compute the following information for each nonleaf vertex S of T
Computing the Girth of a Planar Graph in Linear Time
231
and each pair of distinct nodes u and v of S: (1) an edge eS (u, v) in a minweight path between u and v in G[Below (S)] and (2) distances dS (u, v) and dS (u, v; eS (u, v)). Definition 3.2. For any dissection tree T of graph G, the leaf problem of (G, T ) is to compute the minimum girth(G[L]) over all leaf vertices L of T . Define squares(T ) = S∈Nonleaf (T ) |S|2 . Our proof for Lemma 2.3 consists of the following three tasks. • Task 1. Computing a dissection tree T of G with squares(T ) = O(|G|). • Task 2. Solving the nonleaf problem of (G, T ). • Task 3. Solving the leaf problem of (G, T ). The following lemma ensures that, to prove Lemma 2.3, it suffices to complete all three tasks in O(|G| + |expand(G)|) time for any O(1)-degree plane graph G satisfying Equation (1). Lemma 3.1. Given a dissection tree T of graph G and solutions to the leaf and nonleaf problems of (G, T ), it takes O(squares(T )) time to compute girth(G).
4
Task 1: Computing a Dissection Tree
Let T be a dissection tree of graph G. For each vertex S of T , let Above(S) be the union of the ancestors of S in T and let Inherit (S) = Above(S)∩Below (S). If S is a leaf vertex of T , then let Border (S) = Inherit (S). If S is a nonleaf vertex of T , then let Border (S) = S ∪ Inherit (S). For instance, let T be as shown in Figure 2(b). Let S = Rchild (Root (T )). We have Above(S) = Inherit (S) = {2, 7, 10} and Border (S) = {2, 7, 8, 10}. Let L = Lchild (S). We have Above(L) = {2, 7, 8, 10} and Inherit (L) = Border (L) = {2, 7, 8}. Define (m) = log30 m. For any positive integer r, a dissection tree T of an m-node graph G is an r-dissection tree of G if the following conditions hold. m mr • Condition 1: |V (T )| = O( (m) ) and L∈Leaf (T ) |Border (L)| = O( (m) ). • Condition 2: For any leaf vertex L of T , |L| = Θ((m)) and |Border (L)| = O(r log m). • Condition 3: For any nonleaf vertex S of T , |S| + |Border (S)| = O(r log m). For any r-outerplane G, it takes O(m) time to compute an O(r)-node set S of G such that the node subsets V1 and V2 of G dissected by S satisfy |V1 |/|V2 | = Θ(1) (see, e.g., [3, 29]). By recursively applying this linear-time procedure, an rdissection tree can be obtained in O(m log m) time, which is too expensive for our algorithm. Instead, based upon Goodrich’s O(m)-time separator decomposition [18], we prove the following lemma. Lemma 4.1. Let G be an m-node r-outerplane O(1)-degree graph with r = O(log2 m). It takes O(m) time to compute an r-dissection tree of G.
232
H.-C. Chang and H.-I. Lu
Let T be a rooted binary tree such that each vertex of T is a subset of V (G). We say that T is a decomposition tree of G if Properties 1 and 2b hold for T . For any m-node triangulated plane graph Δ and for any positive integer ≤ m, Goodrich [18] showed that it takes O(m) time to compute an O(m/)vertex O(log m)-height decomposition tree T of Δ such that |L| = Θ() holds for each leaf vertex L of T and |S| = O(|Below (S)|0.5 ) holds for nonleaf vertex S of T . As a matter of fact, Goodrich’s techniques directly imply that if an O(r)-diameter spanning tree of Δ is given, then a decomposition tree T of Δ satisfying the following conditions can also be obtained efficiently. • • • •
Condition Condition Condition Condition
1’: 2’: 3’: 4’:
|V (T )| = O(m/(m)). For any leaf vertex L of T , |L| = Θ((m)) and |Border (L)| = 0. For any nonleaf vertex S of T , |S| = |Border (S)| = O(r). The height of T is O(log m).
Specifically, Goodrich [18, §2.4] showed that, with O(m)-time pre-computed dynamic data structures for the given O(r)-diameter spanning tree and Δ, it takes O(r logO(1) m) time to find a fundamental cycle C of Δ with respect to the given spanning tree such that the maximum number of nodes either inside or outside C is minimized. Since the diameter of the given spanning tree is O(r), we have |C| = O(r). Let V1 (respectively, V2 ) consist of the nodes of Δ inside (respectively, outside) C. We have |V1 |/|V2 | = Θ(1), as shown by Lipton and Tarjan [26]. With the pre-computed data structures, it also takes O(r logO(1) m) time to (1) split Δ into Δ[V1 ] and Δ[V2 ] and (2) split the given O(r)-diameter spanning tree of Δ into an O(r)-diameter spanning tree of Δ[V1 ] and an O(r)diameter spanning tree of Δ[V2 ]. Let T be obtained by recursively computing O(r)-node sets Lchild (S) and Rchild (S) of Δ[V1 ] and Δ[V2 ] until |S| ≤ (m). As long as r = O(m1− ) holds for some constant > 0, the overall running time is O(m). One can verify that the resulting tree T indeed satisfies Properties 1 and 2b and Conditions 1’, 2’, 3’, and 4’, as summarized in the following lemma. Lemma 4.2 (Goodrich [18]). Given an O(r)-diameter spanning tree of an m-node simple triangulated plane graph Δ with r = O(log2 m), it takes O(m) time to compute a decomposition tree T of Δ that satisfies Properties 1 and 2b and Conditions 1’, 2’, 3’, and 4’. Proof (of Lemma 4.1, sketch). It takes O(m) time to triangulate the m-node r-outerplane graph G into an m-node simple triangulated plane graph Δ that admits a spanning tree with diameter O(r). Let T be a decomposition tree of Δ as ensured by Lemma 4.2. We prove the lemma by showing that T can be modified in O(m) time into an r-dissection tree T of G by calling descend(Root(T )), where the recursive procedure descend(S) is defined as follows. If S is a leaf vertex of T , then we return. If S is a nonleaf vertex of T , we first (1) run the following steps for each node u of the current S, and then (2) recursively call descend(Lchild (S)) and descend(Rchild (S)). Step 1. If u is not adjacent to any node in the current Below (Lchild (S)) in G, then we delete u from S and insert u into the current Rchild (S).
Computing the Girth of a Planar Graph in Linear Time
233
Step 2. If u is adjacent to some node in the current Below (Lchild (S)) in G and is not adjacent to any node in the current Below (Rchild (S)) in G, then we delete u from S and insert u into the current Lchild (S). Step 3. If u is adjacent to some node in the current Below (Lchild (S)) and adjacent to some node in the current Below (Rchild (S)) in G, then we leave u in S and insert u into the current Lchild (S) and Rchild (S). One can verify that T is indeed an r-dissection tree of G, and T can be obtained from T in O(m) time. The lemma is proved.
5
Task 2: Solving the Nonleaf Problems
This section proves the following lemma. Lemma 5.1. Let G be an m-node O(1)-degree r-outerplane graph with r + wmax (G) = O(log2 m). Given an r-dissection tree T of G, the nonleaf problem of (G, T ) can be solved in O(mr) time. Definition 5.1. Let T be a dissection tree of G. Let S be a vertex of T . The border problem of (G, T ) for S is to compute the following information for any two distinct nodes u and v of Border (S): (1) dS (u, v), (2) an edge eS (u, v) on some min-weight path between u and v in G[Below (S)] that is incident to u, and (3) dS (u, v; e) for each edge e of G incident to u. Since S ⊆ Border (S) holds for each nonleaf vertex S of T , any collection of solutions to the border problems of (G, T ) for all nonleaf vertices of T yields a solution to the nonleaf problem of (G, T ). We prove Lemma 5.1 by solving the border problems of (G, T ) for all vertices of T in O(mr) time. A leaf vertex L in an r-dissection tree T of an m-node graph G is special if |Border (L)| + r ≤ log2 (m). Section 5.1 shows that the border problems of (G, T ) for all vertices of T can be reduced in O(mr) time to the border problems of (G, T ) for all special leaf vertices of T . Section 5.2 shows that the border problems of (G, T ) for all special leaf vertices of T can be solved in O(mr) time. 5.1
A Reduction to the Border Problems for the Special Leaf Vertices
Our reduction uses the following data structure that supports distance queries. Lemma 5.2 (Klein [24]). Let G be an -node planar graph. It takes O( log2 ) time to compute a data structure Oracle(G) such that each update to the weight of an edge and each query to the distance between any two nodes in G can be supported by Oracle(G) in time O(2/3 log5/3 ) = O(7/10 ). The following lemma shows the reduction. Lemma 5.3. Let G be an m-node O(1)-degree graph. Given (1) an r-dissection tree T of G with r = O(log2 m) and (2) solutions to the border problems of
234
H.-C. Chang and H.-I. Lu
(G, T ) for all special leaf vertices of T , it takes O(mr) time to solve the border problems of (G, T ) for all vertices of T . Proof (sketch). Solutions for special leaf vertices are given. We first show that it takes O(mr) time to compute solutions for all non-special leaf vertices L of T . By Condition 1 of T , we have L∈Leaf (T ) (|Border (L)|+r) = O(mr/(m)), implying that T has O(mr/(m) log2 (m)) non-special leaf vertices. For each non-special leaf vertex L of T , by using Lemma 5.2, one can show that the solutions for L can be computed in O((m) log2 (m)) time. We now show that the solutions for all nonleaf vertices S of T can be computed in O(m) time. By definition of (m) and Condition 1 of T , we have |Nonleaf (T )| = O(m/ log30 m). By r = O(log2 m) and Condition 3 of T , we have |S| + |Border (S)| = O(log3 m). It suffices to prove the following claim for each nonleaf vertex S of T : “Given solutions for S = Lchild (S) and S = Rchild (S), a solution for S can be computed in O(|Border (S)|3 · |S|2 ) time.” One can prove the claim via standard dynamic programming technique. 5.2
Solving the Border Problems for the Special Leaf Vertices
We need the following linear-time pre-computable data structure in the proof of Lemma 5.5 to solve the border problems of (G, T ) for all special leaf vertices of T as well as in the proof of Lemma 6.1 to solve the leaf problem of (G, T ). Lemma 5.4. For any given positive integers k = O(log log m)O(1) and w = O(log m)O(1) , it takes O(m) time to compute a data structure Table(k, w) such that the following statements hold for any O(1)-degree graph H with at most k nodes whose edge weights are at most w. 1. For any node subset B of H, it takes O(|H| + |B|2 ) time to obtain from Table(k, w) the following information for any two distinct nodes u and v in B: (1) the distance of u and v in H, (2) an edge incident to u that belongs to at least one min-weight path between u and v in H, and (3) the distance of u and v in H \ {e} for each edge e of H incident to u. 2. It takes O(|H|) time to obtain girth(H) from Table(k, w). Lemma 5.5. Let G be an m-node O(1)-degree r-outerplane graph satisfying wmax (G) = O(log2 m). Given an r-dissection tree T of G, the border problems of (G, T ) for all special leaf vertices of T can be solved in O(mr) time. Proof (of Lemma 5.1). Since any collection of solutions to the border problems of (G, T ) for all nonleaf vertices of T yields a solution to the nonleaf problem of (G, T ), the lemma follows immediately from Lemmas 5.3 and 5.5.
6
Task 3: Solving the Leaf Problem
Lemma 6.1. Let G be an m-node O(1)-degree r-outerplane graph with r + wmax (G) = O(density (G)). Given an r-dissection tree T of G, the leaf problem of (G, T ) can be solved in O(m · density(G)) time.
Computing the Girth of a Planar Graph in Linear Time
235
It remains to prove the main lemma of the paper, which implies Theorem 1.1, as already shown in §2.3. Proof (of Lemma 2.3). Let m = |V (G)| and n = |V (expand(G))|. Let r = radius(G). That is, G is an m-node O(1)-degree r-outerplane graph with r + wmax (G) = O(density (G)) = O(log2 m). By Lemma 4.1, an r-dissection tree T of G can be obtained from G in O(m) time. By Lemma 5.1, the nonleaf problem of (G, T ) can be solved in O(mr) = O(n) time. By Lemma 6.1, it takes O(m · density(G)) = O(n) time to solve the leaf problem of (G, T ). By Conditions 1 and 3 of T , we have squares(T ) = O(mr2 log2 m/(m)) = O(m). The lemma follows from Lemma 3.1.
7
Concluding Remarks
We give the first linear-time algorithm for computing the girth of any undirected unweighted planar graph. Our algorithm can be modified into one that finds a simple min-weight cycle. Specifically, when we solve each girth problem or each distance problem in our algorithm, we additionally let the algorithm output a node on a corresponding min-weight cycle or min-weight path. As a result, our algorithm not only computes the girth of the input graph, but also outputs a node u on a min-weight cycle of the input graph. We can then use the breadth-first search algorithm of Itai and Rodeh [20] to output a min-weight cycle containing u in linear time. It would be of interest to see if our algorithm can be extended to work for bounded-genus graphs. Acknowledgment. We thank Hsueh-Yi Chen, Chia-Ching Lin and ChengHsun Weng for discussion at an early stage of this research.
References 1. Alon, N., Yuster, R., Zwick, U.: Color–coding. JACM 42(4), 844–856 (1995) 2. Alon, N., Yuster, R., Zwick, U.: Finding and counting given length cycles. Algorithmica 17(3), 209–223 (1997) 3. Bodlaender, H.L.: A partial k-arboretum of graphs with bounded treewidth. Theoretical Computer Science 209(1-2), 1–45 (1998) 4. Bollob´ as, B.: Chromatic number, girth and maximal degree. Discrete Math. 24, 311–314 (1978) 5. Borradaile, G., Klein, P.N.: An O(n log n) algorithm for maximum st-flow in a directed planar graph. JACM 56(2), 9.1–9.30 (2009) 6. Boyer, J.M., Myrvold, W.J.: Stop minding your P’s and Q’s: A simplified planar embedding algorithm. In: SODA, pp. 140–146 (1999) 7. Chalermsook, P., Fakcharoenphol, J., Nanongkai, D.: A deterministic near-linear time algorithm for finding minimum cuts in planar graphs. In: SODA, pp. 828–829 (2004) 8. Chandran, L.S., Subramanian, C.R.: Girth and treewidth. Journal of Combinatorial Theory, Series B 93(1), 23–32 (2005)
236
H.-C. Chang and H.-I. Lu
9. Chang, H.-C., Lu, H.-I.: Computing the girth of a planar graph in linear time (2011), http://arxiv.org/abs/1104.4892 10. Cook, R.J.: Chromatic number and girth. Periodica Mathematica Hungarica 6, 103–107 (1975) 11. Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation 9(3), 251–280 (1990) 12. Diestel, R.: Graph Theory, 2nd edn. Springer, Heidelberg (2000) 13. Djidjev, H.N.: A faster algorithm for computing the girth of planar and bounded genus graphs. ACM Transactions on Algorithms 7(1), 3.1–3.16 (2010) 14. Dorn, F.: Planar subgraph isomorphism revisited. In: STACS, pp. 263–274 (2010) 15. Eppstein, D.: Subgraph isomorphism in planar graphs and related problems. Journal of Graph Algorithms and Applications 3(3), 1–27 (1999) 16. Erd˝ os, P.: Graph theory and probability. Canadian Journal of Math. 11, 34–38 (1959) 17. Erickson, J.: Maximum flows and parametric shortest paths in planar graphs. In: SODA, pp. 794–804 (2010) 18. Goodrich, M.T.: Planar separators and parallel polygon triangulation. Journal of Computer and System Sciences 51(3), 374–389 (1995) 19. Hao, J., Orlin, J.B.: A faster algorithm for finding the minimum cut in a directed graph. Journal of Algorithms 17(3), 424–446 (1994) 20. Itai, A., Rodeh, M.: Finding a minimum circuit in a graph. SIAM Journal on Computing 7(4), 413–423 (1978) 21. Italiano, G.F., Nussbaum, Y., Sankowski, P., Wulff-Nilsen, C.: Improved minimum cuts and maximum flows in undirected planar graphs. In: STOC, pp. 313–322 (2011), http://portal.acm.org/citation.cfm?doid=1993636.1993679 22. Karger, D.R.: Minimum cuts in near-linear time. JACM 47(1), 46–76 (2000) 23. Karger, D.R., Stein, C.: A new approach to the minimum cut problem. JACM 43(4), 601–640 (1996) 24. Klein, P.N.: Multiple-source shortest paths in planar graphs. In: SODA, pp. 146– 155 (2005) 25. Lingas, A., Lundell, E.-M.: Efficient approximation algorithms for shortest cycles in undirected graphs. Information Processing Letters 109(10), 493–498 (2009) 26. Lipton, R.J., Tarjan, R.E.: A separator theorem for planar graphs. SIAM Journal on Applied Math. 36(2), 177–189 (1979) 27. Lov´ asz, L.: On chromatic number of finite set systems. Acta Mathematica Academiae Scientiarum Hungaricae 19, 59–67 (1968) 28. Monien, B.: The complexity of determining a shortest cycle of even length. Computing 31(4), 355–369 (1983) 29. Robertson, N., Seymour, P.D.: Graph minors. III. Planar tree-width. Journal of Combinatorial Theory, Series B 36(1), 49–64 (1984) 30. Shih, W.-K., Wu, S., Kuo, Y.-S.: Unifying maximum cut and minimum cut of a planar graph. IEEE Transactions on Computers 39(5), 694–697 (1990) 31. Sleator, D.D., Tarjan, R.E.: A data structure for dynamic trees. Journal of Computer and System Sciences 26(3), 362–391 (1983) 32. Vazirani, V.V., Yannakakis, M.: Pfaffian orientations, 0/1 permanents, and even cycles in directed graphs. In: Lepist¨ o, T., Salomaa, A. (eds.) ICALP 1988. LNCS, vol. 317, pp. 667–681. Springer, Heidelberg (1988) 33. Weimann, O., Yuster, R.: Computing the girth of a planar graph in O(n log n) time. SIAM Journal on Discrete Math. 24(2), 609–616 (2010) 34. Yuster, R., Zwick, U.: Finding even cycles even faster. SIAM Journal on Discrete Math. 10(2), 209–222 (1997)
Diagonalization Strikes Back: Some Recent Lower Bounds in Complexity Theory Ryan Williams IBM Almaden Research Center
Abstract. The area of complexity lower bounds is concerned with proving impossibility results for bounded-resource computation. In spite of its apparent weaknesses, the ancient method of diagonalization has played a key role in recent lower bounds. This short article briefly recalls diagonalization along with its strengths and weaknesses, and describes a little about how diagonalization has made a recent comeback in complexity theory (although many would argue that it never really went away).
The method of diagonalization was introduced by Cantor in 1891, generalizing his original proof in 1874 that the set of reals is not countable. In computability and complexity theory, the method typically appears in the following context. We have a list of machines {Mi} which output a bit on every input, a list of all inputs {xi }, and we wish to construct a function that is not computed by any machine on the list. Defining the “diagonal” function f (xi ) = 1 − Mi (xi ), we find that for every machine Mi , there is an input (namely xi ) on which the output of f differs from that of Mi . When the list of machines is the set of all Turing machines and we say that Mi (xj ) = 1 if and only if Mi halts on xj , this argument shows that the halting problem is undecidable. When the list of machines becomes time-bounded (for example, each Mi is forced to halt in at most t(n) time on all inputs of length n), the diagonal argument establishes the time hierarchy theorem of Hartmanis and Stearns [5] that for all time-constructible t(n), we have TIME[t(n)] TIME[t(n)2 ]. In English, this theorem says that as we allow algorithms strictly more running time, there arise strictly more problems that such algorithms can solve. For example, there are problems solvable in quadratic time that cannot be solved in linear time. The time hierarchy theorem follows by implementing the above function f to run in t(n)2 time. Subsequent improvements in Turing machine simulations have provided more efficient implementations of f (see, for example, [6,4]) and consequently, stronger time hierarchy theorems. Essentially all computational models are known to have corresponding time hierarchy theorems, with rare exceptions. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 237–239, 2011. c Springer-Verlag Berlin Heidelberg 2011
238
R. Williams
A great strength of diagonalization is its versatility. Let A be an arbitrary set of strings (often called an “oracle”). Let {MiA } be a list of machines as above, but allow them all to have the magical property of oracle access to A, meaning that they can ask arbitrary membership queries to A in a single step of computation (even if A happens to be undecidable). No matter how powerful A is, the diagonal argument shows that there is still a function f that is not in the list {MiA }. Notice that the function f just needs oracle access to A in order to be implemented properly, simulating every MiA . From this observation we can say that for all oracles A, the “halting problem with oracle A” is not decidable by machines with oracle access to A, and that for all oracles A, TIME[t(n)]A TIME[t(n)2 ]A . That is, there are problems solvable in t(n)2 time with oracle A that cannot be solved in t(n) time with oracle A. Many proofs of theorems in complexity theory are still valid when one attaches arbitrary oracle access to all algorithms under discussion in the proof; such proofs are said to be relativizing. The above shows that the proof of the time hierarchy theorem is relativizing. The ability to insert any oracle into a proof is quite powerful, so relativizing proofs are often widely applicable in complexity theory. But while diagonalization is powerful and leads to relativizing proofs, this power comes at a price. The fact that the diagonal argument relativizes means that arguments of its kind will not be enough to resolve major questions in complexity theory like P versus NP. Baker, Gill, and Solovay [1] found oracles A and B such that PA = NPA and PB = NPB . That is, there is an oracle A such that polynomial time algorithms equipped with A are equivalent in power to nondeterministic polynomial time algorithms equipped with A, but there is also an oracle B such that NP algorithms with oracle B can be proved to be more powerful than P algorithms with oracle B. Such oracles show that any proof resolving the P versus NP question must be non-relativizing: it cannot have the strong oracle-universal properties enjoyed by the diagonal argument and other proof methods in complexity theory. Over the years, complexity theory has catalogued a huge library of “opposing” oracle results, where for many complexity classes C and D, there are oracles A and B where C A = DA and C B = DB . These oracles strongly suggest that methods such as diagonalization are simply too coarse to resolve the major open questions in complexity theory. In the conference talk, I will discuss two topics where diagonalization results like the time hierarchy theorem have been used in the proofs of new complexity lower bounds, in spite of the above points. The two topics are time-space lower bounds for the satisfiability problem (originating with work of Fortnow and others [2,3]) and circuit size lower bounds for nondeterministic exponential time [7,8]. The general strategy used to prove these lower bounds is algorithmic in nature. One assumes that too-good-to-be-true algorithms exist, and uses these algorithms to get impossibly good simulations – for example, one may show that every time t(n)2 algorithm can be simulated perfectly by an t(n) time algorithm. Such a universal simulation contradicts the time hierarchy theorem,
Some Recent Lower Bounds in Complexity Theory
239
so the assumed algorithms are in fact too good to be true. To implement this strategy, one mixes together diagonalization arguments with algorithmic tools and special complexity-theoretic properties of the problems under discussion in order to make progress. I will speculate about how algorithmic and complexity theoretic tools may be further combined to prove stronger lower bounds.
References 1. Baker, T., Gill, J., Solovay, R.: Relativizations of the P = NP question. SIAM Journal on Computing 4(4), 431–442 (1975) 2. Fortnow, L.: Nondeterministic polynomial time versus nondeterministic logarithmic space: Time-space tradeoffs for satisfiability. In: IEEE Conference on Computational Complexity (CCC), pp. 52–60 (1997) 3. Fortnow, L., Lipton, R., van Melkebeek, D., Viglas, A.: Time-space lower bounds for satisfiability. JACM 52(6), 835–865 (2005) 4. F¨ urer, M.: The tight deterministic time hierarchy. In: ACM Symposium on Theory of Computing, pp. 8–16 (1982) 5. Hartmanis, J., Stearns, R.E.: On the computational complexity of algorithms. Transactions of the American Mathematical Society 117, 285–306 (1965) 6. Hennie, F.C., Stearns, R.E.: Two-tape simulation of multitape Turing machines. JACM 13(4), 533–546 (1966) 7. Williams, R.: Improving exhaustive search implies superpolynomial lower bounds. In: ACM Symposium on Theory of Computing, pp. 231–240 (2010) 8. Williams, R.: Non-uniform ACC circuit lower bounds. To appear in IEEE Conference on Computational Complexity, CCC (2011)
Unions of Disjoint NP-Complete Sets Christian Glaßer1, John M. Hitchcock2, , A. Pavan3, , and Stephen Travers1 1 Julius-Maximilians-Universit¨ at W¨ urzburg {glasser,travers}@informatik.uni-wuerzburg.de 2 Department of Computer Science, University of Wyoming [email protected] 3 Department of Computer Science, Iowa State University [email protected]
Abstract. We study the following question: if A and B are disjoint NPcomplete sets, then is A ∪ B NP-complete? We provide necessary and sufficient conditions under which the union of disjoint NP-complete sets remain complete.
1
Introduction
A disjoint NP pair is a pair of languages (A, B) such that both A and B are in NP and are disjoint. Given a disjoint pair (A, B), we can view strings from A as “yes” instances and strings from B as “no” instances. We are interested in an algorithm that accepts all instances from A and rejects all instances from B. Viewed this way, disjoint pairs are an equivalent formulation of promise problems, where A ∪ B is the promise. Promise problems were introduced by Even, Selman, and Yacobi [ESY84]. Promise problems and disjoint pairs arise naturally in many scenarios such as the study of complete problems for semantic classes and the study of hardness of approximation problems. In some instances promise problems more precisely capture the underlying computational problem rather than decision problems. Sometimes unresolved questions about complexity classes can be answered by considering promise versions of complexity classes. For example, we know that Promise-MA does not have fixed polynomial-size circuits whereas we do not have an analogous result for the class MA [San09]. For a recent survey on promise problems we refer the reader to [Gol06]. In addition to be able to capture several natural computational problems, disjoint pairs arise naturally in the study of public key cryptosystems and propositional proof systems. The computational problem capturing a public key cryptosystem can be formulated as a disjoint NP pair (A, B) [ESY84, GS88]. A separator of such a pair (A, B) is a set S with A ⊆ S and S ⊆ B. The class of pairs (A, B) whose separators do not belong to P are called P-inseparable pairs.
Research done while this author was on sabbatical at CWI and was supported in part by an NWO travel grant and by NSF grants 0652601 and 0917417. Research supported in part by NSF grants 0830479 and 0916797.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 240–251, 2011. c Springer-Verlag Berlin Heidelberg 2011
Unions of Disjoint NP-Complete Sets
241
The existence of P-inseparable disjoint NP pairs is closely related the existence of secure public key cryptosystems [ESY84, GS88]. Grollmann and Selman [GS88] showed that if P = UP, then there exist P-inseparable disjoint NP pairs. More recently Fortnow, Lutz, and Mayordomo [FLM10] showed that if NP does not have p-measure zero, then P-inseparable disjoint NP pairs exist. Works of Razborov [Raz94] and Pudlak [Pud01] show that disjoint NP pairs are also closely related to the study of propositional proof systems. Razborov identified a canonical disjoint NP pair (SAT∗ , REFf ) for every propositional proof system f . Here SAT∗ is a padded version of SAT and REFf is the set of all formulas that have short proofs of unsatisfiability with respect to f . Glaßer, Selman, and Zhang [GSZ07] showed that for every disjoint NP pair (A, B) there is a propositional proof system f such that its canonical pair (SAT∗ , REFf ) is many-one equivalent to (A, B). Thus disjoint NP pairs and propositional systems have identical degree structure. There is a close relation between disjoint NP pairs and pairs whose both components are NP-complete. For example, there is a P-inseparable disjoint NP pair if and only there is a P-inseparable pair whose both components are NPcomplete [GS88]. We also know that if there is a complete pair for DisjNP, then there is such a pair where both components are NP-complete [GSS05]. In this article we focus on disjoint pairs whose both components are NPcomplete. We investigate the following question: let (A, B) be a disjoint NP pair such that both A and B are NP-complete. Is the union A ∪ B NP-complete? This question was first explicitly raised by Selman [Sel88]. Apart from its connections to the study of public key cryptosystems and propositional proof systems, our question is also of independent interest. We are interested in a simple closure property of NP-complete sets—closure under disjoint unions. It is known that every NP-complete set can be split into two disjoint NP-complete sets [GPSZ08]. Here we are raising the converse question, is the combination of every two disjoint NP-complete sets NP-complete? Glaßer et al. [GSTW08] showed that if A and B are disjoint NP-complete sets, then A ∪ B is complete via strong nondeterministic Turing reductions. They also showed that if NP differs from co-NP at almost all lengths, then A ∪ B is manyone complete via P/poly-reductions. If we consider disjoint Turing complete sets, we know a little more. Glaßer et al. [GPSS06] showed that if UP∩co-UP contains bi-immune sets, then there exist disjoint Turing complete sets whose union is not Turing complete. The above mentioned results do not seem to shed light on the question of whether unions of disjoint NP-complete sets remain NP-complete (under polynomial-time many-one reductions). To date, we do not know of any reasonable hypothesis that either provides a positive answer or a negative answer to this question. In this paper we provide necessary and sufficient conditions under which the union of disjoint NP-complete sets remain NP-complete. We consider two statements and show that one of the statements yields a positive answer to our question, whereas the other statement yields a negative answer.
242
C. Glaßer et al.
Our statements relate to the complexity of SAT. Let us assume that NP differs from co-NP, thus there is no NP-algorithm for SAT. Could it still be the case that there is an NP-algorithm that solves SAT in some “average-case/approximate” sense? Let B be a set in NP that is disjoint from SAT. We can view B as an “approximate/average-case” NP-algorithm for SAT. Since B does not coincide with SAT, there must exist unsatisfiable formulas on which B errs. How easy/hard is it to produce such instances? Any machine that produces instances on which B differs from SAT is called a refuter. Given B, what is the complexity of the refuter? We can make two easy obserk vations. If B can be decided in time 2n , then there exists a refuter that runs in k P time O(2n 2n ). Using the fact that B is in NP we can also design a PΣ2 refuter. Can the complexity of these refuters be reduced further? We show that if the complexity of such refuters can be improved to polynomial-time, then unions of disjoint NP-complete sets remain NP-complete. On the other hand, we show that if the complexity of the refuters can not be reduced, then there exist disjoint NP-complete sets whose union is not NP-complete. More precisely, we show that if there exists a B ∈ NP that is disjoint from SAT such that any refuter for B must take 22n time, then there exist disjoint NP-complete sets whose union is not NP-complete. The notion of refuters can be made precise by using distinguishers and pseudoclasses. These notions were first formally defined by Kabanets [Kab00]. These concepts have been proved to be useful in learning theory [JS05], in the study of heuristics for solving NP-complete problems, and in derandomization [IW98, Kab00]. In this paper, we provide yet another instance where such concepts seem to be useful.
2
Preliminaries
Given two languages A and B, AΔB denotes the symmetric difference between A and B. A refuter R is a deterministic Turing machine that on an input of length n outputs a string of length at least n. Definition 2.1. [Kab00] Let L and L be two languages and R be a refuter. We say that R distinguishes L from L if for infinitely many n, R(1n ) outputs a string (of length ≥ n) from LΔL . A refuter R almost everywhere distinguishes L from L , if for all but finitely many n, R(1n ) outputs a string (of length ≥ n) from LΔL . If a refuter R does not distinguish L from L , then for all but finitely many n, R(1n ) does not output a string on which L and L differ. If a refuter does not almost everywhere distinguish L from L , then for infinitely many n, R(1n ) ∈ / LΔL . Now we mention our statements. Statement 1. There is a language L ∈ NP that is disjoint from SAT and no 22n -time bounded refuter can distinguish SAT from L.
Unions of Disjoint NP-Complete Sets
243
Informally, this means that no 22n -time bounded machine can output strings on which L differs from SAT. Statement 2. For every language L ∈ NP that is disjoint from SAT, there is a polynomial-time refuter that almost everywhere distinguishes L from SAT. This statement implies that for every language L ∈ NP that is disjoint from SAT, there is a polynomial-bounded refuter R such that R(1n ) outputs a string of length ≥ n at which L differs from SAT. Observe that if we replace P with 22n and remove the phrase “almost everywhere” from Statement 2, then it would be a converse to Statement 1. Main Theorem 1: If Statement 1 is true, then there exist disjoint NP-complete sets whose union is not NP-complete. Main Theorem 2: If Statement 2 is true, then unions of disjoint NP-complete sets are NP-complete.
3
Main Theorems
We will show that if Statement 1 is true, then there exist two disjoint NPcomplete sets whose union is not NP-complete. On the other hand, we show that if the Statement 2 is true, then unions of disjoint NP-complete sets remain NP-complete. Let A be an NP-complete set and B be a set in NP that is disjoint from A. Let A = 0A ∪ 1B, and B = 1A ∪ 0B. Both A and B are NP-complete and are disjoint. The set A ∪ B is NP-complete if and only if A ∪ B is NP-complete. Thus we have the following observation. Observation 3.1. There exist two disjoint NP-complete sets whose union is not NP-complete if and only if there exists an NP-complete set A and a set B in NP that is disjoint from A such that A ∪ B is not NP-complete. Theorem 3.2. If Statement 1 is true, then there exist two disjoint NP-complete sets whose union is not NP-complete. Proof. Let L be a language in NP that is disjoint from SAT and for every 22n time bounded refuter R, for all but finitely many n, R(1n ) ∈ / SAT ∪ L. We exhibit an NP-complete set A and a disjoint set B in NP such that A ∪ B is not NP-complete. Since L ∈ NP, there is a constant k ≥ 1 such that L can be decided in time 2 nk 2 . Let t1 = 2, and ti+1 = tki . Before we present a formal proof, we provide the main ideas behind the proof. Let us partition Σ ∗ into blocks B1 , B2 , · · · such that Bi contains all strings of 1/k length ti , every string from Bi−1 is of length at most ti , and every string k from Bi+1 is of length at least ti . Let us take L1 = L ∩ (∪i B2i ) and L2 to be L ∩ (∪i B2i+1 ).
244
C. Glaßer et al.
Suppose that there is a many-one reduction f from L1 to L2 . We will first argue that by using this reduction, we can output a string of length n that is not in L in time less than 22n . Let us fix i. Consider a string x of length t2i . Recall that x lies in block B2i . What does f (x) look like? There are three possibilities: f (x) remains in block B2i , f (x) is in block Bj for some j < 2i, or f (x) lies in block Bj for some j > 2i. Suppose f (x) lies in block B2i . Observe that L2 ∩ B2i is empty. This immediately implies that f (x) does not belong to L2 and thus x does not belong to L1 (and thus x is not in L). If any string of length t2i that is not in L is mapped into block B2i , then one can find and output such a string in time 22t2i . Now suppose f (x) lies in block Bj and j < 2i. Since every string from block 1/k Bj is of length at most t2i , we can decide whether f (x) belongs to L2 or not t2i in time less than 2 . Thus if any string of length t2i that is not in L is mapped into block Bj (j ≤ 2i), then one can find and output such a string in time 22t2i . Now suppose that for every string x of length t2i that is not in L, f (x) lies in block Bj and j > 2i. Consider f (x), its length is at least tk2i . We can now output a string that does not belong to L as follows: by cycling through all strings of length t2i find a string x that does not belong to L. Output f (x). This takes k less than 22t2i time, and it follows that f (x) does not belong to L. Since f (x) belongs to block Bj and j > 2i, it must be the case that m = |f (x)| ≥ tk2i . Thus the time taken to output f (x) (a string of length m) is at most 22m . In the actual proof, outputting strings that are not in L does not suffice. We have to output strings on which L differs from SAT, i.e., strings that are not in SAT ∪ L. This presents additional complications. For this we define three additional sets: an NP-complete set SATJ and two sets in NP LJ and LO that are disjoint from SAT. We will show that if there is a reduction from LO to SATJ ∪ LJ , then one can use this reduction to output strings that are not in SAT ∪ L. Now we present a formal proof. 2 Let t1 = 2 and ti+1 = tki . Consider the following sets. 1/k
≤ |x| < tki and i is even}
1/k
≤ |x| < tki and i is odd}
E = {x | ti O = {x | ti
J = {x ||x| = ti and i is even} If NP = co-NP, then SAT and SAT are NP-complete and their union is Σ ∗ . The set Σ ∗ can not be complete for any class under many-one reductions. Let us assume that NP = co-NP. Then, it must be the case that SAT ∪ L is infinite. Since E ∪ O = Σ ∗ , at least one of E ∩ (SAT ∪ L) or O ∩ (SAT ∪ L) is infinite. From now we will assume that O ∩ (SAT ∪ L) is infinite. If that were not the case we can interchange the roles of E and O, take J = {x | |x| = ti and i odd}, and the proof structure remains similar. Let LJ = L ∩ J, LO = L ∩ O, and SATJ = SAT ∩ J.
Unions of Disjoint NP-Complete Sets
245
Lemma 3.3. The set SATJ ∪ LJ is not NP-complete Since SAT is paddable, SATJ is NP-complete. Clearly, LJ is disjoint from SATJ . Thus by Observation 3.1, the theorem is implied by Lemma 3.3. The rest of the proof is dedicated to proving the above lemma. Our proof proceeds by contradiction. Suppose SATJ ∪ LJ is NP-complete. Since LO is in NP, there is a polynomial-time many-one reduction f from LO to SATJ ∪ LJ . Using this reduction f , we exhibit a 22n -time bounded refuter R that distinguishes SAT from L. This contradicts Statement 1. Let T = O ∩ (SAT ∪ L) = O ∩ SAT ∩ L. Recall that T is infinite. Consider the following sets. T1 = {x ∈ T | f (x) ∈ / J} T2 = {x ∈ T | f (x) ∈ J and |f (x)| < |x|} T3 = {x ∈ T | f (x) ∈ J and |f (x)| ≥ |x|} Clearly T = T1 ∪ T2 ∪ T3 . We now show that each of T1 , T2 , and T3 is finite. Since T is infinite, we obtain a contradiction. Lemma 3.4. T1 is finite. Proof. Suppose not. Since T ⊆ SAT ∪ L, T1 is an infinite subset of SAT ∪ L. Consider the following refuter R. 1. Input 1n . 2. For every x ∈ Σ n do (a) If x ∈ / O ∩ SAT, then go to the next x. Else compute f (x). (b) If f (x) ∈ / J, output x and stop. Else go to the next x. 3. Output ⊥. The algorithm considers at most 2n strings x. Since f is polynomial-time computable and SAT is in DTIME(2n ), R runs in time 22n . We now claim that R distinguishes SAT from L. Consider an input length n. Claim. If z ∈ / T1 ∩ Σ n , then R(1n ) does not output z. Proof. If z ∈ / T1 , then either z ∈ / T or f (z) ∈ J. Note that the above refuter outputs a string x only when f (x) ∈ / J. Thus if f (z) ∈ J, then it does not output z. Now consider the case z ∈ / T . If z ∈ / O ∩ SAT, then the refuter does not output z. So assume z ∈ O ∩ SAT. Since z ∈ / T , it follows that z ∈ L. Since z ∈ O and z ∈ L, z ∈ LO . If z ∈ LO , then f (z) ∈ SATJ ∪ LJ and thus f (z) ∈ J. Thus the above refuter does not output z.
Claim. If T1 ∩ Σ n is not empty, then R(1n ) outputs a string from T1 ∩ Σ n . Proof. Let y be the lexicographically first string from T1 ∩ Σ n . By the previous claim, R(1n ) does not output any z < y. Thus the loop of the above algorithm considers y. Since y ∈ T1 , both the conditions y ∈ O ∩ SAT and f (y) ∈ / J are satisfied. When this happens the refuter outputs y.
246
C. Glaßer et al.
Thus for every n, R(1n ) either outputs ⊥ or outputs a string from T1 . If T1 is infinite, then for infinitely many such n, R(1n ) outputs a string from T1 . Since T1 is a subset of T and T is a subset of SAT ∪ L, it follows that the output of R belongs to LΔSAT. This contradicts Statement 1. Thus T1 is a finite set.
Lemma 3.5. T2 is finite. Proof. If T2 is infinite, then T2 is an infinite subset of SAT ∪ L. Consider the following refuter R. 1. Input 1n . 2. For every x ∈ Σ n do (a) If x does not belong to O ∩ SAT, then go to the next x. Else, compute f (x). (b) If f (x) ∈ / J or |f (x)| ≥ |x|, then go to the next x. (c) If f (x) ∈ J and |f (x)| < |x|, then output x if f (x) ∈ / SATJ ∪ LJ . Else go to the next x. 3. Output ⊥. Checking whether x ∈ O ∩SAT takes time O(2n ). Now we argue that checking the membership of f (x) in SATJ ∪ LJ takes 2|x| time. We will check whether f (x) is in SATJ ∪ LJ only when |f (x)| < |x| and f (x) ∈ J. By Step 2a, x is in 1/k O. Thus ti ≤ |x| < tki for some odd i. Since f (x) ∈ J, |f (x)| = tj for some even j. Since |f (x)| < |x|, it follows that j < i. 2 1/k 1/k Thus ti ≥ tkj and so ti ≥ tkj . Since |f (x)| = tj and |x| ≥ ti , it follows k
that |f (x)| ≤ |x|1/k . Since LJ is decidable in time 2n and SATJ is decidable in time 2n , we can decide the membership of f (x) in SATJ ∪ LJ in time O(2|x| ). The algorithm checks whether f (x) is in SATJ ∪ LJ only when |f (x)| < |x|. Thus the total time taken by the above refuter is at most 22n . Let n be the input length. As before, we make two claims. Claim. If z ∈ / T2 ∩ Σ n , then R(1n ) does not output z. Proof. If z does not belong to T2 , then either z ∈ / T or f (z) ∈ / J or |f (x)| ≥ |x|. If f (z) ∈ / J or |f (z)| ≥ |z|, the refuter does not output z. Suppose z ∈ / T. If z ∈ / O ∩ SAT, the refuter does not output z. If z ∈ O ∩ SAT, it follows that z ∈ L. Since z ∈ O, it follows that z ∈ LO . Thus f (z) ∈ SATJ ∪ LJ . The refuter does not output any string z such that f (z) belongs to SATJ ∪ LJ . Thus the refuter does not output z.
Claim. If T2 ∩ Σ n = ∅, then R(1n ) outputs a string from T2 ∩ Σ n . Proof. Let y be the lexicographically first string from T2 ∩ Σ n . Let z be a string of length n that is smaller than y. By the previous claim, R(1n ) does not output z. So the above refuter considers y during some iteration. Since y ∈ T2 , it must be the case that y ∈ T , f (y) ∈ J, and |f (y)| < |y|. If y ∈ T2 , then y ∈ / LO . Since f is reduction from LO to SATJ ∪ LJ , f (y) ∈ / SATJ ∪ LJ . Thus the refuter outputs z.
Unions of Disjoint NP-Complete Sets
247
Thus for every n, R(1n ) either outputs ⊥ or outputs a string from T2 ∩ Σ n . If T2 is infinite then, for infinitely many n, T2 ∩ Σ n is not empty. Thus for infinitely many n, the refuter on input 1n outputs a string from T2 . Since T2 is a subset of SAT ∪ L, the output of R(1n ) belongs to LΔSAT. This is a contradiction. Thus T2 is also finite.
We now claim that T3 must also be finite. Lemma 3.6. T3 is finite. Proof. Consider the following refuter R. 1. Input 1n . 2. For every x ∈ Σ n do (a) If x ∈ / J, consider the next x. (b) If x ∈ J, search for a string y such that |y| ≤ n1/k and f (y) = x. If no such y is found, consider the next x. (c) If such a y is found output x if and only if y ∈ T . 3. Output ⊥. We first analyze the running time of R. Consider an iteration. There are at 1/k most 2n strings that the refuter considers in step (b). Since L can be decided k k in time 2n , T can be decided in time O(2n ). On input 1n , the algorithm checks for membership, in T , for strings of length at most n1/k . Thus the total run time of the above algorithm is bounded by 22n . Let y be a string from T3 . Since y ∈ T3 , there exists an odd number i such 1/k that the length of y lies between ti and tki . By the definition of T3 , we have that f (y) ∈ J and |f (y)| ≥ |y|. From this it follows that there exists an even 2 number r > i such that |f (y)| = tr . Since r > i and tr = tkr−1 , it follows that |f (y)| ≥ |y|k . Let n be a length at which T3 is not empty. Let m be the smallest number such that f (T3 ∩ Σ n ) ∩ Σ m = ∅. By the previous discussion, it follows that m ≥ nk . Let z be the lexicographically smallest string from f (T3 ) ∩ Σ m . Claim. If a string x of length m does not belong to f (T3 ), then R(1m ) does not output x. Proof. If x ∈ / J or there is no string y of length at most m1/k for which f (y) = x, then clearly R(1m ) does not output x. Let us assume that x ∈ J and there is a y for which f (y) = x. Observe that R outputs x only when y ∈ T . Since f (y) = x ∈ J and |f (y)| ≥ |y|, y ∈ T implies that y ∈ T3 . However x is not in f (T3 ). Thus y ∈ / T and so R does not output x.
Claim. If z is the lexicographically smallest string from f (T3 ) ∩ Σ m , then R(1m ) outputs z. Proof. By previous claim, R(1m ) does not output any string smaller than z. Thus it considers z during some iteration. Since z ∈ f (T3 ), we have that z ∈ J. Let y be a string from T3 such that f (y) = z. By our previous discussion, |y| ≤ m1/k . Since y ∈ T3 , y ∈ T . Thus the refuter outputs z.
248
C. Glaßer et al.
Thus every output of R is either ⊥ or a string z from f (T3 ). Since T3 ⊆ T , T ⊆ LO , and f is a many-one reduction from LO to SATJ ∪ LJ , it follows that z∈ / SATJ ∪ LJ . However z ∈ J. From this it follows that z ∈ SATΔL. If T3 is infinite, then f (T3 ) is also infinite. Thus for every m, R(1m ) outputs ⊥ or outputs a string from SATΔL and for infinitely many m, R(1m ) ∈ SATΔL. This contradicts Statement 1 and so T3 is a finite set.
Thus it follows that T must be a finite set which is a contradiction. Thus f can not be a many-one reduction from Lo to SATJ ∪ LJ . Thus SATJ ∪ LJ is not many-one complete.
We will now show that if Statement 2 is true, then NP-complete sets are closed under disjoint unions. Let A and B be two disjoint NP-complete sets whose union is not NPcomplete. Consider A × Σ ∗ and B × Σ ∗ . These sets are disjoint and are NPcomplete, moreover their union is not NP-complete. Since A×Σ ∗ and B ×Σ ∗ are paddable, they are isomorphic to SAT [BH77]. Thus if there exist two disjoint NP-complete sets A and B such that A ∪ B is not NP-complete, then there exist two disjoint NP-complete sets C and D that are isomorphic to SAT such that C ∪ D is not NP-complete. Since C is isomorphic to SAT, there is a polynomial-time invertible bijection f from Σ ∗ to Σ ∗ that is a reduction from C to SAT. Now consider the sets SAT and f (D). Since f is polynomial-time invertible, f (D) belongs to NP. Moreover f (D) is disjoint from SAT. Suppose there is a reduction g from SAT to SAT ∪ f (D), then f −1 g is a reduction from SAT to C ∪D. Thus if SAT∪f (D) is NP-complete, so is C ∪ D. Thus we have the following observation. Observation 3.7. If there exist two disjoint NP-complete sets whose union is not NP-complete, then there is a set B in NP that is disjoint from SAT such that SAT ∪ B is not NP-complete. Theorem 3.8. If Statement 2 is true, then unions of disjoint NP-complete sets are NP-complete. Proof. By the previous observation, it suffices to show that if L is any set in NP that is disjoint from SAT, then L ∪ SAT is NP-complete. Consider the following set B = {x | ∃ y, |y| = |x|, and x ∨ y ∈ L}, where x ∨ y denotes the disjunction of the boolean formulas x and y. Clearly B ∈ NP, and is disjoint from SAT. Thus by our Statement, there is a polynomialtime bounded refuter R such that for all but finitely many n, R(1n ) ∈ SATΔB. Since B ⊆ SAT, R(1n ) ∈ SAT ∪ B. Consider the following reduction from SAT to SAT ∪ L. On input x, let y be a string of length m output by R(1|x| ). Output y ∨ x. Since y does not belong to SAT, x ∈ SAT if and only if (y ∨ x) ∈ SAT. It remains to show that if x is not in SAT, then y ∨ x is not in L. Suppose
Unions of Disjoint NP-Complete Sets
249
y ∨ x belongs to L. Then by the definition of B, y must belong to B. However y belongs to SAT ∪ B. This is a contradiction. Thus y ∨ x does not belong to L. Thus SAT ∪ L is NP-complete.
3.1
Length-Increasing Reductions
As mentioned in the preliminaries our two statements are not converses of each other. Thus our sufficient and necessary conditions are not equivalent. Ideally, we would like to make them equivalent. We observe that if we strengthen the notion of NP-completeness to “completeness via length-increasing reductions,” then we can make the necessary and sufficient conditions to be equivalent. Consider the following question: is the union of disjoint NP-complete sets complete via lengthincreasing reductions? Theorem 3.9. Unions of disjoint NP-complete sets are NP-complete under length-increasing reductions if and only if Statement 2 is true. Proof. As before, it is easy to see that there exist disjoint NP-complete sets whose union is NP-complete via length-increasing reductions if and only if for every set B ∈ NP that is disjoint from SAT ∪B is complete via length-increasing reductions. Let B be a set in NP that is disjoint from SAT. Let f be a length-increasing from SAT to SAT ∪ B. Consider the following refuter R. On input 1n generate an unsatisfiable formula φ of length ≥ n. Output f (φ). Since generating unsatisfiable formulas is easy, the refuter runs in polynomial time. Since φ ∈ / SAT, f (φ) ∈ / SAT ∪ B. Thus f (φ) is an unsatisfiable formula that does not belong to SAT, i.e, f (φ) ∈ BΔSAT. Since the length of φ is at least n and f is lengthincreasing, the length of f (φ) is at least n. Thus R almost everywhere distinguishes SAT from B. The other direction follows from the proof of Theorem 3.8 as the reduction exhibited in that proof is length-increasing.
Agrawal [Agr02] showed that if one-way permutations exist and E does not have 2n size circuits, then NP-complete sets are complete via length-increasing reductions. This yields the following corollary. Corollary 3.10. Assume that one-way permutations exist and there is a language in E that requires 2n -size circuits for some > 0. Then unions of disjoint NP-completes are NP-complete if and only if Statement 2 is true.
4
Discussion
Suppose NP = co-NP and let L be a language in NP that is disjoint from SAT. k Since L is in NP L can be decided in time 2n . Since L does not equal SAT, there exists a refuter that distinguishes L from SAT. What is the complexity of such a refuter? It is easy to see that there is a refuter that distinguishes L
250
C. Glaßer et al. k+1
from SAT and this refuter runs in time 2n . Statement 1 implies that there is no refuter whose running time is drastically better whereas Statement 2 implies that there is a refuter that runs in polynomial time. Our results indicate that to settle the question of whether unions of disjoint NP-complete sets remain NP-complete, one must understand the complexity of refuters. We have provided necessary and sufficient conditions for the answer to this question to be true. Clearly there is a gap between the necessary and sufficient conditions. We can bridge this gap under certain believable hypotheses. It would be interesting to bridge this gap unconditionally. Acknowledgments. We thank the anonymous referees for numerous helpful suggestions and comments. We thank Eric Allender for pointing out a gap in the proof of one of the claims.
References [Agr02]
Agrawal, M.: Pseudo-random generators and structure of complete degrees. In: Proceedings of the 17th Annual IEEE Conference on Computational Complexity, pp. 139–145. IEEE Computer Society, Los Alamitos (2002) [BH77] Berman, L., Hartmanis, H.: On isomorphisms and density of NP and other complete sets. SIAM Journal on Computing 6(2), 305–322 (1977) [ESY84] Even, S., Selman, A., Yacobi, Y.: The complexity of promise problems with applications to public-key cryptography. Information and Control 61(2), 159–173 (1984) [FLM10] Fortnow, L., Lutz, J.H., Mayordomo, E.: Inseparability and strong hypotheses for disjoint NP pairs. In: Proceedings of the 27th International Symposium on Theoretical Aspects of Computer Science. Leibniz International Proceedings in Informatics, vol. 5, pp. 395–404. Schloss Dagstuhl– Leibniz-Zentrum fuer Informatik (2010) [Gol06] Goldreich, O.: On promise problems: A survey. In: Goldreich, O., Rosenberg, A.L., Selman, A.L. (eds.) TCS 2006. LNCS, vol. 3895, pp. 254–290. Springer, Heidelberg (2006) [GPSS06] Glaßer, C., Pavan, A., Selman, A., Sengupta, S.: Properties of NPcomplete sets. SIAM Journal on Computing 36(2), 516–542 (2006) [GPSZ08] Glaßer, C., Pavan, A., Selman, A., Zhang, L.: Splitting NP-complete sets. SIAM Journal on Computing 37(5), 1517–1535 (2008) [GS88] Grollmann, J., Selman, A.: Complexity measures for public-key cryptosystems. SIAM Journal on Computing 17(2), 309–355 (1988) [GSS05] Glaßer, C., Selman, A., Sengupta, S.: Reductions between disjoint NPpairs. Information and Computation 200(2), 247–267 (2005) [GSTW08] Glaßer, C., Selman, A., Travers, S., Wagner, K.W.: The complexity of unions of disjoint sets. Journal of Computer and System Sciences 74(7), 1173–1187 (2008) [GSZ07] Glaßer, C., Selman, A., Zhang, L.: Canonical disjoint NP-pairs of propositional proof systems. Theoretical Computer Science 370(1), 60–73 (2007) [IW98] Impagliazzo, R., Wigderson, A.: Randomness vs. time: de-randomization under a uniform assumption. In: Proceedings of the 39th Annual Symposium on Foundations of Computer Science, pp. 734–743. IEEE Computer Society, Los Alamitos (1998)
Unions of Disjoint NP-Complete Sets [JS05]
[Kab00]
[Pud01]
[Raz94] [San09] [Sel88]
251
Jackson, J., Servedio, R.: On learning random DNF formulas under the uniform distribution. In: Proceedings of the 9th International Workshop on Randomness and Computation, pp. 342–353. Springer, Heidelberg (2005) Kabanets, V.: Easiness assumptions and hardness tests: Trading time for zero error. In: Proceedings of the 15th Annual IEEE Conference on Computational Colmplexity, pp. 150–157. IEEE Computer Society, Los Alamitos (2000) Pudlak, P.: On reducibility and symmetry of disjoint NP-pairs. Technical Report TR01-044, Electronic Colloquium on Computational Complexity (2001) Razborov, A.: On provably disjoint NP pairs. Technical Report TR94-006, Electronic Colloquium on Computational Complexity (1994) Santhanam, R.: Circuit lower bounds for Merlin-Arthur classes. SIAM Journal on Computing 39(3), 1038–1061 (2009) Selman, A.: Natural self-reducible sets. SIAM Journal on Computing 17(5), 989–996 (1988)
ReachFewL = ReachUL Brady Garvin , Derrick Stolee , Raghunath Tewari , and N.V. Vinodchandran Department of Computer Science University of Nebraska–Lincoln {bgarvin,dstolee,rtewari,vinod}@cse.unl.edu
Abstract. We show that two complexity classes introduced about two decades ago are equal. ReachUL is the class of problems decided by nondeterministic log-space machines which on every input have at most one computation path from the start configuration to any other configuration. ReachFewL, a natural generalization of ReachUL, is the class of problems decided by nondeterministic log-space machines which on every input have at most polynomially many computation paths from the start configuration to any other configuration. We show that ReachFewL = ReachUL.
1
Introduction
A nondeterministic machine is said to be unambiguous if for every input there is at most one accepting computation. UL is the class of problems decided by unambiguous log-space nondeterministic machines. Is this restricted version of log-space nondeterminism powerful enough to capture general log-space nondeterminism (the complexity class NL)? Recent research gives ample evidence to believe that the conjucture NL = UL is true [ARZ99, RA00, BTV09, TW09]. However, researchers are yet to find a proof of this equality. This paper considers a restricted version of log-space unambiguity called reach-unambiguity. A nondeterministic machine is reach-unambiguous if, for any input and for any configuration c, there is at most one path from the start configuration to c. (The prefix ‘reach’ in the term indicates that the property should hold for all configurations reachable from the start configuration). ReachUL is the class of languages that are decided by log-space bounded reach-unambiguous machines [BJLR91]. ReachUL is a natural and interesting subclass of UL. As defined, ReachUL is a ‘semantic’ class. However, unlike most other semantic classes, ReachUL has a complete problem [Lan97]. In particular, Lange showed that the directed graph reachability problem associated with reach-unambiguous computations is
This author is supported in part by NSF grant CFDA#47.076 and AFOSR grant FA9550-10-1-0406. This author is supported in part by NSF grants CCF-0916525 and DMS-0914815. This author is supported in part by NSF grant CCF-0916525. This author is supported in part by NSF grant CCF-0916525.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 252–258, 2011. c Springer-Verlag Berlin Heidelberg 2011
ReachFewL = ReachUL
253
ReachUL-complete. Subsequently Allender and Lange showed that this reachability problem can be solved deterministically in space O(log2 n/ log log n) which is asymptotically better than Savitch’s O(log2 n) bound for the general reachability problem [AL98]. ReachUL is also known to be closed under complement. The notion of fewness is a natural generalization of unambiguity that is of ` interest to researchers [BJLR91, BDHM92, AJ93, BHS93, All06, PTV10]. Since an unrestricted log-space nondeterministic machine can have exponential number of accepting computations, few here means polynomially many. FewL is the class of problems decided by nondeterministic log-space machines which on any input have at most polynomial number of accepting computations. Thus FewL extends the class UL in a natural way. The analogus extension of ReachUL is the class ReachFewL – the class of problems decided by nondeterministic log-space machines which on any input have at most polynomial number of computation paths from the start configuration to any configuration (not just the accepting configuration). Can fewness be simulated by unambiguity? In particular, is FewL = UL? This is an interesting open question and a solution is likely to have implications on the NL versus UL question. In this paper we show that for reach-unambiguity, it is indeed the case that fewness does not add any power to unambiguity for log-space computations. Theorem 1 (Main Theorem). ReachFewL = ReachUL This theorem improves a recent upper bound that ReachFewL ⊆ UL ∩ coUL shown in [PTV10]. We combine several existing techniques to prove our main result. In Section 2, we prove certain necessary results to prove the Theorem 1. In Section 3, we prove Theorem 1.
2
Definitions and Necessary Results
We begin by defining graph properties which characterize the configuration graphs of reach-unambiguous computations. Given a Turing machine M and an input x of M , let GM,x denote the configuration graph of M on x. Let M (x) denote the computation of M on x. Definition 1. Let G be a graph, s be a vertex in G and k be an integer. We say that G is k-reach-unambiguous with respect to s if for all vertices x ∈ V (G), there are at most k paths from s to x. If k = 1, we say G is reach-unambiguous with respect to s. Definition 2. A language L is in ReachUL if L is accepted by a nondeterministic log-space Turing machine M such that, on any input x, GM,x is reachunambiguous with respect to the start configuration. Definition 3. A language L is in ReachFewL if L is accepted by a nondeterministic log-space Turing machine M such that, for some polynomial q and for any input x, GM,x is q(|x|)-reach-unambiguous with respect to the start configuration.
254
B. Garvin et al.
We now state certain critical properties of ReachUL that we use in the proof of Theorem 1. Lange proved that the associated graph reachability problem is complete for ReachUL [Lan97]. Define, Lru = {G, s, t | G is a directed graph, there is a path from s to t, G is reach-unambiguous with respect to s}. Theorem 2 ([Lan97]). Lru is complete for ReachUL. The difficult part in the completeness proof is to show that Lru is in ReachUL. Lange designed a clever ReachUL-algorithm that checks whether a graph is reachunambiguous with respect to the start vertex. We also need the fact that ReachUL is closed under complement [BJLR91]. Proposition 1 ([BJLR91]). ReachUL is closed under complement. 2.1
ReachUL as an Oracle
We first show that a log-space algorithm that queries a ReachUL language can be simulated in ReachUL. Given the fact that ReachUL is closed under complement, this is easy to prove. We give a sketch of the proof here. Lemma 1. LReachUL = ReachUL Proof. The containment ReachUL ⊆ LReachUL is immediate. Let L be a language in LReachUL decided by a log-space oracle Turing machine M with access to a ReachUL oracle O. Since ReachUL is closed under complement, we can assume without loss of generality that O is accepted by a reach-unambiguous Turing machine N (a Turing machine whose configuration graph on any input is reachunambiguous) with three types of halting configurations: ‘accept’, ‘reject’, and ‘?’ so that for any input y (1) if y ∈ O then there is a unique computation path that leads to an ‘accept’ configuration and all other computation paths lead to a ‘?’ configuration and (2) if y ∈ O then there is a unique computation path that leads to a ‘reject’ configuration and all other computation paths lead to a ‘?’ configuration. Moreover, since O ∈ ReachUL, on any input, there is at most one path from the start configuration to any other configuration of N . Consider the nondeterministic machine M which on an input x, simulates M (x) until a query configuration is reached with a query, say y. At this point M will save the current configuration of M and simulate N (y) until it halts. If N (y) accepts y, then M continues with the simulation of M with YES as the answer to the query y; if N (y) rejects y, then M continues with the simulation of M with NO as the answer the query y; and if N (y) reaches a ‘?’ halting configuration then, M rejects the computation and halts. Finally M accepts x if and only if M accepts x. It is straightforward to verify that M (x) accepts if and only if M (x) accepts and GM ,x is reach-unambiguous with respect to the start configuration.
ReachFewL = ReachUL
2.2
255
Converting Graphs with a Few Paths to Distance Isolated Graphs
Definition 4. Let G be a graph on n vertices and s be a vertex of G. We say that G is distance isolated with respect to s, if for every vertex v ∈ V (G) and weight d ∈ {1, . . . , n}, there is at most one path of weight d from s to v. It is straight forward to extend this definition to graphs with positive integer weights on its edges. We use the well known hashing result due to Fredman, Koml´ os and Szemer´edi to convert a graph with polynomially many paths to a distance isolated graph. Theorem 3 ([FKS84]). For every constant c there is a constant c so that for every set S of n-bit integers with |S| ≤ nc there is a c log n-bit prime number p so that for any x = y ∈ S x ≡ y (mod p). The next lemma follows easily from Theorem 3. Lemma 2. Let G be a graph on n vertices and s be a vertex of G. Let E(G) = {e1 , e2 , . . . , e } be the set of edges of G. Let q be a polynomial. If G is q(n)reach-unambiguous with respect to s, then there is a prime p ≤ nk , for some constant k, such that the weight function wp : E(G) → {1, . . . , p} given by wp (ei ) = 2i (mod p) defines a weighted graph Gwp which is distance isolated with respect to s. The graph Gwp in Lemma 2 can be converted to an unweighted, distance isolated graph by replacing an edge having weight by a path of length . 2.3
Converting Distance Isolated Graphs to Unambiguous Graphs
Given a distance isolated graph, we can form a reach-unambiguous graph by applying a standard layering transformation. Definition 5. Let G be a directed graph on n vertices. The layered graph lay(G) induced by G is the graph on vertices V (G) × {0, 1, . . . , n} and for all edges (x, y) of G and i ∈ {0, 1, . . . , n − 1}, the edge (x, i) → (y, i + 1) is in lay(G). Lemma 3. If G is an acyclic and distance isolated graph with respect to a vertex s, then lay(G) is reach-unambiguous with respect to (s, 0), and there is a path of length d from s to v in G if and only if there is a path from (s, 0) to (v, d) in lay(G). Proof. Since all edges in lay(G) pass between consecutive layers, paths of length d from s to v in G are in bijective correspondence with paths from (s, 0) to (v, d) in lay(G). Since there exists at most one path of each length from s to any vertex v in G, there exists at most one path from (u, 0) to any other vertex (v, d) in lay(G).
256
3
B. Garvin et al.
ReachFewL = ReachUL
We have sufficient tools to prove Theorem 1. Theorem 4. ReachFewL ⊆ ReachUL. Proof. Let L be a language in ReachFewL. Then there is a constant c and a nondeterministic log-space machine M deciding L, so that GM,x has at most nc paths from the start configuration to any other configuration. Let s be the vertex corresponding to the start configuration and t be the vertex corresponding to the accepting configuration (without loss of generality we can assume that there is a single accepting configuration for a ReachFewL computation) in GM,x . We need to decide whether there is a path from s to t. The algorithm ReachFewSearch(G, s, t) given in Algorithm 1 is a log-space algorithm that queries the ReachUL complete languages Lru defined in Section 2 and decides whether there is a path from s to t. This gives the inclusion ReachFewL ⊆ LReachUL . Since LReachUL equals ReachUL by Lemma 1, the theorem follows. For the constant c, let c be the constant given by Theorem 3.
Input: (G, s, t) such that G has at most nc paths from s to any other vertex. Output: If there is a path from s to t in G output True, else output False. foreach p ∈ {1, . . . , nc } such that p is a prime do Define wp (ei ) = 2i (mod p); Construct Gwp ; Construct lay(Gwp ); foreach d ∈ {1, . . . , |V (Gwp )|} do if lay(Gwp ), (s, 0), (t, d) ∈ Lru then return True; end return False; end return False; Algorithm 1. ReachFewSearch(G, s, t)
We say that a prime p is good if Gwp is distance isolated. By Lemma 2, there exists a good prime p ∈ {1, . . . , nc }. For this good prime, lay(Gwp ) is reachunambiguous with respect to (s, 0) by Lemma 3. Moreover, there is a path from s to t in G, if and only if there is a d such that there is a path from (s, 0) to (t, d). So for this good prime lay(Gwp ), (s, 0), (t, d) ∈ Lru and the algorithm accepts. Note that for a prime p that is not good, lay(Gwp ) will not be reach-unambiguous and lay(Gwp ), (s, 0), (t, d) ∈ Lru for any d.
ReachFewL = ReachUL
4
257
Discussion
Allender and Lange showed that ReachUL ⊆ DSPACE(log2 n/ log log n) [AL98]. It is not clear how to directly extend this upper bound to ReachFewL. However our main result implies the same upper bound for the reachability problem associated with ReachFewL. Corollary 1. The s-t reachability problem over graphs with a promise that there are at most polynomially many paths from s to any other vertex can be solved in deterministic space O(log2 n/ log log n). Can we show that FewL = UL? Reinhardt and Allender [RA00] showed that the reachability problem for graphs where there is a unique minimum length path from the source to any other vertex can be solved in UL. Given the configuration graph G of a FewL computation, the hashing lemma implies that there exists a small prime p so that in Gwp all the paths from the start configuration to the accepting configuration will be of distinct weights. This implies that Gwp have a unique minimum length path between this pairs of configurations. However, the UL algorithm mentioned above requires that the input graph has a unique minimum length path from the start vertex to any other vertex; not just the terminating vertex. Managing this gap appears to be a serious technical difficulty for showing FewL=UL. Acknowledgement. We would like to thank Eric Allender for pointing to an error in an earlier version of the paper. We would also like to thank Tyler Seacrest for discussions in the Advanced Complexity course which led to the result in this paper.
References ` [AJ93]
` Alvarez, C., Jenner, B.: A very hard log-space counting class. Theoret. Comput. Sci. 107, 3–30 (1993) [AL98] Allender, E., Lange, K.-J.: RUSPACE(log n) ⊆ DSPACE(log2 n/ log log n). Theory of Computing Systems 31, 539–550 (1998); Special Issue Devoted to the 7th Annual International Symposium on Algorithms and Computation (ISAAC 1996) [All06] Allender, E.: NL-printable sets and nondeterministic Kolmogorov complexity. Theor. Comput. Sci. 355(2), 127–138 (2006) [ARZ99] Allender, E., Reinhardt, K., Zhou, S.: Isolation, Matching, and Counting Uniform and Nonuniform Upper Bounds. Journal of Computer and System Sciences 59(2), 164–181 (1999) [BDHM92] Buntrock, G., Damm, C., Hertrampf, U., Meinel, C.: Structure and importance of logspace-mod class. Mathematical Systems Theory 25(3), 223–237 (1992) [BHS93] Buntrock, G., Hemachandra, L.A., Siefkes, D.: Using inductive counting to simulate nondeterministic computation. Information and Computation 102(1), 102–117 (1993)
258
B. Garvin et al.
[BJLR91]
[BTV09]
[FKS84] [Lan97]
[PTV10] [RA00] [TW09]
Buntrock, G., Jenner, B., Lange, K.-J., Rossmanith, P.: Unambiguity and fewness for logarithmic space. In: Budach, L. (ed.) FCT 1991. LNCS, vol. 529, pp. 168–179. Springer, Heidelberg (1991) Bourke, C., Tewari, R., Vinodchandran, N.V.: Directed planar reachability is in unambiguous log-space. ACM Transactions on Computation Theory 1(1), 1–17 (2009) Fredman, M.L., Koml´ os, J., Szemer´edi, E.: Storing a sparse table with O(1) worst case access time. J. ACM 31(3), 538–544 (1984) Lange, K.-J.: An unambiguous class possessing a complete set. In: Reischuk, R., Morvan, M. (eds.) STACS 1997. LNCS, vol. 1200, pp. 339–350. Springer, Heidelberg (1997) Pavan, A., Tewari, R., Vinodchandran, N.V.: On the power of unambiguity in logspace (2010); To appear in Computational Complexity Reinhardt, K., Allender, E.: Making nondeterminism unambiguous. SIAM Journal of Computing 29(4), 1118–1131 (2000) Thierauf, T., Wagner, F.: Reachability in K3,3 -free graphs and K5 -free graphs is in unambiguous log-space. In: Kutylowski, M., Charatonik, W., M. (eds.) FCT 2009. LNCS, vol. 5699, pp. 323–334. Springer, Gebala, Heidelberg (2009)
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment with Resource Augmentation Yuichi Asahiro1 , Kenta Kanmera2, and Eiji Miyano2 1
2
Department of Information Science, Kyushu Sangyo University, 2-3-1 Matsukadai, Higashi-ku, Fukuoka 813-8503, Japan [email protected] Department of Systems Design and Informatics, Kyushu Institute of Technology, 80-4 Kawazu, Iizuka, Fukuoka 820-8502, Japan [email protected], [email protected]
Abstract. This paper studies the online Orthogonal Variable Spreading Factor (OVSF) code assignment problem with resource augmentation introduced by Erlebach et al. in [8]. We propose a (1 + ε)-competitive algorithm with help of (1+1/ε) lg∗ h trees for the height h of the OVSF code tree and any constant 0 < ε ≤ 1. In the case of ε = 1, we obtain a 2-competitive algorithm with 2 lg∗ h trees, which substantially improves the previous resource of 3h/8 + 2 trees shown by Chan et al. in [2].
1
Introduction
Orthogonal Variable Spreading Factor (OVSF) codes are utilized in Wideband Code-Division Multiple-Access (CDMA) systems to support the different data rates of multimedia services. In the OVSF-CDMA systems, the codewords assigned to call requests must be orthogonal to each other, and have different lengths and different spreading factors, where a higher data rate is achieved by using a lower spreading factor. The recursive generation of the OVSF code can be represented by a complete binary tree of height h, commonly called an OVSF code tree. Each node in the OVSF code tree corresponds to a codeword, and hence we use the words “node” and “codeword” interchangeably. The root, which is at the level h, is associated with the codeword 1. If a node has codeword c, then its left and right children have codewords cc and cc, respectively, where c is the complement of c. The leaves of the OVSF code tree are of level 0, and thus have 2h codewords, each of which has 2h bits long. In the OVSF-CDMA systems, when a new call request arrives, we need to allocate a node for it so that the new codeword and all the assigned codewords so far are mutually orthogonal, i.e., in any path from the root to a leaf of the OVSF code tree, there is at most one assigned node. In [8], Erlebach, Jacob, Mihal´ ak, Nunkesser, Szab´ o and Widmayer originally proposed the online version of the problem, called the online OVSF code assignment problem. In this problem, a sequence of assignment/release requests which have to be served is given in online manner, where an assignment request with an integer 0 ≤ ≤ h is served by B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 259–270, 2011. c Springer-Verlag Berlin Heidelberg 2011
260
Y. Asahiro, K. Kanmera, and E. Miyano v0 v1 R1
v2 R2
v0
v3
v1
R3
R1
v2
v0
v3
v1
R3
R1
v2
v3
R3
v0 v1 R1
v2
v3
R4
R3
Fig. 1. Reassignment
assigning a node at the th level of the OVSF code tree at cost 1, and a release request is served by releasing a specified assigned node from the OVSF code tree at cost 0. The node assignments have to guarantee that no two assigned nodes are on the same root-to-leaf path, and hence in order to serve a new assignment request it might be necessary to reassign some already assigned node to another node of the same level at cost 1. Suppose, for example, that three assignment requests R1 , R2 and R3 of the bottom level arrive in this order, and nodes v1 , v2 and v3 are respectively assigned to them as shown in Fig. 1(1). Then, a release request for v2 arrives and v2 is released (Fig. 1(2)). Next, an assignment request R4 of the second level arrives, but no node can be assigned to R4 under the mutually orthogonal constraint. If v3 is reassigned to v2 for the request R3 (Fig. 1(3)), then v0 can be assigned to R4 (Fig. 1(4)). The cost of an algorithm is defined as the total number of assignments and reassignments the algorithm requires. The problem is to find a sequence of assignments/reassignments to serve the whole sequence of requests so that the cost is minimized. The cost of the online algorithms is measured by the competitive analysis. The competitive ratio of an online algorithm ALG is defined by the worst-case ratio between the costs incurred by ALG and an optimal offline algorithm. If the competitive ratio of ALG is σ, then we say that ALG is σ-competitive. Note that the OVSF code tree of height h has the bandwidth of 2h , and an assigned node at level consumes a fraction of 1/2 of the bandwidth, i.e., bandwidth of 2h− . In this paper, we assume that the consumed bandwidth of assigned nodes at any moment does not exceed the total bandwidth of 2h . Also, without loss of generality, assume that there are no assignment requests of level h. Thus, the online algorithms are expected to accept all the assignment requests, if necessary, by using codeword-reassignment operations. Since the assignment cost is indispensable to serve assignment requests, the goal is to design an assignment scheme that ensures the number of reassignments required is as small as possible. The online OVSF code assignment problem has a variety of applications, for example, to wireless communications and memory management problems, and thus has been studied extensively in recent years (see a short survey [3] for more details and references). Mainly two variants are considered in the literature, the problems with and without resource augmentation. Erlebach et al. [8] first gave an O(h)-competitive algorithm, and showed that no deterministic online algorithm achieves a competitive ratio better than 1.5 for the problem without resource augmentation. By subsequent improvements in [9,4,11,5], the current best known upper and lower bounds for the competitive ratio of the problem without resource augmentation are 6 [5] and 2 [11], respectively.
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment
261
In this paper, we focus on the online OVSF code assignment problem in the resource augmentation model of competitive analysis. The resource augmentation was introduced by Kalyanasundaram and Pruhs in [10] as a method for analyzing online scheduling problems. Then, in the last decade it has become a very popular technique, and thus has been applied to a lot of problems in scheduling, paging, bin packing, and so on (e.g., [12,1,7]). In the resource augmentation model, we compare the performance of an online algorithm to that of the optimal offline algorithm in an unfair way. In the online OVSF code assignment problem, we assume that the optimal offline algorithm uses one main tree of height h while the online algorithm can use k ≥ 1 trees in total, one main tree of height h and k − 1 additional trees of height h. The goal is still to minimize the cost, i.e., the total number of assignments and reassignments the algorithm requires. Clearly, there is a trade-off between the competitive ratio and the number of required trees; the more trees are available, the smaller competitive ratio we can obtain. The resource augmentation model of the online OVSF code assignment problem was also first introduced in [8]; Erlebach et al. showed that a 4-competitive algorithm can be designed if two code trees of height h are available. In [6], Chin, Zhang, and Zhu provided a 5-competitive algorithm with 9/8 trees, one tree of height h and one tree of height h − 3. Very recently, Chan, Chin, Ting, Thang [2] proved that if reassignments are not allowed, any online algorithm requires at least (h + 1)/2 trees to handle all the sequences of assignment/release requests without rejection, and gave a 1-competitive algorithm that uses (h + 1)/2 trees. That is, it is optimal in terms of the number of trees, and does not need any reassignments. Also, Chan et al. [2] gave a 2-competitive online algorithm with 3h/8+2 trees, which pays one assignment cost for each assignment request and at most one reassignment cost for each release request. Furthermore, they showed that there is an amortized (4/3 + δ)-competitive algorithm with (11/4 + 4/(3δ)) trees for any 0 < δ ≤ 4/3 if it is not necessary to bound the incurred cost for individual requests to a constant. The goal of this paper is to give a resource-augmented online algorithm which has a small constant competitive ratio less than 2 and uses less additional trees to improve on previous results. We propose a (1 + 1/α)-competitive algorithm with help of (1 + α) lg∗ h trees of height h for any α ≥ 1. The algorithm bounds the cost for individual requests to a constant. More precisely, it requires one assignment cost per each assignment request, and at most one reassignment cost per α release requests (i.e., ε 1/α cost per release request on average). For example, by setting α = 1, we obtain a 2-competitive algorithm with 2 lg∗ h trees, which substantially improves the previous resource of 3h/8 + 2 trees shown in [2]. Furthermore, the range of α ≥ 3 in particular gives us a new trade-off between the competitive ratio and the resource augmentation.
2
Preliminaries
For simplicity, by (sub)trees we mean complete binary (sub)trees in the remaining parts. For example, if three subtrees of height h − 1 can be used to serve
262
Y. Asahiro, K. Kanmera, and E. Miyano
requests, then we consider that 1/2 × 3 = 3/2 trees of height h are available since the bandwidth of the tree of height h − 1 is the half size of the tree of height h. For a leaf node v, its level l(v) is 0. For a non-leaf node v, its level l(v) is defined as l(u) + 1, where u is a child node of v. An available bandwidth abw(v) of a node v is 2l(v) . A node v is assigned if v is assigned to an assignment request and it has not been released. A node v is said to be free if there are no assigned nodes in every root-to-leaf path containing v. Assume that an online algorithm always satisfies the mutually orthogonal constraint, i.e., no two assigned nodes lie on a single path from the root to a leaf. In the following, we describe conditions of a (sub)tree by three colors, white, black, and gray: A (sub)tree T is said to be white if every node in T is free, black if there are no free nodes in T , and gray if T is neither white nor black. For a (sub)tree T , A(T ) denotes a set of assigned nodes in T . Also for a set of (sub)trees S, A(S) denotes a set of all the assigned nodes in the trees in S. An available bandwidth abw(T ) of a (sub)tree T of height h h can be regarded as the bandwidth of its root node, which is 2 . The available bandwidth abw(S) of a set S of (sub)trees is defined as T ∈S abw(T ). For an assigned node v ∈ A(T ) of level (v) in a (sub)tree T , its consumed bandwidth cbw(v) is 2(v) . Thus, the consumed bandwidth of a (sub)tree T is defined as or cbw(T ). For a set S of v∈A(T ) cbw(v), and will be denoted by cbw(A(T )) trees, the total consumed bandwidth cbw(S) of S is T ∈S cbw(T ). Let lg n be the binary logarithm, i.e., lg n = log2 n. Let f (i) (n) denote the function f (n) iteratively applied i times to an initial value of n. For example, lg(3) n = lg lg lg n. We use the notation lg∗ n to denote the iterated binary logarithm, which is defined as lg∗ n = min{i ≥ 0 | lg(i) n ≤ 1}. For the height h of the original code tree, let 0 be h and i be lg(i) h for 1 ≤ i ≤ lg∗ h, ∗ that is, 1 = lg(1) h, 2 = lg(2) h, . . ., lg∗ h−1 = lg(lg h−1) h(= 2), and ∗ lg∗ h = lg(lg h) h(= 1). Let i-subtree denote a subtree having height h − i − 1. In this paper, we assume the following two restrictions on the input, which are introduced in the previous research [2,6,7]. The first assumption guarantees that an optimal offline algorithm consumes bandwidth at most 2h only in the original code tree, which is usual in the resource augmentation models. Also, the second assumption is not so strong; if an assignment request of level h arrives, all the nodes in the original code tree must be free, namely, all the nodes assigned so far have been released, because the available bandwidth of the original code tree is just 2h . This implies that we can divide the input sequence into subsequences between such requests of level h, each of which can be independently solved. Assumption 1. The total consumed bandwidth of assigned nodes is always at most 2h . Assumption 2. There is no assignment request of level h in the input sequence.
3
2-Competitive Algorithm with 2 lg∗ h Trees
In this section, we design a 2-competitive algorithm ALG1 which uses 2 lg∗ h trees of height h. The key strategies of the algorithm can be summarized as follows:
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment
263
(i) We first divide the levels from 0 through h − 1 into lg∗ h groups. (ii) We prepare a lot of subtrees of a certain height for each group of levels. Every subtree is shareable among assignment requests within the group of levels, but it must be exclusively used only for a single level; once an assignment request of the ith level is served by a subtree, any node of the subtree cannot be assigned to an assignment request of the different level until all the already assigned nodes are released. Although the number of subtrees and their height will be specified later, the total available bandwidth of subtrees is (at most) 2 × 2h for each group of levels. In other words, two trees of height h are available for each group of levels. (iii) Reassignment is done at most once per one release request. In Sec. 3.1, we explain the group partition and the sizes of subtrees before describing the algorithm. In the algorithm, we put labels on the subtrees that represent color-conditions, white, black, or gray, of the subtrees and change their labels according to processed requests, which is explained in Sec. 3.2. Then, Sec. 3.3 shows a description of the algorithm ALG1 and its competitive ratio. 3.1
Preparation of Subtrees
We first partition the levels into lg∗ h groups: Lj = {i | h − j−1 ≤ i ≤ h − j − 1} for 1 ≤ j ≤ lg∗ h − 1, and Llg∗ h = {h − 2, h − 1}. For example, if h = 7, then 0 = 7, 1 = lg 7 = 3, and 2 = lg lg 7 = 2, that derives L1 = {0, 1, 2, 3}, L2 = {4}, and L3 = {5, 6}. To handle the requests of level i ∈ Lj for 1 ≤ j ≤ lg∗ h − 1, we prepare a set Tj of (j−1 − j ) + 2j +1 j-subtrees to be shared among levels in Lj . The number of subtrees comes from the following facts: (j−1 − j ) is equal to the number of levels in Lj , which is at most 2j +1 (we will see it in the proof of Lemma 1), and the total available bandwidth of 2j +1 j-subtrees is equal to 2h (i.e., the bandwidth of the tree of height h). For the highest group Llg∗ h of levels, we use two trees Th−1 and Th−2 of height h to handle the requests of levels h − 1 and h − 2, respectively. We note here that the original code tree is used as either of the two trees of height h for these two levels. The lemma below gives an upper bound of the number of trees of height h we prepared. Lemma 1. The number of available trees of height h is at most 2 lg∗ h. Proof. First we observe that j−1 ≤ 2j +1 for 1 ≤ j ≤ lg∗ h − 1 by the fact lg j−1 = lglg(j−1) h ≤ lg(2 lg(j−1) h) = lg(j) h + 1 ≤ lg(j) h + 1 = j + 1. Let us add up the total available bandwidth abw(Tj ) for a group Lj . Since we have (j−1 − j ) + 2j +1 j-subtrees of height h − j − 1 in Tj , the total available bandwidth abw(Tj ) prepared for Lj is as follows: abw(Tj ) = ((j−1 − j ) + 2j +1 ) · 2h−j −1 < j−1 · 2h−j −1 + 2h ≤ 2j +1 · 2h−j −1 + 2h ≤ 2h+1 ,
264
Y. Asahiro, K. Kanmera, and E. Miyano
where the second inequality comes from the fact j−1 ≤ 2j +1 mentioned in the above. That is, two trees of height h are prepared for each of log∗ h − 1 groups, L1 through Llog∗ h−1 . Since two trees of height h are used for serving requests in Llg∗ h , the total number of trees of height h that Algorithm ALG1 can be used is at most (lg∗ h − 1) · 2 + 2 = 2 lg∗ h. 3.2
Labeling Subtrees
The algorithm ALG1 puts and erases a label on each j-subtree in Tj ’s in order to represent its color-condition, white, gray or black. Also the label of a j-subtree represents which level of assignment requests is currently served by it, where only a single level of assignment requests is exclusively served by a black or gray j-subtree until its current label is erased. Initially, all the j-subtrees in Tj ’s do not have any labels since they are white. We use two types of labels for a jsubtree in Tj ’s. Label Bi,k : the j-subtree is exclusively used for a single level i, and is black. Also, it is the kth black j-subtree in Tj .1 Label Gi : the j-subtree is exclusively used for a single level i, and is gray. We may simply write a j-subtree Bi,k (or Bi,k only) and a j-subtree Gi (or Gi only), instead of writing “a j-subtree having label Bi,k ” and “a j-subtree having label Gi ,” respectively. Let the current number of black and gray j-subtrees used for a level i in Tj be denoted by bi and gi , respectively. In addition, wj denotes the number of white j-subtrees in Tj . Recall that wj + i∈Lj (bi + gi ) = |Tj | = (j−1 − j ) + 2j +1 as described before. As shown in Observation 1 later, it holds gi ∈ {0, 1} for any i ∈ Lj in the execution of ALG1 . This is the reason why it is sufficient to use only one label Gi representing the color gray for each level i. The values of bi ’s, gi ’s and wj ’s vary (increase or decrease) during the execution of the algorithm ALG1 , e.g., a white j-subtree becomes gray by assigning a node to a request, a black j-subtree becomes gray by releasing an assigned node, and so on. The algorithm needs to maintain those changes. At the end of processing each request, the algorithm updates the labels of j-subtrees as well as the values of bi ’s, gi ’s and wj ’s. There are seven types of update operations, according to change of the color-condition of a j-subtree T : – White j-subtree T becomes black by assigning a node at level i to a request: Put the label Bi,bi +1 to T , wj := wj − 1, and bi := bi + 1. – White j-subtree T becomes gray by assigning a node at level i to a request: Put the label Gi to T , wj := wj − 1, and gi := 1. – Black j-subtree T having label Bi,k becomes white: Erase the label Bi,k from T , relabel the j-subtree Bi,bi to Bi,k if bi ≥ 2 and k = bi , bi := bi − 1, and wj := wj + 1. – Black j-subtree T having label Bi,k becomes gray: Change the label Bi,k to Gi , relabel the j-subtree Bi,bi to Bi,k if bi ≥ 2 and k = bi , gi := 1, and bi := bi − 1. 1
The algorithm ALG1 does not care about the order of black j-subtrees, but we use the subscript k’s to distinguish black j-subtrees in the explanation of the paper.
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment
265
– Gray j-subtree T having label Gi becomes white: Erase the label Gi from T , gi := 0, and wj := wj + 1. – Gray j-subtree T having label Gi becomes black: Change the label Gi to Bi,bi +1 , gi := 0, and bi := bi + 1. – The color-condition of T does not change: Do nothing. One can see that these update operations can be done in constant time. We refer this update operation by Update1 (T ) in the description of ALG1 . As seen in the above, if T is black, Update1 (T ) may relabel j-subtree Bi,bi as well as T . 3.3
Algorithm ALG1
According to the level of a request, the algorithm ALG1 chooses an appropriate procedure among the ones in the following; one procedure is designed for each Lj . If the level of a request is h − 1 or h − 2, the algorithm is simple: Algorithm ALG1 for level i ∈ {h − 1, h − 2} (= Llg∗ h ) Assignment request R of level i : Assign a free node at level i in the tree Ti of height h to R. Release request R of level i : Release the node assigned to R. For requests of levels in Lj (1 ≤ j ≤ lg∗ h − 1), the algorithm works as follows. Algorithm ALG1 for level i ∈ Lj Assignment request R of level i : One of the following is processed depending on the value of gi . Case A1 (gi = 1): Assign a free node at level i in Gi to R, and then call Update1 (Gi ). Case A2 (gi = 0): Pick any one of white j-subtree T ∈ Tj and assign a free node at level i in it to R. Then call Update1 (T ). Release request R of level i : Release the node u assigned to R (by which u becomes free). Let T denote the j-subtree that u belongs. Then one of the following is processed depending on the value of gi . Case R1 (gi = 1): This case is further divided into two subcases. (i) If T has label Bi,k for some k, then choose an assigned node v at level i from Gi , and reassign the new free node u to the request served by v. Then call Update1 (Gi ). (ii) If T has label Gi , then call Update1 (Gi ). Case R2 (gi = 0): Call Update1 (T ).
266
Y. Asahiro, K. Kanmera, and E. Miyano B3,1
v1
level 3
level 2
B2,1
v2
set T1 of 1-subtrees for group L1 (h = 7)
v3
v4
B1,1
level 1 v8
v9 v10
v6
G2
v7
G1 v11 v12
v13 v14
v15
G0
level 0
v16
B2,2 v5
v18 v17
v20
v22
v19 v21
v23
Fig. 2. Algorithm ALG1 ’s behavior
Figure 2 shows an example behavior of the algorithm ALG1 . For example, if the height h of the OVSF code tree is seven, then we prepare a set T1 consisting of 20 (= (0 − 1 ) + 21 +1 = (7 − 3) + 24 ) 1-subtrees of height 3 (= h − 1 − 1) for the lowest group L1 . Algorithm ALG1 works as follows: (1) Suppose that there are 19 assignment requests, one request of level 3, five requests of level 2, six requests of level 1, and seven requests of level 0. Also, suppose that there are four release requests for node v12 of level 1, and nodes v17 , v19 , v20 of level 0. Then, the current assigned nodes are filled in black shown in the figure. Levels 3, 2, 1 and 0 have one black 1-subtree B3,1 , two black 1-subtrees B2,1 , B2,2 and one gray G2 , one black B1,1 and one gray G1 , and one gray G0 , respectively. There still exist thirteen white 1-subtrees (i.e., w1 = 13) although those are not shown in the figure. (2) Furthermore, suppose that a release request for v4 of level 2 arrives. Then, v4 is released, and ALG1 processes Case R1-(i), i.e., v6 in the gray 1-subtree G2 is reassigned to v4 ’s position. Since the gray 1-subtree G2 becomes white, the label G2 is erased, g2 and w1 are set to 0 and 14, respectively. (3) For example, if an assignment request of level 3 arrives at this time, then the algorithm ALG1 processes Case A2: A new white 1-subtree is selected, its root node is assigned to the request, and then the 1-subtree is labeled B3,2 . The value of w1 decreases by one, and b3 is set to two. We show that ALG1 can always find a free node in the prepared trees for an assignment request. Some of proofs are by contradiction based on Assumption 1. For levels h − 1 and h − 2, the following lemma holds (its proof is omitted).
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment
267
Lemma 2. For i ∈ {h − 1, h − 2}, when an assignment request R of level i arrives, there is always a free node at level i in Ti . For levels lower than h − 2, we first make an observation on the number gi of gray j-subtrees used for level i in Tj since ALG1 assumes gi ∈ {0, 1} (details are omitted). Observation 1. For i ∈ Lj (1 ≤ j ≤ lg∗ h − 1), it always holds gi ∈ {0, 1}. Now we can show the following lemma which guarantees that ALG1 can always find a free node to serve an assignment request. Lemma 3. Consider the time when an assignment request R of level i ∈ Lj arrives. Then, either the following (i) or (ii) is satisfied, i.e., ALG1 can always find a free node for the assignment request R: (i) There exists a gray j-subtree having label Gi in Tj . (ii) There remains a white j-subtree in Tj . Proof. Let us assume the following for contradiction: (A3) There is no gray jsubtree labeled Gi and remains no white j-subtree in Tj . Then, the number of gray j-subtrees in Tj is at most j−1 − j − 1 since gk is at most one for every k ∈ Lj , k = i, as shown in Observation 1, and |Lj | = j−1 −j . By the assumption (A3), the other 2j +1 + 1 j-subtrees in Tj must be black. Since the bandwidth of the j-subtree is 2h−j −1 , the total consumed bandwidth of those black j-subtrees is (2j +1 + 1) × 2h−j −1 > 2h , which contradicts Assumption 1. Therefore, there must exist either an assignable white j-subtree or the gray j-subtree Gi in Tj whenever the assignment request R of level i ∈ Lj arrives. Finally, we obtain the following theorem. Theorem 1. ALG1 is 2-competitive and needs at most 2 log∗ h trees of height h. Proof. (The number of trees) The number of trees of height h is 2 lg∗ h as calculated in Lemma 1. (Correctness) Lemma 3 guarantees that ALG1 can always find a free node for an assignment request. Also, it is obvious that ALG1 can process release requests. (Competitive ratio) For each assignment request, ALG1 assigns a free node to the request and does not reassign any node. On the other hand, at most one reassignment is done per one release request in Case R1-(i). Therefore the total cost is at most n + m, where n and m are the numbers of assignment and release requests in the input sequence, respectively. Since the cost of an optimal offline algorithm is at least n and it holds m ≤ n, the competitive ratio of ALG1 is at most (n + m)/n ≤ 2.
4
(1 + 1/α)-Competitive Algorithm with (1 + α) lg∗ h Trees
In this section, we extend the 2-competitive algorithm ALG1 to a (1 + 1/α)competitive algorithm ALGα for any α > 1. The main new idea of ALGα is that at most one reassignment is done per α release requests, while at most one reassignment is done per one release request in ALG1 . The procedure of ALGα for levels h − 1 and h − 2 is exactly the same as that of ALG1 .
268
4.1
Y. Asahiro, K. Kanmera, and E. Miyano
Preparation of Subtrees
For levels lower than h−2, one of the modifications to ALG1 is that ALGα prepares a set Tj of α(j−1 − j ) + 2j +1 j-subtrees for 1 ≤ j ≤ lg∗ h − 1. By this modification, the number of (sub)trees increases (the proof is omitted): Lemma 4. ALGα requires at most (1 + α) lg∗ h trees of height h. 4.2
Labeling Subtrees
Similarly to ALG1 , we put labels to j-subtrees and denote the current number of white j-subtrees in Tj by wj , and the numbers of black and gray j-subtrees exclusively used for level i by bi and gi , respectively. These numbers and labels are updated at the end of each assignment and release process. In execution of ALGα , the number gi of gray j-subtrees may be greater than one, while it is zero or one for ALG1 . Thus, the following labels are put to gray j-subtrees (Label Bi,k for black j-subtrees is the same as in ALG1 ). Label Gi,k : the j-subtree is exclusively used for a single level i, and is gray. The subscript k is determined in the decreasing order of the number of assigned nodes (or, consumed bandwidth) among all gray j-subtrees used for level i in Tj . Namely, it holds |A(Gi,1 )| ≥ |A(Gi,2 )| ≥ · · · ≥ |A(Gi,gi )| > 0, which indicates that cbw(Gi,1 ) ≥ cbw(Gi,2 ) ≥ · · · ≥ cbw(Gi,gi ) > 0. We note here that the subscript k in the label Gi,k ’s is put only for explanation in this paper. The algorithm only needs to sort gray j-subtrees; it does not need to maintain the subscript k’s. This sorting is done when any change of labels on j-subtrees occurs. This maintenance of the decreasing order of gray j-subtrees can be done in constant time for each request by utilizing a list structure. We refer this list of gray j-subtrees used for level i by Di , and its reordering procedure as Reorder(Di ). There are seven types of update operations for labels of a j-subtree T and the numbers bi ’s, gi ’s, and wj ’s, as in ALG1 . We refer the following update procedure for a j-subtree T as Updateα (T ) in the description of ALGα . – White j-subtree T becomes black by assigning a node at level i to a request: Put the label Bi,bi +1 to T , wj := wj − 1, and bi := bi + 1. – White j-subtree T becomes gray by assigning a node at level i to a request: Put the label Gi,gi +1 to T , wj := wj − 1, and gi := gi + 1. – Black j-subtree T having label Bi,k becomes white: Erase the label Bi,k from T , relabel the j-subtree Bi,bi to Bi,k if bi ≥ 2 and k = bi , bi := bi − 1, and wj := wj + 1. – Black j-subtree T having label Bi,k becomes gray: Change the label Bi,k to Gi,gi +1 , call Reorder(Di ), relabel the j-subtree Bi,bi to Bi,k if bi ≥ 2 and k = bi , gi := gi + 1, and bi := bi − 1. – Gray j-subtree T having label Gi,k becomes white: Erase the label Gi,k from T , call Reorder(Di), gi := gi − 1, and wj := wj + 1. – Gray j-subtree T having label Gi,k becomes black: Change the label Gi,k to Bi,bi +1 , call Reorder(Di ), gi := gi −1, and bi := bi +1. – The color-condition of T does not change: Do nothing.
(1 + ε)-Competitive Algorithm for Online OVSF Code Assignment
4.3
269
Algorithm ALGα
The following is the procedure of ALGα for levels lower than h−2. The procedures use one counter ri for each level i, which is initialized to zero at the beginning. Each ri stores the number of release requests that satisfy a condition among all the release requests from the beginning through the current request R. The condition is presented in the description of ALGα below. Algorithm ALGα for level i ∈ Lj Assignment request R of level i : One of the following is processed depending on the value of gi . Case A1 (gi ≥ 1): Assign a free node at level i in Gi,1 to R, and then call Updateα (Gi,1 ). Case A2 (gi = 0): Pick any one of white j-subtree T in Tj and assign a free node at level i in it to R. Then call Updateα (T ). Release request R of level i : Release the node u assigned to R (by which u becomes free). Let T denote the j-subtree that u belongs. Then one of the following is processed depending on gi and the label of T . Case R1 (gi ≥ 1 and T has label Bi,k for some k): Update ri := ri + 1. This case is further divided into two subcases depending on the value of ri . Case R1-(i) (ri mod α = 0): Choose an assigned node v at level i from the j-subtree Gi,gi and reassign the new free node u to the request served by v. Then, call Updateα (Gi,gi ). Case R1-(ii) (ri mod α = 0): Call Updateα (T ). Case R2 (gi ≥ 2 and T has a label in {Gi,1 , . . . , Gi,gi −1 }): Update ri := ri + 1. This case is also divided into two subcases depending on the value of ri . Case R2-(i) (ri mod α = 0): Choose an assigned node v at level i from the j-subtree Gi,gi and reassign a free node of level i in Gi,1 to the request served by v. Then, call Updateα (T ) and Updateα (Gi,gi ). Case R2-(ii) (ri mod α = 0): Call Updateα (T ). Case R3 (gi = 0 or T has label Gi,gi ): Call Updateα (T ). We can show the following lemma which guarantees that ALGα can always find a free node to serve an assignment request (its proof is omitted). Lemma 5. Consider the time when an assignment request R of level i ∈ Lj arrives. Then, either the following (i) or (ii) is satisfied, i.e., ALGα can always find a free node for the assignment request: (i) There is a gray j-subtree having label Gi,1 in Tj . (ii) There remains a white j-subtree in Tj . In Lemmas 4 and 5, the number of required trees and the correctness of ALGα are shown, respectively. Since at most one reassignment is done per α release
270
Y. Asahiro, K. Kanmera, and E. Miyano
requests in Cases R1 and R2, the total cost of ALGα is at most n + m/α, where n and m are the numbers of assignment and release requests in the input sequence, respectively. Since the cost of an optimal offline algorithm is at least n, we obtain the following theorem: Theorem 2. ALGα is (1+1/α)-competitive and requires at most (1+α) log∗ h trees of height h. Acknowledgments. This work is partially supported by KAKENHI, 22700019 and 23500020.
References 1. Albers, S., Arora, S., Khanna, S.: Page replacement for general caching problems. In: 10th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 1999), pp. 31–40 (1999) 2. Chan, J.W.T., Chin, F.Y.L., Ting, H.F., Zhang, Y.: Online tree node assignment with resource augmentation. In: Ngo, H.Q. (ed.) COCOON 2009. LNCS, vol. 5609, pp. 358–367. Springer, Heidelberg (2009) 3. Chan, J.W.T., Chin, F.Y.L., Ting, H.F., Zhang, Y.: Online problems for frequency assignment and OVSF code assignment in wireless communication networks. ACM SIGACT News 40(3), 86–98 (2009) 4. Chin, F.Y.L., Ting, H.F., Zhang, Y.: A constant-competitive algorithm for online OVSF code assignment. Algorithmica 56(1), 89–104 (2010) 5. Chin, F.Y.L., Ting, H.F., Zhang, Y.: Constant-competitive tree node assignment (manuscript) 6. Chin, F.Y.L., Zhang, Y., Zhu, H.: Online OVSF code assignment with resource augmentation. In: Kao, M.-Y., Li, X.-Y. (eds.) AAIM 2007. LNCS, vol. 4508, pp. 191–200. Springer, Heidelberg (2007) 7. Epstein, L., Stee, R.v.: Online bin packing with resource augmentation. Discrete Optimization 4, 322–333 (2007) 8. Erlebach, T., Jacob, R., Mihal´ ak, M., Nunkesser, M., Szab´ o, G., Widmayer, P.: An algorithmic view on OVSF code assignment. In: Diekert, V., Habib, M. (eds.) STACS 2004. LNCS, vol. 2996, pp. 270–281. Springer, Heidelberg (2004) 9. Foriˇsek, M., Katreniak, B., Katreniakov´ a, J., Kr´ aloviˇc, R., Kr´ aloviˇc, R., Koutn´ y, V., Pardubsk´ a, D., Plachetka, T., Rovan, B.: Online bandwidth allocation. In: Arge, L., Hoffmann, M., Welzl, E. (eds.) ESA 2007. LNCS, vol. 4698, pp. 546–557. Springer, Heidelberg (2007) 10. Kalyanasundaram, B., Pruhs, K.: Speed is as powerful as clairvoyance. J. ACM 47(4), 617–643 (2000) 11. Miyazaki, S., Okamoto, K.: Improving the competitive ratio of the online OVSF code assignment problem. Algorithms 2(3), 953–972 (2009) 12. Phillips, C.A., Stein, C., Torng, E., Wein, J.: Optimal time-critical scheduling via resource augmentation. Algorithmica 32(3), 163–200 (2002)
Scheduling Jobs on Heterogeneous Platforms Marin Bougeret1, Pierre Francois Dutot1 , Klaus Jansen2 , Christina Robenek2 , and Denis Trystram1 1 LIG, Grenoble University, France {bougeret,dutot,trystram}@imag.fr 2 Department of Computer Science Christian-Albrechts-University Kiel Christian-Albrechts-Platz 4, 24098 Kiel, Germany {kj,cot}@informatik.uni-kiel.de
Abstract. In the context of grid scheduling we consider a scheduling scenario, where parallel jobs have to be scheduled non-preemptively on heterogeneous computational platforms of processors. The speed of the processors may differ among the platforms and the jobs are submitted simultaneously or over time and cannot run across multiple platforms. We focus on the target of minimizing the total makespan, i.e. the global latest finishing time of a job. In this paper we present an AFPTAS for the problem without release times and show how to generalize our result to malleable jobs and jobs with release times.
1
Introduction
For solving problems that include large-scale computation grid computing gets more and more important. The efficient coordination of those computations appearing as atomic jobs on distributed resources is a difficult task. To get theoretical insights one first needs to think of an adequate model that realizes the main principles of grid computing. In this paper we focus on a scheduling scenario where parallel jobs have to be scheduled non-preemptively on heterogeneous computational platforms of processors. In order to complete extensive computations as fast as possible we are interested in minimizing the total makespan, i.e. the global latest finishing time of a job. The jobs are submitted simultaneously or over the time and cannot run across multiple platforms. In the following we describe our basic model where we consider heterogeneous platforms with different speeds and parallel jobs without release times (SPP ). Later we fit this model to take malleable jobs and release times into account. Model. In our setting we have n jobs {J1 , . . . , Jn } that have to be scheduled on N platforms P , ∈ {1, . . . , N }. A platform P contains a set M of m identical processors. We assume the platforms to be sorted by non-decreasing order of
Research supported by German Research Foundation (DFG) project JA612/12-1, “Design and analysis of approximation algorithms for two- and three- dimensional packing problems”, and DGA-CNRS.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 271–283, 2011. c Springer-Verlag Berlin Heidelberg 2011
272
M. Bougeret et al.
their number of processors (or machines), i.e. m1 ≤ m2 ≤ . . . ≤ mN . To each platform is assigned a speed value s ∈ R> 0. Every job Jj is described by a pair (pj , qj ) of the length of a job pj (number of operations) and a number of parallel processors qj (degree of parallelism) that Jj requires when executed. We assume qj ≤ mN = max m for all jobs, if not there is no feasible schedule. Since sometimes we will identify jobs with rectangles, we call qj the width of job Jj . Consequently, the area (or work ) of a job is pj qj and for a list of jobs or rectangles L we denote with A(L) the total area of the jobs (or rectangles) in L. A job Jj is only allowed to be scheduled within one platform, its processing time p in platform P is tj := sj if qj ≤ m else tj := ∞. We assume furthermore (by scaling) min s = 1 and define tmax := maxj, {tj |tj < ∞}, which is less than pmax := maxj pj (as min s = 1). Our objective is to find a non-preemptive schedule of all jobs into the platforms minimizing Cmax := max Cmax (), where Cmax () denotes the completion time of a feasible schedule in P . For an instance J of SPP let OPT(J) denote the optimum value for Cmax . For a minimization problem as SPP we say that an algorithm B has absolute ratio α, if supJ B(J)/OP T (J) ≤ α, and asymptotic ratio α, if α ≥ lim supOP T (J)→∞ B(J)/OP T (J), respectively. A minimization problem admits an (asymptotic) polynomial-time approximation scheme ((A)PTAS), if there exists a family of polynomial-time approximation algorithms {Bε |ε > 0} of (asymptotic) (1 + ε)-approximations. We call an approximation scheme fully polynomial ((A)FPTAS), if the running time of every algorithm Bε is bounded by a polynomial in the size of the input |J| and 1ε . Related work. For N = 1 the problem is equivalent to scheduling n parallel jobs on m identical machines. The well-known List Algorithm of Garey and Graham [13] achieves absolute ratio 2 for this problem. For the case that the number of machines is polynomially bounded in the number of jobs a (1.5 + ε)approximation for the contiguous case and a (1 + ε)-approximation for the noncontiguous case were given in [11]. For malleable job scheduling there are several results, as e.g. in [4], [9], [7] and [18]. If N = 1 and the jobs are assigned to processors of consecutive addresses, the problem corresponds directly to strip packing. For strip packing, classical shelfbased algorithms are given in [12]. Further results are given in [20], [22] and [6]. An important result is an AFPTAS for strip packing with additive constant O(1/ε2 hmax ) given by Kenyon and R´emila in [14], where hmax denotes the height of the tallest rectangle (i.e. the length of the longest job). This constant was improved by Jansen and Solis-Oba who presented in [10] an APTAS with additive constant hmax . The problem SPP is also closely related to the generalized multiple strip packing (MSP ) where rectangles have to be packed into strips of infinite height and different widths. Here one wants to find a packing that minimizes the maximum of the heights used in every strip. It corresponds to the case that all platforms are identical and the jobs need to be scheduled on contiguous processors. For MSP, Zhuk [25] showed that there is no polynomial time approximation algorithm with absolute ratio better than 2 (unless P = N P ). Later, Ye et al. [24]
Scheduling Jobs on Heterogeneous Platforms
273
obtained an algorithm for MSP with ratio 2 + ε. In [1] we presented a tight 2-approximation and an AFPTAS for MSP. Keep in mind that because of the contiguity constraint algorithms for SPP cannot be directly applied to the generalized MSP, but vice versa. However, in general approximation ratios are not preserved, but the optimal value for generalized MSP is an upper bound for the optimal value for SPP. Schwiegelshohn et al. [21] achieved ratio 3 scheduling parallel jobs on heterogeneous platforms with identical speeds without release times, and ratio 5 with release times. Tchernykh et al. presented in [23] an algorithm with absolute ratio 10 without release times. For scheduling parallel jobs on identical platforms, we proposed recently a low cost approximation algorithm with absolute ratio 5/2 in [2]. We were able to improve our result to a fast 5/2-approximation for heterogeneous platforms with identical speeds and under the additional constraint that every job can be scheduled in each platform [3]. Our results. In this paper we present an AFPTAS for SPP with additive factor O(1/ε2 pmax ). Theorem 1. For every accuracy ε there exists an approximation algorithm with running time polynomial in the size of the input |J| and 1/ε that produces for every instance J of SPP a schedule of length at most (1+ε)OPT(J)+O(1/ε2 pmax ). In practical applications the jobs are usually small compared to the optimum so that an algorithm with a good asymptotic ratio is more applicable than one with a worse absolute ratio. If pmax ≤ ε3 OPT(J) for an instance J, the makespan of the schedule constructed by our algorithm is very close to the optimum (≤ (1 + ε)OP T (J) + O(1/ε2 pmax ) ≤ (1 + cε)OP T (J)) for a constant c ∈ R≥0 , while an absolute 2 or 3-approximation may be quite far away. To our best knowledge this is also the first result for platform scheduling that takes different speed values among the platforms into account. Since the platforms may have different numbers of processors the AFPTAS in [1] does not apply for SPP, because it is based on cutting a solution for a single strip and distributing it well-balanced. Additionally, we do not assume that every job fits in every platform. Thus, the algorithm in [3] does also not apply. The algorithm and its analysis are given in Section 2. Since we assign each job to processors of consecutive addresses, our algorithm also applies to the generalized MSP. Moreover, in Section 4 we show how our model and the algorithm can be slightly modified to achieve an AFPTAS for scheduling malleable jobs in heterogeneous platforms with different speeds. In Section 5 we give an AFPTAS for SPP with release times. Due to space reduction missing proofs can be found in the full version of the paper.
2
An AFPTAS for SPP
Our algorithm is based on an LP -relaxation where migration and preemption are allowed. That is a job is allowed to be split into fractions that are executed in different platforms (if they fit). Emanating from the solution of the LP we
274
M. Bougeret et al.
compute a unique assignment of almost all jobs to the platforms. This is done by skillful rounding the fractions of jobs using a result of Lenstra et al. [17]; i.e. the number of remaining fractional jobs per platform will be bounded by O(1/ε2 ). Remarkably, the rounding technique needs except an (approximate) solution of the LP no extra information about the speed values. For each platform we reschedule the obtained integral jobs with an approximation algorithm for strip packing [14] and schedule the fractional jobs behind them. An overview of the algorithm is given in Figure 1.
Algorithm 1. 1: Solve a linear program relaxation of the problem (1) and get a fractional schedule where preemption and migration are allowed. 2: Group the fractional jobs corresponding to the LP-solution as described in steps 1-4 in Section 2.2 according their widths and for every platform P obtain sets Lwide and Lnarrow of wide and narrow fractional rectangles, respectively. 3: Via a general assignment problem (2) round the fractional rectangles and obtain ˜ wide , L ˜ narrow and fractional rectangles F for ∈ sets of rounded rectangles L {1, . . . , N }. 4: for all ∈ {1, . . . , N } do ˜ wide ∪ L ˜ narrow with the approximation algorithm for strip packing in [14] 5: Pack L into platform P . 6: Schedule the fractional jobs in F greedily on top of the schedule corresponding to the packing obtained before. 7: end for
2.1
Relaxed Schedule
Let J be an instance of SPP and let T be the makespan of an optimum schedule for J. To simplify the structure of the schedule instead of handling the specific processing times tj we consider each platform as a two-dimensional bin of width m and height T s and schedule the jobs concerning their lengths pj within this bin. Furthermore, we abandon the constraint that a job has to be scheduled nonpreemptively and within only one platform. We represent the schedule of a job Jj = (pj , qj ) as a (finite) sequence of pairs (Ii , Qi )i∈I(j) , I(j) ⊂ N, where every Ii ⊂ [0, T ] is a time interval and every Qi is a set of processors so that there is a uniquely defined platform Pi ∈ {1, . . . , N } with Qi ⊂ Mi and |Qi | = qj . Additionally, we assume that the following conditions hold: (i) the time intervals for job Jj within the same platform do not overlap except maybe at the i.e. for all ∈ {1, . . . , N } endpoints, ◦ ◦ ◦ Ii ∩ Ii = ∅, where A denotes the interior of a set A. i,i ∈I(j),i=i i ==i
N (ii) =1 s {i∈I(j)|Qi ⊂M } |Ii | ≥ pj (covering constraint). (iii) at any time for every processor there is at most one job running on it.
Scheduling Jobs on Heterogeneous Platforms T s1 = 10
275
T s2 T s 3
P 1
P 2 Job Jj , pj = 7.5, qj = 3
P3
Fig. 1. Relaxed schedule
Keep in mind that under this constraints a job is allowed to be split among the platforms and may be executed in two different platforms at the same time, but never in parallel with itself within the same platform (except for a discrete time, when one piece starts and another ends). It can be executed on two different (not necessary disjoint) subsets of processors within the same platform during different time intervals, where only the endpoints of the time intervals may overlap. An example how such a relaxed schedule can look like is given in Figure 1: Assume that T = 10/s1 and job Jj needs to be scheduled on qj = 3 processors for pj = 7.5 operations. So in P1 it is scheduled on processors {7, 8, 9} during time [0, 1/s1 ] and on processors {2, 3, 4} during time [5/s1 , 7/s1 ]. In P2 it is scheduled on processors {1, 2, 3} during time [0, 3/s2 ] and in P3 it is scheduled on processors {3, 4, 5} during time [3.5/s3 , 5/s3 ]. This gives 1 + 2 = 3 operations in P1 , 3 operations in P2 and 1.5 operations in P3 (this fulfills the covering constraint). The relaxed schedule can be formulated via the linear program below: For each platform in P , 1 ≤ ≤ N we introduce configura tions C . A configuration C is a function C : {1, . . . , n} −→ {0, 1}, so that {j∈{1,...,n}|C (j)=1} qj ≤ m . It tells us which jobs can be scheduled in parallel in platform P . By definition, the number q() of different configurations for P is bounded by 2n . Let C = {C1 , . . . , Cq() } denote the set of all configurations for a platform P . In the LP below the variable xCk indicates the length of configuration Ck . That means that the jobs in {j ∈ {1, . . . , n}|Ck (j) = 1} are executed in platform P during xCk operation steps. q()
xCk = s T ∈ {1, . . . , N }
k=1 N
=1 {k∈{1,...,q()}|C (j)=1} k
xCk ≥ pj j ∈ {1, . . . , n}
(1)
xCk ≥ 0 k ∈ {1, . . . , q()}, ∈ {1, . . . , N } The first N constraints ensure that the makespan Cmax () in each platform P does not exceed T . The next n constraints are covering constraints for the n
276
M. Bougeret et al.
jobs. They make sure that every job is executed sufficiently long. We describe how to solve the LP efficiently in the full version of this article. Lemma 1. If T is the makespan of an optimum schedule for SPP(J), the linear program above (1) is a relaxation of SPP(J). 2.2
Rounding the Fractional Solution
In this section we round the jobs in order to get a unique assignment of every job to a subset of processors of a platform. Consider an approximate solution (xCk ) of the LP-relaxation. We introduce a new variable xj ∈ [0, pj ] that indicates the length of the fraction of job Jj that is scheduled on P . Formally this is xj = {k∈{1,...,q()}|Ck (j)=1} xCk , the sum of the length of all configurations in P in which Jj appears. We can assume for all jobs Jj the equality N =1 xj = pj , if not we simply delete job Jj from appropriate configurations or replace a configuration by two “shorter” configurations (one with job Jj and one without, their total length is the same as the one of the original configuration). For all fractions xj of a platform P we build rectangles (xj , qj ) of height xj and width qj . In the following steps the rectangles of every platform P are grouped geometrically. 1. Choose ε := ε/3 and partition the rectangles into wide and narrow rectangles, Lwide := {(xj , qj )|qj > ε m } and Lnarrow := {(xj , qj )|qj ≤ ε m }. 2. Build a stack of the rectangles in Lwide ordered by non-increasing width. The total height of the stack is denoted with H . 3. Set M := (1/ε2 ). Divide the stack into M groups Gi by drawing M − 1 horizontal lines at height iH /M for i ∈ {1, . . . , M − 1} through it. If the interior of a rectangle intersects a horizontal line, cut the rectangle along this line and introduce two new rectangles, so that every rectangle can be assigned to exactly one group. Let L wide denote the modified list of rectangles (see Figure 2). With yj,i ∈ [0, pj ] we denote the fraction of job j that is assigned to Gi . Let zj,i = yj,i/pj ∈ [0, 1] denote the scaled fraction. 3H M
G3 2H M
G2
yj,2 yj,1
H M
G1 Rectangle (xj , qj ), a fraction of Jj .
Fig. 2. Constructing L wide
Scheduling Jobs on Heterogeneous Platforms
4. Compute A(Lnarrow ) =
(xj ,qj )∈Lnarrow
277
xj qj and locate the corresponding
rectangles on top of the stack as group G0 . Let yj,0 ∈ [0, pj ] denote the fraction of a narrow job Jj that is assigned to G0 and and let zj,0 = yj,0/pj ∈ [0, 1]. If we were able to round the variables zj,i to integer values {0, 1} (without losing too much), this would imply a unique assignment of every rectangle to exactly one group of a platform. Re-identifying the rectangles with jobs, where we identify the height of a rectangle with the length of a job, this would also imply a unique assignment of every job to a platform. We achieve such a rounding of the variables zj,i via the following general assignment problem, so that there remain at most M + 1 fractionally assigned rectangles per platform. n
zj,0 pj qj ≤ A(Lnarrow ) ∈ {1, . . . , N }
j=1 n j=1
zj,i pj ≤
H i ∈ {1, . . . , M }, ∈ {1, . . . , N } M N M
(2)
zj,i ≥ 1 j ∈ {1, . . . , n}
=1 i=0 zi,j ∈ [0, 1]
The above formulation is related to the problem of scheduling jobs on parallel unrelated machines with (M + 1)N machines. Each group Gi corresponds to a machine. Lenstra et al. showed in [17] that a feasible solution (zi,j ) of this problem can be rounded to a feasible solution (˜ zi,j ) of the corresponding integer program formulation in polynomial time, so that there remains at most one fractional job z˜i,j < 1 per machine. Hence, we get a unique assignment of almost all rectangles to the platforms P except at most M + 1 fractionally assigned rectangles per platform. Let F denote the set of rectangles with fractional vari ables z˜j,i after the rounding. We will execute the corresponding jobs at the end of the schedule; their total processing time is bounded by (M + 1)tmax . From now on we consider for each platform P an instance of strip packing containing ˜ a set of wide rectangles L zj,i pj , qj )|˜ zj,i = 1, i > 0} and a set of narwide := {(˜ ˜ row rectangles Lnarrow := {(˜ zj,0 pj , qj )|˜ zj,0 = 1}. In every platform we repack ˜ ˜ the pre-assigned rectangles in L ∪ L narrow using the following strip packing wide subroutine by Kenyon and R´emila [14]. 2.3
Strip Packing Subroutine
˜ ˜ For wide rectangles in L wide we generate a list of rounded rectangles Lsup with only a constant number M of different widths w1 , . . . , wM for the rectangles: ˜ We partition the stack of L wide into M groups by drawing M horizontal lines ˜ iH at height M , i ∈ {0, 1 . . . , M − 1}. Thus, we obtain at most M threshold
278
M. Bougeret et al.
rectangles, i.e. rectangles that intersect either with their lower bounds or with their interiors such a horizontal line. The widths of rectangles between the ith and the (i + 1)th line are rounded up to the width of the ith threshold rectangle, i ∈ {0, 1, . . . , M − 1}. For rectangles above the M th line we take the width of the M th threshold rectangle. The main part of the algorithm is to produce a fractional packing for the ˜ using a linear program. In doing so we build configurations rectangles in L sup C˜j := {α ˜ ij : wi |i ∈ {1, . . . , M }}, i.e. multisets of widths where α ˜ ij denotes the ˜ ij wi ≤ m . Then the following number of rectangles of width wi in C˜j and M i=1 α LP is solved.
min
q
x˜j
j=1
s.t.
q
α ˜ ij x˜j ≥ βi for all i ∈ {1, . . . , M }
(3)
j=1
x˜j ≥ 0 for all j ∈ {1, . . . , q }. The variable x ˜j indicates the height of configuration C˜j , βi is the total height ˜ sup and q denotes the number of possible configuof rectangles of width wi in L rations. A feasible solution of the LP corresponds to a fractional strip packing. The fractional packing can be converted into an integral one. Then the nar˜ narrow are added in the remaining space next to the integral row rectangles in L packing and on top of it with Next Fit Decreasing Height heuristic.
3
Analysis
In the end we re-identify the rectangles with jobs, i.e. their widths with qj and their heights with pj . Note that a packing of the rectangles of total height h in platform P corresponds to a schedule with makespan h /s . Then the fractional jobs in F are scheduled on top. To directly apply strip packing results we scale ˜ ∪ L ˜ 1 the widths of all rectangles in L sup narrow by /m . Furthermore we consider platform P as a strip of width 1 and infinite height. As we consider each platform and the allocated jobs independently, this has no impact on the solution. 3.1
Analyzing the Output
˜ ˜ Let (xCk ) be an approximate solution of (1) and let L wide ∪ Lnarrow contain the rectangles that have to be repacked in Step 5 of Algorithm 1 with the strip packing subroutine above. For a list of rectangles L let LinSP (L) denote the height of an optimal fractional strip packing for the rectangles in L. By construction we have that the height of an optimal fractional strip packing for the wide and narrow rectangles in Lwide ∪ Lnarrow into platform P , is less than the length of the schedule corresponding to the approximate solution of (1) constructed in
Scheduling Jobs on Heterogeneous Platforms
279
step 1, that is LinSP (Lwide ∪Lnarrow ) ≤ s (1+3ε)Lin(J). Let “≤” denote a partial order on lists of rectangles. For a list of rectangles L let S denote the shape of a stack built as described above. We say L ≤ L for two lists of rectangles, if shape ˜ ) ≤ LinSP (L ˜ ), since L ˜ ˜ S covers S. It is clear that LinSP (L wide wide ≤ Lsup . sup 1 ˜ sup ) ≤ 1 + ˜ With Lemma 3 in [14] we conclude LinSP (L LinSP (L wide ) and Mε 1 ˜ ˜ A(Lsup ) ≤ 1 + Mε A(Lwide ). We go on with step 2 and consider the stack built from L wide in the 3rd step of the grouping procedure in Section 2.2. We introduce a new list of rectangles L sup that is developed when in each group Gi of the stack, i ∈ {1, . . . , M }, the width of each rectangle is rounded up to the widest width of a rectangle that is contained in this group. Remember that every rectangle in L wide is uniquely assigned to one of the groups Gi since we introduced two new rectangles for ˜ border rectangles before. Notice that during building L wide in step 3 of Algorithm 1 we do not increase the total height of any group Gi and we do not exceed the ˜ largest width of a rectangle that appears in it. Thus, we obtain L wide ≤ Lsup . Since LinSP (Lwide ) = LinSP (Lwide ) and A(Lwide ) = A(Lwide ) this gives: Lemma 2. For all ∈ {1, . . . , N } we have ˜ ) ≤ 1 + 1 2 LinSP (L ) a) LinSP (L sup wide Mε ˜ ) ≤ 1 + 1 2 A(L ). b) A(L sup
Mε
wide
Let hsup denote the height of the packing produced by converting the fractional solution of (3) into an integral one. This is done by adding for each configuration appearing with height > 0 in the fractional solution the maximum height of a rectangle. Each basic solution of (3) has at most M non-zero entries and one can show that there are effectively at most 2M different configurations in platform ˜ ) + (1 + 2M ) max{pj |(pj , qj ) ∈ L ˜ }. P [14]. So we conclude hsup ≤ LinSP (L sup sup ˜ Note that we only packed the rounded rectangles in Lsup so far. Let h denote ˜ the height after adding the narrow rectangles in L narrow to platform P , ∈ {1, . . . , N }. We can now bound h : Lemma 3. For all ∈ {1, . . . , N } we have h ≤ (1 + 7ε)Lin(J)s + O(1/ε2 ) max{pj |(pj , qj ) ∈ Lwide ∪ Lnarrow }. The packing in each platform P corresponds to a schedule with length (re ferring to pj ) at most (1 + 7ε)Lin(J)s + ( 36 ε2 + 1) max{pj |(pj , qj ) ∈ Lwide ∪ Lnarrow }, thus we conclude that its completion time (referring to tj ) is bounded by (1 + 7ε)Lin(J) + O( ε12 tmax ). The remaining jobs in F have total processing time bounded by (M + 1)tmax ∈ O( ε12 tmax ) ≤ O( ε12 pmax ), since tmax ≤ pmax as min s = 1. Adding now the remaining jobs in F to the schedule does not change the magnitude of the additive factor. With rescaling ε and since Lin(J) ≤ OPT(J) we obtain that the makespan of the produced schedule in each platform P is less than Cmax () ≤ (1 + ε)OPT(J) + O( ε12 pmax ) and conclude our main Theorem 1. Since during the repacking process we considered jobs as rectangles,
280
M. Bougeret et al.
we assigned every job to a set of processors with consecutive addresses. Thus we also obtain an AFPTAS for multiple strip packing for strips with different widths (in this case we have s = 1 for all ∈ {1, . . . , N }). 3.2
Running Time of the Algorithm
The time needed for solving (1) approximately via max-min resource sharing (details in the full version)in step 1 is O(N n2 ε−6 log2 (n) log2 (1/ε) log(N max s )). The number of non-zero configurations in the final solution is bounded by O(n(ε−2 +ln n)) [15]. So step 2 takes time O(N n2 (ε−2 +log n) log(n2 (ε−2 +log n)) = O(N n2 ε−2 log2 (n) log(1/ε)), since there are at most n2 (ε−2 + log n) rectangles in each platform that have to be sorted. We represent the assignment problem in step 3 as a weighted bipartite graph G = (V1 , V2 , E), where V1 corresponds to the N (M + 1) machines (parts of the stacks), V2 to the jobs. There is an edge between the node representing part i of the stack for P and the node representing job Jj if zj,i > 0. This assignment problem can be converted in time O(|E||V1 |) = O(|V1 |2 |V2 |) = O(ε−2 N 2 n) into another assignment problem, whose corresponding graph is a forest [19]. Applying the rounding technique in [17] to the new assignment takes time in O(|V1 | + |V2 |) = O(ε−2 N + n). So step 3 takes time in O(ε−2 N 2 n). In step 5 it is sufficient to solve the corresponding linear program (3) approximatively with accuracy ε also via a max-min resource sharing problem. This can be done in time O(M (ε−2 + ln M ) ln(ε−1 ) max{M + ε−3 , M ln ln(M ε−1 )}) for every platform [8]. Since M ∈ O(ε−2 ) this gives for step 5 a total running time in O(N ε−7 ). The overall running time sums up to O(ε−7 N 2 n2 log2 (n) log2 (1/ε) log(N max s )).
4
Malleable Jobs
One can also obtain an AFPTAS for scheduling malleable jobs non-preemptively by only adding a few modifications to the algorithm. To get a better overview we do not consider the platform speeds here. But remember that one can easily add speeds here by considering bins of height s T instead of T , where T denotes an optimum value for the makespan for scheduling malleable jobs in platforms. In the following we give a short instruction how to adjust our algorithm: In malleable scheduling a job Jj is described by a function pj : {1, . . . , mN } −→ Q+ ∪ ∞, where pj (k) is the length of job j running on k parallel processors of a platform. We introduce a configuration as a map f : {1, . . . , m } −→ {0} ∪ {1, . . . , n} that assigns a processor to a job (0 for idle time). Instead of solving (1) we can solve in a similar way the following linear program: xf = T ∈ {1, . . . , N } f ∈F m N =1 k=1
1 pj (k)
xf ≥ 1 j ∈ {1, . . . , n}
f ∈F ,|f −1 (j)=k|
xf ≥ 0.
(4)
Scheduling Jobs on Heterogeneous Platforms
281
Consider step 2 of the algorithm. Let ai , bi be the smallest and the largest width of a rectangle in group Gi and let Wi,j be the set of widths job Jj adopts in Gi . To guarantee that we have chosen the right number of processors for a job we add the following steps before rounding the jobs via the general assignment problem: – For i ∈ {1, . . . , M } and w ∈ Wi,j let yj,i (w) denote the fraction of job j of width w that is assigned to Gi . Let zj,i = w∈Wi,j yj,i (w) be the complete fraction of job j in Gi . – For each part i ∈ {1, . . . , M } and job j with |Wj,i | ≥ 2 compute kj,i := arg mink∈[ai ,bi ] pj (k) and replace the rectangles corresponding to job j in Gi by (zj,i pj (kj,i )kj,i ). Note that pj (kj,i ) is the smallest processing time among all processor numbers k ∈ [ai , bi ]. – For each job j with |Wj,0 | ≥ 2 compute kj,0 := arg mink∈[0,ε m ] pj (k)k and replace all rectangles corresponding to job j in G0 by (zj,0 pj (kj,0 ), kj,0 ).
Including different speed values we define the processing time of job Jj in p (k) platform P as tj (k) = js . Note that tj (k) = ∞ is possible. We define pmax := maxj,k {pj (k)|pj (k) < ∞} and tmax := maxj,k, {tj (k)|tj (k) < ∞}. To include speed values in the linear program we change the first N constraints of LP (4) into ... = s T , since different speeds can be considered as providing length s T instead of T for the schedule. During the repacking process the algorithm remains the same and finally we achieve the following theorem Theorem 2. There is an AFPTAS for scheduling non-preemptive malleable jobs in heterogeneous platforms with different speeds with additive factor O(1/ε2 pmax ).
5
Release Times
Theorem 3. There is an AFPTAS for scheduling parallel jobs in heterogeneous platforms with different speeds and release times with additive factor O(1/ε3 pmax ). For a better overview we describe here the idea for the proof when all platforms run with the same speed, i.e. s = 1 for all ∈ {1, . . . , N }. The general case can be derived from it. Let rj denote the release time of job Jj and Φ := maxj rj . We assume that Φ > εT , otherwise it is easy. As in [5] we round down the release times to the next multiples of iεT i ∈ {0, 1, . . . , 1/ε} and obtain new release times r˜1 . . . , r˜n with at most R = O(1/ε) different values ρ1 , . . . , ρR . To recover the loss we made by rounding down we shift the final schedule by εT in the end. For every platform P we consider R new platforms P˜,i , i ∈ {1, . . . , R}, with m processors and create a new instance J˜R of SPP (without release times) with RN platforms and n jobs. A job Jj can now be scheduled in platform P˜,i if it fits and if it is already released, i.e. qj ≤ m and r˜j ≤ ρi . For each of the new platforms P˜,i the value of an optimal fractional schedule is at most εT .
282
M. Bougeret et al.
References 1. Bougeret, M., Dutot, P.F., Jansen, K., Otte, C., Trystram, D.: Approximation algorithms for multiple strip packing. In: Bampis, E., Jansen, K. (eds.) WAOA 2009. LNCS, vol. 5893, pp. 37–48. Springer, Heidelberg (2010) 2. Bougeret, M., Dutot, P.F., Jansen, K., Otte, C., Trystram, D.: A low cost 5/2 approximation for scheduling rigid jobs on multiple organizations. In: Calude, C.S., Sassone, V. (eds.) TCS 2010. IFIP Advances in Information and Communication Technology, vol. 323, pp. 316–327. Springer, Heidelberg (2010) 3. Bougeret, M., Dutot, P.F., Jansen, K., Otte, C., Trystram, D.: A fast 5/2approximation algorithm for hierarchical scheduling. In: D’Ambra, P., Guarracino, M., Talia, D. (eds.) Euro-Par 2010. LNCS, vol. 6271, pp. 157–167. Springer, Heidelberg (2010) 4. Du, J., Leung, J.Y.-T.: Complexity of scheduling parallel task systems. SIAM Journal on Discrete Mathematics 2(4), 473–487 (1989) 5. Hall, L.A., Shmoys, D.B.: Approximation Schemes for Constrained Scheduling Problems. In: 30th Annual Symposium on Foundations of Computer Science (FOCS 1989), pp. 134–139 (1989) 6. Harren, R., Jansen, K., Pr¨ adel, L., van Stee, R.: A 5/3 + approximation for strip packing. In: The 12th Symposium on Algorithms and Data Structures, WADS 2011 (to appear, 2011) 7. Jansen, K.: Scheduling malleable parallel tasks: An asymptotic fully polynomial time approximation scheme. Algorithmica 39(1), 59–81 (2004) 8. Jansen, K.: Approximation algorithms for min-max and max-min resource sharing problems and applications. In: Bampis, E., Jansen, K., Kenyon, C. (eds.) Efficient Approximation and Online Algorithms. LNCS, vol. 3484, pp. 156–202. Springer, Heidelberg (2006) 9. Jansen, K., Porkolab, L.: Linear-time approximation schemes for scheduling malleable parallel tasks. Algorithmica 32(3), 507–520 (2002) 10. Jansen, K., Solis-Oba, R.: Rectangle packing with one-dimensional resource augmentation. Discrete Optimization 6(3), 310–323 (2009) 11. Jansen, K., Th¨ ole, R.: Approximation algorithms for scheduling parallel jobs. SIAM Journal on Computing 39(8), 3571–3615 (2010) 12. Coffman Jr., E.G., Garey, M.R., Johnson, D.S., Tarjan, R.E.: Performance bounds for level-oriented two-dimensional packing algorithms. SIAM Journal on Computing 9(4), 808–826 (1980) 13. Garey, M.R., Graham, R.L.: Bounds for Multiprocessor Scheduling with Resource Constraints. SIAM Journal on Computing 4(2), 187–200 (1975) 14. Kenyon, C., R´emila, E.: A near optimal solution to a two-dimensional cutting stock problem. Mathematics of Operations Research 25, 645–656 (2000) 15. Khachiyan, L.G., Grigoriadis, M.D., Porkolab, L., Villavicencio, J.: Approximate max-min resource sharing for structured concave optimization. SIAM Journal on Optimization 11, 1081–1091 (2001) 16. Lawler, E.L.: Fast approximation algorithms for knapsack problems. Mathematics of Operation Research 4(4), 339–356 (1979) ´ Approximation algorithms for scheduling 17. Lenstra, J.K., Shmoys, D.B., Tardos, E.: unrelated parallel machines. Mathematical Programming 46, 259–271 (1990) 18. Mouni´e, G., Rapine, C., Trystram, D.: Efficient approximation algorithms for scheduling malleable tasks. In: ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pp. 23–32 (1999)
Scheduling Jobs on Heterogeneous Platforms
283
´ Fast approximation algorithms for frac19. Plotkin, S.A., Shmoys, D.B., Tardos, E.: tional packing and covering problems. Mathematics of Operations Research 20, 257–301 (1995) 20. Schiermeyer, I.: Reverse-fit: A 2-optimal algorithm for packing rectangles. In: van Leeuwen, J. (ed.) ESA 1994. LNCS, vol. 855, pp. 290–299. Springer, Heidelberg (1994) 21. Schwiegelshohn, U., Tchernykh, A., Yahyapour, R.: Online scheduling in grids. In: IEEE International Parallel and Distributed Processing Symposium (IPDPS), pp. 1–10 (2008) 22. Steinberg, A.: A strip-packing algorithm with absolute performance bound 2. SIAM Journal on Computing 26(2), 401–409 (1997) 23. Tchernykh, A., Ram´ırez, J., Avetisyan, A., Kuzjurin, N., Grushin, D., Zhuk, S.: Two level job-scheduling strategies for a computational grid. In: Wyrzykowski, R., Dongarra, J., Meyer, N., Wa´sniewski, J. (eds.) PPAM 2005. LNCS, vol. 3911, pp. 774–781. Springer, Heidelberg (2006) 24. Ye, D., Han, X., Zhang, G.: On-line multiple-strip packing. In: Du, D.-Z., Hu, X., Pardalos, P.M. (eds.) COCOA 2009. LNCS, vol. 5573, pp. 155–165. Springer, Heidelberg (2009) 25. Zhuk, S.N.: Approximate algorithms to pack rectangles into several strips. Discrete Mathematics and Applications 16(1), 73–85 (2006)
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets Steven M. Kautz and Brad Shutters Iowa State University, Ames, IA 50011 U.S.A. {smkautz,shutters}@iastate.edu
Abstract. Discrete self-similar fractals have been studied as test cases for self-assembly ever since Winfree exhibited a tile assembly system in which the Sierpinski triangle self-assembles. For strict self-assembly, where tiles are not allowed to be placed outside the target structure, it is an open question whether any self-similar fractal can self-assemble. This has motivated the development of techniques to approximate fractals with strict self-assembly. Ideally, such an approximation would produce a structure with the same fractal dimension as the intended fractal and with specially labeled tiles at positions corresponding to points in the fractal. We show that the Sierpinski carpet, along with an infinite class of related fractals, can approximately self-assemble in this manner. Our construction takes a set of parameters specifying a target fractal and creates a tile assembly system in which the fractal approximately selfassembles. This construction introduces rulers and readers to control the self-assembly of a fractal structure without distorting it. To verify the fractal dimension of the resulting assemblies, we prove a result on the dimension of sets embedded into discrete fractals. We also give a conjecture on the limitations of approximating self-similar fractals.
1
Introduction
Fractal structures are ubiquitous in nature but are difficult to engineer using top-down techniques. The bottom-up approach of tile self-assembly, relying on brownian motion and cooperative binding to allow simple objects to assemble into complexes, could prove to be a useful technology for engineering fractal structures. Carbone and Seeman [3] have stated that “generating fractal structures by self-assembly is a major challenge for nanotechnology.” In this paper, our motivation is to use fractals as challenging test cases for self-assembly with the hope of discovering general self-assembly techniques that may prove useful in other constructions. We will work in the abstract Tile Assembly Model (aTAM), a constructive version of Wang tiling [18] introduced by Rothemund and Winfree as a mathematical model of self-assembly [16,19]. There are two main notions of the selfassembly of a fractal in the aTAM. In weak self-assembly, one typically causes a two-dimensional surface to self-assemble with the desired fractal appearing as a labeled subset of the surface. Winfree [19] exhibited a tile assembly system B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 284–296, 2011. c Springer-Verlag Berlin Heidelberg 2011
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
285
in which the Sierpinski triangle weakly self-assembles. Kautz and Lathrop [7] showed that an infinite class of related fractals, including the Sierpinski carpet, can weakly self-assemble. However, in weak self-assembly the result is not a fractal structure, but rather a surface upon which the fractal pattern is “painted.” In contrast, strict self-assembly requires only the fractal, and nothing else, to selfassemble. For structures with low fractal dimension, strict self-assembly requires significantly fewer physical tiles. However, due to the aperiodic arrangement of fractals, their strict self-assembly is fundamentally a more challenging problem than their weak self-assembly. Indeed, Lathrop, Lutz, and Summers [9] proved that the Sierpinski triangle cannot strictly self-assemble in the aTAM, and Patitz and Summers [12] extended this result to an infinite class of related fractals. It is an open question whether any fractal can strictly self-assemble. This has motivated the development of techniques to approximate fractal structures with strict self-assembly.1 Lathrop, Lutz, and Summers [9] and Patitz and Summers [12] developed a technique to approximate fractal structures by introducing communication fibers that shift the successive stages of the fractal. Although this technique results in a structure with the same fractal dimension as the intended fractal, the fractal pattern cannot be observed in specially labeled tiles. In fact, the resulting structure does not even contain the intended fractal structure. Ideally, an approximation of a fractal F would be an in-place approximation, i.e., a set X ⊃ F with the same fractal dimension as F that strictly self-assembles in such a way that those tiles corresponding to F are specially labeled. Lutz and Shutters [10] exhibited a construction in which the Sierpinski triangle approximately self-assembles in-place. Our main result is that every generalized Sierpinski carpet has an in-place approximation in the aTAM. We exhibit a construction that takes a set of parameters specifying a target fractal and creates a tile assembly system in which the fractal approximately self-assembles. (We note that the Sierpinski triangle construction of Lutz and Shutters [10] is accomplished using optimal counters controlled by a blocking technique; this paper uses different methods and is not a generalization of that construction.) Our construction introduces rulers and readers to control the self-assembly of a fractal structure without distorting it. Many tile assembly systems make use of optimal counters [4] for controlling a growing assembly [1,9,12,15,17]. For example, a set of counter tiles may grow eastward along the north side of another structure and count as it grows (as in Figure 1) to determine the width of the southern structure. If the final value N of the counter needs to be advertised not on the east edge of the counter, but on the north, this can be achieved by adding well-known rotator tiles that rotate the value 90 degrees counterclockwise, but this extends the length of the counter by log N tiles. The rotation can also be achieved by specially marking 1
Carbone and Seeman proposed an approach to the self-assembly of the Sierpinski carpet using specially designed molecules and a process requiring physical intervention at each successive stage of the fractal [2]. However, there is no direct translation of their approach into a model of self-assembly such as the aTAM.
286
S.M. Kautz and B. Shutters 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1
Fig. 1. Illustrates limitations of counters. Rotator tiles are shaded.
the glue of the log N -to-last tile of the southern structure, to begin rotation “in place” with the counting, but this requires that the southern structure come “pre-marked”, which is not always possible. We introduce rulers and readers to solve this problem. They should be useful in other constructions. We provide a simulation [8] of our construction in the ISU TAS [11]. Constructing an in-place approximation X of a fractal F requires analysis of the set of added points X \ F to show that the dimension of X is the same as that of F . In order to characterize the set X \ F we develop a notion of embedded fractals and prove a very general, and somewhat surprising, new result about their fractal dimensions. Given a subset G of the first quadrant and a fractal F , we define the embedding of G in F as the set X that is obtained, loosely speaking, by filling each empty square in F with a translated copy of G that is truncated to fill the available space. (Figure 4 illustrates the embedding of the Sierpinski triangle in the Sierpinski carpet.) The goal is to use knowledge of the dimension of G to analyze the dimension of the approximation X. Our theorem establishes that the dimension of the set X \ F , and therefore of the set X, is always the maximum of the dimensions of F and G. As a simple example, if G is a single point, then the embedding X consists of F with just one point added to each empty square. Since G has dimension zero, we can conclude that the dimension of the set of added points X \ F is equal to the dimension of F itself. To the best of our knowledge, this is the first time that embedded fractals have been considered. We conclude by showing that this theorem provides strong evidence of a conjecture on the limitations of approximating fractal structures in the aTAM.
2
Preliminaries
We work in the first quadrant N2 of the discrete Euclidean plane. For any set S ⊆ N2 , let S|m denote the set {(x, y) ∈ S : x < m and y < m}. For u, v ∈ N, let S|m [u, v] = {(x, y) : (x − u, y − v) ∈ S|m }, i.e., the set S|m translated to (u, v). We now give a brief overview of the abstract Tile Assembly Model (aTAM) suitable for reading this paper. We refer readers unfamiliar with the model to [15] for a good introduction. We use the notation of [10]. Rothemund and Winfree [16,19] introduced the abstract Tile Assembly Model (aTAM), a constructive version of Wang tiling [18], in order to study the growth of DNA crystals. It models the self-assembly of unit square tiles that can be translated, but not rotated, so that each tile has a well defined side for each cardinal direction. A tile has a glue on each side that is made up of a color and an integer strength
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
a pw
cu c
287
Strengths are represented by notches and colors by strings on the corresponding side and rendered in red when the value is specified externally (in a construction). Tiles may optionally contain a character or colored dot in the middle for labeling purposes. Fig. 2. Example illustration of a tile
(usually 0, 1, or 2). Intuitively, a tile models a DNA double crossover molecule and the glues correspond to the “sticky ends” on the four arms of the molecule. Two tiles placed next to each other interact if the glues on their abutting sides match in both color and strength. Two tiles with the same glues on all sides are of the same tile type. A tile assembly system (TAS) is a tuple T = (T, σ, τ ) where T is a finite set of tile types called the tileset, σ is the seed configuration, and τ ∈ N is the temperature. In this paper we always have τ = 2. We assume that the tile assembly system contains an infinite number of tiles of each type. The process starts with the seed configuration and growth occurs by single tiles attaching one at a time. A tile can attach at a site where the summed strength of the glues on sides that interact with the existing structure is at least the temperature. The assembly is terminal when no more tiles can attach; note that a terminal assembly may be infinite. A TAS is directed if it always results in a unique terminal assembly. A set X ⊆ Z2 strictly self-assembles in a TAS T if, in every terminal assembly of T , the set of locations at which tiles have been placed is exactly X. A set X ⊆ Z2 weakly self-assembles in a TAS T if the tileset T can be partitioned into two subsets, conventionally called the “black” tile types and “white” tile types, and in every terminal assembly of T , the set of locations at which black tile types have been placed is exactly X. Definition 1. Let S be a subset of Z2 . An in-place approximation of S in the aTAM is a set X ⊃ S that strictly self-assembles in the aTAM in such a way that specially labeled tiles appear at exactly the positions corresponding to points in S and X has exactly the same fractal dimension as S. The approximation X contains additional elements occupying the “negative space” of S, as illustrated in Figure 5, but the space occupied by these additional elements is negligible in the sense that it does not increase the fractal dimension of the resulting structure. Definition 2. For any integer p > 1, let K be a nonempty, proper subset of {(x, y) ∈ S : x < p and y < p}. The discrete self-similar fractal with p×p kernel K is the set F defined by F |p = K and F |pk+1 = (s,t)∈K F |pk [spk , tpk ]. The most commonly used fractal dimension for discrete fractals is zeta-dimension [5], a measure of how completely a fractal fills space. Let n ∈ N, A ⊆ Z2 , and A≤n = {(i, j) ∈ A : |i| ≤ n and |j| ≤ n}. Then the ζ-dimension (zetadimension) of A is log |A≤n | Dimζ (A) = lim sup . (1) log n n→∞
288
w
1
(a) Seed
y
(b) Left wx
w yz
wy
w
(c) Bottom
xz
wx
w
w
wy
1
1
WeakCarpetTileset(a, b, c, p) parameters: integers a, b, c and a prime p include (a) as the seed. foreach j ∈ {0, . . . , p − 1} include (b) with y = j and w = by mod p. include (c) with x = j and w = ax mod p. foreach (x, y, z) ∈ {0, ..., p − 1}3 include (d) with w = (ax + by + cz) mod p.
x
1 2 3 4 5 6
S.M. Kautz and B. Shutters
(d) Interior
Fig. 3. Weak self-assembly of a generalized Sierpinski carpet. “Black” tile types have nonzero labels (w > 0) and “white” tile types have zero labels (w = 0).
It is easy to verify using Definition 2 that if F is a fractal with p × p kernel K, then Dimζ (F ) = logp |K|. Certain fractals can be derived from the following numerical relationship, shown in [7] and independently in [13]. If a, b, and c are not congruent to 0 modulo p, the fractal defined by Theorem 1 is a generalized Sierpinski carpet. Theorem 1. Let a, b, c ≥ 0 and let p be a prime. Let M : N2 → {0, 1, . . . p − 1} be defined by M [0, 0] ≡ 1, M [0, j] ≡ aj for j > 0, M [i, 0] ≡ bi for i > 0, and M [i, j] ≡ aM [i, j − 1] + bM [i − 1, j] + cM [i − 1, j − 1] for i, j > 0, where the equivalences are modulo p. Define S ⊆ N2 by (x, y) ∈ S ⇐⇒ M [x, y] ≡ 0 mod p. Then S is a discrete self-similar fractal with p × p kernel S|p . Theorem 2. Every generalized Sierpinski carpet weakly self-assembles. Theorem 2 was shown in [7] using the construction illustrated in Figure 3.
3
Embedded Fractals
We now present a general result on sets embedded in discrete fractals, which will be used in Section 4 to establish the fractal dimension of the assemblies resulting from our construction. One of the tasks involved in applying Definition 1 is to show that the additional elements X \ S do not increase the dimension of the approximation. In many cases X \ S can be described by taking restrictions G|i of a known set G and replicating and translating them into empty i × i regions of S. This idea is captured in the following definition. Definition 3. Let F be a discrete fractal with p × p kernel K and let G be any nonempty subset of N2 . Then the embedding of G in F is the set W defined by the recurrence in Figure 4.
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
W |p = F |p ∪
289
G|1 [s, t]
(s,t)∈K
W |pk+1 =
0≤s,t
W |pk [spk , tpk ]
(s,t)∈K
∪
G|pk [spk , tpk ].
(s,t)∈K
0≤s,t
Fig. 4. Definition and example of embedding a set G in a fractal F
For example, the illustration in Figure 4 shows the Sierpinski triangle embedded in the Sierpinski carpet. (Note, however, that the definition does not require the set G to be a fractal.) Our goal is to use knowledge of the dimension of G to analyze the dimension of the entire structure W . The result below characterizes the dimension of the added points W \ F and hence the dimension of W . Theorem 3. Let F be a self-similar fractal, G a nonempty subset of N2 , and W the embedding of G in F . Then, Dimζ (W \ F ) = max(Dimζ (F ), Dimζ (G)). Corollary 1. Dimζ (W ) = max(Dimζ (F ), Dimζ (G)).
4
Approximating Generalized Sierpinski Carpets
In this section we present our main result: Theorem 4. Every generalized Sierpinski carpet has an in-place approximation in the aTAM. Our proof includes a construction that, given parameters a, b, c, and p specifying a generalized Sierpinski carpet, produces a TAS in which the approximating set X strictly self-assembles. In an assembly produced by the construction of Figure 3, all the “white” tiles (tiles with label w = 0) occur in nonadjacent pk ×pk blocks. The main idea is to replace the blocks of “white” tiles in the assembly with a set of communication tiles that are sufficient for the “black” tiles to self-assemble, but which occupy a relatively insignificant fraction of the original pk ×pk block of “white” tiles. This is accomplished by introducing rulers and readers to measure the south and west sides of a “white” block and then broadcast the measured value to decrementer tiles which complete the assembly of the east and north sides. The readers and decrementers will also send the original signals from the construction of Figure 3 to their abutting black tiles. We will need tile types for rulers, readers, and decrementers that run both horizontally and vertically. We will define the horizontal tile types along with a transformation V such that given a tileset T , V(T ) consists of the tiles in T with the south and west glues swapped and the north and east glues swapped.
290
4.1
S.M. Kautz and B. Shutters
Rulers and Readers
The behavior of the rulers is encapsulated by the ruler function [6]. For each integer b ≥ 2, the base b ruler function ρb : Z+ → N is defined by the recurrence 0 if n = bk + i for some k ∈ N and 0 < i < b (2) ρb (n) = ρb (k) + 1 if n = bk for some k ∈ Z+ . Intuitively, ρb (n) is the exponent of the largest power of b that divides n. For each integer b ≥ 2 and n ∈ Z+ , let 2ρb (n)
Bb,n =
tb (n)
{(n, i)} and Tb,n =
i=0
n−1
{(j, 2i − 1), (j, 2i)}
i=1 j=n−bi +1
where tb (n) = ρb (n) − 1 if n is a power of b and tb (n) = ρb (n) otherwise. Intuitively, each Bb,n is a bar of height 2ρb (n) and Tb,n is the set of communication fibers added to the structure to allow Bb,n to properly assemble. Then, we define Rb,n =
n
Bb,i ∪ Tb,i and Rb =
i=1
∞
Rb,n .
n=1
We refer to Rb,n as the nth stage of a base b ruler. Theorem 5. For each b ≥ 2 there is a tileset Tb such that for every n ∈ Z+ , Rb,n strictly self-assembles using the tile types in Tb and a seed configuration of length n. Let b be a given base and n ∈ Z+ . To define a seed for the assembly of a ruler, we say that a horizontal sequence of tiles {ti }0≤i
Carpet Tile Trigger Tile Ruler Tile Reader Tile Decrementer Tile
Fig. 5. Rulers, readers, and decrementers embedded in the Sierpinski carpet
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
Hy
Mx
T
T
T
T
(f)
(g)
(h)
H1 H1
Hx M1
H0
MT
Mx
H2
H0
H1
Hx
H0
Mx
H2
T
Hx
H1
Hx
H0
M
(e) first top
T
M2
My
M1 H0
B
(c) top
MT
T
M2
T
B
B
T
M1
T
M
(b) mid
(d) top
later series of that height
M1
B
(a) zig Mx
first series of that height
T
1 2 3 4 5 6 7 8
B
H0
B
B
RulerTileset(b) parameters: a base b include (a), (e), & (f). foreach x ∈ {0, . . . , b − 1} y ← x + 1. if y = b then include (b). if y < b then include (c). if x > 0 & y < b then include (d). include (g). if x > 0 then include (h).
291
H2
H0
H2 H1
H2
H0
H1
H2
seed configuration
(i) Example assembly sequence of base 3 ruler. Fig. 6. Tileset for a ruler
when i = kb for some k > 1, and T as its north glue color otherwise. Then let Tb,n = (Tb , σ, 2) where Tb = RulerTileset(b) as in Figure 6 and the tiles in σ form a ruler ground sequence with dom σ = {1, . . . , n} × {0}. To explain the assembly sequence of Tb,n , we decompose the bars of the ruler into series of b − 1 bars, all of the same height. Each series begins with the first bar at that height or the first bar following a bar of greater height, and ends when a bar of greater height appears. We give special attention to the first series of a given height to appear in the ruler. Figure 6i illustrates an assembly sequence for for a base 3 ruler of length 54. The assembly sequence mainly consists of “bar” tiles (i.e. Figures 6a – 6e) attaching to the seed configuration σ. The bar tiles that attach to the seed configuration at location (b, 1) are of the type 6e. For each location (kb, 1) where k > 1, the bar that assembles at that location consists of alternating tiles of type 6a and then one of the types in 6b – 6d, or, if B is the first bar of that height, both of the types in 6e. To determine which tile should attach, the 6a tile type initiates the assembly of communication tiles (i.e. 6f) which assemble to the nearest bar L to the left of the assembling bar B that is at least the current height h of B, and return a signal representing its “bar type” using tile types of 6g – 6h. The tile type to attach next to B is determined from the returned signal as follows. – Hx (0 ≤ x < b−1): B is the x + 1st bar in a series of height h + 1. B’s assembly completes with a 6c tile type (with y = x + 1). – Hx (x = b−1): Then L is the last bar in a series of height h + 1, so B’s height is at least h + 2. The assembly proceeds with attachment of a 6b and a 6a tile, and at height h + 2 the communication process repeats.
292
(c) 1st bar
B yz
S0y
yz
Skz
M
S0y
Rkz
Sky
Sjz
Rky
GroundTileset(p, y, z) parameters: a prime p and integers y, z foreach j ∈ {0, 1, . . . , p − 2} k ← j + 1. T include (a) & (b). k ← p − 1. yz yz include (c) & (d). (a) 1st cycle (b) cycle Rjz
1 2 3 4 5
S.M. Kautz and B. Shutters
(d) bar
Fig. 7. Tileset for ground of ruler embedded in a carpet
– Mx (x < b−1): Then L is the xth bar and B is the x + 1st bar in the first series of height h + 1. B’s assembly completes with a 6d attaching (with y = x + 1). – Mx (x = b−1): Then B is the first bar of height h + 3. B’s assembly continues with the two 6e tile types attaching. To use a ruler in the self-assembly of a generalized Sierpinski carpet, we replace the seed configuration with a set of ground tiles, defined in Figure 7, that bind to the “black” tiles along the south and west sides of each square of “white” tiles in the original construction (Figure 3). Each ruler will begin its assembly on the north or east side of a ruler trigger tile, defined in Figure 9e and illustrated in Figure 5. The ground tiles attach along the bottom or left side of the square, but cannot extend past the square. The ground tiles for a base b ruler assemble in cycles of b tile types. The glue colors on the tile type’s east and west sides is R for the first cycle and S for the remaining cycles. At the end of each cycle a tile type attaches that has a M for a glue color on the north side if it is the first cycle (causing the initial bar to assemble) or a B for the remaining cycles (causing a bar to assemble that communicates with previous bars to determine its height). Once a ruler embedded along the bottom edge of the square has completed its assembly, its value needs to be read so that right side of the square can properly assemble. The purpose of the reader is to broadcast the ruler’s value along the north edge. In principle, the growth of a reader is similar to the growth of a ruler bar, in that its height is controlled by communication with the ruler bars to its left, using the same communication tiles used within the ruler (i.e. Figure 6f – 6h). The difference is that each time a signal is returned, another base p digit is added to the left of the growing reader. The readers used in the present construction are particularly simple because the length of the embedded ruler, not including the ruler trigger, is always one less than a power of p. However, since the intended height of the right side of the square is the same as the length of the bottom, we want the value on the reader to be the length of the ruler, less the height of the reader itself. This is accomplished by combining a decrement operation with the growth of the rightmost tiles of the reader. An example is shown in Figure 8. Once the reader is assembled, the length pk of the ruler, less the height of the reader itself, is encoded in the glues on the north sides of the reader tiles. A
M H
ruler ground
220 21 21 1 H2
2 0 1 2 0 1 2
decrement
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
293
The value encoded in the north glues of the reader tiles is 74 (in base 3), which is 81 less 7, the height of the reader itself.
Fig. 8. Example assembly of a base 3 reader of length 80
tileset that assembles upwards from the reader to exactly the desired height pk is easy to construct using decrementers. The growth of a reader and decrementer is initiated by a reader trigger tile which has one of the three forms shown in Figures 9g–9k. The tiles forming the rightmost vertical bar of the reader and decrementer replace the original “black” tiles from Figure 3 along the east side of each “white” block. We do not go into the remaining details here, but we will assume the existence of constructions ReaderTileset(p, w, y) DecrementTileset(p, w, y) that take as parameters a prime p and integers w, y and create the necessary tile types. Having defined the reader and decrementer tiles, it is then possible to fully formalize and prove the fact that given an appropriate ruler ground sequence of length pk plus a reader trigger, a ruler, reader, and decrementer of height pk will strictly self-assemble above the ruler ground sequence. 4.2
Putting It all Together
The construction of the complete tileset for approximating a generalized Sierpinski carpet is shown in Figure 9. The set to be assembled is illustrated in Figure 5, where the locations of the tiles of Figure 9 are shown in black. Each block of “white” tiles from the original assembly produced by Figure 3 is removed, along with the “black” tiles directly adjacent to its right and upper sides, and the block is replaced by a pair of rulers, readers, and decrementers forming the border of the block. The tiles in Figure 9a – 9d, added in lines 2 – 9, are identical to those from the construction of Figure 3, excluding those tiles with w = 0, x = 0, or y = 0. The case w = 0, x > 0, and y > 0 indicates the lower left hand corner of a “white” block, and the tile type 9e is used to trigger both a horizontal and vertical ruler. The ruler ground sequences added in lines 12 – 15 form the bottom and left of the “white” square and are terminated with a reader trigger as in 9g, 9i, or 9k. The right and top of the square are formed by the reader and decrementer tiles. A special situation arises when w > 0, x = 0, y = 0, and z > 0, indicating the lower left corner of a black block with a white block to its left and a white block below. This causes two ruler ends to meet, so we need special tiles (j) to deal with triggering both vertical and horizontal readers for the two blocks at once . Let F be a generalized Sierpinski carpet and let X be the set informally described above and pictured in Figure 5. Let T denote the TAS (T, σ, 2), where T is the tileset defined by Figure 9 and σ is the seed tile of Figure 9a. The formal verification of Theorem 4 consists of the following steps:
294
w
x
σ
wy
CarpetApproximationTileset(a, b, c, p) parameters: a prime p and integers a, b, c n ← p − 1. include (a) which is the seed tile. w wx 1 foreach j ∈ {1, 2, . . . , n} y include (b) with y = j and w = by mod p. include (c) with x = j and w = ax modp. (a) (b) left (c) bottom foreach (x, y, z) ∈ {0, 1, . . . , n}3 w ← (ax+by+cz) modp. wx R0xR if w > 0, x > 0 and y > 0 then include (d). yz yz if w = 0, x > 0 and y > 0 then (d) interior (e) ruler trigger include (e). if w = 0, x = 0 and y > 0 then w0 Fnw Enw include GroundTileset(p,y,z). if w = 0, x > 0 and y = 0 then yz yz yz include V(GroundTileset(p,x,z)). if w > 0, x = 0, y > 0 and z > 0 then (f) ruler end (g) trigger include (f) & (g). if w > 0, x > 0, y = 0 and z > 0 then wx wx wx include (h) & (i). if w > 0, x = 0, y = 0 and z > 0 then R0z Snz Rnz include (j) & (k). (h) vertical ruler end (i) trigger if w > 0, x = 0, y > 0, z = 0 then include ReaderTileset(p,w,y) w0 FnwF EnwE include DecrementTileset(p,w,y). if w > 0, x > 0, y = 0, z = 0 then R0z Snz Rnz include V(ReaderTileset(p,w,x)) include V(DecrementTileset(p,w,x)). (j) ruler ends meet (k) trigger include RulerTileset(p) include V(RulerTileset((p)). 1
0y
xz
wy
xz
R0z
wy
Rnz
wy
Snz
wy
xz
w0
xz
Fnw
xz
Enw
R0z
w0
Rnz
nw
Snz
nw
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
S.M. Kautz and B. Shutters
Fig. 9. Constructing a Tileset for Approximating a Generalized Sierpinski Carpet
1. 2. 3. 4.
5
Precisely define the set X. Define a T -assembly sequence whose terminal assembly is X. Show that T is directed, i.e., the terminal assembly is unique. Show that F ⊂ X and Dimζ (F ) = Dimζ (X).
Conclusion
We have shown that for every generalized Sierpinski carpet F there exists an inplace approximation of F , that is, a set X ⊇ F with the same fractal dimension as F that strictly self-assembles in such a way that those tiles corresponding to the set F are recognizably labeled. Moreover, there is an algorithm that produces the tileset for the approximation X from the four parameters a, b, c, and p specifying F . As part of the construction we introduced rulers and the corresponding readers as a new way to control the growth of an assembly. To
Self-assembling Rulers for Approximating Generalized Sierpinski Carpets
295
analyze the dimension of the approximation X we introduced the concept of an embedded fractal and showed that whenever a set G is embedded in a self-similar fractal F , the dimension of the resulting set is always max(Dimζ (G), Dimζ (F )). It is unknown whether any self-similar fractal self-assembles in the aTAM, and in fact it is known that the discrete Sierpinski triangle cannot self-assemble [9]. Lutz and Shutters [10] showed in addition that there is a limitation on how closely the Sierpinski triangle can be approximated: if X is any set that strictly self-assembles, and S is the Sierpinski triangle, then Dimζ (X Δ S) ≥ Dimζ (S), where Δ denotes the symmetric difference. In particular, any in-place approximation X of S has the property that the set of “extra” points X \ S used in the approximation has dimension at least as great as the dimension of S itself. Theorem 3 suggests the following line of reasoning: if a discrete self-similar fractal F does not strictly self-assemble, it may be possible to construct an inplace approximation X as we have done for the generalized Sierpinski carpets. X must add some additional points to the empty squares in F . Theorem 3 shows that if only a single point is added to each of the empty squares of F , then Dimζ (X \ F ) = Dimζ (F ). Conjecture 1. For every self-similar fractal F ⊂ Z2 either F strictly self-assembles, or, for every in-place approximation X of F , Dimζ (X \ F ) ≥ Dimζ (F ). Acknowledgements. We thank Jack Lutz and Jim Lathrop for useful discussions, Matt Patitz for the ISU TAS software, and an anonymous referee for several valuable comments.
References 1. Adleman, L., Cheng, Q., Goel, A., Huang, M.: Running time and program size for self-assembled squares. In: Proceedings of the 33rd Annual ACM Symposium on Theory of Computing (2001) 2. Carbone, A., Seeman, N.C.: A route to fractal DNA-assembly. Natural Computing 1, 469–480 (2002) 3. Carbone, A., Seeman, N.C.: Coding and geometrical shapes in nanostructures: a fractal DNA-assembly. Natural Computing 2, 133–151 (2003) 4. Cheng, Q., Goel, A., Moisset, P.: Optimal self-assembly of counters at temperature two. In: Proceedings of the 1st Conference on Foundations of Nanoscience: SelfAssembled Architectures and Devices (2004) 5. Doty, D., Gu, X., Lutz, J.H., Mayordomo, E., Moser, P.: Zeta-dimension. In: Proceedings of the 30th International Symposium on Mathematical Foundations of Computer Science (2005) 6. Graham, R.L., Knuth, D.E., Patashnik, O.: Concrete Mathematics. AddisonWesley, Reading (1994) 7. Kautz, S.M., Lathrop, J.I.: Self-assembly of the Sierpinski carpet and related fractals. In: Proceedings of DNA15 (2009) 8. Kautz, S.M., Shutters, B.: Supplementary materials, www.cs.iastate.edu/~ shutters/saragsc
296
S.M. Kautz and B. Shutters
9. Lathrop, J.I., Lutz, J.H., Summers, S.M.: Strict self-assembly of discrete Sierpinski triangles. Theoretical Computer Science 410, 384–405 (2009) 10. Lutz, J.H., Shutters, B.: Approximate self-assembly of the Sierpinski triangle. In: Proceedings of the 6th Conference on Computability in Europe (2010) 11. Patitz, M.J.: Simulation of self-assembly in the abstract tile assembly model with ISU TAS. In: Proceedings of the 6th Annual Conference on Foundations of Nanoscience (2009) 12. Patitz, M.J., Summers, S.M.: Self-assembly of discrete self-similar fractals. Natural Computing 9, 135–172 (2010) 13. Razpet, M.: The lucas property of a number array. Discrete Mathematics 248, 157–168 (2002) 14. Rothemund, P.W.K., Papadakis, N., Winfree, E.: Algorithmic self-assembly of DNA Sierpinski triangles. PLoS Biology 2(12) (2004) 15. Rothemund, P.W.K., Winfree, E.: The program-size complexity of self-assembled squares. In: Proceedings of the 32nd Annual ACM Symposium on Theory of Computing (2000) 16. Rothemund, P.W.K.: Theory and Experiments in Algorithmic Self-Assembly. PhD thesis, University of Southern California, Los Angeles, California (2001) 17. Soloveichik, D., Winfree, E.: Complexity of self-assembled shapes. SIAM Journal on Computing 36, 1544–1569 (2007) 18. Wang, H.: Dominoes and the AEA case of the decision problem. In: Proceedings of the Symposium on Mathematical Theory of Automata (1962) 19. Winfree, E.: Algorithmic Self-Assembly of DNA. PhD thesis, California Institute of Technology, Pasadena, California (1998)
Approximately Uniform Online Checkpointing Lauri Ahlroth1,2 , Olli Pottonen1,2 , and Andr´e Schumacher1,2 1
Aalto University, Department of Information and Computer Science 2 Helsinki Institute for Information Technology P.O. Box 15400, FI-00076 Aalto, Finland {Lauri.Ahlroth,Olli.Pottonen,Andre.Schumacher}@tkk.fi
Abstract. In many complex computational processes one may want to store a sample of the process’ history for later use by placing checkpoints. In this paper we consider the problem of maintaining, in an online fashion, a collection of k checkpoints as an approximately uniformly spaced sample in the history of a continuous-time process. We present deterministic algorithms tailored for small values of k and a general one for arbitrary k. The algorithms are proven to be close to optimum. Keywords: checkpointing, online algorithm, uniform spacing.
1
Introduction
Checkpointing means storing the state of a computer process at some moments for further use. In the most obvious application the checkpoints are backups that can be used to restore the process after an error. This application is considered by e.g. Ziv and Bruck [13], who developed an online checkpointing algorithm that minimizes the cost of placing checkpoints, and Nicola and Spanje [8], who compare checkpointing methods for databases. Checkpointing can be used more generally to maintain a sample from the history of the process. For example when adaptively compressing a large file, decompressing a part of it requires knowledge of the compression statistics at the time of compressing that particular part. If the statistics are obtained from a nearby checkpoint, the process is greatly accelerated. Bern et al. [3] present an algorithm for this kind of checkpointing problem. When solving certain differential equations one needs to iterate over the intermediate results in reverse order. If storing all intermediate data is infeasible, a specific checkpointing algorithm is needed to avoid repeating the same computations numerous times. Sturm and Walther solve this problem in offline [10] and online [11] settings. Checkpointing also employs some principles from the field of streaming algorithms [7,2], which have received increasing attention in recent years. Streaming algorithms typically operate on a single pass over a large data input while using sublinear memory or time with respect to input size. This description seems to fit many real-time checkpointing models. The decompression example above is one case where a sample of the history is required. Other such cases include a simulation or experiment where the intention B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 297–306, 2011. c Springer-Verlag Berlin Heidelberg 2011
298
L. Ahlroth, O. Pottonen, and A. Schumacher
is to study the evolution of the process afterwards and rerun parts of the process with different input. When there is no application specific information, spreading the checkpoints uniformly throughout the history appears to be the most natural goal. By uniform we mean that the distances between consecutive checkpoints are equal, which should not be confused with random samples from a uniform distribution. In this paper we develop algorithms for maintaining the checkpoint placement as approximately uniform in an online setting. Our model is different from models previously studied, e.g., in [13,3], since we do not impose costs for either placing or modifying checkpoints. However, we constrain an algorithm to use at most k checkpoints and limit its actions to choose between placing a new checkpoint at the current state of the process, if available, replacing a previous checkpoint, or waiting. Our performance measure reflects uniformness of the checkpoint placement. The resulting problem has an interesting combinatorial structure, and we are not aware of any prior work considering this type of checkpointing problem. Recently, Teramoto et al. [12] and Asano [1] studied the related problem of finding point sequences to be inserted into the unit interval that achieve a close to uniform spacing along the sequence of insertion. Although related, our model is different from [12, 1] since we only allow the presence of a constant number of points at any time. Further, due to the online nature of our problem, an algorithm can place checkpoints only at the current time horizon, which is progressing as time proceeds. Another related problem is to compute lowdiscrepancy sequences [4, 6, 9] of the unit interval. Although mainly beneficial in high dimensions, a well-known example of a low-discrepancy sequence is the onedimensional van der Corput sequence [5, as cited in [6]] whose first m elements represent a reasonably uniformly spaced sample on the unit interval for each m ≥ 1. This paper is organized as follows. In Section 2 we formally define the checkpointing problem. Section 3 discusses online algorithms for solving it. Some of our algorithms are tailored to small values for k, while one algorithm performs slightly worse for small k but has asymptotically optimal performance, as we show in Section 4. Section 5 discusses conclusions and future work.
2
Model
We consider a process which starts at time 0 and halts at time T , where T is not known in advance. Time can be modeled as a real valued or integral variable, that is, time can be either continuous or discrete. In this paper we discuss primarily algorithms that work with continuous time. They can be transformed to discrete time algorithms of comparable performance by simple rounding. Even if the performance gets worse for small T due to rounding effects, the difference vanishes asymptotically. An algorithm has enough memory for k ≥ 2 checkpoints, which save the state of the process at a certain point in time. There are no limits or costs associated with storing checkpoints. The goal is to have the checkpoints placed as evenly as
Approximately Uniform Online Checkpointing
299
possible on the interval [0, T ]. As boundary conditions we assume a permanent checkpoint on time 0 and a rolling checkpoint at T , neither of which is included in the limit of k replaceable checkpoints. During the execution of an algorithm, the k checkpoints and the boundaries divide the time interval from start to present into k + 1 intervals of lengths l0 , l1 , . . . , lk . The actions that the algorithm can take are rather limited. At any moment it can either wait or place a checkpoint at the present state, removing one of the earlier checkpoints unless there still are unplaced checkpoints available. Considering the intervals, the algorithm can at any moment either let the last interval grow, or merge two consecutive intervals, thereby introducing a new interval of zero length. If an algorithm performs perfectly, at time T the checkpoints are placed uniformly, i.e., l0 = l1 = · · · = lk . As a measure of uniformness of the checkpoint placements we introduce the max-min ratio r(t) =
max0≤j≤k lj (t) , min0≤j≤k−1 lj (t)
(1)
which is to be kept small at all times. This measure is closely related to the onedimensional special case of the gap ratio [12]. The last interval lk is excluded when taking the minimum in the denominator, since otherwise the inevitable action of placing a checkpoint at the present state would lead to an infinite maxmin ratio for any algorithm. As the interval lengths lj vary over time, the ratio r varies also, but for a fixed algorithm both the lengths and the ratio depend only on time. We consider deterministic algorithms and their worst-case performance, meaning that T is chosen in the least favorable way. However, in the absence of a lower bound on T the problem becomes meaningless. Every algorithm has a positive time t1 when it is going to place the first checkpoint. For T < t1 the process halts before any checkpoints are placed, implying extremely bad algorithmic performance. To avoid this initialization problem we assume T ≥ c > 0 for some constant c which is known to the algorithm. The actual value of c does not matter as we can scale time as we please. Hence the performance metric considered in this work is π = sup r(T ) , (2) T ≥c
where r(t) is defined in (1). In online algorithms terminology, π is the competitive ratio of an online algorithm compared to an optimal offline algorithm that knows T beforehand and achieves r(T ) = 1. Note that by taking the supremum over the halting time T we essentially require the checkpoints to remain approximately uniformly spaced at all times. We point out that some other natural uniformness measures include the average and greatest distance from a point in time to the nearest checkpoint. T Normalized to have value 1 with the uniform spacing lj ≡ k+1 , these measures become k+1 2 lj (3) T2 0≤j≤k
300
L. Ahlroth, O. Pottonen, and A. Schumacher
and
k+1 max lj , (4) T 0≤j≤k respectively. However, (1) is the strongest of these three measures in the sense that any constant upper bound for (1) implies a constant upper bound in the two others. Hence, we focus on the first measure. Theorem 1. If r(t) ≤ β, then β = β k+1 k is an upper bound for measures (3) and (4). Proof. Assume r(t) ≤ β and denote lm = min0≤j≤k−1 lj . Note that T = lj ≥ lj ≥ k l m , 0≤j≤k
0≤j≤k−1
implying lm ≤ Tk . Also the max-min ratio implies by definition lj ≤ β lm for all j. Thus k+1 2 k+1 k+1 lj ≤ β lm lj = β lm ≤ β , 2 2 T T T 0≤j≤k
0≤j≤k
which implies the result for measure (3). Similarly k+1 k+1 max lj ≤ β lm ≤ β , T 0≤j≤k T implying the result for measure (4).
3
Checkpointing Algorithms
In this section we present several algorithms for the checkpointing problem. We start with a simple algorithm that is in fact asymptotically optimal for k → ∞, as we show in Section 4. For small k, however, we are able to prove better performance guarantees for algorithms discussed in Section 3.3. All of our algorithms are based on the following idea of cyclicity. If one can find a checkpoint placing procedure that transforms the interval length configuration as (l0 , l1 , . . . , lk ) → (γ l0 , γ l1 , . . . , γ lk ) (5) for some γ > 1, then by essentially scaling down the unit of time and thus the lj by γ one again obtains the initial configuration. Repeating the procedure leads to an algorithm that can run indefinitely. Note that the max-min ratio r(t) in (1) is invariant under uniform scaling of the lj values. Hence, the competitive ratio of this algorithm can be determined by examining just the first transition cycle. 3.1
Powers-of-Two Algorithm
There is a simple algorithm that works for any k and has competitive ratio π = 2. It only places checkpoints at integer moments, and the checkpoints are placed
Approximately Uniform Online Checkpointing
301
Place a checkpoint on each integer between 1 and k; j ← 2; while True do Wait until current time t is divisible by j; Place a checkpoint at present time t, removing the checkpoint of the earliest time not divisible by j; if t = kj then j ← 2j; end end Algorithm 1. Powers-of-two algorithm 2j−1
2j−1
2j
Fig. 1. Illustration of the Powers-of-two algorithm, k = 6
so that the interval lengths are powers of two. Also checkpoints are placed on consecutive multiples of a power of two, and these facts inspired the name. We start by placing the k checkpoints on the integers 1, 2, . . . , k, which gives a uniformly spaced sample on the interval [0, k]. The idea is to scale this configuration with γ = 2, eventually becoming a uniformly spaced sample on [0, 2k]. This is achieved by simply removing every other checkpoint on [0, k] and placing new checkpoints on [k + 1, 2k] so that we finally have a checkpoint on every even number. From here on we continue cyclically by applying the same procedure in increasing scale. Pseudocode for this method is given as Algorithm 1. Observe that j in the pseudocode is always a power of two, and j is doubled when we have a checkpoint on each of j, 2j, 3j, . . . , kj where kj is the current time. One should note that Algorithm 1 is similar to the greedy algorithm proposed in [12] if one considers the set of active checkpoints at any given time. Here, however, we need to consider the eviction of a checkpoint from the selection once the maximum number has been reached and a new checkpoint is placed at the end of current time horizon. 3.2
Golden Ratio Approach
The previously discussed powers-of-two algorithm is appealing due to its simplicity. For small values of k, however, one is able to find algorithms that guarantee
302
L. Ahlroth, O. Pottonen, and A. Schumacher
a max-min ratio strictly smaller than 2. Following the cyclicity discussion in the beginning of Section 3, it remains to explicitly build the chain of transitions (5) such that the max-min ratio stays strictly below 2. One method of building these transitions is to require interval lengths lj be integer powers of a common base φ. When merging two intervals, the resulting interval should have a length that is again a power of φ. Hence, we consider φn defined as the unique positive root of 1 + φn = φnn
(6)
where n ≥ 2. Now φ2 is the golden ratio, and we refer to φn as the generalized golden ratio. In our case (6) formulates that by merging two consecutive intervals of lengths 1 and φn one obtains an interval of length φnn . Further, by scaling both sides of the equation by φan it becomes clear how the algorithm can also merge larger intervals into a single interval that is still a power of φn . It is straightforward to show φn ∈ (1, 2) and 1 3 n−1 φn = 1 + ∈ ,2 . (7) φn 2 Hence, an algorithm is an improvement over the powers-of-two algorithm if it satisfies r(t) ≤ φn−1 for a complete cycle. In the following we present several n algorithms which satisfy this condition and achieve π = φn−1 . n 3.3
Golden Ratio Algorithms
For k = 2 define Fj = φj2 , j ≥ 0, so that Fj satisfies the recursion Fj+1 = Fj + Fj−1 , which follows from (6). Now consider Algorithm 2 which places a checkpoint at each Fj , always erasing the oldest checkpoint. At any point in time the checkpoints occur at Fj−1 and Fj for some j, the interval lengths being l0 = Fj−1 , l1 = Fj − Fj−1 = Fj−2 , l2 ≤ Fj−1 . Most importantly, the max-min ratio (1) stays always at Fj /Fj−1 = φ2 . This algorithm is illustrated in Fig. 2. A discrete time variant of the algorithm maintains checkpoints at two latest Fibonacci numbers. In this variant the max-min ratio (1) approaches φ2 as time tends to infinity. Place checkpoints at F1 and F2 ; j ← 1; while True do Wait until time Fj+1 ; Place checkpoint at present time Fj+1 , removing checkpoint at Fj−1 ; j ← j + 1; end Algorithm 2. Golden ratio algorithm, k = 2
Approximately Uniform Online Checkpointing
Fj
303
Fj−1
Fj−1
Fj−2 Fj−1
Fj
Fj+1
Fig. 2. Illustration of the golden ratio algorithm, k = 2
ω 1 ω2 ω ω2 2
φ 1 0 φ 1 φ φ2 φ 0 (a) k = 2
φ 1 φ 1 φ2 φ φ2 φ
φ φ
0 φ
φ 0 φ φ2 − φ φ2 φ φ 2 0 (b) k = 3
ω 1 ω2 ω 0 2 2 ω 1 ω ω ω ω3 ω2 ω ω2 0 3
2
2
ω ω ω ω ω
3
ω3 ω2 ω4 ω3 0 (c) k = 4
2
ω 1 ω ω ω ω3 ω2 ω ω2 ω2 3
ω ω
2
2
ω ω ω
2
0 ω2 0 3
ω − ω2
ω3 ω2 ω ω2 ω3
0
2 3 ω3 ω2 ω ω ω
ω3
ω3 ω2 ω4 ω3 ω3
0
ω3 ω2 ω4 ω3 ω3 ω4 − ω3 ω3 ω2 ω4 ω3 ω4
0
(d) k = 5 Fig. 3. Tabular representations of algorithms for different numbers of checkpoints. Note the shorthands φ = φ2 , ω = φ3 .
In order to present similar algorithms for k = 3, 4, 5 we introduce a tabular representation of the algorithms as shown in Figure 3. Each row of a table lists the relative lengths of the intervals. Going from one row to the next, we either just wait and increase the length of the last interval, or place a new checkpoint at the present time, thereby merging two earlier intervals. These intervals are marked with an underbrace. Each table represents one cycle of the algorithm, resulting in a scaled up version of the initial configuration. Algorithm 2 is represented in Figure 3(a), and similar algorithms for k = 3, 4, 5 in Figures 3(b), 3(c) and 3(d). They have competitive ratios π = φ2 , φ23 and φ23 , respectively. We tried to apply the same golden ratio approach for constructing algorithms for k = 6. However an exhaustive search indicated that this is impossible, at least with base φn , n ≤ 10. It is still possible that there is another kind of algorithm that achieves a better competitive ratio than Algorithm 1, but in Section 4 we will see that only a slightly better ratio is attainable.
304
3.4
L. Ahlroth, O. Pottonen, and A. Schumacher
Optimal Algorithm for k = 2
For k = 2, there is still a better algorithm that can be proven optimal, presented in the following table. 1 1 √0 1 1 2 √ 2 √2 0√ 2 2 2− 2 2 2 0 The structure of this algorithm is very close to the earlier golden ratio framework. Instead of Eq. (6) the interval lengths merge through the rather trivial identity 1 + 1 =√φ2s , and all intervals but the last have a length √ that is an integer power of φs = 2. Furthermore the algorithm achieves π = 2, which is proven optimal as a special case of Theorem 2 in the next section.
4
Lower Bound for Competitive Ratio
Even if the powers-of-two algorithm does not lead to the optimal performance for small k values, asymptotically there are no better algorithms. Theorem 2. An online algorithm with k checkpoints has competitive ratio π ≥ 1−
2
1 k+1 2
.
Proof. Assume there are k checkpoints, and let m = (k + 1)/2 . Let us consider the state of the algorithm just before a merge and consider the m following merges. Let xi be the length of the shortest interval after i merge steps. We can assume that the algorithm always merges an interval of minimum length with an adjacent interval, because if it does not, π > 2 and the claim of the theorem holds. Each of the original k + 1 intervals (just before the first merge) has length at most πx0 , and at least m merges are needed before they all cease to exist. Hence xm−1 ≤ πx0 . Let √ xm−1 m−1 α= ≤ m−1 π . (8) x0 Since α is the geometric mean of the ratios x1 /x0 , . . . , xm−1 /xm−2 , all of them can not be less than α. That is, α ≥ xi+1 /xi for some i. After i + 1 merges the shortest interval length is xi+1 and the longest at least 2xi , and their ratio at least 2xi /xi+1 ≥ 2/α. Now we have π≥
2xi 2 ≥ ≥ xi+1 α
1 2 √ = 2π − m−1 π
m−1
which implies π≥2 This finishes the proof.
m−1 m
1
= 21− m = 2
1−
1 k+1 2
.
(9)
(10)
Approximately Uniform Online Checkpointing
305
Table 1. Summary of found results for different values of k k 2 3 √ Upper bound 2 ≈ 1.414 φ2 ≈ 1.618 √ √ Lower bound 2 ≈ 1.414 2 ≈ 1.414
4 φ23 ≈ 1.755 √ 3 4 ≈ 1.587
5 ≥6 φ23 ≈ 1.755 2 √ 3 4 ≈ 1.587 21−o(1)
The algorithms in Section 3 achieve competitive ratios quite close to the lower bound of Theorem 2. See Table 1 for a summary of the results.
5
Conclusions and Future Work
We considered the problem of maintaining a collection of k checkpoints as an approximately uniformly spaced sample in the history of a continuous-time process in an online fashion. Although the problem shares some similarities with previously studied checkpoint problems, the authors are not aware of any prior work addressing this problem, which has a fundamental combinatorial structure. We propose an online algorithm for the checkpoint problem that is based on the idea of using multiples of powers of two as the checkpoint values. Although surprisingly simple, we show that the algorithm is asymptotically optimal with respect to our performance measure. For a smaller number of available checkpoint times we also provide several other algorithms and prove bounds on their performance. These algorithms are based on a generalization of the golden ratio, which directly leads to a performance guarantee slightly better than for the powers-of-two algorithm. We note that the same type of constructions we used for obtaining provably good algorithms for small k may be applicable to other related problems, possible to a generalization of our problem to higher dimensions. Analyzing randomized algorithms would also be a natural future extension of the work. Acknowledgments. This research has been supported by the Academy of Finland under grant 128823. The third author has been supported also partly by the Helsinki Graduate School of Computer Science and Engineering. The authors are thankful to Pekka Orponen for some helpful comments.
References 1. Asano, T.: Online uniformity of integer points on a line. Information Processing Letters 109(1), 57–60 (2008) 2. Babcock, B., Babu, S., Datar, M., Motwani, R., Widom, J.: Models and issues in data stream systems. In: Proceedings of the Twenty-first ACM SIGMOD-SIGACTSIGART Symposium on Principles of Database Systems, pp. 1–16. ACM, New York (2002) 3. Bern, M., Greene, D.H., Raghunathan, A., Sudan, M.: On-line algorithms for locating checkpoints. Algorithmica 11, 33–52 (1994) 4. Chazelle, B.: The Discrepancy Method: Randomness and Complexity. Cambridge University Press, Cambridge (2000)
306
L. Ahlroth, O. Pottonen, and A. Schumacher
5. van der Corput, J.G.: Verteilungsfunktionen. Proc. Nederl. Akad. Wetensch. 38, 813–821 (1935) 6. Kuipers, L., Niederreiter, H.: Uniform Distribution of Sequences. Dover Publications, Inc., New York (2006) 7. Muthukrishnan, S.: Data streams: Algorithms and applications. Foundations and Trends in Theoretical Computer Science 1(2), 117–236 (2005) 8. Nicola, V., van Spanje, J.: Comparative analysis of different models of checkpointing and recovery. IEEE Transactions on Software Engineering 16, 807–821 (1990) 9. Niederreiter, H.: Random number generation and quasi-Monte Carlo methods. Society for Industrial and Applied Mathematics, Philadelphia (1992) 10. Stumm, P., Walther, A.: Multistage approaches for optimal offline checkpointing. SIAM J. Sci. Comput. 31(3), 1946–1967 (2009) 11. Stumm, P., Walther, A.: New algorithms for optimal online checkpointing. SIAM Journal on Scientific Computing 32, 836–854 (2010) 12. Teramoto, S., Asano, T., Doerr, B., Katoh, N.: Inserting points uniformly at every instance. IEICE - Trans. Inf. Syst. E89-D, 2348–2356 (2006) 13. Ziv, A., Bruck, J.: An on-line algorithm for checkpoint placement. IEEE Transactions on Computers 46, 976–985 (1997)
Bandwidth of Convex Bipartite Graphs and Related Graphs Anish Man Singh Shrestha, Satoshi Tayu, and Shuichi Ueno Department of Communications and Integrated Systems, Tokyo Institute of Technology {anish,tayu,ueno}@lab.ss.titech.ac.jp
Abstract. It is known that the bandwidth problem is NP-complete for chordal bipartite graphs, while the problem can be solved in polynomial time for bipartite permutation graphs, which is a subclass of chordal bipartite graphs. This paper shows that the problem is NP-complete even for convex bipartite graphs, a subclass of chordal bipartite graphs and a superclass of bipartite permutation graphs. We provide an O(n)-time, 4-approximation algorithm and an O(n log2 n)-time, 2-approximation algorithm for convex bipartite graphs with n vertices. For 2-directional orthogonal ray graphs, which is a subclass of chordal bipartite graphs and a superclass of convex bipartite graphs, we provide an O(n2 log n)-time, 3-approximation algorithm, where n is the number of vertices.
1
Introduction
A linear layout of a graph G with vertex set V (G) is a bijection π : V (G) → {1, 2, . . . , |V (G)|}. The bandwidth of π is defined as bπ (G) = max{|π(u)− π(v)| | (u, v) ∈ E(G)}. The bandwidth of G is defined as b(G) = min bπ (G) where π ranges over all linear layouts of G. A linear layout π of G is said to be optimal if bπ (G) = b(G). Given a graph G and an integer k, the bandwidth problem asks whether the bandwidth of G is at most k. Since the bandwidth of a graph is the maximum bandwidth over all its connected components, we shall consider only connected graphs. Let G be a bipartite graph with bipartition (X, Y ). The ordering ≺ of X is said to fulfill the adjacency property if for each y ∈ Y , the set of neighbors of y consists of vertices that are consecutive in the ordering ≺ of X. G is said to be convex if there is an ordering of X that fulfills the adjacency property. G is said to be biconvex if there is an ordering of X and an ordering of Y that fulfill the adjacency property. A graph G with vertex set V (G) = {v1 , v2 , . . . , vn } and edge set E(G) is called a permutation graph if there exists a pair of permutations π1 and π2 on N = {1, 2, . . . , n} such that for all i, j ∈ N , (vi , vj ) ∈ E(G) if and only if (π1−1 (i) − π1−1 (j))(π2−1 (i) − π2−1 (j)) < 0. A bipartite graph which is also a permutation graph is called a bipartite permutation graph. A bipartite graph G is said to be chordal if G contains no induced cycles of length greater than 4. A tree is a chordal bipartite graph by definition. A bipartite graph G with bipartition (X, Y ) is called a 2-directional orthogonal ray graph if, in B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 307–318, 2011. c Springer-Verlag Berlin Heidelberg 2011
308
A.M.S. Shrestha, S. Tayu, and S. Ueno
the xy-plane, there exist a family {Ra |a ∈ X} of horizontal rays (half-lines) extending in the positive x-direction and a family {Rb |b ∈ Y } of vertical rays extending in the positive y-direction, such that two rays Ra and Rb intersect if and only if a and b are adjacent in G. The following relationship between these classes of graphs is known [3,11]: {Bipartite Permutation Graphs} ⊂ {Biconvex Bipartite Graphs} ⊂ {Convex Bipartite Graphs} ⊂ {2-directional Orthogonal Ray Graphs} ⊂ {Chordal Bipartite Graphs}. Papadimitriou [10] showed that the bandwidth problem is NP-complete for general graphs. Monien [9] showed that it is NP-complete even for generalized caterpillars of hair length at most 3, which are very special trees. This implies that it is also NP-complete for chordal bipartite graphs. On the other hand, Heggernes, Kratsch, and Meister [6] recently showed that the bandwidth of bipartite permutation graphs can be computed in polynomial time. Uehara [14] proposed a faster algorithm for the same problem. Polynomial-time algorithms are also known for chain graphs [7], interval graphs [13], and generalized caterpillars of hair length at most 2 [1]. To the best of our knowledge, there are no prior results that determine the complexities of the bandwidth problem for 2-directional orthogonal ray graphs, convex bipartite graphs, or biconvex bipartite graphs. We show in Section 2.1 that the bandwidth problem is NP-complete even for convex trees and therefore for 2-directional orthogonal ray graphs. In Section 4, we show that the problem can be solved in polynomial time for biconvex trees. Several results regarding approximation algorithms to compute bandwidth are known for general and special graph classes. Dubey, Feige, and Unger [5] showed that even for generalized caterpillars (and therefore for chordal bipartite graphs), it is NP-hard to approximate the bandwidth within any constant factor. Polynomial-time, constant-factor approximation algorithms are known for few special graph classes such as AT-free graphs and its subclasses as shown by Kloks, Kratsch, and M¨ uller [8]. Convex graphs or 2-directional orthogonal ray graphs are not contained in any of the classes for which approximation algorithms have been reported. We provide in Section 2.2 an O(n)-time, 4-approximation algorithm and an O(n log2 n)-time, 2-approximation algorithm for convex bipartite graphs, and in Section 3 an O(n2 log n)-time, 3-approximation algorithm for 2-directional orthogonal ray graphs, where n is the number of vertices of a graph.
2 2.1
Bandwidth of Convex Bipartite Graphs NP-Completeness Result
A caterpillar is a tree in which all the vertices of degree greater than one are contained in a single path called a body. An edge incident to a vertex of degree one is called a hair. A generalized caterpillar is a tree obtained from a caterpillar by replacing each hair by a path. A path replacing a hair is also called a hair. Monien [9] showed the following: Theorem I. The bandwidth problem is NP-complete for generalized caterpillars of hair length at most 3.
Bandwidth of Convex Bipartite Graphs and Related Graphs ti
...
p−1
...
...
p−1
309
...
p−1
...
2p − 2
(a) Ti corresponding to task ti
(b) p-barrier
...
2p − 1
(c) Turning point of height p
Fig. 1. Components of caterpillar C
We can show the following by a simple modification of the proof of Theorem I: Theorem 1. The bandwidth problem is NP-complete for convex trees. Proof. (Sketch.)As in the proof of Theorem I, we reduce the multiple processor scheduling problem, which is known to be strongly NP-complete, to our problem. Given a set T = {t1 , t2 , . . . , tn } of tasks (ti being the execution time of task i), a deadline D, and the size m of a set {1, 2, . . . , m} of processors, the multiple processor schedule problem asks whether the tasks in T can be scheduled on the m processors satisfying the deadline D. Corresponding to an instance of this problem, a convex tree C is constructed as follows. Each task ti is represented by a caterpillar Ti shown in Figure 1(a). Each processor i is represented by a chain Pi of length D − 1. Special components called “barrier” and “turning point” are constructed as shown in Figure 1(b) and Figure 1(c), respectively. C is constructed from these components as shown in Figure 2. Task caterpillars Ti and Ti+1 are separated by a chain Li of length Δ. Processor chains Pi and Pi+1 are separated by a (p + 1)-barrier Bi . A turning point of height p+2n+1 separates the upper task portion and the lower processor portion. A (p + 2n + 1)-barrier B0 is attached to the left of P1 . L1
D−1
Ln
T2
Tn
Δ
P2 (p + 1) barrier B1
Pm−1 ...
Pm (p + 1) barrier Bm−1
P1 (p + 1 + 2n) barrier B0
Ln−1
Δ
...
T1
L2
D−1
... turning point of height p + 1 + 2n
Fig. 2. Instance of bandwidth reduced from multiprocessor scheduling problem
310
A.M.S. Shrestha, S. Tayu, and S. Ueno
If we remove from C the degree-1 vertices of the turning point, the remaining tree is a caterpillar. It is easy to see that a caterpillar is biconvex, and therefore both partitions of C have an ordering satisfying the adjacency property. If we restore the degree-1 vertices, irrespective of their positions in the ordering of the partition to which they belong, they do not disturb the adjacency property of the ordering of the other partition. Thus C is a convex tree. If we set the values of Δ and p such that Δ = 2 × (m(D + 2) − 2) and p > 2n(D + 4), C can be constructed in time polynomial in n, m, and D; and it can be shown that the tasks in T can be scheduled on the m processors if and only if C has a bandwidth of k = p + 1 + 2n. In fact, this proof is exactly the same as the proof of Theorem I, except only for a slight difference in the structure of the turning point. Therefore, we shall only briefly describe the idea of the proof here. For a detailed treatment, we refer to Monien [9]. If there exists a scheduling of the tasks in T such that tasks ti1 , ti2 , . . . , tij are assigned to processor i, then C has bandwidth k and an optimal layout can be achieved by (a) laying out the vertices of the body of Ti1 , Ti2 , . . . , Tij between barriers Bi−1 and Bi (betwen Bm−1 and turning point, for i = m) and (b) laying out the vertices of B0 at the extreme left and those of the turning point at the extreme right. Conversely, if C has bandwidth k, then in any optimal layout of C, (a) the turning point must be laid out at one of the extreme ends, and barrier B0 must be laid out at the other, (b) all the vertices of the body of each Tj must be laid out between two barriers Bi and Bi+1 for some i (or Bm−1 and the turning point for i = m − 1), and (c) for each i, if between Bi and Bi+1 (or between Bm−1 and turning point for i = m−1), bodies of Ti1 , Ti2 , . . . , Tij are laid out, then ti1 +ti2 +· · ·+tij < D. This gives us a scheduling of the tasks in T . 2.2
Approximation Algorithms for Convex Bipartite Graphs
In this section, we present two algorithms that approximate the bandwidth of convex graphs with worst-case performance ratios of 2 and 4. Let G be a convex bipartite graph with bipartition (X, Y ) and an ordering ≺ of X satisfying the adjacency property with X = {x1 , x2 , . . . , x|X| } and x1 ≺ . . . ≺ x|X| . Assume Y = {1, 2, . . . , |Y |}. Define mappings s : Y → {1, 2, . . . , n} and l : Y → {1, 2, . . . , n} such that for y ∈ Y , xs(y) and xl(y) are, respectively, the smallest and largest vertices in ≺ adjacent to y. For each vertex y ∈ Y , let m(y) = (s(y) + l(y))/2 . 2.2.1 Algorithm 1 Our first algorithm is described in Figure 3. Algorithm 1 takes as input G along with the mappings s and l and outputs a linear layout π of G. The idea of the
Bandwidth of Convex Bipartite Graphs and Related Graphs
311
1 Compute m(i) for each vertex i ∈ Y . Add a dummy vertex |Y | + 1 to Y with m(|Y | + 1) = |X| + 1. 2 Let σ(1), . . . , σ(|Y + 1|) be the vertices of Y sorted in the non-decreasing order of m(i) value, where σ is a permutation on {1, . . . , |Y | + 1}. 3 Initialize i ← 1, j ← 1, k ← 1. 4 while (j ≤ |X|) 5 if j < m(σ(i)) 6 π(xj ) = k; j ← j + 1; k ← k + 1. 7 else if j = m(σ(i)) 8 π(σ(i)) = k; i ← i + 1; k ← k + 1. 9 return π Fig. 3. Algorithm 1
algorithm is to lay out the vertices of X in the same order as they appear in ≺ and insert the vertices of y between them, such that for each y ∈ Y , |N (y)|/2 vertices of the set N (y) of its neighbors are onto its left and the remaining to its right. Algorithm 1 starts by computing m(y) for each vertex of Y and sorting the vertices according to their m(i) values (Lines 1 and 2). It incrementally assigns labels to the vertices of X in the order in which they appear in ≺ ; stopping at each xj to check whether there is a vertex in y with m(y) value equal to j, in which case it assigns the current label to y. The process is repeated until all vertices have been labelled (Lines 3 through 8). We shall next analyze the performance of Algorithm 1. Consider a layout π output by Algorithm 1. The following lemma is easy to see. Lemma 1. Algorithm 1 preserves the ordering ≺ of X, i.e., π(x1 ) < π(x2 ) < · · · < π(x|X| ).
For a vertex y ∈ Y , let Gy be the subgraph of G induced by the vertices in Vy = {v|π(xs(y) ) ≤ π(v) ≤ π(y)} ∪ {v|π(y) ≤ π(v) ≤ π(xl(y) )}. The diameter of a graph is the least integer k such that a shortest path between any pair of vertices of the graph is at most k. Lemma 2. For any y ∈ Y , the diameter of Gy is at most 4. Proof. Consider Gy corresponding to some y ∈ Y Let u, v be a pair of vertices of Vy . Consider first the case that both u, v ∈ Vy ∩ X. Since π preserves the ordering ≺ of X from Lemma 1, u must be xi and v must be xj for some s(y) ≤ i, j ≤ l(y). Thus both u and v are adjacent to y. Hence the distance between u and v is 2. Consider next the case that u ∈ Vy ∩ X and v ∈ Vy ∩ Y . Vertex v must be adjacent to at least one vertex u in Vy ∩ X. If not, then it must be that l(v) < s(y) or s(v) > l(y), which means that m(v) < s(y) or m(v) > l(y),
312
A.M.S. Shrestha, S. Tayu, and S. Ueno
contradicting the assumption that Algorithm 1 placed v between xs(y) and y or between xl(y) and y. If u is u, then the distance between u and v is 1. Else, both u and u are at distance 2 from the earlier case, and therefore the distance between u and v is 3. Consider finally the case that both u, v ∈ Vy ∩ Y . From the earlier case u must be adjacent to some vertex u , v must be adjacent to some vertex v . Also u and v are both adjacent to y. Hence the distance between u and v is at most 4. In all the above cases, the shortest path between any pair of vertices does not exceed 4, and thus we have the lemma. The following is a well-known lower bound for the bandwidth of a graph [1]. Lemma 3. For a graph G, b(G) ≥ max(N − 1)/D , where the maximum is taken over all connected subgraphs G of G, N is the number of vertices of G , and D is the diameter of G . We are now ready to show the approximation ratio of Algorithm 1. Lemma 4. For layout π returned by Algorithm 1, bπ (G) ≤ 4 × b(G). Proof. Let (x, y), x ∈ X, y ∈ Y be an edge of G such that |π(x) − π(y)| = bπ (G). Let Vxy be the set of vertices v such that v lies between x and y in π. Then bπ (G) = |Vxy | − 1. On the other hand, from Lemmas 2 and 3, we get b(G) ≥ (|Vy | − 1)/4 . Thus we have: bπ (G) |Vxy | − 1 ≤ b(G) (|Vy | − 1)/4 Since the order of X in ≺ is preserved in π, x must be xs(y) or xl(y) , and therefore Vxy ⊆ Vy . Thus we get: bπ (G) ≤ 4. b(G)
There exist convex bipartite graphs for which this ratio is asymptotically equal to 4. Figure 4(a) shows an example of such a convex bipartite graph. Let us assume that the mappings s and l provided to Algorithm 1 are based on the left to right ordering of the vertices of the upper partition as shown in Figure 4(a). The layout π returned by Algorithm 1 will lay out between y and xn+1 all the vertices xi , xi , yij , yij (1 ≤ i ≤ n, 1 ≤ j ≤ 2n − 1). Thus bπ (G) = 2n2 + 2n + 1. On the other hand, the diameter of this graph is 4, and so from Lemma 3, b(G) ≥ (2n2 + 4n + 2)/4 . In fact, for large values of n, there is a layout of bandwidth (2n2 + 4n + 2)/4 as shown in Figure 4(b). Thus the approximation ratio bπ (G)/b(G) is asymptotically equal to 4. Algorithm 1 can be implemented to run in O(|X| + |Y |) time. So it follows from Lemma 4 that: Theorem 2. Algorithm 1 computes a linear layout of a convex bipartite graph G with bipartition (X, Y ) in O(|X| + |Y |) time such that bπ (G) ≤ 4 × b(G).
Bandwidth of Convex Bipartite Graphs and Related Graphs xn+1x−n x−n x−1 x−1
x1 x1
...
y
x2
x2
...
yn1 y22 y23 y11 y11 y21y22y23 y21
xn
xn
...
...
yn,2n−1 yn1
313
xn+1
yn,2n−1
(a) (2n2 + 4n + 2)/4
y
...
x−1
x−n xn+1
...
...
(2n2 + 4n + 2)/4
...
x1
...
xn
...
yn1
...
yn,2n−1
(b) Fig. 4. (a)An example for which the approximation ratio of Algorithm 1 is asymptotically equal to 4. (b) A layout with bandwidth (2n2 + 4n + 2)/4. Only the half right of y is shown as the left half contains the primed counterparts in a symmetric layout. Vertices yij can be laid out in the region indicated by the black vertices.
If only G, and not s and l, is given, we can compute an ordering satisfying the adjacency property (and thus s and l) in time linear to the number of vertices and edges of the graph, as shown by Booth and Lueker [2]. In that case, the time complexity would be O(|X| + |Y | + |E|), where E is the edge set of G. In the next subsection, we show a different algorithm that runs slower but improves the approximation ratio to 2. 2.2.2 Algorithm 2 Let G be a convex bipartite graph with bipartition (X, Y ) and an ordering ≺ of X satisfying the adjacency property with X = {x1 , x2 , . . . , x|X| } and x1 ≺ . . . ≺ x|X| . Let s and l be mappings defined at the beginning of Section 2.2. Let GI be the graph obtained from G by adding to it an edge (y1 , y2 ) for each pair y1 ,y2 ∈ Y having a common neighbor. A graph is said to be an interval graph if for every vertex of the graph, there exists an interval on the real line, such that two intervals intersect if and only if their corresponding vertices are adjacent. Lemma 5. GI is an interval graph. Proof. We can see that GI is an interval graph by defining interval [i, i] for each vertex xi ∈ X, and interval [s(y), l(y)] for each vertex y ∈ Y . Lemma 6. b(GI ) ≤ 2b(G) Proof. Let π be an optimal layout of G. Consider the same layout of GI . For edge (u, v) ∈ E(GI )∩E(G), π(u)−π(v) ≤ b(G). For edge (u, v) ∈ E(GI )\E(G), there exists a common neighbor of u and v in G, and therefore π(u) − π(v) ≤ 2b(G). Thus bπ (GI ) ≤ 2b(G). Since b(GI ) ≤ bπ (GI ), we get b(GI ) ≤ 2b(G).
314
A.M.S. Shrestha, S. Tayu, and S. Ueno
Sprague [13] showed that given an interval model of an n-vertex interval graph G and a positive integer k, a layout of bandwidth at most k, if one exists, can be constructed in O(n log n) time. Thus by doing a binary search between 1 and n, we can compute an optimal layout of G, and therefore we have the following lemma. Lemma 7. An optimal layout of an n-vertex interval graph can be computed in O(n log2 n) time, if its interval model is given. Given a convex bipartite graph G and mappings s and l, Algorithm 2 simply constructs the interval model of GI and applies the algorithm for interval graphs. The interval model of GI can be constructed from s and l in time linear to the number of vertices in G, and therefore we have from Lemmas 6 and 7 the following theorem: Theorem 3. Algorithm 2 computes a linear layout π of a convex graph G with n vertices in O(n log2 n) time such that bπ (G) ≤ 2 × b(G). For a path of length 3, whose bandwidth is 1, Algorithm 2 may return a layout of bandwidth 2. Therefore this bound is tight.
3
Bandwidth of 2-Directional Orthogonal Ray Graphs
Since the set of convex bipartite graphs is a proper subset of the set of 2directional orthogonal ray graphs, the bandwidth problem is NP-complete for 2-directional orthogonal ray graphs, by Theorem 1. In this section, we show a 3-approximation algorithm for 2-directional orthogonal ray graphs. Let G be a bipartite graph with bipartition (X, Y ), and let (≺X , ≺Y ) be a pair of orderings of X and Y , respectively. Two edges (x1 , y1 ) and (x2 , y2 ) of G are said to cross in (≺X , ≺Y ) if x2 ≺X x1 and y1 ≺Y y2 . If for every pair (x1 , y1 ) and (x2 , y2 ) that cross, (x2 , y1 ) is also an edge of G, then (≺X , ≺Y ) is said to be a weak ordering of G. If for every pair (x1 , y1 ) and (x2 , y2 ) of crossing edges, both (x1 , y2 ) and (x2 , y1 ) are edges of G, then (≺X , ≺Y ) is said to be a strong ordering of G. Spinrad, Brandst¨ adt, and Stewart [12] gave the following characterization of bipartite permutation graphs. Lemma 8. A graph G is a bipartite permutation graph if and only if G has a strong ordering. In an earlier work [11], we showed the following characterization of 2-directional orthogonal ray graphs. Lemma 9. A graph G is a 2-directional orthogonal ray graph if and only if G has a weak ordering. Given a 2-directional orthogonal ray graph G with bipartition (X, Y ), edge set E, and a weak ordering (≺X , ≺Y ) of G, we can construct a graph GBP having vertex set VBP = X ∪ Y and edge set EBP = E ∪ E , where E is the set consisting of an edge (x1 , y2 ) for every pair of edges (x1 , y1 ) and (x2 , y2 ) that cross in (≺X , ≺Y ).
Bandwidth of Convex Bipartite Graphs and Related Graphs
315
Lemma 10. GBP is a bipartite permutation graph. Proof. We will show that GBP is a bipartite permutation graph by showing that (≺X , ≺Y ) is a strong ordering of GBP . Let e1 = (x1 , y1 ) and e2 = (x2 , y2 ) be two edges of GBP that cross in (≺X , ≺Y ). We distinguish three cases: Case 1. both e1 , e2 ∈ E, Case 2. one each of e1 , e2 is in E \ E and E, and Case 3. both e1 , e2 ∈ E \ E. Case 1: Since (≺X , ≺Y ) is a weak ordering of G, (x2 , y1 ) ∈ E. By definition of E , (x1 , y2 ) ∈ E . Hence both (x2 , y1 ), (x1 , y2 ) ∈ EBP . Case 2: Without loss of generality, assume e1 ∈ E \E and e2 ∈ E. By definition of E , e1 ∈ E \ E implies that there exist y1 ≺Y y1 and x1 ≺X x1 such that (x1 , y1 ), (x1 , y1 ) ∈ E and they cross. Since (x1 , y1 ) and (x2 , y2 ) also cross, (x1 , y2 ) must be in E and therefore in EBP . To see that (x2 , y1 ) ∈ EBP , we further distinguish three cases depending on the order of x1 and x2 in ≺X . Case 2.1. x1 = x2 : (x2 , y1 ) = (x1 , y1 ) and hence (x2 , y1 ) ∈ E ⊆ EBP . Case 2.2. x2 ≺X x1 : since (x1 , y1 ) and (x2 , y2 ) cross, (x2 , y1 ) ∈ E ⊆ EBP . Case 2.3. x1 ≺X x2 : since (x1 , y1 ) and (x2 , y2 ) cross, (x2 , y1 ) ∈ E; and (x2 , y1 ) and (x1 , y1 ) cross, implying that (x2 , y1 ) ∈ E ⊆ EBP . In all the above subcases of Case 2, we have shown that (x2 , y1 ) ∈ EBP , and hence both (x2 , y1 ), (x1 , y2 ) ∈ EBP . Case 3: By definition of E , e1 ∈ E \ E implies that there exist y1 ≺Y y1 and x1 ≺X x1 such that (x1 , y1 ), (x1 , y1 ) ∈ E and they cross. Again by definition of E , e2 ∈ E \ E implies that there exist y2 ≺Y y2 and x2 ≺X x2 such that (x2 , y2 ),(x2 , y2 ) ∈ E and they cross. Since (x1 , y1 ) and (x2 , y2 ) also cross, (x1 , y2 ) must be in E and therefore in EBP . To see that (x2 , y1 ) ∈ EBP , we further distinguish three cases depending on the order of x1 and x2 in ≺X . Case 3.1. x1 = x2 : since (x2 , y1 ) = (x1 , y1 ), we have (x2 , y1 ) ∈ E ⊆ EBP . Case 3.2. x2 ≺X x1 : since (x1 , y1 ) ∈ E and (x2 , y2 ) ∈ E \ E cross, we have (x2 , y1 ) ∈ EBP from Case 2. Case 3.3. x1 ≺X x2 : we further distinguish three cases, depending on the order of y2 and y1 in ≺Y . Case 3.3.1. y2 = y1 : since (x2 , y1 ) = (x2 , y2 ), we have (x2 , y1 ) ∈ E ⊆ EBP Case 3.3.2. y2 ≺Y y1 : since (x2 , y2 ) and (x1 , y1 ) cross, (x2 , y1 ) ∈ E ⊆ EBP . Case 3.3.3. y1 ≺Y y2 : since (x1 , y1 ) ∈ E \ E and (x2 , y2 ) ∈ E cross, we have (x2 , y1 ) ∈ EBP from Case 2. In all the above subcases of Case 3, we have shown that (x1 , y1 ) ∈ EBP , and hence both (x2 , y1 ), (x1 , y2 ) ∈ EBP . Thus we have shown that for every e1 = (x1 , y1 ) and e2 = (x2 , y2 ) of GBP that cross in (≺X , ≺Y ), both (x2 , y1 ) and (x1 , y2 ) are also edges of GBP ; and therefore from Lemma 8, GBP is a bipartite permutation graph.
316
A.M.S. Shrestha, S. Tayu, and S. Ueno
Lemma 11. b(GBP ) ≤ 3 × b(G). Proof. Let π be an optimal layout of G. Consider the same layout of GBP . For an edge (x, y) of E(GBP ) ∩ E(G), |π(x) − π(y)| ≤ b(G). For an edge (x, y) of E(GBP ) \ E(G), there exist vertices x ∈ X and y ∈ Y such that (y, x ), (x , y), (y , x) are edges of G, and therefore |π(x)−π(y)| ≤ 3×b(G) . Thus we have bπ (GBP ) ≤ 3b(G). Since b(GBP ) ≤ bπ (GBP ), we get b(GBP ) ≤ 3×b(G). We shall assume that along with a 2-directional orthogonal ray graph G, a weak ordering (≺X , ≺Y ) is also provided as input. If not, then such an ordering can be computed in O(n2 ) time, where n is the number of vertices of G [11]. We can construct GBP from G in O(n2 ) time. This can be done by first remembering for each x ∈ X, its smallest neighbor yx in ≺Y and for each y ∈ Y , its smallest neighbor xy in ≺X , and then adding to G an edge (x, y) for each pair x, y for which yx ≺ y and xy ≺ x. Uehara [14] showed that an optimal layout of an n-vertex bipartite permutation graph having bandwidth k can be computed in O(n2 log k) time. Then it follows from Lemma 11 that: Theorem 4. There is an O(n2 log n)-time algorithm which computes a linear layout π of an n-vertex 2-directional orthogonal ray graph G such that bπ (G) ≤ 3 × b(G). Although we do not yet know of an instance for which the ratio is 3, we show in Figure 5(a), graph G for which the algorithm returns a layout of bandwidth 2.5 times the optimal. We can see that the ordering (≺X , ≺Y ) of G such that both ≺X and ≺Y are the top-to-bottom order of the vertices in Figure 5(a) is a weak ordering. The corresponding bipartite permutation graph GBP is shown in Figure 5(b). The bandwidth of G is 2. GBP contains a complete bipartite graph K4,3 induced by the round vertices. Since it is known [4] that b(Km,n) =
(m − 1)/2 + n for m ≥ n > 0, we have b(GBP ) ≥ 4. It can be quickly checked that if b(GBP ) = 4, then in any optimal layout, the black vertices must be laid out as one contiguous block with two of the remaining round vertices on either side of the block. The square vertex, which is adjacent to three round vertices, cannot be placed anywhere without increasing the bandwidth of the layout. Thus b(G) > 4. On the other hand, a layout of bandwidth 5 can be easily obtained.
4
Bandwidth of Biconvex Trees
The 2-claw is a graph obtained from the complete bipartite graph K1,3 by replacing each edge by a path of length 2. The following lemma can be quickly verified. Lemma 12. The 2-claw is not a biconvex tree.
Bandwidth of Convex Bipartite Graphs and Related Graphs
(a) G.
317
(b) GBP .
Fig. 5. 2-directional orthogonal ray graph G for which the approximation ratio is 2.5
Biconvex trees can be characterized as follows: Lemma 13. A tree T is biconvex if and only if T is a caterpillar. Proof. The sufficiency is easy. To prove the necessity, suppose T is a biconvex tree. Let P be a longest path in T . If the length of P is less than five, T is trivially a caterpillar, and so we assume that it is greater than five. Suppose there exists a vertex not in P having degree greater than 1. This implies that T contains the 2-claw as a subtree, contradicting the assumption that T is biconvex graph. Therefore T is a caterpillar. Assmann, Peck, Syslo, and Zak showed the following: Lemma 14. The bandwidth of an n-vertex generalized caterpillars of hair length at most two can be computed in O(n log n) time. From Lemma 13 and Lemma 14, we have: Theorem 5. The bandwidth of an n-vertex biconvex tree can be computed in O(n log n) time. We conclude this paper by noting that the complexity of bandwidth problem for biconvex graphs is open.
References 1. Assmann, S.F., Peck, G.W., Syslo, M.M., Zak, J.: The Bandwidth of Caterpillars with Hairs of Length 1 and 2. SIAM Journal on Algebraic and Discrete Methods 2(4), 387–393 (1981) 2. Booth, K.S., Lueker, G.S.: Testing for the Consecutive Ones Property, Interval Graphs, and Graph Planarity Using PQ-tree Algorithms. Journal of Computer and System Sciences 13(3), 335–379 (1976) 3. Brandst¨ adt, A., Le, V.B., Spinrad, J.P.: Graph Classes: A Survey. Society for Industrial and Applied Mathematics, Philadelphia (1999) 4. Chv´ atal, V.: A Remark on a Problem of Harary. Czechoslovak Mathematical Journal 20(1), 109–111 (1970)
318
A.M.S. Shrestha, S. Tayu, and S. Ueno
5. Dubey, C., Feige, U., Unger, W.: Hardness Results for Approximating the Bandwidth. J. Comput. Syst. Sci. 77, 62–90 (2011) 6. Heggernes, P., Kratsch, D., Meister, D.: Bandwidth of Bipartite Permutation Graphs in Polynomial Time. J. of Discrete Algorithms 7(4), 533–544 (2009) 7. Kloks, T., Kratsch, D., M¨ uller, H.: Bandwidth of Chain Graphs. Inf. Process. Lett. 68(6), 313–315 (1998) 8. Kloks, T., Kratsch, D., M¨ uller, H.: Approximating the Bandwidth for Asteroidal Triple-Free Graphs. Journal of Algorithms 32, 41–57 (1999) 9. Monien, B.: The Bandwidth Minimization Problem for Caterpillars with Hair Length 3 is NP-complete. SIAM J. Algebraic Discrete Methods 7(4), 505–512 (1986) 10. Papadimitriou, C.: The NP-Completeness of the Bandwidth Minimization Problem. Computing 16, 263–270 (1976) 11. Shrestha, A.M.S., Tayu, S., Ueno, S.: On Orthogonal Ray Graphs. Discrete Appl. Math. 158, 1650–1659 (2010) 12. Spinrad, J., Brandst¨ adt, A., Stewart, L.: Bipartite Permutation Graphs. Discrete Appl. Math. 18(3), 279–292 (1987) 13. Sprague, A.P.: An O(n log n) Algorithm for Bandwidth of Interval Graphs. SIAM J. Discrete Math. 7(2), 213–220 (1994) 14. Uehara, R.: Bandwidth of Bipartite Permutation Graphs. In: Hong, S.-H., Nagamochi, H., Fukunaga, T. (eds.) ISAAC 2008. LNCS, vol. 5369, pp. 824–835. Springer, Heidelberg (2008)
Algorithms for Partition of Some Class of Graphs under Compaction Narayan Vikas School of Computing Science, Simon Fraser University, Burnaby, British Columbia, Canada V5A 1S6 [email protected]
Abstract. The compaction problem is to partition the vertices of an input graph G onto the vertices of a fixed target graph H, such that adjacent vertices of G remain adjacent in H, and every vertex and nonloop edge of H is covered by some vertex and edge of G respectively, i.e., the partition is a homomorphism of G onto H (except the loop edges). Various computational complexity results, including both NPcompleteness and polynomial time solvability, have been presented earlier for this problem for various class of target graphs H. In this paper, we pay attention to the input graphs G, and present polynomial time algorithms for the problem for some class of input graphs, keeping the target graph H general as any reflexive or irreflexive graph. Our algorithms also give insight as for which instances of the input graphs, the problem could possibly be NP-complete for certain target graphs. With the help of our results, we are able to further refine the structure of the input graph that would be necessary for the problem to be possibly NP-complete, when the target graph is a cycle. Thus, when the target graph is a cycle, we enhance the class of input graphs for which the problem is polynomial time solvable. Keywords: computational complexity, algorithms, graph, partition, coloring, homomorphism, compaction.
1
Introduction
We first introduce the following definitions and problems. A vertex v of a graph is said to have a loop if vv is an edge of the graph. A reflexive graph is a graph in which every vertex has a loop. A graph in which no vertex has a loop is said to be an irreflexive graph. A graph in general is a partially reflexive graph, in which a vertex may or may not have a loop. A bipartite graph is a graph whose vertex set can be partitioned into two subsets such that no vertex of a set is adjacent to any vertex of the same set. Thus, a bipartite graph is irreflexive by definition. If uv is an edge of a graph then vu is also an edge of the graph. For a graph G, we use V (G) and E(G) to denote its vertex set and edge set respectively. A walk W of length k in a graph G is a sequence of not necessarily distinct vertices W = v0 v1 . . . vk such that vi vi+1 ∈ E(G), for all i = 0, 1, 2, . . . , k−1. We say that W is a walk from v0 to vk . The vertex vi is called the (i + 1)st vertex of W , for B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 319–330, 2011. c Springer-Verlag Berlin Heidelberg 2011
320
N. Vikas
all i = 0, 1, . . . , k. If the vertices of a walk are distinct, the walk is called a path. The length of a walk W will be denoted by length(W ). A graph in which there is a path between every pair of vertices is called a connected graph; otherwise it is called a disconnected graph. For a connected graph H, we shall denote by WH , a walk of minimum length in H that includes all the vertices and non-loop edges of H. A component of a graph is its maximal connected subgraph. The distance between a pair of vertices u and v in a connected graph G, denoted as dG (u, v) or dG (v, u), is the length of a shortest path from u to v in G. The diameter of a connected graph G, denoted as diam(G), is the maximum distance between any two vertices of G. Note that if a connected graph is of diameter 0 then this graph has just an isolated vertex, and no non-loop edge. We denote the sum of the diameters of the components of a graph G by diam+ (G). A subgraph H of a graph G is said to be isometric in G or an isometric subgraph of G, if the distance between any two vertices h and h in H is the same as the distance between the two vertices h and h in G, i.e., dH (h, h ) = dG (h, h ), for all h, h ∈ V (H). In the following, let G and H be graphs. A homomorphism f : G → H, of G to H, is a mapping f of the vertices of G to the vertices of H, such that if g and g are adjacent vertices of G then f (g) and f (g ) are adjacent vertices of H. If there exists a homomorphism of G to H then G is said to be homomorphic to H. Note that if G is irreflexive then G is k-colorable if and only if G is homomorphic to the irreflexive complete graph Kk having k vertices. Thus the concept of a homomorphism generalizes the concept of a k-colorability. A compaction c : G → H, of G to H, is a homomorphism of G to H, such that for every vertex x of H there exists a vertex v of G with c(v) = x, and for every edge hh of H, h = h , there exists an edge gg of G with c(g) = h and c(g ) = h . Notice that the first part of the definition for a compaction (the requirement for every vertex x of H) follows from the second part unless H has isolated vertices. If there exists a compaction of G to H then G is said to compact to H. Given a compaction c : G → H, if for a vertex v of G we have c(v) = x, where x is a vertex of H, then we say that the vertex v of G covers the vertex x of H under c; and if for an edge gg of G we have c({g, g }) = {h, h }, where hh is an edge of H, then we say that the edge gg of G covers the edge hh of H under c. We note that the notion of a homomorphic image used in [Harary, 1969] coincides with the notion of a compaction in the case of irreflexive graphs (i.e., when G and H are irreflexive in the above definition for compaction). The problem of deciding the existence of a compaction to a fixed graph H, called the compaction problem for H, and denoted as COMP-H, asks whether or not an input graph G compacts to H. Results on the compaction problem can be found in [Vikas, 1999, 2003, 2004a, 2004b, 2004c, 2005]. As mentioned earlier, the compaction problem is a special partition problem. The compaction problem has applications in a multiprocessor system for parallel computation [Vikas, 2005], and is also closely related to the constraint satisfaction problem [Vikas, 2004b], which is well known to have an important role in artificial intelligence with vast applications.
Algorithms for Partition under Compaction
321
We now mention some computational complexity results, including both NPcompleteness and polynomial time solvability, that have been presented earlier for the problem COMP-H for various class of target graphs H. When H is a reflexive chordal graph (which includes a reflexive 3-cycle), the problem COMP-H is polynomial time solvable, cf. [Vikas, 2004b]. When H is a chordal bipartite graph (which includes an irreflexive 4-cycle), the problem COMP-H is again polynomial time solvable, cf. [Vikas, 2004b]. It is shown in [Vikas, 1999, 2003] that when H is a reflexive k-cycle, the problem COMP-H is NP-complete, for all k ≥ 4. In particular, for k = 4, this solves a widely publicised open problem on partition posed by Peter Winkler in 1988. The motivation for Winkler’s problem can be found in [Vikas, 1999, 2003]. In [Vikas, 2004a], it has been shown that the problem COMP-H is NP-complete, when H is an irreflexive k-cycle, for all k ≥ 3, k = 4. In fact, it follows from [Hell and Nesetril, 1990] that COMPH is NP-complete for every non-bipartite irreflexive graph H (which includes irreflexive odd cycles), cf. [Vikas, 2004a]. A complete computational complexity classification of COMP-H is given in [Vikas, 2004c, 2005] for all graphs H, including partially reflexive graphs, with at most four vertices. The above mentioned results are also shown to hold by the author (Vikas, 2009) for a variation of the compaction problem, which we call the vertex-compaction problem, that requires only all the vertices to be covered, and not necessarily the edges. In this paper, we pay attention to the input graphs G (instead of the target graphs H), and establish some class of input graphs for which the problem COMP-H is polynomial time solvable, when H is any reflexive or irreflexive graph, and present the corresponding polynomial time algorithms. Our algorithms also give insight as for which instances of the input graphs, the problem COMP-H could possibly be NP-complete, for certain graphs H. This would guide in choosing the instances of the input graphs, when trying to see whether COMP-H is NP-complete, for certain graphs H. Our results make use of the diameter of graphs. However, making use of the consistency test technique and list homomorphisms, we point out that COMP-H is polynomial time solvable, when the input graph is a forest. List partitions have also been studied in [Feder, Hell, Klein, and Motwani, 1999, 2003]. The consistency test is a popular technique in artificial intelligence, and has been used for list homomorphism problems, cf. [Vikas, 2002]. We show that we can modify the results that we present in this paper, so that they also hold analogously for the vertex-compaction problem. In Section 2, we prove some results giving necessary conditions for a graph to compact to another graph. In Section 3, we prove some results giving necessary and sufficient conditions for compaction to reflexive and irreflexive paths. With the help of these results, we establish in Section 4, some sufficient conditions for compaction to reflexive and irreflexive graphs H, using a walk WH in H. This helps in designing polynomial time algorithms for COMP-H for some class of input graphs, when H is any reflexive or irreflexive graph; we present our algorithms in Section 4.1 and Section 4.2 for the reflexive and irreflexive case respectively. In Section 5, we further refine the structure of the input graph that would be necessary for the problem COMP-H to be possibly NP-complete, when
322
N. Vikas
H is a cycle, and thus we enhance the class of input graphs for which the problem COMP-H is polynomial time solvable in the case of cycles.
2
Some Requirements for Compaction
In this section, we establish some necessary conditions for a graph to compact to another graph. Theorem 2.1. Let G be a graph having components G1 , G2 , . . . , Gt , and let H be a graph having components H1 , H2 , . . . , Hs . If G compacts to H then for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt }, such that diam+ (Zi ) ≥ diam(Hi ), and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s. Proof. Let c : G → H be a compaction. Note that the vertices of a component of G cannot map to the vertices of more than one component of H under c, as c is a homomorphism. Thus there exists a graph Zi having components among {G1 , G2 , . . . , Gt } such that Zi compacts to Hi under c, i.e., c : Zi → Hi is a compaction, for all i = 1, 2, . . . , s. Note that Zi and Zj must be disjoint since Hi and Hj are different components, for all i, j = 1, 2, . . . , s, i = j. We now show that diam+ (Zi ) ≥ diam(Hi ), for all i = 1, 2, . . . , s. In order to show this, we first prove the following two lemmas, Lemma 2.1.1 and Lemma 2.1.2. We use Lemma 2.1.1 in the proof of Lemma 2.1.2, and finally we use Lemma 2.1.2 in completing the proof of the theorem. Lemma 2.1.1. If a connected graph G compacts to a graph H then H is also connected and diam(G) ≥ diam(H). Proof. Let G be a connected graph and H be some graph. Suppose that c : G → H is a compaction. Since G is connected, vertices of G cannot map to different components of H under c, as c is a homomorphism. Further, since all the vertices of H are covered by some vertex of G under c, this implies that H must be connected. Now, let h and h be vertices of H such that dH (h, h ) = diam(H). Since c : G → H is a compaction, there exist vertices u and v of G such that c(u) = h and c(v) = h . Since c : G → H is a homomorphism, it must be that dG (u, v) ≥ dH (c(u) = h, c(v) = h ) = diam(H). This implies that diam(G) ≥ diam(H). Lemma 2.1.2. Let G be a graph having components G1 , G2 , . . . , Gt , and let H be a connected graph. If G compacts to H then diam+ (G) ≥ diam(H). Proof. Suppose that c : G → H is a compaction. Then Gi compacts to some subgraph Si of H under c, for all i = 1, 2, . . . , t, with ∪ti=1 Si = H. From Lemma 2.1.1, we have that diam(G t i ) ≥ diam(Si ), for all i = 1, 2, . . . , t. Thus t diam+ (G) = i=1 diam(Gi ) ≥ i=1 diam(Si ) ≥ diam(H), and the lemma is proved. We now continue with the proof of the theorem. From Lemma 2.1.2, we have that diam+ (Zi ) ≥ diam(Hi ), for all i = 1, 2, . . . , s. This completes the proof of the theorem.
Algorithms for Partition under Compaction
3
323
Compaction to Reflexive and Irreflexive Paths
In this section, we establish the necessary and sufficient conditions under which a graph may compact to a reflexive path or an irreflexive path. This would provide a good introduction to some of the requirements to meet for finding a compaction to any graph, and help in designing polynomial time algorithms for COMP-H for some class of input graphs, when H is any reflexive or irreflexive graph. Consider first the special cases of a reflexive and an irreflexive path. If H is a reflexive graph containing a single vertex (which has a loop) then trivially every graph compacts to H. If H is an irreflexive graph containing a single vertex then a graph G compacts to H if and only if E(G) = φ. We now prove the following theorem for reflexive paths. Theorem 3.1. Let H be a graph having components H1 , H2 , . . . , Hs , where Hi is a reflexive path, for all i = 1, 2, . . . , s. Let G be any graph having components G1 , G2 , . . . , Gt . Then G compacts to H if and only if for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt }, such that diam+ (Zi ) ≥ length(Hi), and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s. Proof. If G compacts to H then from Theorem 2.1, we know that the claim holds. In order to prove the converse, we first prove the following two lemmas, Lemma 3.1.1 and Lemma 3.1.2. We use Lemma 3.1.1 in the proof of Lemma 3.1.2, and finally we use Lemma 3.1.2 in proving the converse of the theorem. Lemma 3.1.1. Let H be a reflexive path of length n, and G be any connected graph. Then G compacts to H if and only if diam(G) ≥ n. Proof. Let H be the reflexive path h0 h1 . . . hn of length n. See Figure 1.
h0
h1
hn
Fig. 1. A Reflexive Path H
If G compacts to H then from Lemma 2.1.1, we have that diam(G) ≥ diam(H) = n. Now suppose that diam(G) ≥ n, and let u be a vertex of G such that there exists a vertex w of G with dG (u, w) ≥ n. Define a mapping c : G → H which maps u to h0 , all the vertices at distance 1 from u in G to h1 , all the vertices at distance 2 from u in G to h2 , . . ., and all the vertices at distance n or greater than n from u in G to hn . The distance of adjacent vertices from u in G differ by at most one, and thus they remain adjacent
324
N. Vikas
under c; when the distance is the same they map to the same vertex and remain adjacent under c due to the presence of loops on the vertices of H. Hence c : G → H is a homomorphism. We note in the above definition that c(u) = h0 and c(w) = hn , and hence all the vertices and edges of H are covered under c by respectively the vertices and edges of the path from u to w in G. Thus c : G → H is a compaction. Lemma 3.1.2. Let H be a reflexive path of length n, and G be any graph, not necessarily connected. Then G compacts to H if and only if diam+ (G) ≥ n. Proof. If G compacts to H then from Lemma 2.1.2, we have that diam+ (G) ≥ diam(H) = n. Now suppose that diam+ (G) ≥ n. Using Lemma 3.1.1, each component of G may be assumed to compact to a subpath of H of maximum possible length but not longer than the diameter of the component. We may continue compacting the components of G to the next longest possible uncovered consecutive subpaths of H (starting from the first vertex of H). The mapping for compaction of the components to the subpaths can be defined analogous to as in the proof of Lemma 3.1.1. Let G1 , G2 , . . . , Gt be the components of G. Let ui be a vertex of Gi such that there exists a vertex wi of Gi with dGi (ui , wi ) = diam(Gi ), for all i = 1, 2, . . . , t. We define a mapping c : G → H as follows: i−1 c(ui ) = hj , where j = 0, if i = 1, and j = min( p=1 diam(Gp ), n), for all i = 2, 3, . . . , t, c(vi ) = hj+k , where k = min(dGi (ui , vi ), n − j), for all vi ∈ V (Gi ), for all i = 1, 2, . . . , t. As in the proof of Lemma 3.1.1, c : G → H is a homomorphism. We note in the above definition that c(wi ) = hj+k , where k = min(dGi (ui , wi ), n − j) = min(diam(Gi ), n − j), for all i = 1, 2, . . . , t. Since diam+ (G) ≥ n, this implies that c : G → H is also a compaction. We now prove the converse and complete the proof of the theorem. Suppose that there exists a graph Zi having components among {G1 , G2 , . . . , Gt } such that diam+ (Zi ) ≥ length(Hi ), and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s. Since diam+ (Zi ) ≥ length(Hi ), from Lemma 3.1.2, we have that Zi compacts to Hi , for all i = 1, 2, . . . , s. It follows that G compacts to H, as we can define a compaction c : G → H as follows. Let ci : Zi → Hi be a compaction, for all i = 1, 2, . . . , s. For each vertex v of G, we define c(v) = ci (v), if v ∈ V (Zi ), 1 ≤ i ≤ s, c(v) = h, for some fixed vertex h ∈ V (H), if v ∈ ∪si=1 Zi . In the above definition, if any component Gk of G does not belong to any Zi , 1 ≤ i ≤ s, then we can map the vertices of Gk to any fixed vertex of H for homomorphism under c, as the vertices of H have a loop. Clearly, c : G → H is a compaction. We now prove the following theorem for irreflexive paths.
Algorithms for Partition under Compaction
325
Theorem 3.2. Let H be a graph having components H1 , H2 , . . . , Hs , where Hi is an irreflexive path, for all i = 1, 2, . . . , s. Let G be any graph having components G1 , G2 , . . . , Gt . Then G compacts to H if and only if G is bipartite, E(H) = φ if E(G) = φ, and for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt }, such that diam+ (Zi ) ≥ length(Hi), E(Hi ) = φ if E(Zi ) = φ, and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s. Proof. Suppose that G compacts to H. Consider the conditions under which G may compact to H. As G compacts to H, we know that G is homomorphic to H. Since H is bipartite, it is clear that G must also be bipartite to be homomorphic to H. Also, since H is irreflexive, if G has an edge then clearly H must also have an edge, for G to be homomorphic to H (there are no loops in H, and H cannot contain only isolated vertices, if G contains an edge and is homomorphic to H), i.e., E(H) = φ if E(G) = φ. Also, from Theorem 2.1, we know that the other conditions hold, and since, as mentioned in the proof of Theorem 2.1, Zi compacts to Hi , we must have that Zi is bipartite, and E(Hi ) = φ if E(Zi ) = φ, as explained above (since G is bipartite, we know that Zi is also bipartite), for all i = 1, 2, . . . , s. Now we prove the converse, for which we first prove the following two lemmas, Lemma 3.2.1 and Lemma 3.2.2. Lemma 3.2.1. Let H be an irreflexive path of length n, and G be any connected graph. Then G compacts to H if and only if G is bipartite, E(H) = φ if E(G) = φ, and diam(G) ≥ n. Proof. Let H be the irreflexive path h0 h1 . . . hn of length n. See Figure 2.
h0
h1
hn
Fig. 2. An Irreflexive Path H
Suppose first that G compacts to H. Since H is bipartite, in order that G be homomorphic to H, G must also be bipartite, and H must have an edge if G has an edge, i.e., E(H) = φ if E(G) = φ. Further, from Lemma 2.1.1, diam(G) must be at least n. Now suppose that G is bipartite with diam(G) ≥ n, and H has an edge if G has one, then indeed we can find a compaction of G to H as follows (slightly different from the reflexive case). Let u be a vertex of G such that there exists a vertex w of G with dG (u, w) ≥ n. Define a mapping c : G → H which maps u to h0 , all the vertices at distance 1 from u in G to h1 , all the vertices at distance 2 from u in G to h2 , . . ., all the vertices at distance n from u in G to hn , and all the vertices x at distance px > n from u in G to hn , if px and n have the same parity, and to hn−1 , if px and n have different parity. Note that for mapping the vertices at distance greater than n from u in G, in which case G clearly has an edge, we took advantage of the fact that H also has an edge, namely, hn−1 hn . Since G is bipartite, the distance of adjacent vertices from u in G differ by one,
326
N. Vikas
and thus they remain adjacent under c; they do not map to the same vertex and hence absence of loops in H do not affect their adjacency under c. Hence c : G → H is a homomorphism. Since dG (u, w) ≥ n, there exists a vertex y in G such that dG (u, y) = n. We note in the above definition that c(u) = h0 and c(y) = hn , and hence all the vertices and edges of H are covered under c by respectively the vertices and edges of the path from u to y in G. Thus c : G → H is a compaction. Similar to the reflexive case, we can extend the result when G is disconnected. Thus we have the following lemma. Lemma 3.2.2. Let H be an irreflexive path of length n, and G be any graph, not necessarily connected. Then G compacts to H if and only if G is bipartite, E(H) = φ if E(G) = φ, and diam+ (G) ≥ n. We now prove the converse of the theorem similar to the proof of the converse of Theorem 3.1 but using Lemma 3.2.2.
4
Compaction to Reflexive and Irreflexive Graphs through a Walk
We prove the following theorems for reflexive and irreflexive graphs H, which we shall use in designing polynomial time algorithms for COMP-H, for some class of input graphs, in Section 4.1 and Section 4.2 respectively. Theorem 4.1. Let H be a reflexive graph having components H1 , H2 , . . . , Hs , and G be any graph having components G1 , G2 , . . . , Gt . If for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt }, such that diam+ (Zi ) ≥ length(WHi ), and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s, then G compacts to H. Proof. We first obtain a reflexive path PHi from the walk WHi by assigning distinct names to the vertices of WHi , for all i = 1, 2, . . . , s. Let length(WHi ) = ni , and let PHi = hi0 hi1 . . . hini be the corresponding reflexive path of length ni , where hij is the name assigned to the (j + 1)st vertex of WHi , for all j = 0, 1, 2, . . . , ni , i = 1, 2, . . . , s. Let PH be the graph having components PH1 , PH2 , . . . , PHs . Suppose that for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt } such that diam+ (Zi ) ≥ length(WHi ), and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s. From Theorem 3.1, we know that G compacts to PH . Let c : G → PH be a compaction. We define a compaction c : G → H as follows. If c(v) = hij then we let c (v) = (j + 1)st vertex of WHi , 0 ≤ j ≤ ni , 1 ≤ i ≤ s, for all v ∈ V (G). Since c : G → PH is a homomorphism, and like PH , the graph H is also reflexive, we have that c : G → H is also a homomorphism. Further, all the vertices and edges of WHi , which by definition include all the vertices and non-loop edges of Hi , are covered under c by the vertices and edges of G respectively, for all i = 1, 2, . . . , s, implying that c : G → H is a compaction. Thus G compacts to H.
Algorithms for Partition under Compaction
327
Corollary 4.1.1. Let H be a connected reflexive graph, and G be any graph, not necessarily connected. If diam+ (G) ≥ length(WH ) then G compacts to H. Theorem 4.2. Let H be any graph having components H1 , H2 , . . . , Hs , and G be any graph having components G1 , G2 , . . . , Gt . If G is bipartite, E(H) has a non-loop edge if E(G) = φ, and for each Hi , there exists a graph Zi having components among {G1 , G2 , . . . , Gt }, such that diam+ (Zi ) ≥ length(WHi ), E(Hi ) has a non-loop edge if E(Zi ) = φ, and Zi is disjoint from Zj , for all j = 1, 2, . . . , s, j = i, 1 ≤ i ≤ s, then G compacts to H. Proof. The proof is similar to the proof of Theorem 4.1, where we assume the paths in PH are irreflexive, and use Theorem 3.2. Corollary 4.2.1. Let H be a connected irreflexive graph, and G be any graph, not necessarily connected. If G is bipartite, E(H) = φ if E(G) = φ, and diam+ (G) ≥ length(WH ), then G compacts to H. 4.1
An Algorithm for the Partition Problem COM P -H for Some Class of Input Graphs when H Is Reflexive
In this section, we present a polynomial time algorithm for COMP-H for some class of input graphs, when H is a reflexive graph. The class of graphs for which we design the algorithm is governed by Theorem 2.1 and Theorem 4.1. For simplicity, we assume that H is connected. Our algorithm uses a walk WH in H. We outline our algorithm below which also includes the case when the input graph G may be disconnected. We have included some explanations within brackets in the algorithm. 1. Find the components of G by obtaining a depth first forest. 2. Find the diameter of each component of G by obtaining breadth first trees rooted at each vertex of the component, and keeping record of the maximum height of these trees. Also, keep record of diam+ (G). (The breadth first tree rooted at a vertex v of a component gives the distance from v to each of the vertices in the component, as the path from v to any vertex u in the tree is a shortest path from v to u in the component. A proof for this can be found in [Cormen, Leiserson, Rivest, 1990].) 3. Find diam(H), WH , and length(WH ). 4. If diam(H) ≤ diam+ (G) ≤ length(WH ) − 1 then report this fact stating that the algorithm does not include such an input graph, as such an instance of the input graph G could be a candidate for COMP-H to be possibly NP-complete for certain reflexive graphs H. (See Section 5 for examples.) 5. Else if diam+ (G) ≥ length(WH ) then G compacts to H. (This follows from Corollary 4.1.1. The mapping for compaction of the components to subpaths view of WH can be defined analogous to as in the proof of Theorem 4.1 and Lemma 3.1.2.) 6. Else G does not compact to H. (Since neither Step 4 nor Step 5 applies, this implies that diam+ (G) < diam(H), and hence it follows from Lemma 2.1.2 that G cannot compact to H.)
328
N. Vikas
We now analyse the running time of the above algorithm, assuming adjacency list representation of the input graph. Suppose that the number of vertices and edges in G are n and m respectively. In the above algorithm, Step 1 takes time O(n + m), Step 2 would take in the worst case O(n(n + m)) = O(n2 + nm) time, Step 3 takes O(1) time as H is fixed, Step 4 takes O(1) time, Step 5 takes O(1) time to check the condition, and then O(n) time to define a compaction c : G → H, if required, giving mapping for all the vertices of G, making the total time for Step 5 to be O(n), and Step 6 takes O(1) time. Thus the entire algorithm runs in time O(n2 + nm) and is dominated by Step 2. 4.2
An Algorithm for the Partition Problem COM P -H for Some Class of Input Graphs when H Is Irreflexive
In this section, we present a polynomial time algorithm for COMP-H for some class of input graphs, when H is an irreflexive graph. The class of graphs for which we design the algorithm is governed by Theorem 2.1 and Theorem 4.2. For simplicity again, we assume that H is connected. Our algorithm uses a walk WH in H. We outline our algorithm below which also includes the case when the input graph G may be disconnected. We have again included some explanations within brackets in the algorithm. 1. If G has a loop or E(H) = φ if E(G) = φ then G does not compact to H. 2. Else determine whether or not G and H are bipartite, and if H is bipartite but G is not bipartite then G does not compact to H. (Only a bipartite graph may be homomorphic to a bipartite graph.) 3. Else do steps 4 through 9. 4. Find the components of G by obtaining a depth first forest. 5. Find the diameter of each component of G by obtaining breadth first trees rooted at each vertex of the component, and keeping record of the maximum height of these trees. Also, keep record of diam+ (G). 6. Find diam(H), WH , and length(WH ). 7. If diam(H) ≤ diam+(G) ≤ length(WH ) − 1, or G is not bipartite with diam+ (G) ≥ diam(H) (since Step 2 does not apply, this means that H is also not bipartite, and since Step 1 does not hold, G is irreflexive like H), then report this fact stating that the algorithm does not include such an input graph, as such an instance of the input graph G could be a candidate for COMP-H to be possibly NP-complete for certain irreflexive graphs H. (See Section 5 for eaxmples.) 8. Else if diam+ (G) ≥ length(WH ) then G compacts to H. (This follows from Corollary 4.2.1. Since Step 1 and Step 7 do not apply, we have that G is bipartite and E(H) = φ if E(G) = φ, as required conditions for Corollary 4.2.1. Note that H may be bipartite or non-bipartite here. The mapping for compaction of the components to subpaths view of WH can be defined analogous to as in the proof of Theorem 4.2, Lemma 3.2.2, and Lemma 3.1.2.) 9. Else G does not compact to H. (Since neither Step 7 nor Step 8 applies, this implies that diam+ (G) < diam(H), and hence it follows from Lemma 2.1.2 that G cannot compact to H.)
Algorithms for Partition under Compaction
329
The analysis of the above algorithm is similar to that of the algorithm of Section 4.1, except note that in the above algorithm, Step 1 and Step 2 may be achieved in time O(n + m).
5
Structure of Graphs for Compaction to Cycles
In this section, we further refine the structure of the input graph that would be necessary for the problem COMP-H to be possibly NP-complete, when H is a cycle. Thus, we enhance the class of input graphs for which the problem COMP-H is solvable in polynomial time, when H is a cycle. Theorem 5.1. Let H be a k-cycle, and G be any graph, not necessarily connected, with diam(H) ≤ diam+ (G) ≤ length(WH )−1, i.e., k/2 ≤ diam+ (G) ≤ k − 1. Suppose that G compacts to H, and let c : G → H be a compaction. Then there exists an isometric induced q-cycle S in G, with k/2 ≤ diam(S) ≤ k − 1, i.e., k ≤ q ≤ 2k − 1, such that c : S → H is a compaction. Proof. Since G compacts to H under c, either there exists an isometric induced subgraph P of G, each of whose component is a path in a distinct component of G, with diam+ (P ) ≥ length(WH ) = k, such that P compacts to H under c (if G is connected then P is itself a path), or there exists an isometric induced cycle in G of length ≥ k that compacts to H under c. Since it is given that diam+ (G) ≤ k − 1, there cannot exist an isometric induced subgraph P of G with diam+ (P ) ≥ k. Thus we are left with the only choice that there exists an isometric induced q-cycle S in G of length ≥ k that compacts to H under c. Since diam+ (G) ≤ k − 1, we have diam(S) ≤ k − 1. Since S compacts to H, from Lemma 2.1.1, we have diam(S) ≥ diam(H) = k/2. Thus k/2 ≤ diam(S) ≤ k − 1, i.e., k ≤ q ≤ 2k − 1. Thus if H is a reflexive k-cycle, we can modify Step 4 in the algorithm of Section 4.1, as follows. 4. If diam(H) ≤ diam+ (G) ≤ length(WH ) − 1 and there exists an isometric induced q-cycle S in G with k/2 ≤ diam(S) ≤ k − 1, i.e., k ≤ q ≤ 2k − 1, then report this fact stating that the algorithm does not include such an input graph. Similarly, if H is an irreflexive k-cycle, we can modify Step 7 in the algorithm of Section 4.2, as follows. 7. If diam(H) ≤ diam+ (G) ≤ length(WH ) − 1 and there exists an isometric induced q-cycle S in G with k/2 ≤ diam(S) ≤ k − 1, i.e., k ≤ q ≤ 2k − 1, or if G is not bipartite with diam+ (G) ≥ diam(H), then report this fact stating that the algorithm does not include such an input graph. Thus now Step 6 in the algorithm of Section 4.1 for a reflexive k-cycle H, and Step 9 in the algorithm of Section 4.2 for an irreflexive k-cycle H, would be executed for a larger class of input graphs. Since H, and hence k, is fixed, the above modified steps can be tested in polynomial time. Thus, with our results, we have enhanced the class of input graphs for which the problem COMP-H is solvable in polynomial time, when H is a reflexive or an irreflexive cycle.
330
N. Vikas
It may be pointed that, indeed for a reflexive k-cycle H, the instance of the input graph, for which COMP-H has been shown to be NP-complete in [Vikas, 1999, 2003], is of diameter length(WH ) − 1 = k − 1, and contains an isometric induced reflexive k-cycle, for all k ≥ 4. Similarly, for an irreflexive even k-cycle H, the instance of the input graph, for which COMP-H is shown to be NP-complete in [Vikas, 1999, 2004a], is also of diameter length(WH ) − 1 = k − 1, and contains an isometric induced irreflexive even k-cycle, for all even k ≥ 6. It has been shown by the author (Vikas, 2009) that these results for reflexive and irreflexive k-cycles also hold when the input graph has diameter length(WH ) − 2 = k − 2. Indeed, if H is a reflexive chordal graph or a chordal bipartite graph then COMPH is solvable in polynomial time, cf. [Vikas, 2004b], regardless of the diameter of the input graph, and we can call a separate procedure for such graphs in our algorithms.
References Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. The MIT Press, McGraw-Hill Book Company, Cambridge, Massachusetts, New York (1990) Feder, T., Hell, P., Klein, S., Motwani, R.: Complexity of Graph Partition Problems. In: Proceedings of the 31st Annual ACM Symposium on Theory of Computing (STOC), Atlanta, Georgia (1999) Feder, T., Hell, P., Klein, S., Motwani, R.: List Partitions. SIAM Journal on Discrete Mathematics 16, 449–478 (2003) Harary, F.: Graph Theory. Addison-Wesley, Reading (1969) Hell, P., Nesetril, J.: On the Complexity of H-colouring. Journal of Combinatorial Theory, Series B 48, 92–110 (1990) Vikas, N.: Computational Complexity of Compaction to Cycles. In: Proceedings of the Tenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), Baltimore, Maryland (1999) Vikas, N.: Connected and Loosely Connected List Homomorphisms. In: Kuˇcera, L. (ed.) WG 2002. LNCS, vol. 2573, pp. 399–412. Springer, Heidelberg (2002) Vikas, N.: Computational Complexity of Compaction to Reflexive Cycles. SIAM Journal on Computing 32, 253–280 (2003) Vikas, N.: Computational Complexity of Compaction to Irreflexive Cycles. Journal of Computer and System Sciences 68, 473–496 (2004a) Vikas, N.: Compaction, Retraction, and Constraint Satisfaction. SIAM Journal on Computing 33, 761–782 (2004b) Vikas, N.: Computational Complexity Classification of Partition under Compaction and Retraction. In: Chwa, K.-Y., Munro, J.I.J. (eds.) COCOON 2004. LNCS, vol. 3106, pp. 380–391. Springer, Heidelberg (2004c) Vikas, N.: A Complete and Equal Computational Complexity Classification of Compaction and Retraction to All Graphs with at most Four Vertices. Journal of Computer and System Sciences 71, 406–439 (2005)
A Generic Approach to Decomposition Algorithms, with an Application to Digraph Decomposition Binh-Minh Bui-Xuan1 , Pinar Heggernes1 , Daniel Meister2 , and Andrzej Proskurowski3
3
1 Department of Informatics, University of Bergen, Norway {buixuan,pinar.heggernes}@ii.uib.no, [email protected] 2 Theoretical Computer Science, University of Trier, Germany [email protected] Department of Information and Computer Science, University of Oregon, USA [email protected]
Abstract. A set family is a collection of sets over a universe. If a set family satisfies certain closure properties then it admits an efficient representation of its members by labeled trees. The size of the tree is proportional to the size of the universe, whereas the number of set family members can be exponential. Computing such efficient representations is an important task in algorithm design. Set families are usually not given explicitly (by listing their members) but represented implicitly. We consider the problem of efficiently computing tree representations of set families. Assuming the existence of efficient algorithms for solving the Membership and Separation problems, we prove that if a set family satisfies weak closure properties then there exists an efficient algorithm for computing a tree representation of the set family. The running time of the algorithm will mainly depend on the running times of the algorithms for the two basic problems. Our algorithm generalizes several previous results and provides a unified approach to the computation for a large class of decompositions of graphs. We also introduce a decomposition notion for directed graphs which has no undirected analogue. We show that the results of the first part of the paper are applicable to this new decomposition. Finally, we give efficient algorithms for the two basic problems and obtain an O(n3 )-time algorithm for computing a tree representation.
1
Introduction
The running time of an algorithm that finds a solution by exhaustive search over the family of possible solutions is dependent on the number of possible solutions. For most practical applications, the number of possible solutions is large compared to the input size itself, which makes this brute-force algorithm very inefficient. If the family of possible solutions has some structure, an efficient
This work was supported by the Research Council of Norway. The first author was supported by the French National Research Agency, project MAGNUM.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 331–342, 2011. c Springer-Verlag Berlin Heidelberg 2011
332
B.-M. Bui-Xuan et al.
and compact representation of the family may be a key step to designing an efficient algorithm for the problem. As an example, Gabow used an efficient representation for minimum cuts in a network to improve max-flow algorithms [12]. The above example is one of many possible applications of space-efficient representations, and different specifications of the problem do exist. The fundamental problem that we are considering is the following: given a set family over a finite universe, we ask for an efficient algorithm for computing a space-efficient representation of the set family. An extremal example of such a set family is the power set of the universe, which is exponential in the size of the universe. The space-efficient representation that we are aiming at is a tree whose nodes are labeled, so that each family member can be determined from the tree and only family members can be determined from the tree. The size of the tree, i.e., the number of nodes of the tree, must be linear in the size of the universe. We will call such a representation a tree representation. By a simple counting argument, it is clear that a tree representation cannot exist for arbitrary set families. It is, however, known that efficient representations do exist for set families that satisfy certain closure conditions [7,10,8,6,12,3,5]; a summary of such results and examples for their application can be found in [2]. The resulting tree representation is dependent on the actual closure conditions. In this paper, we focus on so-called weakly partitive crossing families, which are set families that are closed under union, intersection and difference of its crossing members. Two members cross if their intersection is non-empty, none of the two is a subset of the other and the union of the two members does not cover the whole universe. Many studied set families are in fact weakly partitive crossing families. To name only one, the family of non-trivial minimizers of a symmetric submodular function is weakly partitive crossing. This has numerous consequences, since many families arise naturally from such functions [16], such as min-cuts and splits of a graph. As mentioned in the previous paragraph, it is known that set families of certain properties admit tree representations. However, the bare existence of such representations does not imply their efficient computation. In the first part of this paper, we investigate exactly this question: when does a set family admit an efficient tree representation computation? We will give a sufficient condition for this question. We will identify two basic problems whose efficient solutions directly yield an efficient algorithm for the computation of a tree representation. We briefly describe the two basic problems, the oracle problem and the separation problem. The oracle problem decides whether a given set is a member of the given set family F . Note that the oracle problem usually requires a non-trivial algorithm, since the given input represents the set family only implicitly. The separation problem, given two sets A and B, computes (if possible) a member M of the set family that satisfies A ⊂ M ⊂ B; we would say that M separates A and B. In many situations, e.g., the ones mentioned in the last paragraph, a solution for the separation problem exists using a polynomial number of calls to the oracle problem. The algorithm for computing the tree representation will work in three steps: first, it computes the intersection T of the maximal
A Generic Approach to Decomposition Algorithms
333
cross-free subfamilies of F , second, it builds a tree representation for T , and third, it labels the nodes and edges of the tree. A cross-free subfamily of F consists of members that pairwise do not cross. Since it is not possible to list all maximal cross-free subfamilies for obtaining an efficient algorithm, our algorithm for the first step will determine the cross-free kernel from a specific maximal cross-free subfamily. This algorithm part will rely heavily on the algorithms for the oracle and separation problem and the properties of weakly partitive crossing families. Independent of our application, this first step, sometimes also called “uncrossing”, is a crucial pre-processing step in numerous algorithms (see, for instance, [16]). The tree representation for T is built by applying a fundamental result by Edmonds and Giles [11]. Our results unify and generalise several individual results, such as in [5,9,13,14]. In the second part of this paper, we will show an application of the results from the first part. We will introduce a new decomposition notion for directed graphs (digraphs). Usually, decomposition notions for undirected graphs naturally carry over to digraphs. However, the structure of digraphs is much more complex in comparison to undirected graphs, so that these decomposition notions may not have the comparable power for digraphs as their undirected analogue for undirected graphs. To give a short description, our decomposition combines properties of modules and splits. For a digraph G, we say that a set M of vertices of G is a splitmodule if the vertices in M have the same in-neighbours in the outside of M and vertices in M with out-neighbours in the outside of M have the same out-neighbours in the outside of M . We can say that M is a module with respect to in-neighbours and a split with respect to out-neighbours. Splitmodules generalise modules, as every module is a splitmodule. Therefore, splitmodules are less restrictive than modules and seem better prepared for coping with the rich and complex structure of digraphs. We show that the family of splitmodules of a strongly connected digraph forms a weakly partitive crossing family, and, therefore, a tree representation exists. As the main algorithmic results in this part, we will give efficient algorithms for the oracle and separation problem. By applying the results from the first part, we will obtain an O(n3 )-time algorithm for computing a tree representation of the splitmodules of a strongly connected digraph. Due to space restrictions, proofs may be omitted. We assume the reader is familiar with the basic graph-theoretic notions about undirected graphs and trees. Edges of an undirected graph are denoted as uv, meaning that the vertices u and v are adjacent.
2
Efficient Tree Representations of Set Families
A universe is a finite set, which we will usually denote as U. A set family over a universe is a set of subsets of the universe. The elements of a set family are called members. The size of a set family can be exponential in the size of the universe, which means that a fixed concise representation cannot represent all possible set families. In this section, we consider set families of special properties and
334
B.-M. Bui-Xuan et al.
present an algorithmic framework for efficiently computing tree representations of such set families. A main result, Theorem 1, will imply a sufficient condition on a set family to admit a polynomial-time computation of the representation. To be more precise, we will identify two basic algorithmic tasks that will be used as subroutines for the computation algorithm. Efficient algorithms for the two subroutines will directly imply an efficient algorithm for the computation of the desired tree representation. We begin by formally defining our general form of tree representation. Let T be a tree that has at least two nodes. The node set of T is denoted as V (T ), and the edge set of T is denoted as E(T ). A leaf of T is a node with exactly one neighbour in T ; a node that is not a leaf is called an inner node. For an edge e = uv of T , T −e denotes the graph after deletion of e. Note that T −e consists of exactly two connected components, which are also trees: the one that contains node u and the other that contains node v. For a node x of T , (T −e)x denotes the connected component of T −e that contains node x. Assume that δ is a function that labels the leaves of T . By δ((T −e)x ), we denote the set of labels that are assigned to the nodes of (T −e)x that are leaves of T . Definition 1. Let U be a universe. Let (T, δ, λ, κ) be a quadruple where T is a tree with |U| leaves, δ is a bijective function from the leaves of T to the elements of U, λ is a function such that for every edge uv of T , λ(uv) ∈ {(u, v), (v, u), {u, v}}, and κ assigns to every inner node of T a set family over U. Let F be the union δ((T −uv)v ) : (u, v) ∈ V (T ) × V (T ), uv ∈ E(T ), λ(uv) = (v, u) ∪ κ(u) . u inner node of T
We call (T, δ, λ, κ) a tree representation, and F is called the set family represented by (T, δ, λ, κ). A set family F over a universe U is called normalised if ∅ ∈ F and U ∈ F and {u} ∈ F for every u ∈ U. It is not difficult to see that every normalised set family has a tree representation, for instance, by using a star as a tree and assigning the set family to the centre node of the star by function κ. Note that this observation does not contradict the claims from the Introduction, since this star representation is not space-efficient. The size of a tree representation, i.e., the space required for the representation, is mainly determined by the size of the assignment function κ. Thus, the problem of obtaining a space-efficient representation is to “structure” the tree T in such a way that the assignment function κ admits a space-efficient representation. It was shown that weakly partitive crossing set families admit tree representations where the assignment function κ assigns only a bounded number of different set types to the nodes of the representation tree [5]. Let U be a universe. Two sets A and B over U cross if the four sets A ∩ B, A \ B, B \ A, U \ (A ∪ B) are non-empty. It is important to observe that A and B cross if and only if A
A Generic Approach to Decomposition Algorithms
A
B
A
335
B
Fig. 1. The left picture represents the situation when sets A and B cross. The right picture shows the situation for A and U \ B, under the assumption that A and B cross.
and U \ B cross. The crossing property is depicted in Figure 1. A set family is called cross-free if no pair of its members cross. Cross-free families admit easy tree set representations. Lemma 1 ([11]). Let F be a normalised set family over a universe U of at least three elements. If F is cross-free then F has a unique tree representation (T, δ, λ, κ0 ) such that T is a tree without vertices of degree 2 and assignment function κ0 is empty. An easy but important corollary of Lemma 1 is that every cross-free subfamily of a set family over a universe of n elements can have at most 4n members. This observation will be important later in this section for the running time of our algorithms. For computing the tree of the tree representation, we will employ a special cross-free family. For a set family F over a universe U, the canonical cross-free subfamily of F is the set of members A of F for which there is no member B of F such that A and B cross. We show that the canonical cross-free subfamily is the unique maximal subfamily of the maximal cross-free subfamilies of F . Lemma 2. Let F be a set family over a universe U. The canonical cross-free subfamily of F is equal to the intersection of the maximal cross-free subfamilies of F . Proof. Let C be the canonical cross-free subfamily of F , and let T be the intersection of the maximal cross-free subfamilies of F . Let S be a maximal cross-free subfamily of F . We show that C ⊆ S. Let A ∈ C. Due to the definition of C, for all B ∈ F , A and B do not cross, so that S ∪ {A} is cross-free. The maximality of S implies that A ∈ S. Due to the choice of S, it follows that C ⊆ T . For the converse, let D ∈ F be such that D ∈ C. Due to the definition of C, there is B ∈ F such that D and B cross. Since {B} is a cross-free subfamily of F , there is a maximal family S with {B} ⊆ S ⊆ F and S is cross-free. Observe that D ∈ S. Thus, D ∈ T , which shows that T ⊆ C.
Using the canonical cross-free subfamily, we compute the tree of the tree representation by applying Lemma 1. The labeling function λ represents the members of the canonical cross-free subfamily. It remains to represent the remaining members of the family. They will be represented through the assignment function κ.
336
B.-M. Bui-Xuan et al.
It turns out that κ has a very restricted structure, if the considered set family satisfies certain closure properties. A set family F over a universe U is called weakly partitive crossing if for every pair A, B of members of F that cross, the four sets A ∪B, A ∩ B, A \ B, B \ A are members of F . By A, we denote the complement of set A over U, that is A =def U \ A. For a partition P = {P1 , . . . , Pr } of U, let f (F, P) =def A ∈ F : either Z ⊆ A or Z ⊆ A for all Z ∈ P . Clearly, f (F, P) is the set of members of F that are unions of partition classes of P. Weakly partitive crossing families admit a concise description of the assignment function κ. Lemma 3 ([5]). Let F be a normalised weakly partitive crossing family over a universe U. Let C be the canonical cross-free subfamily of F, and let (T, δ, λ, κ0 ) be the tree representation of C with T contains no nodes of degree 2 and κ0 is empty. Let u be an inner node of T . Let Pu =def {δ((T −ux)x ) : ux ∈ E(T )}. If Pu has more than four members, then one of the following cases holds: 1) f (F, Pu ) = X, X : X ∈ Pu or f (F , Pu) = X : ∅ ⊂ A ⊂ P u X∈A 2) there is an ordering P1 , . . . , Pr of the members of Pu such that one of the three cases holds: a) f (F , Pu ) = Pi ∪ · · · ∪ Pj : 1 ≤ i ≤ j ≤ r b) f (F , Pu ) = Pi ∪ · · · ∪ Pj , Pi ∪ · · · ∪ Pj : 1 ≤ i ≤ j ≤ r c) Pi ∪ · · · ∪ Pj : 2 ≤ i < j ≤ r and j − i < r − 2 ⊆ f (F, Pu ) and X ∩ P1 = ∅ for all X ∈ f (F, Pu ) 3) there is Y ∈ Pu , and Y = ∅ for all let Pu =def Pu \ {Y }, such that X ∩ X ∈ f (F , Pu ) and X∈A X : ∅ ⊂ A ⊂ Pu \ X : X ∈ Pu ⊆ f (F, Pu ). Let κ(u) =def f (F, Pu ) for every inner node u of T . Then, (T, δ, λ, κ) is a tree representation for F. This tree representation is unique. As a corollary of Lemma 3, we can present our algorithm for computing the tree representation of a normalised weakly partitive crossing family. The algorithm works in four steps. Let F be a set family over a universe U. Then, step step step step
(1) (2) (3) (4)
compute a maximal cross-free subfamily T of F compute the canonical cross-free subfamily C of F from T compute the tree representation of C according to Lemma 1 assign the remaining family members to the inner nodes of the tree according to Lemma 3, which defines assignment function κ.
In the remaining part of this section, we will show that each of the four steps can be solved efficiently, assuming efficient algorithms for two basic problems. These two problems are the following. Let U be a universe, and let F be a set family over U.
A Generic Approach to Decomposition Algorithms
337
Algorithm 1. Uncrossing input: set family F over a universe U, partition P of universe U 1: if P has at most three partition classes then 2: T ← f (F, P) 3: else 4: pick any X ∈ P and Y ∈ P such that X = Y 5: A ← SeparationF (P, X, Y ) 6: if A = ∅ then 7: if A ∈ F then T ← {A, A} else T ← {A} end if 8: T ← T ∪ Uncrossing(F , {Z ∈ P : Z ⊆ A} ∪ {A}) 9: T ← T ∪ Uncrossing(F , {Z ∈ P : Z ⊆ A} ∪ {A}) 10: else 11: T ←∅ 12: if X ∪ Y ∈ F then T ← T ∪ {X ∪ Y } end if 13: if X ∪ Y ∈ F then T ← T ∪ {X ∪ Y } end if 14: T ← T ∪ Uncrossing(F , (P \ {X, Y }) ∪ {X ∪ Y }) 15: end if 16: end if output: T
OracleF Input A ⊆ U Question Is A a member of F ? SeparationF Input partition P of U and X, Y ∈ P Output A ∈ f (F , P) such that X ⊂ A ⊂ Y ;
∅, if no such A exists.
Employing algorithms for the two problems OracleF and SeparationF as subroutines, we can compute a maximal cross-free subfamily of F . The algorithm for computing such a subfamily is given as Algorithm 1, called Uncrossing. It takes as input a partition of U, and in each recursive step, a new element for the cross-free subfamily is found and the partition is made coarser. Note that this directly implies that the number of recursive calls of Uncrossing is linear in |U|. The oracle problem is denoted as a usual membership test of the form: X ∈ F . The following lemma shows the main property about the result computed by Uncrossing. Note that F can be an arbitrary set family. Lemma 4. Let F be a set family over a universe U and let P be a partition of U. Let R be the output of Uncrossing(F , P). Then, R∪{U, ∅}∪{Z, Z : Z ∈ P} is a maximal cross-free subfamily of f (F, P) ∪ {U, ∅} ∪ {Z, Z : Z ∈ P}. As a consequence of Lemma 4, we can efficiently compute a maximal cross-free subfamily of F : Uncrossing(F , {{u} : u ∈ U}) outputs the non-trivial part of a maximal cross-free subfamily T of F . We briefly discuss the number of calls to SeparationF . This number is equal to the number of recursive calls to Uncrossing. Observe that each call increases the size of T by at least one member (the assignment in line 7) or decreases the size of the involved partition
338
B.-M. Bui-Xuan et al.
by 1 (the new partition in line 14). Therefore, for an n-element universe, this makes a total of at most 4n + n calls to Uncrossing. We use the output cross-free family T to compute the canonical cross-free subfamily of F . The algorithm starts from a tree representation of T and explore its properties. The algorithm, which cannot be presented here, due to the space restrictions, is strongly dependent on the properties of normalised weakly partitive crossing families. The running-time result is stated in the next lemma. Lemma 5. Let F be a normalised weakly partitive crossing family over a universe U. Let T an arbitrary maximal cross-free subfamily of F be given. Then, the canonical cross-free subfamily C of F can be computed from T in linear time with O(|U|) calls to OracleF . To complete our algorithm, it remains to determine assignment function κ. The result of Lemma 3 shows that κ does not require an explicit representation of the assigned subfamilies but can be efficiently represented by simply storing the information about which of the cases in the statement applies. The computational problem to resolve is to decide the actual case for each node of the tree. Given the maximal cross-free subfamily of F and the canonical cross-free subfamily, κ can be computed efficiently. Lemma 6. Let F be a normalised weakly partitive crossing family over a universe U. Assume that the canonical cross-free subfamily C of F and a maximal cross-free subfamily T of F are given. Then, the tree representation of F can be computed in linear time by making O(|U|) calls to OracleF . The space required for the representation is linear in |U|. Combining Lemma 4, Lemma 5 and Lemma 6, we obtain Theorem 1. For a normalised weakly partitive crossing family F over a universe U, the (unique) tree representation of F can be computed in linear time by making O(|U|) calls to OracleF and SeparationF . The space required for the representation is linear in |U|.
3
A Module-Split Digraph Decomposition
We will introduce a digraph decomposition notion, which bridges the gap between modular and split decomposition for digraphs. We will show that the decomposition satisfies the closure properties of weakly partitive crossing families, so that the algorithmic results from Section 2 are applicable. We will also show that the two basic problems, Oracle and Separation, are efficiently solvable, so that our main theorem from Section 2 directly implies an efficient algorithm for computing a tree representation. We consider only simple finite digraphs. For a digraph G, the vertex set of G is denoted as V (G), and the arc set of G is denoted as A(G). For an arc (u, v) of G, we say that u is an in-neighbour of v and v is an out-neighbour of u. For a vertex v
A Generic Approach to Decomposition Algorithms
339
in of G, the in-neighbourhood of v is NG (v) =def {u : (u, v) ∈ A(G)}, and the outout neighbourhood of v is NG (v) =def {u : (v, u) ∈ A(G)}. For two vertices u, v of G, a directed path from u to v is a sequence u = x1 , x2 , . . . , xk = v of vertices of G such that (xi , xi+1 ) ∈ A(G) for 1 ≤ i < k. A digraph is strongly connected if there is a directed path from every vertex to every other vertex.
3.1
Splitmodules of Digraphs
We say that two vertices u and v of a digraph are not distinguishable by a third vertex w if w is an in-neighbour of u and v or if w is not an in-neighbour of u and v. “Being indistinguishable” is a fundamental property that is explored in graph theory as well as by graph algorithms. We study variants of this property. Definition 2. Let G be a digraph. A set M of vertices of G satisfies: in in (u) \ M = NG (v) \ M for every vertex pair u, v a) the module condition if NG from M ; out out b) the split condition if NG (u) \ M = NG (v) \ M for every vertex pair u, v out out from M where NG (u) \ M = ∅ and NG (v) \ M = ∅.
Let M be a set of vertices of G. If M satisfies the module condition then M is called a genuine module of G. If M satisfies the split condition then M is called a genuine split of G. If M satisfies the module and split condition then M is called a splitmodule of G. A set family is crossing if it is closed under union and intersection of its crossing members. It is known that the genuine modules of a digraph form a crossing family [4]. A similar result holds for genuine splits and splitmodules. Lemma 7. Let G be a stongly connected digraph. The genuine splits of G form a crossing family, and the splitmodules of G form a weakly partitive crossing family. We show that splitmodules admit a local characterisation property. For a digraph G and X ⊆ V (G), the subgraph of G induced by X, denoted as G[X], is the digraph on vertex set X and with arc set A(G) ∩ X 2 . Lemma 8. Let G be a digraph. For a set M of vertices of G and a ∈ M and c ∈ M where (a, c) ∈ A(G), M is a splitmodule of G if and only if there is no ordered vertex pair (b, d) of G such that b ∈ M and d ∈ M and {a, b} is not a splitmodule of G[{a, b, c, d}]. Proof. Let M and a and c be as assumed. We have to show two implications. First, assume that M is a splitmodule of G. Let H be an induced subgraph of G. Then, M ∩ V (H) is a splitmodule of H, and thus, {a, b} is a splitmodule of G[{a, b, c, d}] for every choice of b ∈ M and d ∈ M . For the converse, assume that M is no splitmodule of G. Then, M does not satisfy the module or the split condition. First assume that M does not satisfy the module condition. This
340
B.-M. Bui-Xuan et al.
means that there is a vertex triple u, v, w of G such that u, v ∈ M and w ∈ M and (w, u) ∈ A(G) and (w, v) ∈ A(G). If a = u or a = v then {u, v} is not a splitmodule of G[{u, v, c, w}], and the claim follows. Otherwise, if a ∈ {u, v} then either (w, a) ∈ A(G) and {a, v} is not a splitmodule of G[{a, v, c, w}] or (w, a) ∈ A(G) and {a, u} is not a splitmodule of G[{a, u, c, w}]. Note that we do not exclude the possibility of c = w. Second, assume that M does not satisfy the split condition. Then, there are four vertices u, v, w, x of G such that u, v ∈ M and w, x ∈ M and (u, w) ∈ A(G) and (v, w) ∈ A(G) and (v, x) ∈ A(G). Analogously to the module condition case, if a ∈ {u, v}, then {u, v} is not a splitmodule of G[{u, v, c, w}]. Let a ∈ {u, v}. If (a, w) ∈ A(G) then {a, u} is not a splitmodule of G[{a, u, c, w}]. If (v, c) ∈ A(G) then {a, v} is not a splitmodule of G[{a, v, c, x}]. If (v, c) ∈ A(G) then {a, v} is not a splitmodule in G[{a, v, c, w}].
The proof of Lemma 8 actually shows a local characterisation property for genuine modules and genuine splits, which combine into the local characterisation property for splitmodules. 3.2
A Tree Representation for Splitmodules
We present an efficient algorithm for computing a tree set representation for the splitmodules of a strongly connected digraph. We apply the results of Section 2, which is possible, since the splitmodules of a strongly connected digraph form a weakly partitive crossing family, due to Lemma 7. According to Theorem 1, it remains to specify algorithms for the oracle and separation problem. We begin with the separation problem. Our procedure is given as Algorithm 2. It receives as input a digraph G, a partition of its vertex set and two vertices. To give a brief description, the algorithm tries to compute a union of partition classes of the given partition such that this union is properly between classes X and Y (selected in line 1). The proper inclusion is partly ensured by the chosen partition class Z (line 2) and partly by the checks in line 7 and line 12. Note here that Z is chosen without any restriction. Also note that the algorithm always terminates, since the two while loops, in lines 4–5 and 9–10, can be executed at most k − 2 times, where k is the number of partition classes of the partition. We show that, under a certain condition on the selection of the input vertices, Algorithm 2 implements Separation. Lemma 9. Let G be a digraph. Let F be the family of splitmodules of G and let P be a partition of V (G) with at least three partition classes. Let X, Y ∈ P be such that X = Y and (a, c) ∈ A(G) for some a ∈ X and c ∈ Y . Let A be the output of Algorithm 2 on input (G, P, a, c). Then, X ⊂ A ⊂ Y and A ∈ f (F , P) if and only if there exists E ∈ f (F , P) such that X ⊂ E ⊂ Y . Lemma 10. There is a linear-time algorithm, given a digraph G and a set M of vertices of G, to decide whether M is a splitmodule of G. Combining Lemma 9, Lemma 10 and Theorem 1, we obtain
A Generic Approach to Decomposition Algorithms
341
Algorithm 2. (Separation) input: partition P of V (G) of a digraph G and a, c ∈ V (G) 1: let X, Y ∈ P with a ∈ X and c ∈ Y 2: pick Z ∈ P such that Z = X and Z = Y 3: A ← X ∪ Z 4: while exist b ∈ A and d ∈ / A with {a, b} is not a splitmodule of G[{a, b, c, d}] do 5: A ← A ∪ D for D ∈ P with d ∈ D 6: end while 7: if A ⊂ Y then output A end if 8: A ← Y ∪ Z 9: while exist b ∈ A and d ∈ / A with {a, b} is not a splitmodule of G[{a, b, c, d}] do 10: A ← A \ B for B ∈ P with b ∈ B 11: end while 12: if X ⊂ A then output A end if 13: output ∅
Theorem 2. The (unique) tree representation of the family of splitmodules of a strongly connected digraph can be computed in O(n3 ) time, where n is the number of vertices of the input digraph.
4
Conclusion
We introduced the notion of splitmodule for digraphs. The splitmodules of a strongly connected digraph form a weakly partitive crossing family, a set family that admits efficient tree representation. We gave an O(n3 )-time algorithm for computing this representation. The algorithm is specific for splitmodules only in two respects: splitmodules admit a local characterisation property (Lemma 8), and, given a digraph G and M ⊆ V (G), it can be checked in linear time whether M is a splitmodule of G (Lemma 10). It directly follows for an arbitrary weakly partitive crossing family that a similar tree representation algorithm exists, if these two easy conditions can be satisfied. The second task, the oracle problem, is basic. The more challenging problem may be the local characterisation property. The running time of Algorithm 2 was mainly determined by the structure of the local characterisation property, which required consideration of almost all vertex pairs (lines 4 and 9). Thus, our approach provides efficient tree representation algorithms for a large class of decomposition notions. A first question is whether our algorithm can be improved to O(nm) or even O(n2 ) running time for the case of splitmodules of strongly connected digraphs. Another question is whether a similar approach also works for generalisations of weakly partitive crossing families, such as crossing families. It is known that crossing families admit O(|U|2 )-space representations [1,12]. The main difficulty is to determine a concise representation of assignment function κ.
342
B.-M. Bui-Xuan et al.
Acknowledgement. We would like to thank Ross McConnell for fruitful initial discussions on the topic and for comments on the final version of the paper.
References 1. Bern´ ath, A.: A note on the directed source location algorithm. Technical report, TR-2004-12, Egerv´ ary Research Group, Budapest (2004) 2. Bui-Xuan, B.-M.: Tree-representation of set families in graph decompositions and efficient algorithms. PhD thesis, University of Montpellier II (2008) 3. Bui-Xuan, B.-M., Habib, M.: A representation theorem for union-difference families and application. In: Laber, E.S., Bornstein, C., Nogueira, L.T., Faria, L. (eds.) LATIN 2008. LNCS, vol. 4957, pp. 492–503. Springer, Heidelberg (2008) 4. Bui-Xuan, B.-M., Habib, M., Limouzy, V., de Montgolfier, F.: Algorithmic Aspects of a General Modular Decomposition Theory. Discrete Applied Mathematics 157, 1993–2009 (2009) 5. Bui-Xuan, B.-M., Habib, M., Rao, M.: Tree-representation of set families and applications to combinatorial decompositions. European Journal of Combinatorics (to appear) 6. Chein, M., Habib, M., Maurer, M.-C.: Partitive hypergraphs. Discrete Mathematics 37, 35–50 (1981) 7. Cunningham, W.: A combinatorial decomposition theory. PhD thesis, University of Waterloo (1973) 8. Cunningham, W., Edmonds, J.: A combinatorial decomposition theory. Canadian Journal of Mathematics 32, 734–765 (1980) 9. Cunningham, W.: Decomposition of directed graphs. SIAM Journal on Algebraic and Discrete Methods 2, 214–228 (1982) 10. Dinitz, E., Karzanov, A., Lomonosov, M.: On the structure of a family of minimal weighted cuts in a graph. In: Pridman, A. (ed.) Studies in Discrete Optimization, Nauka, Moscow, pp. 290–306 (1976) 11. Edmonds, J., Giles, R.: A min-max relation for submodular functions on graphs. Annals of Discrete Mathematics 1, 185–204 (1977) 12. Gabow, H.: Centroids, Representations, and Submoduar Flows. Journal of Algorithms 18, 586–628 (1995) 13. Hsu, W.-L., Gabor, C., Supowit, K.: Recognizing circle graphs in polynomial time. Journal of the ACM 36, 435–473 (1989) 14. de Mongolfier, F., Rao, M.: The bi-join decomposition. Electronic Notes in Discrete Mathematics 22, 173–177 (2005) 15. Queyranne, M.: Minimizing symmetric submodular functions. Mathematical Programming 82, 3–12 (1998) 16. Schrijver, A.: Combinatorial Optimization – Polyhedra and Efficiency. Springer, Heidelberg (2003)
Matching and P2 -Packing: Weighted Versions Qilong Feng1 , Jianxin Wang1 , and Jianer Chen1,2 1
2
School of Information Science and Engineering, Central South University, Changsha 410083, P.R. China Department of Computer Science and Engineering Texas A&M University College Station, Texas 77843-3112, USA [email protected]
Abstract. Parameterized algorithms are presented for the weighted P2 Packing problem, which is a generalization of the famous Graph Matching problem. The algorithms are based on the following new techniques and observations: (1) new study on structure relationship between graph matchings in general graphs and P2 -packings in bipartite graphs; (2) an effective graph bi-partitioning algorithm; and (3) a polynomial-time algorithm for a constrained weighted P2 -Packing problem in bipartite graphs. These techniques lead to randomized and deterministic parameterized algorithms that significantly improve the previous best upper bounds for the problem for both weighted and unweighted versions.
1
Introduction
Packing problems, such as Set Packing and Subgraph Packing, form an important class of NP-hard problems with wide applications in the fields of scheduling and code optimization [1,10]. The Subgraph Packing (H-Packing) problem is to find the maximum number of vertex-disjoint subgraphs each of which is isomorphic to the given subgraph H. If H is the complete graph K2 , the H-Packing problem becomes the famous maximum Graph Matching problem, which can be solved in polynomial time [7]. For the case when the number of vertices in H is no less than three, the HPacking problem is NP-hard [14]. Kann [12] proved that the H-Packing problem is MAXSNP-complete. Recently, parameterized H-Packing problems have been studied, where on a given graph G and a parameter k, the objective is to find k vertex-disjoint subgraphs each of which is isomorphic to H, or report that no such subgraphs exist. In this paper, we study the weighted version of a special case of the H-Packing problem, the weighted P2 -Packing problem. The graph P2 is a simple path of
This work is supported by the National Natural Science Foundation of China under Grant (61073036, 61070224), the Doctoral Discipline Foundation of Higher Education Institution of China under Grant (20090162110056).
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 343–353, 2011. c Springer-Verlag Berlin Heidelberg 2011
344
Q. Feng, J. Wang, and J. Chen
three vertices and two edges. A P2 -packing of size k in a graph G is a collection of k vertex-disjoint subgraphs in G of which each is isomorphic to P2 . The problem is formally defined as follows. (Parameterized) Weighted P2 -Packing: Given a weighted graph G in which each edge is associated with a positive weight, and an integer k, either construct a P2 -packing of size k whose weight is the maximum over all P2 -packings of size k in G, or report that no P2 -packing of size k exists. The P2 -Packing problem is closely related to the Test Cover problem and the Vehicle Routing problem, which have applications in fault testing and diagnosis, pattern recognition, and transportation systems. The Test Cover problem is to find a set of edges E in a given hypergraph G such that for each pair of vertices vi and vj in G, there is an edge e in E that is incident to exactly one of the vertices vi and vj . De Bontridder et al. [4] showed a relationship between the Test Cover problem and the P2 -Packing problem. The Vehicle Routing problem [8] can be modeled by packing of paths of length d, which has been studied in [2,16]. Solving the P2 -Packing problem has a direct impact on solving the Test Cover and Vehicle Routing problems. In the study of approximation algorithms, for a general subgraph H, Hurkens and Schrijver [11] presented an approximation algorithm with ratio |H|/2 + ε for any ε > 0 for the maximum H-Packing problem. Hassin and Rubinstein [9] gave a randomized approximation algorithm with ratio 35/67 for the maximum P2 Packing problem. De Bontridder et al. [4] considered approximation algorithms for the maximum P2 -Packing problem based on a maximal P2 -packing and tried to replace a P2 -packing of size l with a P2 -packing of size l + 1, which leads to an approximation algorithm with ratio 2/3 for l ≥ 4. In terms of parameterized algorithms, for a general subgraph H, Fellows et al. [5] presented an algorithm of running time O∗ (2O(|H|k log k+k|H| log |H|) ) for the H-Packing problem.1 Since the weighted P2 -Packing problem can be reduced to the weighted 3-Set Packing problem in polynomial time, all parameterized algorithms solving the weighted 3-Set Packing problem can be used to solve the weighted P2 -Packing problem. The 3-Set Packing problem has been studied extensively (see, for example [6,13,19]). In particular, Feng et al. [6] gave a deterministic parameterized algorithm of time O∗ (32k ) for the weighted 3-Set Packing problem, which is the current best result for the problem and is also the current best upper bound for the weighted P2 -Packing problem. For the unweighted P2 -Packing problem, Prieto and Sloper studied kernelization algorithms for the problem that, plus other techniques, lead to a parameterized algorithm of time O∗ (39.43k ) for the problem [18]. Based on an improved kernelization algorithm given in [20], Henning et al. [8] gave an improved parameterized algorithm with running time O∗ (14.67k ), which is the current best result for the unweighted P2 -Packing problem. 1
Following a recent convention, for a function f , we will use the notion O∗ (f ) for the bound O(f ·nO(1) ).
Matching and P2 -Packing: Weighted Versions
345
We remark that the current best randomized algorithm for the unweighted 3-Set Packing problem is of time O∗ (8k ) [13]. However, whether the randomized algorithm in [13] can be derandomized and whether the algorithm can be used to solve the weighted case are unknown. In this paper, we propose a different algorithmic approach to the weighted P2 -Packing problem. We first study a constrained P2 -Packing problem on bipartite graphs, and present properties on the structure relationship between the constrained P2 -Packing problem on bipartite graphs and the Graph Matching problem on general graphs. This study leads to a polynomial-time algorithm for the constrained P2 -Packing problem on bipartite graphs. We then present an effective bi-partitioning algorithm for general graphs that, when combined with the polynomial-time algorithm for the constrained P2 -Packing problem on bipartite graphs, gives an O(8k )-time randomized algorithm and an O(8k+o(k) )time deterministic algorithm for the weighted P2 -Packing problem, significantly improving the previous best upper bound O∗ (32k ). The deterministic algorithm, when applied to the unweighted version of the problem, solves the unweighted P2 -Packing problem in time O∗ (8k+o(k) ), improving the previous best upper bound O∗ ((14.67)k ) for the unweighted P2 -Packing problem.
2
Constrained P2 -Packings on Bipartite Graphs
Let G = (V, E) be an undirected and weighted simple graph, in which each edge is associated with a positive weight. The weight of an edge [u, v] is denoted by wt(u, v). For a P2 that is a simple path of two edges, the middle vertex of a P2 is called the mid-vertex, and the two end-vertices of P2 are called the end-vertices. We first study a constrained P2 -Packing problem on bipartite graphs. Let B = (L ∪ R, E) be a bipartite graph. We say that a P2 -packing P in B is with end-vertices in L if each P2 in P has both its end-vertices in the vertex set L. The following is the formal definition of our problem. Constrained Weighted P2 -Packing on Bipartite Graphs (CWPB): Given a weighted bipartite graph B = (L ∪ R, E) and an integer k, either construct a P2 -packing P of size k with end-vertices in L such that the weight of P is the maximum over all P2 -packings of size k with endvertices in L, or report that no such P2 -packing exists. The concept of the auxiliary graph of a bipartite graph, as defined below, plays an important role in our discussion. Definition 1. Let B = (L ∪ R, E) be a weighted bipartite graph, where R = {v1 , v2 , . . . , vt } and the sum of the total edge weights in B is equal to b0 . The auxiliary graph B+R of B has the vertex set L∪R∪R , where R = {v1 , v2 , . . . , vt } is a copy of R, and contains B as a subgraph. Moreover, for each vertex vi in R : (1) if [vi , w] is an edge in B, then add an edge [vi , w] of weight wt(vi , w) to B+R , and (2) add also an edge {vi , vi } of weight b0 + 1 to B+R .
346
Q. Feng, J. Wang, and J. Chen
P2 -packings in the bipartite graph B and matchings in its auxiliary graph B+R are related by the following lemma. Lemma 1. Let B = (L ∪ R, E) be a bipartite graph, and let k ≥ 0 be an integer. For all real numbers b ≥ 0, the graph B has a P2 -packing P of size k with endvertices in L such that the weight of P is equal to b if and only if the auxiliary graph B+R of B has a matching M of |R| + k edges such that the weight of M is equal to (b0 +1)(|R|−k)+b. Moreover, the P2 -packing P in B can be constructed from the matching M in B+R in linear time. Proof. Let P = {π1 , . . . , πk } be a P2 -packing of size k with end-vertices in L in the bipartite graph B = (L ∪ R, E) whose weight is equal to b. For each i, suppose that the 2 πi has two end-vertices ui and wi in L and the mid-vertex ri P k in R. We have i=1 [wt(ri , ui ) + wt(ri , wi )] = b. Construct a matching M in the auxiliary graph B+R as follows: the matching M contains the 2k edges [ri , ui ] and [ri , wi ] for 1 ≤ i ≤ k, where ri ∈ R is the copy of the vertex ri . Moreover, for each vi of the |R| − k vertices in R − {r1 , . . . , rk }, the matching M contains the edge [vi , vi ] of weight b0 + 1, where vi ∈ R is the copy of vi . It is clear that M makes a valid matching in B+R with 2k + (|R| − k) = |R| + k edges, whose weight is equal to (b0 + 1)(|R| − k) +
k
[wt(ri , ui ) + wt(ri , wi )]
i=1
= (b0 + 1)(|R| − k) +
k
[wt(ri , ui ) + wt(ri , wi )]
i=1
= (b0 + 1)(|R| − k) + b. For the other direction, suppose that the auxiliary graph B+R has a matching M of |R|+k edges whose weight is equal to (b0 +1)(|R|−k)+b. Let E be the set of edges in B+R whose both end-vertices are in R∪R (i.e., E = {[vi , vi ] | vi ∈ R}). We first show that the matching M contains exactly |R| − k edges in the set E . The sum of the weights of edges in M − E is bounded by b0 because for each edge [w, v] in B, where w ∈ L and v ∈ R, at most one of its two copies [w, v] and [w, v ] in B+R , where v ∈ R is the copy of the vertex v, can be in the matching M . Thus, if the matching M contains no more than |R| − k − 1 edges in E , then the weight of M is bounded by (b0 + 1)(|R| − k − 1) + b0 < (b0 + 1)(|R| − k) ≤ (b0 + 1)(|R| − k) + b, contradicting the assumption that the weight of M is equal to (b0 + 1(|R|− k))+ b. On the other hand, if M contains at least |R|− k + 1 edges in E , which will pair at least 2(|R| − k + 1) vertices in R ∪ R , then there are at most 2(k − 1) vertices left in the set R ∪ R that are not paired by the edges in E ∩ M . Since all edges of B+R that are not in E must have one end-vertex in L and the other end-vertex in R ∪ R , the number of edges in M − E is bounded by 2(k − 1). This would imply that the total number of edges in the matching M is bounded by (|R| − k + 1) + 2(k − 1) = |R| + k − 1, contradicting the assumption that M has |R| + k edges.
Matching and P2 -Packing: Weighted Versions
347
Thus, the matching M contains exactly |R|− k edges in E . Since each edge in the matching M has at least one end in R ∪ R , the |R| + k edges in the matching M can be divided into two groups: (1) a group M1 of |R| − k edges in E that pairs |R| − k vertices in R with their copies in R , respectively; and (2) a group M2 of 2k edges not in E that, for each v of the k vertices in R that is not an end of an edge in M1 , contains the two edges [w, v] and [w, ¯ v ], where v ∈ R is the copy of v, and w, w ¯ ∈ L. Note that the total weight of the edges in the group M2 can be computed precisely: e∈M2
wt(e) =
e∈M
wt(e) −
wt(e) = [(b0 + 1)(|R| − k) + b] − [(b0 + 1)(|R| − k)] = b.
e∈M ∩E
Now we can easily construct in linear time a P2 -packing P of size k with end-vertices in L in the bipartite graph B from the matching M in the auxiliary graph B+R : for each v of the k vertices in R that is not an end of an edge in M1 , let [w, v] and [w, ¯ v ] be the two edges in M2 , where v ∈ R is the copy of v, and w, w¯ ∈ L, we construct a P2 in P whose mid-vertex is v and whose two endvertices are w and w. ¯ The constructed P is clearly a P2 -packing with end-vertices in L in the graph B such that the weight of P is equal to e∈M2 wt(e) = b. This completes the proof of the lemma. We say that a P2 -packing P in the bipartite graph B = (L ∪ R, E) is a maximum weighted P2 -packing of size k with end-vertices in L if P is a P2 -packing of size k with end-vertices in L whose weight is the largest over all P2 -packing of size k with end-vertices in L. Similarly, we say that a matching M in the auxiliary graph B+R is a maximum weighted matching of |R| + k edges if M is a matching of |R| + k edges in B+R whose weight is the largest over all matchings of |R| + k edges in B+R . Lemma 1 gives us directly the following corollary. Corollary 1. If a maximum weighted matching M of |R| + k edges in the auxiliary graph B+R has weight (b0 + 1)(|R| − k) + b, where b ≥ 0, then a maximum weighted P2 -packing P of size k with end-vertices in L in the bipartite graph B = (L ∪ R, E) has weight b. Moreover, the P2 -packing P can be constructed from the matching M in linear time. Now we are ready for our main theorem in this section. Theorem 1. The CWPB problem can be solved in time O(k(m+n log n)), where n and m are the number of vertices and the number of edges in the input graph, respectively. Proof. let (B, k) be an instance of the CWPB problem, where B = (L ∪ R, E) is a weighted bipartite graph, k is an integer, and we are looking for a maximum weighted P2 -packing P of size k with end-vertices in L in B. By Lemma 1 and Corollary 1, this problem can be reduced in linear time to the problem of constructing a maximum weighted matching M of |R| + k edges in the auxiliary graph B+R .
348
Q. Feng, J. Wang, and J. Chen
A maximum weighted matching of |R| + k edges in the auxiliary graph B+R can be constructed in time O(nm + n2 log n) by Gabow’s algorithm [7]. Based on the special structure of the auxiliary graph G+R , we can have a more efficient algorithm, described as follows. Let Mq be a maximum weighted matching of q edges in the auxiliary graph B+R , and let Pq be a maximum weighted augmenting path with respect to Mq (the weight of an augmenting path P is defined to be the difference of the sum of weights of the edges in P − Mq and the sum of the weights of the edges in P ∩Mq ). It is not difficult to prove (see, e.g., [15], page 583) that Mq ⊕ Pq is a maximum weighted matching of q + 1 edges for G+R . Gabow’s algorithm [7] works by repeatedly finding a maximum weighted augmenting path respect to a given maximum weighted matching. Given a maximum weighted matching Mq of q edges, Gabow’s algorithm constructs a maximum weighted augmenting path with respect to Mq in time O(m + n log n). Now consider the auxiliary graph B+R . Note that the collection of the |R| edges M|R| = {[vi , vi ] | vi ∈ R} obviously makes a maximum weighted matching of |R| edges in the auxiliary graph B+R since each of these edges has a weight b0 + 1 that is the largest edge weight in the graph G+R . Therefore, we can start from the maximum weighted matching M|R| of |R| edges and repeatedly apply Gabow’s algorithm k times to construct a maximum weighted augmenting path for a maximum weighted matching until we obtain a maximum weighted matching of |R| + k edges in the auxiliary graph G+R . This process takes time O(k(m + n log n)). This completes the proof of the theorem.
3
Improved Algorithms for the P2 -Packing Problem
Now we return back to the weighted P2 -Packing problem on general graphs. Let (G, k) be an instance of the weighted P2 -Packing problem, where G is a weighted graph in which each edge is associated with a positive weight, and k is an integer. We are looking for a P2 -packing of size k whose weight is the maximum over all P2 -packings of size k in G. Suppose the desired P2 -packing P exists, i.e., P is a maximum weighted P2 packing of size k in the graph G. If we can partition the vertex set of G into two disjoint subsets L and R such that L contains all end-vertices of the P2 ’s in P and R contains all mid-vertices of the P2 ’s in P, then we can remove all edges whose end-vertices are both in R or both in L. The resulting graph B = (L ∪ R) is a bipartite graph. It is clear that every P2 -packing of size k with end-vertices in L in the graph B is a P2 -packing in the original graph G, and that P is a maximum weighted P2 -packing of size k with end-vertices in L in the graph B. By Theorem 1, a maximum weighed P2 -packing of size k with end-vertices in L in the bipartite graph B can be constructed in time O(n3 ), which is also a maximum weighted P2 -packing of size k in the original graph G. Therefore, in order to construct a maximum weighted P2 -packing P of size k in the original graph G, It suffices to effectively partition the vertices of the
Matching and P2 -Packing: Weighted Versions
349
graph G into two disjoint subsets L and R such that all end-vertices of the P2 ’s in P are in L and all mid-vertices of the P2 ’s in P are in R. Unfortunately, the P2 -packing P is unknown. Consider the following simple randomized process. For each vertex v in the graph G, randomly put v either in the set L or in the set R. The probability that the 2k vertices that are end-vertices of the P2 ’s in the P2 -packing P are put in L and that the k vertices that are mid-vertices of the P2 ’s in the P2 -packing P are put is R is (1/2)3k . This observation suggests a randomized algorithm that solves the weighted P2 -Packing problem on general graphs, which is presented in Figure 1, where c is a constant determining the probability error bound. Algorithm R-WP2P(G, k) Input: a weighted graph G, and an integer k Output: a maximum weighted P2 -packing of size k in G if it exists 1. P = ∅; \\P is a virtual P2 -packing of size k with weight 0 2. loop c·8k times 2.1 randomly partition the vertices of G into two disjoint subsets L and R; 2.2 construct a bipartite graph B = (L ∪ R, E) from G by removing edges in G whose ends are either both in L or both in R; 2.3 construct a maximum weighted P2 -packing P of size k with end-vertices in L in B; 2.4 if step 2.3 is successful and the weight of P is larger than that of P then P = P ; 3. if P = ∅ then return(P) else return(“no P2 -packing of size k exists”). Fig. 1. A randomized algorithm for the weighted P2 -Packing problem
Theorem 2. The algorithm R-WP2P runs in time O(8k k(m + n log n)) = O∗ (8k ). If the input graph G has no P2 -packing of size k then the algorithm correctly reports the fact. If the input graph G has P2 -packings of size k, then with a probability larger than 1−1/ec, the algorithm returns a maximum weighted P2 -packing of size k in G, where e = 2.718 · · · is the base of the natural logarithm. Proof. First note that the bipartite graph B constructed in step 2.2 is a subgraph of the input graph G. Therefore, if the input graph G has no P2 -packing of size k, then step 2.3 can never construct a P2 -packing of size k in the bipartite B. In this case, P remains an empty set, and step 3 of the algorithm will correctly report that the graph G has no P2 -packing of size k. Now suppose that the graph G contains P2 -packings of size k. Let P be a maximum weighted P2 -packing of size k in G. If step 2.1 correctly puts all end-vertices of the P2 ’s in P in the subset L and all mid-vertices of the P2 ’s in P in the subset R, then P becomes a maximum weighted P2 -packing of size k in the bipartite graph B. Moreover, all end-vertices of the P2 ’s in P are in L. Therefore, any P2 -packing of size k with end-vertices in L whose weight is the largest over all P2 -packings of size k with end-vertices in L in the bipartite graph
350
Q. Feng, J. Wang, and J. Chen
B is a maximum weighted P2 -packing of size k in the original graph G. As a consequence, in this case step 2.3 will construct a maximum weighted P2 -packing of size k in the original graph G. Note that as long as in any single execution of the loop steps 2.1-2.4, does step 2.1 partition the vertex set of G into L and R correctly, the collection P returned in step 3 is a maximum weighted P2 -packing of size k in the original graph G. Now we consider the probability that the algorithms fails in constructing a maximum weighted P2 -packing of size k in G. As explained earlier, with a probability (1/2)3k = 1/8k , the random partition in step 2.1 puts all end-vertices of the P2 ’s in P in the subset L and all midvertices of the P2 ’s in P in the subset R. Therefore, the probability that step 2.1 does not correctly partition the vertex set of G into L and R is 1 − 1/8k , and the probability that none of the c·8k executions of step 2.1 in the algorithm correctly partitions is thus bounded by c·8k 8k c c 1 1 1 1− k = 1− k < . 8 8 e As a consequence, the algorithm correctly constructs a maximum weighted P2 packing of size k in the original graph G with a probability larger than 1 − 1/ec. According to Theorem 1, step 2.3 of the algorithm takes time O(k(m + n log n)). Thus, the algorithm R-WP2P runs in time O(8k k(m + n log n)). For any given error bound > 0, by picking a sufficiently large constant c so that > 1/ec , we can guarantee that the error probability of the algorithm R-WP2P be bounded by . The randomized algorithm R-WP2P can be de-randomized based on the concept of universal sets that was studied by Naor, Schulman, and Srinivasan [17]. Assume that n and k are integers such that n > k. Denote by Zn the set {0, 1, · · · , n − 1}. A splitting function f over Zn is a {0, 1} function over Zn . A splitting function f over Zn naturally partitions the set Zn into two subsets Y0 and Y1 , where Yi = {a ∈ Zn | f (a) = i}, for i = 0, 1. A subset W of Zn is called a k-subset if it contains exactly k elements. Let (W0 , W1 ) be a partition of the k-subset W , i.e., W0 ∪ W1 = W and W0 ∩ W1 = ∅. We say that a splitting function f over Zn implements the partition (W0 , W1 ) if f (a) = 0 for all a ∈ W0 and f (b) = 1 for all b ∈ W1 . Definition 2. [17] A set Ψn,k of splitting functions over Zn is an (n, k)universal set if for every k-subset W of Zn and any partition (W0 , W1 ) of W , there is a splitting function f in Ψn,k that implements (W0 , W1 ). The size of the (n, k)-universal set Ψn,k is the number of splitting functions in Ψn,k . The complexity of constructing an (n, k)-universal set was studied in [17], which outlined a deterministic algorithm of running time O(n2k+o(k) ). A more detailed description of a construction of an (n, k)-universal set was presented in [3].
Matching and P2 -Packing: Weighted Versions
351
2
Proposition 1. [3,17] There is an O(n2k+12 log k )-time deterministic algorithm 2 that constructs an (n, k)-universal set of size bounded by 4n2k+12 log k . The existence of the universal set given in Proposition 1 provides with an effective way to correctly partition an unknown subset in any presumably desired way, which suggests a deterministic algorithm solving the weighted P2 -Packing problem. The algorithm is presented in Figure 2, where, without loss of generality, we assume that the n vertices in the input G are named by the n integers 0, 1, . . ., n − 1 in Zn . Algorithm D-WP2P(G, k) Input: a weighted graph G = (V, E) and an integer k, where V = Zn Output: a maximum weighted P2 -packing of size k in G if it exists 2 1. construct a (n, 3k)-universal set Ψn,3k of size bounded by 4n23k+12 log (3k) ; 2. P = ∅; \\P is a virtual P2 -packing of size k with weight 0 3. for each splitting function f in Ψn,3k do 3.1 let L = {v ∈ V | f (v) = 0} and R = {w ∈ V | f (w) = 1}; 3.2 construct a bipartite graph B = (L ∪ R, E) from G by removing edges in G whose ends are either both in L or both in R; 3.3 construct a maximum weighted P2 -packing P of size k with end-vertices in L in B; 3.4 if step 2.3 is successful and the weight of P is larger than that of P then P = P ; 4. if P = ∅ then return(P) else return(“no P2 -packing of size k exists”). Fig. 2. A deterministic algorithm for the weighted P2 -Packing problem
Theorem 3. The deterministic algorithm D-WP2P solves the weighted P2 2 Packing problem in time O(8k+O(log k) (nm + n2 log n)) = O∗ (8k+o(k) ). Proof. The proof goes similar as that for Theorem 2. We will focus on the differences. As we explained in the proof of Theorem 2, since the bipartite graph B is a subgraph of the input graph G, the algorithm D-WP2P will correctly reports if the input graph G contains no P2 -packings of size k. In the case the input graph G contains P2 -packings of size k, let P be a maximum weighted P2 -packing of size k in G. We only need to verify that at least one of the splitting functions in the (n, 3k)-universal set Ψn,3k correctly puts all end-vertices of the P2 ’s in P in the subset L and all mid-vertices of the P2 ’s in P in the subset R. Let W0 be the set of the 2k vertices that are the end-vertices of the P2 ’s in P, and let W1 be the set of the k vertices that are the mid-vertices of the P2 ’s in P. Then W = W0 ∪ W1 is a subset of 3k vertices in the input graph G whose vertex set is Zn , and (W0 , W1 ) is a partition of W . By the definition of the universal set Ψn,3k , there must be a splitting function f0 in Ψn,3k that implements the partition (W0 , W1 ) of W . Thus, when this splitting function f0 is picked in step 3 of the algorithm D-WP2P, step 3.1 will put all
352
Q. Feng, J. Wang, and J. Chen
vertices in W0 , which are the end-vertices of the P2 ’s in P, in the subset L, and all vertices in W1 , which are the mid-vertices of the P2 ’s in P, in the subset R. Now the proof goes exactly the same as that of Theorem 2: in the execution of steps 3.1-3.4 in the loop with this splitting function f0 , step 3.4 will construct a maximum weighted P2 -packing of size k in the original graph G, which will be returned in step 4 of the algorithm. By Theorem 2, each execution of steps 3.1-3.4 takes time O(k(m + n log n)). 2 Since there are 4n23k+12 log (3k) splitting functions in the universal set Ψn,3k , we conclude that the algorithm D-WP2P runs in time O(kn23k+12 log
2
(3k)
(m+n log n)) = O(8k+O(log
This completes the proof of the theorem.
4
2
k)
(nm+n2 log n)) = O∗ (8k+o(k) ).
Conclusion
In this paper, we studied improved parameterized algorithm for the generalized matching problem weighted P2 -Packing. Our study has provided special properties and efficient algorithm for constrained P2 -Packing problem on bipartite graph. For example, for the constrained weighted P2 -Packing problem, new structure relationship between matching and P2 -Packing on bipartite graph is given, which results in an efficient algorithm for constrained weighted P2 -Packing problem on bipartite graph. Moreover, (n, k)-Universal set technique has been developed to partition the vertices of given instance in a more efficient way. The combination of these techniques leads to an O∗ (8k ) time parameterized algorithm for weighted P2 -Packing problem, which improves the current best result O∗ (32k ). The algorithm proposed for weighted P2 -Packing problem can be used to solve the unweighted version in time O∗ (8k ), improving the current best result O∗ ((14.67)k ).
References 1. Bar-Yehuda, R., Halld´ orsson, M., Naor, J., Shachnai, H., Shapira, I.: Scheduling split intervals. In: Proc. 13th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 732–741. ACM Press, New York (2002) 2. Bazgan, C., Hassin, R., Monnot, J.: Approximation algorithms for some vehicle routing problems. Discrete Appl. Math. 146, 27–42 (2005) 3. Chen, J., Lu, S.: Improved parameterized set splitting algorithms: A probabilistic approach. Algorithmica 54(4), 472–489 (2008) 4. De Bontridder, K., Halld´ orsson, B., Lenstra, J., Ravi, R., Stougie, L.: Approximation algorithms for the test cover problem. Math. Program, Ser. B 98, 477–491 (2003) 5. Fellows, M., Heggernes, P., Rosamond, F., Sloper, C., Telle, J.A.: Exact algorithms for finding k disjoint triangles in an arbitrary graph. In: Hromkoviˇc, J., Nagl, M., Westfechtel, B. (eds.) WG 2004. LNCS, vol. 3353, pp. 235–244. Springer, Heidelberg (2004)
Matching and P2 -Packing: Weighted Versions
353
6. Feng, Q., Liu, Y., Lu, S., Wang, J.: Improved deterministic algorithms for weighted matching and packing problems. In: Chen, J., Cooper, S.B. (eds.) TAMC 2009. LNCS, vol. 5532, pp. 211–220. Springer, Heidelberg (2009) 7. Gabow, H.: Data structures for weighted matching and nearest common ancestoers. In: Proc. 1st Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 434–443. ACM Press, New York (1990) 8. Fernau, H., Raible, D.: A parameterized perspective on packing paths of length two. Journal of Combinatorial Optimization 18(4), 319–341 (2009) 9. Hassin, R., Rubinstein, S.: An approximation algorithm for maximum triangle packing. Discrete Appl. Math. 154, 971–979 (2006) 10. Hell, P., Kirkpatrick, D.: On the complexity of a generalized matching problem. In: Mitzenmacher, M. (ed.) Proc. 10th Annual ACM Symposium on Theory of Computing, pp. 240–245. ACM Press, New York (1978) 11. Hurkens, C., Schrijver, A.: On the size of systems of sets every t of which have an SDR, with application to worst case ratio of heuristics for packing problems. SIAM Journal on Discrete Mathmatics 2, 68–72 (1989) 12. Kann, V.: Maximum bounded H-matching is MAX-SNP-complete. Information Processing Letters 49, 309–318 (1994) 13. Koutis, I.: Faster algebraic algorithms for path and packing problems. In: Aceto, L., Damg˚ ard, I., Goldberg, L.A., Halld´ orsson, M.M., Ing´ olfsd´ ottir, A., Walukiewicz, I. (eds.) ICALP 2008, Part I. LNCS, vol. 5125, pp. 575–586. Springer, Heidelberg (2008) 14. Kirkpatrick, D.G., Hell, P.: On the complexity of general graph factor problems. SIAM Journal on Computing 12, 601–609 (1983) 15. van Leeuwen, J.: Graph algorithms. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. A, pp. 525–631 (1990) 16. Monnot, J., Toulouse, S.: The Pk partitioning problem and related problems in bipartite graphs. In: van Leeuwen, J., Italiano, G.F., van der Hoek, W., Meinel, C., Sack, H., Pl´ aˇsil, F. (eds.) SOFSEM 2007. LNCS, vol. 4362, pp. 422–433. Springer, Heidelberg (2007) 17. Naor, M., Schulman, L., Srinivasan, A.: Splitters and near-optimal derandomization. In: Proc. 39th Annual Symposium on Foundatins of Computer Science, pp. 182–190. IEEE Press, New York (1995) 18. Prieto, E., Sloper, C.: Looking at the stars. Theoretical Computer Science 351, 437–445 (2006) 19. Wang, J., Feng, Q.: An O∗ (3.523k ) parameterized algorithm for 3-set packing. In: Agrawal, M., Du, D.-Z., Duan, Z., Li, A. (eds.) TAMC 2008. LNCS, vol. 4978, pp. 82–93. Springer, Heidelberg (2008) 20. Wang, J., Ning, D., Feng, Q., Chen, J.: An improved parameterized algorithm for a generalized matching problem. In: Agrawal, M., Du, D.-Z., Duan, Z., Li, A. (eds.) TAMC 2008. LNCS, vol. 4978, pp. 212–222. Springer, Heidelberg (2008)
On Totally Unimodularity of Edge-Edge Adjacency Matrices Yusuke Matsumoto1 , Naoyuki Kamiyama2, and Keiko Imai2 1
2
IBM Software Group, Japan [email protected] Department of Information and System Engineering, Chuo University, Japan {kamiyama,imai}@ise.chuo-u.ac.jp Abstract. We consider totally unimodularity for edge-edge adjacency matrices which represent a relationship between two edges in a graph. The matrices appear in integer programming formulations for the minimum maximal matching problem and the edge dominating set problem. We consider a problem of characterizing graphs having totally unimodular matrices as their edge-edge adjacency matrices, and give a necessary and sufficient condition for the characterization. The condition is the first characterization for edge-edge adjacency matrices.
1
Introduction
In the combinatorial optimization, a polyhedral approach is important and useful. One of the main topics in the polyhedral approach is to investigate on integrality of the polyhedron. The integrality means that we can obtain an optimal integer solution to a given integer programming problem via the linear programming relaxation. The integrality of the polyhedron has a strong relationship to totally unimodularity of the constrained matrix appeared in the integer programming formulation of the problem. If every square non-singular submatrix is an integer matrix with determinant 1 or −1, we call the matrix totally unimodular. From this definition, any totally unimodular matrix has only 0, 1 or −1 entries. If a constrained matrix of an integer programming is totally unimodular, we can obtain an optimal integer solution via the linear programming relaxation. Thus, we are interested in what kind of constrained matrices is totally unimodular. For example, it is known that a vertex-edge adjacency matrix of a bipartite graph is totally unimodular [5]. On the other hand, totally unimodularity on edge-edge adjacency matrices (EE matrices) which appear in the edge dominating set problem (EDS) and the minimum maximal matching problem (MMM) is unknown. A. Berger and O. Parekh [1] claimed a theorem which said that an EE matrix of trees is totally unimodular. Unfortunately, the theorem was not correct. In this paper, we consider totally unimodularity for EE matrices. We prove that each EE matrix of graphs in Fig. 1 is not totally unimodular. Using the graphs in Fig. 1, we characterize graphs with totally unimodular EE matrices. By this, if we solve an integer programming whose constrained matrix is totally unimodular, we can obtain an optimal integer solution via the linear programming relaxation. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 354–365, 2011. c Springer-Verlag Berlin Heidelberg 2011
On Totally Unimodularity of Edge-Edge Adjacency Matrices
2
355
Preliminaries
Let G = (V, E) be an unweighted simple graph with a vertex set V and an edge set E. We regard an edge of E as a set of exactly two vertices of V . For two edges e, f ∈ E, we say that e and f are adjacent if e ∩ f = ∅. An EE matrix M(G) = (mei ,ej ) is defined by 1 if ei ∩ ej = ∅, mei ,ej = 0 otherwise, for each ei , ej ∈ E. We remark mei ,ei = 1. A subset M ⊆ E is called a matching in G if e ∩ f = ∅ for every distinct e, f ∈ M . A matching M ⊆ E is called maximal if no other matching in G properly contains M . Then, the MMM seeks to find a maximal matching of minimum cardinality in G. For each distinct e, f ∈ E, we say that e dominates f if e ∩ f = ∅. A subset D ⊆ E is called an edge dominating set in G if every edge e ∈ E \ D is dominated by some edge e ∈ D. Then, the EDS seeks to find an edge dominating set of minimum cardinality in G. For the EDS, we consider the following linear programming formulation for x ∈ RE , where R denotes the set of reals. x(e), (1) minimize e∈E
subject to
x(e ) ≥ 1
∀
e ∈ E,
(2)
∀
e ∈ E,
(3)
e ∈δ(e)
x(e) ∈ {0, 1}
where for each X ⊆ V , δ(X) is the set of e ∈ E such that X ∩ e = ∅. We refer this formulation as (IP). A coefficient matrix corresponding to the constraint (2) is an EE matrix. The MMM is formulated by adding x(e ) ≤ 1 ∀ v ∈ V e ∈δ(v)
to (IP). Let TS be a tree which is formed by replacing every edge in K1,3 by a path with two edges (Fig. 1(a)) and Ct be a circuit with t edges (Fig. 1(b)). In addition, we define a graph which is formed by adding an edge to each vertex in C3 as GT C (Fig. 1(c)).
3
A Necessary and Sufficient Condition on Totally Unimodularity of EE Matrices
First of all, we introduce the following theorem. Let Z denote the set of integers.
356
Y. Matsumoto, N. Kamiyama, and K. Imai
(a)
(b)
(c)
Fig. 1. (a) TS , (b) C4 and (c) GT C
Theorem 1 ([4]). A matrix A ∈ Zp×q is totally unimodular if and only if every extreme point of the polyhedron {x | Ax ≤ b, x ≥ 0} has integer coordinates for any b ∈ Zq . From the above theorem, for the EDS, if an EE matrix of a given graph is totally unimodular, we can obtain an optimal integer solution via the linear programming relaxation of (IP). In addition, it is known that there exists a simple linear time algorithm for transforming every given edge dominating set D in G to a maximal matching M in G with |M | = |D| [7]. Thus, for the MMM, if an EE matrix of a given graph is totally unimodular, we can obtain also an optimal integer solution from the optimal integer solution to the EDS. From this point of view, it is important to give a necessary and sufficient condition on totally unimodularity for EE matrices. The following is a main theorem in this paper and it gives the necessary and sufficient condition. Theorem 2. An EE matrix of a given undirected graph is totally unimodular if and only if the graph contains none of TS , Ct for t ≥ 4 and GT C as a subgraph. Before proving Theorem 2, we will show that each EE matrix of TS , Ct for t ≥ 4 and GT C is not totally unimodular. From now on, we call a set of TS , Ct for t ≥ 4 and GT C prohibited graphs. Next, we will prove that if a given graph contains none of the prohibited graphs as a subgraph, then the EE matrix of the graph is totally unimodular. Consequently, we can obtain Theorem 2. 3.1
Necessary Condition
First, we show that each EE matrix of the prohibited graphs is not totally unimodular. We remark that every entry of M(C3 ) is 1 and M(C3 ) is totally unimodular. Before proving the necessary condition, we introduce the following theorem. Theorem 3 ([2]). A matrix A is totally unimodular if and only if each collection R of rows of A can be partitioned into classes R1 and R2 such that the sum of the rows in R1 minus the sum of the rows in R2 is a vector with entries −1, 0 or 1, only. We rewrite Theorem 3 in order to prove the necessary condition.
On Totally Unimodularity of Edge-Edge Adjacency Matrices
357
Corollary 1. Let G = (V, E) be a given graph. The EE matrix M(G) is totally unimodular if and only if for any function ψG : E → {0, 1}, there exists a function πG : E → {−1, 1} such that ψG (ei )πG (ei ) ≤ 1, (4) −1 ≤ ei ∈δ(ej )
for every ej ∈ E. Proof. “Each collection R” and “classes R1 and R2 ” in Theorem 3 are represented by ψG and πG respectively. From the definition of M(G) = (mei ,ej ), we obtain ψG (ei )πG (ei )mei ,ej = ψG (ei )πG (ei ), ei ∈E
ei ∈δ(ej )
for every ej ∈ E.
By Corollary 1, if for some ψG , there does not exist πG which satisfies the equation (4), the EE matrix M(G) is not totally unimodular. We prove the following lemmas for the necessary condition. Lemma 1. The EE matrix M(Ct ) for t ≥ 4 is not totally unimodular. ψ/π
1/−1 e2 e3 1/1 0/∗ e1 e4 1/
Fig. 2. Counterexample for totally unimodularity of M(C4 ) ( means that we can not assign 1 or −1 for the edge and ∗ means that it makes no difference if we assign 1 or −1 for the edge)
Proof. We consider C4 . Let e1 be any edge in C4 . In clockwise order from e1 , we assign from e2 to e4 for edges other than e1 (Fig. 2). We assume that ψC4 assigns 1 for e2 , e3 and e4 and assigns 0 for e1 . In Fig. 2, a/b shows that a = ψC4 (e) and b = πC4 (e). If πC4 (e2 ) = −1, πC4 has to assign 1 for e3 by the equation (4) for e2 . We remark that it makes no difference if πC4 assigns 1 or −1 for edges assigned 0 in ψC4 . In this case, if πC4 (e4 ) = 1, ψC4 (e )πC4 (e ) = 2. e ∈δ(e4 )
If πC4 (e4 ) = −1,
e ∈δ(e1 )
ψC4 (e )πC4 (e ) = −2.
358
Y. Matsumoto, N. Kamiyama, and K. Imai
Therefore, if πC4 (e2 ) = −1, it is impossible to satisfy the equation (4). By similar argument, in the case where πC4 (e2 ) = 1, it is also impossible to satisfy the equation (4). Thus, the EE matrix M(C4 ) is not totally unimodular. Next, we show that the EE matrix M(C4+4 ) is not totally unimodular. For proving this, we use an expander gadget (Fig. 3). The expander gadget PE is ψ/π
v1
e1
e2
1/1
0/∗
e3
e4
1/ − 1
v2
0/∗
Fig. 3. Expander gadget PE
a path with four edges. Let v1 be one vertex of the leaves in PE and v2 be the other leaf. We define an edge which is incident to v1 as e1 . The edges of PE are named e1 , · · · , e4 from one end to the other. We assume that ψPE assigns 1 for e1 and e3 and assigns 0 for e2 and e4 . We cut C4 at the common vertex in e1 and e4 and duplicate the vertices v1 and v2 , where v1 (v2 ) is incident to e1 (e4 ). We consider C4+4 which is obtained by connecting the path and PE by setting v1 = v1 and v2 = v2 (Fig. 4). For C4+4 , we define ψC4+4 as ψC4 (e) if e is an edge in the transformed C4 , ψC4+4 (e) = ψPE (e) if e is an edge in PE .
ψ/π
v1 = v1 1/1 e1 0/∗ e2
0/∗ e1
1/ − 1 e2 e3 1/1 e4
e3
e4
1/ − 1
0/∗
1/
v2 = v2
Fig. 4. Counterexample for totally unimodularity of M(C4+4 )
For this ψC4+4 , we assume that πC4+4 (e2 ) = −1 (we can make the same discussion for the case of πC4+4 (e2 ) = 1). Therefore, πPE (e1 ) = 1 and πPE (e3 ) = −1. Then, we have to define πC4+4 as πC4 (e) if e is an edge in the transformed C4 , πC4+4 (e) = πPE (e) if e is an edge in PE .
On Totally Unimodularity of Edge-Edge Adjacency Matrices
359
Thus, πC4+4 can not also assign 1 or −1 for e4 on satisfying the equation (4). Similarly, the EE matrix M(C4+4p ) is not totally unimodular (Fig. 5(a)), where p is a positive integer. We consider C5 (Fig. 5(b)). Let e1 be any edge in C5 . In clockwise order from e1 , we assign from e2 to e5 for edges other than e1 . We assume that ψC5 assigns 1 for e2 , e4 and e5 and assigns 0 for the other edges. Without loss of generality, πC5 assigns −1 for e2 . Since πC5 has to satisfy the equation (4) for e3 , πC5 assigns 1 for e4 . In this case, πC5 can not assign 1 or −1 for e5 on satisfying the equation (4) for e1 and e5 . Thus, the EE matrix M(C5 ) is not totally unimodular. We consider C6 (Fig. 5(c)). Let e1 be any edge in C6 . In clockwise order from e1 , we assign from e2 to e6 for edges other than e1 . We assume that ψC6 assigns 1 for e2 , e4 and e6 and assigns 0 for the other edges. Without loss of generality, πC6 assigns −1 for e2 . Since πC5 has to satisfy the equation (4) for e3 , πC6 assigns 1 for e4 . In this case, πC6 can not assign 1 or −1 for e6 on satisfying the equation (4) for e1 and e5 . Thus, the EE matrix M(C6 ) is not totally unimodular. We consider C7 (Fig. 5(d)). Let e1 be any edge in C7 . In clockwise order from e1 , we assign from e2 to e7 for edges other than e1 . We assume that ψC7 assigns 0 for e3 and e6 and assigns 1 for the other edges. Without loss of generality, πC7 assigns −1 for e1 . Thus, πC7 has to assign 1 for e2 and e5 and assign −1 for e4 . In this case, πC7 can not assign 1 or −1 for e7 on satisfying the equation (4) for e6 and e7 . Thus, the EE matrix M(C7 ) is not totally unimodular. For C5+4p , C6+4p and C7+4p , by applying p expander gadgets for C5 , C6 and C7 , we can prove these EE matrices are not totally unimodular. Thus, the EE matrix M(Ct ) for t ≥ 4 is not totally unimodular.
Lemma 2. The EE matrix M(TS ) is not totally unimodular. Proof. We assume that ψTS assigns 1 for all edges. Without loss of generality, πTS assigns 1 for one edge which is incident to a vertex with a degree three and assigns −1 for the other two edges (Fig. 6). Then, for edges which are adjacent to the edges assigned −1 in πTS and have a leaf, πTS has to assign 1 on satisfying the equation (4). Thus, πTS can not assign 1 or −1 for an edge which is adjacent to the edge assigned 1 in πTS and has a leaf. Consequently, the EE matrix M(TS ) is not totally unimodular.
Lemma 3. The EE matrix M(GT C ) is not totally unimodular. Proof. We assume that ψGT C assigns 0 for edges which have a leaf and assigns 1 for the other edges. For this, without loss of generality, πGT C assigns 1 and −1 for two edges in edges assigned 1 in ψGT C , respectively (Fig. 7). Then, πGT C can not assign 1 or −1 for the other edge in edges assigned 1 in ψGT C on satisfying the equation (4). Thus, the EE matrix M(GT C ) is not totally unimodular.
We obtain the following proposition from Lemmas 1–3. Proposition 1. If a given graph G contains at least one graph in the prohibited graphs as a subgraph, the EE matrix M(G) is not totally unimodular.
360
Y. Matsumoto, N. Kamiyama, and K. Imai
ψ/π 0/∗ v1
e1
0/∗
1/ − 1 e2
e1
e4 1/
0/∗
(a)C4+4p
0/∗ 1/ − 1
1/1 e4
e3
v1
0/∗
1/1
0/∗
e3
e2
e5 1/ − 1
1/
e1 0/∗
v2
(b)C5+4p
e6
e2
1/1 e5 1/
1/ − 1 e2
e3 1/1
v2
e4
e3
e5
e1
v1
v2
1/ − 1 e4
e7 v2
v1
(c)C6+4p
1/
1/1
e6 0/∗
(d)C7+4p
Fig. 5. Counterexample for totally unimodularity of M(Ct ) for t ≥ 4
ψ/π
1/−1 1/−1
1/1
1/1
1/
1/1
Fig. 6. Counterexample for totally unimodularity of M(TS )
ψ/π
0/∗ 1/1
0/∗
1/−1
1/ 0/∗
Fig. 7. Counterexample for totally unimodularity of M(GT C )
On Totally Unimodularity of Edge-Edge Adjacency Matrices
361
Proof. We consider φG which assigns 1 for edges of the graph in the prohibited graphs and assigns 0 for the other edges. Then, by regarding φG (e)ψG (e) as a new ψG (e), we can apply Lemmas 1–3. Thus, the EE matrix M(G) is not totally unimodular.
3.2
Sufficient Condition
In section 3.1, we showed that an EE matrix of a graph which contains at least one of the prohibited graphs as a subgraph is not totally unimodular. In this section, we show that an EE matrix of a graph which contains none of the prohibited graphs is totally unimodular. In the proof, after we claim that an EE matrix of a tree which does not contain TS is totally unimodular, we show that an EE matrix of a graph which contains none of the prohibited graphs is totally unimodular. A graph G is called caterpillar if there exists a path PC in G such that all the vertices are within distance one from PC (Fig. 8). PC is called a central path. The following lemmas give the characterization of caterpillars.
eˆ2
eˆ1 e1
v
e2
e3
Fig. 8. Caterpillar (A central path consists of solid edges)
Lemma 4 ([3]). A tree does not contain TS as a subgraph if and only if the tree is a caterpillar. For proving the sufficient condition, we introduce the following lemma. Lemma 5 ([6], Example 7 in p.279). If every entry of a matrix is either 0 or 1 and each row of the matrix has its 1’s consecutively, the matrix is totally unimodular. Let Rei be a row corresponding to ei in an EE matrix. For caterpillars, we have the following lemma. Lemma 6. An EE matrix of a caterpillar is totally unimodular. Moreover, for appropriate order of the edges, each row of the EE matrix has its 1 s consecutively. Proof. We assume that a graph G is a caterpillar. Then, G has a central path and we define a path induced by vertices which are not a leaf in G as the central path PC = (VPC , EPC ). The edges of PC are named e1 , . . . , e|EPC | from one end to the other (Fig. 8). The EE matrix M(PC ) is a tri-diagonal matrix,
362
Y. Matsumoto, N. Kamiyama, and K. Imai
e1 1 ⎜1 ⎜ ⎜0 ⎜ ⎜ .. ⎝ .
e2 1 1 1 .. .
e3 0 1 1 .. .
0
0
0
⎛
e1 e2 e3 .. . e|EPC |
. . . e|EPC | ⎞ ... 0 ... 0 ⎟ ⎟ ... 0 ⎟ ⎟. .. ⎟ .. . . ⎠ ... 1
Therefore, the EE matrix M(PC ) satisfies the condition of Lemma 5 and is totally unimodular. For each v ∈ VPC , we denote by Ev the set of edges e ∈ E \ EPC such that e ∩ VPC = {v} and we consider Ev . If v is not a leaf in PC , there exists two edges ei , ei+1 ∈ EPC which are incident to v. δ(ˆ e) = δ(ei ) ∩ δ(ei+1 )
(5)
for any eˆ ∈ Ev holds. We insert rows corresponding to all edges in Ev into between Rei and Rei+1 . Moreover, columns corresponding to the edges are also inserted. Thus, the EE matrix after the operations satisfies the condition of Lemma 5. Therefore, the EE matrix is totally unimodular. Next, if v is a leaf and is incident to e1 , then δ(ˆ e) ⊆ δ(e1 ) for any eˆ ∈ Ev . Thus, if we insert rows corresponding to all edges in Ev into the above of Re1 , the EE matrix satisfies the condition of Lemma 5. If v is a leaf and is incident to e|PC | , similarly, rows corresponding to all edges in Ev are inserted into the below of Re|PC | . Columns corresponding to the edges are also inserted. Therefore, the EE matrix is totally unimodular. For example, we consider a caterpillar G and Ev in Fig. 8. The EE matrix of PC is as follows. e e2 e3 ⎞ ⎛ 1 e1 1 1 0 e2 ⎝ 1 1 1 ⎠. e3 0 1 1 After inserting the rows and the columns corresponding to all edges in Ev , the EE matrix is as follows. e1 e1 1 eˆ1 ⎜ ⎜1 eˆ2 ⎜ ⎜1 e2 ⎝ 1 e3 0 ⎛
eˆ1 1 1 1 1 0
eˆ2 1 1 1 1 0
e2 1 1 1 1 1
e3 ⎞ 0 0⎟ ⎟ 0⎟ ⎟. 1⎠ 1
From the above argument, each row of M(G) obtained by the above operations has its 1 s consecutively. Thus, an EE matrix of G is totally unimodular.
Using Lemma 6, we show the following proposition.
On Totally Unimodularity of Edge-Edge Adjacency Matrices
363
Proposition 2. If a given graph contains none of the prohibited graphs, the EE matrix of the given graph is totally unimodular. Proof. We assume that a given graph G = (V, E) contains none of the prohibited graphs and consider a spanning tree TG = (V, ETG ) of G. Since G does not contain TS , TG does not also contain TS . From Lemma 4, TG is a caterpillar. Let a central path PC = (VPC , EPC ) of TG be a path induced by vertices other than leaves in TG . In addition, the edges of PC are named e1 , . . . , e|EPC | from one end to the other. From Lemma 6, we are allowed to assume that each row of the EE matrix of TG has its 1 s consecutively. Next, we consider the cotree E of TG in G. We classify the edges in E for three cases as follows. – Case 1 : An edge consisting of vertices in VPC (Fig. 9) – Case 2 : An edge consisting of a leaf in TG and a vertex in VPC (Fig. 10) – Case 3 : An edge consisting of leaves in TG (Fig. 11). Case 1 : We assume that e ∈ E is incident to two vertices v1 and v2 of VPC . Since G does not contain Ct for t ≥ 4, there exists only one vertex v between v1 v1
v2
v ei
ei+1 e
Fig. 9. Case 1 v
eˆj f
v ei
e v
ei+1
Fig. 10. Case 2
eˆ2
e eˆl
e eˆl
(a)
eˆ1
eˆ2
v
e
(b) Fig. 11. Case 3
e
eˆ1
e
v
(c)
364
Y. Matsumoto, N. Kamiyama, and K. Imai
and v2 in PC . If v is incident to an edge in E \ EPC , G contains GT C . Therefore, v is not incident to an edge in E \ EPC (Fig. 9). Since for ei , ei+1 ∈ δ(v), δ(e ) = δ(ei ) ∪ δ(ei+1 ), if we insert Re into between Rei and Rei+1 in the EE matrix, the EE matrix satisfies the condition of Lemma 5. Therefore, the EE matrix is totally unimodular. Case 2: We assume that e = {v, v } ∈ E and eˆj = {v , v } ∈ ETG \ EPC , where v is a common vertex of ei and ei+1 in EPC , v is a vertex in V \ VPC and v = v is a vertex in VPC (Fig. 10). Since ei is in EPC , there is an edge f = ei+1 which is adjacent to ei , where f is an edge in ETG . Therefore, we have (δ(ei ) ∩ δ(ei+1 )) ∪ {ˆ ej } = δ(e ). Re is inserted into the Rei ’s next row in the EE matrix. The obtained matrix satisfies the condition of Lemma 5. Therefore, the matrix is totally unimodular. Moreover, the above argument works for the case where ei and ei+1 change their parts. Case 3: Let e be an edge consisting of two leaves vl and vl in TG . Let eˆl and eˆl be edges containing vl and vl respectively. If eˆl and eˆl are not incident to a same vertex in VPC (Fig.11(a)), G contains Ct for t ≥ 4. Therefore eˆl ∩ eˆl = {v}. If v is not a leaf in PC , (V, ETG ∪ {e }) contains TS . Therefore, we leave this case out of consideration. v is a vertex of e1 in PC . If necessary, we can change the order in Ev such that l = 1 l = 2. Case 3-1: PC consists only one vertex (Fig. 11(b)). In the case where there exists no other edges having the same property as that of e , Re can be inserted into the row above the first row Re1 in the EE matrix. The corresponding column is inserted into the matrix in the same manner. Next, we consider the case where there exists only one edge e having the same property as that of e . Let eˆi and eˆi+1 be adjacent to e . If e ∩ e = ∅, the order of the edges in Ev such that i = |Ev | − 1. The row Re is inserted into the row below the row Reˆ|Ev | . The obtained matrix is totally unimodular. If e ∩ e = ∅, G contains C4 in the case. Moreover, when there are more than two edges having the same property as that of e , G contains TG . Therefore, we leave these cases out of consideration. Case 3-2: PC has more than one edge (Fig. 11(c)). In the case where there is no other edges having the same property as that of e , Re can be insert into the row above the first row in the EE matrix. The matrix is still totally unimodular. Next, we consider the case where there is another e having the same property as that of e and the same v. If e ∩ e = ∅, G contains C4 . Then, we assume that e ∩ e = ∅. Also, in this case G contains TS . Therefore, there is only one edge such that it is incident to two leaves in eˆ1 and eˆ2 , and eˆ1 ∩ eˆ2 = {v}. In the case where v is the other leaf of PC , Re can be insert into the matrix in the row below the last row. The matrix is still totally unimodular. In the above argument, rows and columns corresponding to edges in the cotree E insert into a position defined by the vertex v in some sense. Each case has different v. Therefore, the insert operation can be done independently.
On Totally Unimodularity of Edge-Edge Adjacency Matrices
365
We obtain Theorem 2 from Proposition 1, 2. Theorem 2. An EE matrix of a given undirected graph is totally unimodular if and only if the graph contains none of TS , Ct for t ≥ 4 and GT C as a subgraph.
4
Conclusion
We considered edge-edge adjacency matrices which represent a relationship between two edges in a graph. For edge-edge adjacency matrices, we gave the necessary and sufficient condition on totally unimodularity. Acknowledgement. The work of the second and third authors was supported in part by Grant-in-Aid for Scientific Research of Japan Society for the Promotion of Science.
References 1. Berger, A., Parekh, O.: Linear time algorithms for generalized edge dominating set problems. Algorithmica 50(2), 244–254 (2008) 2. Ghouila-Houri, A.: Caract´erisation des matrices totalement unimodulaires. Comptes Redus Hebdomadaires des S´eances de l’Acad´emie des Sciences (Paris) 254, 1192– 1194 (1962) 3. Harary, F., Schwenk, A.: Trees with Hamiltonian square. Mathematika 18, 138–140 (1971) 4. Hoffman, A.J., Kruskal, J.B.: Integral boundary points of convex polyhedra. In: Kuhn, H.W., Tucker, A.W. (eds.) Linear Inequalities and Related Systems, pp. 223–246. Princeton University Press, Princeton (1956) 5. Korte, B., Vygen, J.: Combinatorial Optimization: Theory and Algorithms, 4th edn. Springer, Heidelberg (2007) 6. Schrijver, A.: Theory of linear and integer programming. J. Wiley & Sons, Chichester (1986) 7. Yannakakis, M., Gavril, F.: Edge dominating sets in graphs. SIAM Journal on Applied Mathematics 38(3), 364–372 (1980)
The Topology Aware File Distribution Problem Shawn T. O’Neil, Amitabh Chaudhary, Danny Z. Chen, and Haitao Wang Department of Computer Science and Engineering University of Notre Dame, Notre Dame, IN 46556, USA {soneil,achaudha,dchen,hwang6}@nd.edu
Abstract. We present theoretical results for large-file distribution on general networks of known topology (known link bandwidths and router locations). We show that the problem of distributing a file in minimum time is NP-hard in this model, and we give an O(log n) approximation algorithm, where n is the number of workstations that require the file. We also characterize our method as optimal amongst the class of “nolink-sharing” algorithms.
1
Introduction
In this paper, we consider the problem of distributing a file across a communication network (such as a local area or ad-hoc wireless network) to a number of workstations in the minimum amount of time. The input is a graph representing the physical connectivity of the network: routers are distinct from workstations (though workstations may act as routers as well), and the bandwidth for each communication link is given (see Sections 3 and 5 for more detail). In the past, such network topology information has been difficult to obtain, but several recent advances in network topology discovery have been made. Designing topology/network aware solutions is an important next step in building efficient distributed systems [18]. It has been noted that distribution methods minimizing inter-cluster transfers perform better (where cluster is defined as a set of workstations connected to a common router) [11]. Unless the inter-cluster link is very large, multiple simultaneous transfers across it will compete for bandwidth and create a bottleneck. Furthermore, because bandwidth is reduced for these transfers, this critical link is saturated for a long time, heavily taxing the network and reducing performance for other users. Figure 1 illustrates this point in a simple network with uniform bandwidths of 100 Mb/s and two routers. Suppose a 1 GB file originates at node A. If node A first sends the file to E using (theoretically) 1 GB / 100 Mb/s ≈ 82 seconds, then both A and E can simultaneously complete their clusters in two more rounds of full-bandwidth transfers, for a total time of 3 × 82 = 246 seconds. However, if A completes its cluster {A, B, C, D} first (two rounds, 164 seconds), the intercluster link may be over-utilized; for example A, B, C, and D can send to E, F , G, and H simultaneously, such that each transfer gets 25 only Mb/s and 1 GB / 25 Mb/s ≈ 328 additional seconds are used. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 366–378, 2011. c Springer-Verlag Berlin Heidelberg 2011
10
10 0M b/s
The Topology Aware File Distribution Problem
b/ s
Mb
/s s
10
100 Mb/s
100
/s
Mb
Mb/
s
/s Mb
0M
b/s
Mb/
100
0 10
100
0M
100
367
Fig. 1. A simple network with uniform bandwidths and two routers. This network illustrates the principle of minimizing inter-cluster transfers.
In the next two sections, we review the related literature and outline the network model, which we call the RTA (Router Topology Aware) model. In Section 4 we give an O(log n)-approximation algorithm (where n is the number of workstations in the network) for minimizing distribution time, and show that this is optimal amongst a general class of solutions. Finally, in Section 5, we show that the problem of deciding whether a file can be distributed in a given amount of time in this model is NP-complete.
2
Related Work
Broadcasting information to distributed nodes with an eye towards network efficiency has been studied in a number of contexts, including multimedia systems [20], grid computing systems [19], sensor networks [9], and ad-hoc wireless networks [15]. One common approach is the use of overlay networks. Here, nodes are “virtually” connected together such that if two nodes can communicate, a virtual link can be created directly between them [14]. One of the advantages of overlay networks is that they can usually accommodate new node arrivals easily (see, e.g., [10]). To simplify distribution, overlay networks are often built as trees, though more complex structures are also seen [1]. Overlay networks are often used when physical network topology information is not available. For example, when a new node wishes to join, the virtual connection may be chosen greedily to maximize bandwidth to the virtual neighbor, under heuristic constraints that seek to minimize interference [10]. Unfortunately, in reality a virtual network may bear little resemblance to the physical one. Router-only nodes are typically not found in overlay networks, and transfer paths that appear independent in the overlay network may cause network congestion in actuality [2]. Thus, it has been noted that overlay networks may suffer reduced performance, as well as unnecessarily tax the network infrastructure [14]. In the realm of theoretical analyses, Biersack et al. analyzed the distribution times for a number of overlay network topologies and distribution strategies [1]. Here it is assumed that links have one of two guaranteed bandwidths and files
368
S.T. O’Neil et al.
may be split into “chunks,” each of which may be transferred separately. Several recent papers analyze BitTorrent, a common “chunking” peer-to-peer distribution system, and similar tools using fluid models [16,13,22]; these analyses assume that transfers only interfere at the incoming/outgoing links of workstations. Not having physical topology information, BitTorrent and similar systems allow each workstation to transfer to a constant number of peers simultaneously (defaulting to four for BitTorrent [16]) in an interference agnostic way, possibly resulting in O(n) transfers simultaneously on inter-cluster links. Many theoretical models for file distribution are discrete in nature. In the “minimum broadcast time” problem, S is given as a subset of nodes in a graph, each of which has a copy of a token, and in a single time step each node with the token can copy it to a single neighbor. For this model, the minimum time distribution to all nodes is NP-hard [8]. When |S| = 1, this problem is also known as the “telephone broadcast” problem. The best known approach to date, by Elkin and Kortsarz, achieves an approximation ratio of O(log n/ log log n) [7]. Killian et al. discussed a similar model with multiple token types where multiple tokens can be transferred across an edge and a node can send to multiple neighbors in a single timestep [12]. This version is also NP-hard and the authors presented heuristic solutions. Motivating our work, recent developments in discovering network topology have been made. Shirai et al. developed a method to approximate the physical topology of local area networks, including routers [18]. Coates et al. inferred a topology approximation for hosts on the internet [5]. Similar work exists for topology inference of ad-hoc wireless and sensor networks [4,21]. In practice, topology information is often accessible in institutional distributed computing environments [2], where broadcasting large files for scientific computation, image processing, and visualization is common (e.g., [3]).
3
The Router Topology Aware (RTA) Network Model
Based on the recent encouraging network topology inference results reviewed in Section 2, we describe a model we call the Router Topology Aware (RTA) network model. We aim for this model to be general in describing local area as well as ad-hoc wireless and sensor networks, while still being tractable from a combinatorial perspective. The RTA network model consists of an undirected, weighted graph G = (W, R, E). The nodes are either workstations (W ) or routers (R), and each edge e ∈ E is labeled with a non-negative bandwidth capacity b[e]. For the file distribution problem, we assume that a single workstation s0 possesses a file of size c that needs to be distributed to n − 1 other workstations in the network, where n = |W |. Since we wish to capture the properties of ad-hoc wireless networks, we give workstations routing capabilities: if any workstation s possessing the file wishes to send it to a destination workstation d, we assume that a single path p = s, v1 , v2 . . . , vl , d may be specified, such that each vi (1 ≤ i ≤ l) is a router or a workstation. The path can also be direct, p = s, d,
The Topology Aware File Distribution Problem
369
if such a connection exists. Workstations that don’t require the file may simply be labeled as routers. The file is transferred in its entirety (i.e., no splitting of the file is allowed) and the only way for a workstation to receive the file is to be the destination of a transfer (no “snooping”). This is useful in an ad-hoc network setting in which transfers may be end-to-end encrypted for security [17]. The path cannot be changed during the course of a transfer. At any time t during the transfer, any bandwidth b(t) can be chosen for the transfer that doesn’t violate the classic flow constraints — the sum bandwidth of transfers being used on any edge in G must not exceed its capacity and the flow must be conserved at the nodes (unless a node is currently a source or destination). As in other flow-based models (e.g., [16]), time taken to transfer a file of size c is the amount of time elapsed from the transfer start time α to β, β where β is the first time such that α b(t)dt = c (since a definite integral over b(t) represents the amount of information moved). If b(t) represents a constant bandwidth b, then the time taken to transfer the file is c/b, as expected. Thus, transfer times depend only on bandwidths used and are independent of the number of hops, just as in the example of Figure 1. While the hardness results of Section 5 allow the bandwidth usage function b(t) to be defined by the user for each transfer, all our results also hold if the bandwidths of transfers are determined first by the bottleneck edges on the paths and second by some fairness protocol (such as that commonly used by TCP/IP) if multiple transfers share some edges.
4
An O (log n)-Approximation
We first give an O(log n)-approximation algorithm for RTA File Distribution, whose intuitive idea is to first discard edges of small bandwidths from the network, leaving only a tree of high bandwidth edges that spans all the workstations. Once this distribution tree is found, a divide and conquer strategy is used to distribute the file such that only one connection is present on any tree edge at a given time. Below is an outline of the algorithm. Algorithm TREEDIST 1. Given a network graph G, the start workstation s0 applies the “Max-Min edge Workstation Spanning Tree” (MMWST, Section 4.1) algorithm producing the distribution tree T . 2. Workstation s0 , possessing the file, splits T (using TREESPLIT, Section 4.2) into two subtrees Ts (which contains s0 ) and To (which does not), that share a “bridging” node and have roughly the same number of workstations in each. 3. Workstation s0 sends the file, along with a copy of To , to some workstation w2 ∈ To . 4. Workstation w2 then begins with Step 2 recursively on To ; simultaneously s0 begins again with Step 2 recursively on Ts .
370
S.T. O’Neil et al.
The MMWST algorithm runs in linear time in the network size (O(|E|), since we can assume the input network is connected). While TREESPLIT guarantees an even division of workstations, it does not guarantee an even division of routers. Fortunately, though, recursive computation is performed in parallel on different workstations, so the recurrence relation for TREESPLIT is T (|W |, |R|) = T (|W |/2, |R|)+|W |+|R| (rather than T (|W |, |R|) = 2T (|W |/2, |R|)+|W |+|R|). Thus, the total time spent in computation is O(|E| + |R| log |W |). The divide and conquer file distribution method described above ensures that any edge is used only by a single transfer at any given time. This natural congestion avoidance strategy allows for the following file distribution time approximation result: Theorem 1. The total time taken for TREEDIST to distribute a file of size c to all n workstations in the network is O(log n) times that needed for any optimal distribution method adhering to the rules of the RTA network model, if the length of the description (or representation) of the distribution tree T is O(c). Proof. Let l be the bandwidth of the smallest bandwidth edge in the distribution tree T , which maximizes the minimum bandwidth edge while keeping all workstations connected. Any algorithm, including the optimal one, must send at least one transfer (of size c) over this edge, incurring a transfer time cost of at least c/l. (If this weren’t the case, then the edges used by the optimal solution must all have bandwidths greater than l and connect the workstations, which contradicts the fact that T is the max-min workstation spanning tree.) Suppose that each transfer made by TREEDIST achieves only a bandwidth of l. Since the transfers do not interfere edge-wise in TREEDIST, this is the worst situation that could be encountered. In this case, each transfer takes c/l time, which we consider to be the maximum time for one distribution “round” in which multiple transfers are occurring simultaneously over different edges. Since the number of workstations is reduced by an amount between 1/3 and 2/3 for each subtree, the number of rounds is O(log n). Thus, since the time taken is O(c/l) per round (to transfer both a subtree To of T and the file), the total transfer time taken for TREEDIST is O(c log n/l). Note that Theorem 1 does not include the time needed for computation. The condition on the description length of T (i.e., O(c)) is needed because we also send subtrees of T across the network along with each copy of the file. This should be a reasonable assumption in practice. This approximation bound may appear rather loose, since even if the divide and conquer strategy encounters a “small” bandwidth edge on every transfer, the optimal solution is likely to do so as well. However, Theorem 2 below indicates that the approximation bound is in fact tight. Theorem 2. There exists a network such that TREEDIST uses Ω(log n) times that needed for an optimal distribution method adhering to the rules of the RTA network model. Proof. Consider a “star” network in which all workstations are connected to a central router. Let s0 be connected to the router with a bandwidth of n − 1
The Topology Aware File Distribution Problem
371
and all n − 1 other workstations be connected to the router with a bandwidth of 1. For this network, the total transfer time taken by the divide and conquer approach will be Θ(c log n). However, the optimal strategy would be to immediately initiate n − 1 transfers from the start node, using only c time. Definition 1. A no-link-sharing strategy is one that never utilizes any edge for more than one transfer at a time. Note that TREEDIST is a no-link-sharing strategy. We can easily lower-bound the approximation ratio for any no-link-sharing strategy as Ω(log n). This is because any no-link-sharing strategy can at best double the number of workstations possessing the file in each distribution round on such star topology networks; in these topologies, no-link-sharing becomes synonymous with disallowing workstations from participating in simultaneous transfers. This implies the following lemma, indicating that the search for better solutions will necessitate consideration of much more complex strategies: Lemma 1. TREEDIST is a best possible no-link-sharing strategy. 4.1
Max-Min Edge Workstation Spanning Tree, MMWST
The first step of the TREEDIST algorithm is to reduce the network to a distribution tree T such that i) all workstations are connected in T and ii) the smallest bandwidth edge in T , which we call the bottleneck value, is maximized. It is not necessary for the tree to span all routers, though of course many may be included to achieve these objectives. This problem is similar to the “bottleneck spanning tree” problem (min-max edge weight, no optional nodes), which can be solved in linear time [6]. The algorithm proceeds recursively: if more than one workstation still remains in the graph being processed, G, then all edges of bandwidth at most the median bandwidth are removed from G. There are three possible cases for the bottleneck value of T : 1) greater than the median bandwidth, 2) less than the median bandwidth, and 3) equal to the median bandwidth. In the first case, the removed edges leave the workstations all in one connected component in G (which is determined via a DFS starting at a workstation node), and we can recurse with the connected component containing all the workstations. Suppose this connected component has n nodes and m edges. Then recursing with only this connected component ensures that i) at least half of the edges of the graph G have been removed from the recursive computation, and ii) n ≤ m + 1 holds for the connected component. In the second and third cases, the workstations will be disconnected after the removal of edges (Figure 2). We can distinguish the second and third cases by adding back the edges of exactly median bandwidth to G, and contracting the resulting connected components (with the median and larger bandwidth edges) into nodes using a linear time contraction method. We mark contracted nodes as workstations if they contain any workstations, and routers if not. Since the median edges are put back before contraction, at least half of the edges are contracted away in this case as well.
372
S.T. O’Neil et al.
Fig. 2. Computing the Max-Min Workstation Spanning Tree on an example ad-hoc wireless network. The sought tree (bold) maximizes the minimum edge while keeping the workstations connected. In this iteration, after removing the median bandwidth and smaller edges (dashed), we find that that workstations are left unconnected. Thus, the bottleneck value is less than or equal to the median value.
If more than one contracted workstation remains, then we are in case two, as we need some of the smaller edges to keep the workstations connected. We add back the remaining removed edges to the contracted version of G (one of which must determine the value of the tree), and recurse. Note that in this case we are also recursing on a single connected component. Finally, if only one workstation remains after contraction, we must be in case three. In this case, we have determined the bottleneck value of the sought tree T , and we can use this information to build the max-min workstation spanning tree T via depth-first search on the subgraph of the original graph induced by edges of at least the known value. Note that the third case must always be reached. In each iteration, the number of edges is reduced by at least half. This, along with the fact that we always recurse on a fully connected graph, serves to show that the total running time of MMWST is linear in the number of edges in a connected input graph since other operations, such as median selection, depth-first searches, and contraction, are themselves linear time. The returned spanning tree must have the desired properties, as we isolate the bottleneck value to sets of edges in each iteration, and workstations are always left connected at the end of each iteration. 4.2
Tree Splitting, TREESPLIT
The divide and conquer strategy for distributing the file requires a method to split the distribution tree (or a recursively generated subtree of it) into two trees such that the number of workstations in each is roughly equal. In particular, this tree splitting method ensures that the number of workstations in each subtree is between n/3 and 2n/3, where n is the original number of workstations. Further, this method results in the “bridging” node that connects the two subtrees being duplicated (as opposed to being removed) in both the subtrees. If the bridging node happens to be a workstation, then in one of the subtrees it is left as a workstation, but in the other it becomes a router-only node — this ensures that
The Topology Aware File Distribution Problem
373
the algorithm does not send to the bridging node twice, and that workstations that are used as bridging routers are not ignored for file destination at some later point. At the beginning of the algorithm, all workstations in T are given a weight 1 and all routers are given a weight 0. The tree T is rooted at an arbitrary node v, and a depth-first search is used to compute sweight(u), the sum of node weights in the subtree of T rooted at u, for each node u. We recursively search for the bridge node in T , starting at the root. If any child u of the current node v has sweight(u) greater than or equal to n/3, then it is possible for that child u (or one of its descendants) to be the bridge, and thus we recurse to u. Otherwise, the current node v must be the bridge. Suppose the bridge node v is a workstation. If sweight(v) < n/3 + 1, then v must be left together with all of its descendants to create a subtree T1 (so that v and its descendants form a subtree of weight at least n/3), and a router copy of v must be placed in the remaining subtree T2 . Otherwise, v goes with T2 as a workstation, and a subset of v’s children must sum up to at least n/3 but less than or equal to 2n/3 (since in this case sweight(v) − 1 ≥ n/3). Such a subset goes with a router copy of v to form T1 , and the other children connect to v in T2 . If the bridge node v is a router, the situation is simpler. A subset of v’s children must have a combined sweight between n/3 and 2n/3. These go with a copy of v in T1 , and other children connect to v in T2 . Because the operation in this case and in the second subcase above is the same, we can combine them in practice.
5
NP-Completeness
To show that the problem of minimizing the file transfer time is NP-complete, we first define a decision version of the problem by asking whether a file of size c can be distributed in time at most k, as follows: RTA File Distribution INSTANCE: A graph G = (W, R, E) with node sets W of workstations and R of routers, and an edge set E. Each edge e ∈ E is labeled with a non-negative bandwidth b[e]. A start node s0 ∈ W that has possession of a file of size c is specified. QUESTION: Is it possible to distribute the file to all other nodes of W in time at most k, respecting the bandwidth constraints? That is, for each workstation d ∈ {W − s0 }, is there a workstation s and a transfer path pi = s, v1i , v2i , . . . , vmi , d or pi = s, d with an associated transfer start time α(i), transfer end time β(i), and non-negative bandwidth allocation function bi (t) under the following constraints: 1) pirepresents a valid path in G, 2) for any t and for each edge e ∈ E, j∈Je bj (t) ≤ b[e], where Je = {j | e ∈ pj } (edge bandwidth constraints must be respected; Je is the set of transfers using edge e), 3) bi (t) = 0 for t ∈ [α(i), β(i)] (transfer bandwidths must be zero before the start time and after the end time), 4) bi (t) ≥ 0 for t ∈ [α(i), β(i)] (bandwidths must be non-negative),
374
S.T. O’Neil et al.
5) s ∈ W (transfers can only begin at workstations), 6) vji ∈ W ∪ R for 1 ≤ j ≤ m (workstations and routers may be intermediaries), 7) α(i) ≤ β(i) (transfer start time must be before transfer end time), 8) the transfer to d cannot begin until the transfer to s has ended, 9) β(i) b (t)dt = c (the total information sent for each transfer is c), and α(i) i 10) maxi {β(i)} ≤ k (all transfers complete in time k)? We show that this problem is NP-complete by using a transformation from the 3-Partition problem [8]: 3-Partition INSTANCE: A set A of 3m elements a1 , a2 , . . . , a3m , a bound B ∈ Z + (Z + is the set of all positive integers), and a sizes(a) ∈ Z + for each a ∈ A such that B/4 < s(a) < B/2 and such that a∈A s(a) = mB. QUESTION: Can A be partitioned into m disjoint subsets A1 , A2 , . . . , Am such that, for 1 ≤ j ≤ m, a∈Aj s(a) = B (note that each Aj then must contain exactly three elements from A)? The RTA File Distribution problem is clearly in the class of NP, as verification consists of ensuring that none of the ten constraints are violated, each of which can be checked in polynomial time. In the following, we prove that the problem is NP-hard via reduction from 3-Partition. Given an instance of 3-Partition, we construct a network as follows. First, let l = mina∈A{s(a)} be the smallest size of the elements in the set A. Create a workstation node s0 , which will be the node initially having the file to be transferred to all other workstation nodes. Create router nodes r1 , r2 , . . . , rm , and connect each rj to s0 with an edge of bandwidth B. Next, for each element ai of A with s(ai ) = l, create two workstation nodes vi and vi , a router ri , and m + 2 edges. Connect workstation node vi to router node ri with an edge of bandwidth s(ai ). Connect router node ri to router nodes rj for 1 ≤ j ≤ m, with edges of bandwidth s(ai ). Finally, connect nodes vi and vi with an edge of bandwidth s(ai )l/ (s(ai ) − l). For each element ai of A with s(ai ) = l, we follow the same connection process but do not create node vi and the associated edge that would be connected to it. Figure 3 shows an example of the network created. This construction takes polynomial time, since only O(m) nodes and O(m2 ) edges are created. The remaining question is: Can a file of size c be distributed from s0 to all other workstation nodes in time ≤ k = c/l? The solution to the transformed problem will determine whether it is possible to transfer the file to all workstations in time less than or equal to c/l. If the answer is “yes”, then the answer is also “yes” for the 3-Partition instance. Otherwise, the answer is “no” for the 3-Partition instance. Proof. First, if a solution exists for the 3-Partition problem, then it is possible to distribute the file in the created network in c/l time. To do this, let A1 , A2 , . . . , Am be a solution to 3-Partition. The start node s0 can immediately begin transferring the file to each vi node, where a transfer to vi is routed through
The Topology Aware File Distribution Problem
375
Fig. 3. Illustrating the transformation from 3-Partition to the RTA file distribution problem. The workstation nodes are represented as circles; node s0 starts with the file initially.
rj if vi corresponds to an element in Aj . All available bandwidth will be used on the links (s0 , rj ), (rj , ri ), and (ri , vi ) during this process. After each vi receives the file, it immediately transfers it to vi if it exists. The total time taken for any vi and vi pair to finish is exactly c/s(ai ) + c (s(ai ) − l) / (s(ai )l) = c/l. Of course, if vi does not exist, then s(ai ) = l and the time taken is also c/l. Second, we need to show that being able to supply all workstations in time c/l implies a “yes” answer for 3-Partition. Note that the bandwidth between vi and vi (if it exists) is always greater than that of the edge coming in to vi from a router. This is because s(ai )l/ (s(ai ) − l) > s(ai ) reduces to 2l > s(ai ), which is guaranteed by the fact that B/4 < s(ai ) < B/2 for all i. This also means that the time it takes to transfer the file across the smaller link, c/s(ai ), must be larger than the time it takes to transfer the file across the larger link, c(s(ai ) − l)/(s(ai )l). Further, since the bandwidth of edge (vi , vi ) is larger than that of edge (ri , vi ), supplying both vi and vi from outside (that is, vi does not supply vi or vice versa) results in too much time being used. To see this, suppose both vi and vi are supplied from outside and define be (t) to be the total amount of bandwidth used at time t on edge (ri , vi ). Let t∗ be the first time when both transfers are completed. Because 2c information must be transferred and be (t) is restricted to being no bigger than s(ai ),
t∗
2c =
t∗
be (t)dt ≤
0
s(ai )dt = t∗ s(ai ),
0
t∗ ≥ 2c/s(ai). Thus, since 2c/s(ai) > c/s(ai ) + c (s(ai ) − l) / (s(ai )l) = c/l, vi and vi cannot both be supplied from outside. In order to supply both in the desired amount
376
S.T. O’Neil et al.
of time c/l, one of them must be supplied first from outside (utilizing all s(ai ) bandwidth on edge (ri , vi )), followed immediately by a full bandwidth transfer between them. Obviously, this process must begin at time 0. For those nodes vi that do not have an associated vi , transfer to vi must start at time 0 and also use all s(ai ) = l bandwidth on edge (ri , vi ) to complete in time. Finally, we argue that being able to supply all workstations in time c/l implies a “yes” answer for 3-Partition. We show this by contradiction. Assume that a distribution time of c/l is possible, but there is no solution to the 3-Partition instance. Since only c/l time is used, we know that each (ri , vi ) link must be fully utilized by a single transfer from s0 with s(ai ) bandwidth starting at time 0. Since there is no solution to 3-Partition, this means that the total outgoing bandwidth of some rj must exceed B at time 0, which is impossible. Further, based on the file transferring of each router rj , j = 1, 2, . . . , m, we can easily generate the corresponding subset Aj for the 3-Partition instance, in polynomial time. Here, we also note that because 3-Partition is NP-complete in the strong sense, and the created bandwidths are polynomial in the size of the input of the original problem, RTA File Distribution is also NP-complete in the strong sense [8]. Interestingly, a similar reduction from the related, but not strongly NP-complete, 2-Partition problem doesn’t work — the fact that B/4 < s(ai ) < B/2 is critical for both the above reduction as well as the strong-sense hardness of 3-Partition.
6
Conclusion
Motivated by encouraging results in topology discovery for computer networks, we’ve considered the problem of minimum-time file distribution on general networks of known topology. Although we know this problem is (strongly) NP-hard, we’ve also developed a distributed O(log n) approximation algorithm which is best amongst strategies that don’t make use of single links for multiple simultaneous transfers. Although future exploration of more sophisticated “link-sharing” strategies is sure to be interesting, similar results in discrete models that have only recently broken the O(log n) barrier indicate that it is also likely to be quite challenging. Acknowledgments. The research of D.Z. Chen and H. Wang was supported in part by NSF grants CCF-0515203 and CCF-0916606. S. O’Neil was supported in part by the Arthur J. Schmitt foundation. We also thank Prof. Douglas Thain of the University of Notre Dame for useful discussions.
References 1. Biersack, E.W., Carra, D., Lo Cigno, R., Rodriguez, P., Felber, P.: Overlay architectures for file distribution: Fundamental performance analysis for homogeneous and heterogeneous cases. Comput. Netw. 51(3), 901–917 (2007) 2. Burger, M., Kielmann, T., Bal, H.E.: TOPOMON: A monitoring tool for grid network topology. In: ICCS 2002: Proc. of the International Conference on Computational Science-Part II, pp. 558–567 (2002)
The Topology Aware File Distribution Problem
377
3. Carmichael, R., Braga-Henebry, B., Thain, D., Emrich, S.: Biocompute: towards a collaborative workspace for data intensive bio-science. In: HPDC 2010: Proc. of the ACM International Symposium on High Performance Computing (2010) 4. Choudhury, R.R., Bandyopadhyay, S., Paul, K.: Topology discovery in ad hoc wireless networks using mobile agents. In: Horlait, E. (ed.) MATA 2000. LNCS, vol. 1931, pp. 1–15. Springer, Heidelberg (2000) 5. Coates, M., Rabbat, M., Nowak, R.: Merging logical topologies using end-to-end measurements. In: Proc. of the 3rd ACM SIGCOMM Conference on Internet Measurement, pp. 192–203 (2003) 6. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press, McGraw-Hill Book Company (2000) 7. Elkin, M., Kortsarz, G.: Sublogarithmic approximation for telephone multicast. J. Comput. Syst. Sci. 72(4), 648–659 (2006) 8. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York (1979) 9. Heinzelman, W.R., Kulik, J., Balakrishnan, H.: Adaptive protocols for information dissemination in wireless sensor networks. In: Proc. of the 5th Annual ACM/IEEE International Conference on Mobile Computing and Networking, pp. 174–185 (1999) 10. Jannotti, J.J., Gifford, D.K., Johnson, K.L., Kaashoek, M.F., O’Toole Jr., J.W.: Overcast: Reliable multicasting with on overlay network. In: Proc. of the 4th USENIX Symposium on Operating System Design & Implementation, pp. 197– 212 (2000) 11. Kielmann, T., Hofman, R.F.H., Bal, H.E., Plaat, A., Bhoedjang, R.A.F.: Magpie: MPI’s collective communication operations for clustered wide area systems. SIGPLAN Not. 34(8), 131–140 (1999) 12. Killian, C., Vrable, M., Snoeren, A., Vahdat, A., Pasquale, J.: The overlay network content distribution problem. Technical Report CS2005-0824, University of California, San Diego, CA (May 2005) 13. Kumar, R., Ross, K.: Peer-assisted file distribution: The minimum distribution time. In: IEEE Workshop on Hot Topics in Web Systems and Technologies, HOTWEB (2006) 14. Lua, E.K., Crowcroft, J., Pias, M., Sharma, R., Lim, S.: A survey and comparison of peer-to-peer overlay network schemes. IEEE Communications Survey and Tutorial 7, 72–93 (2005) 15. Nandan, A., Das, S., Pau, G., Gerla, M., Sanadidi, M.Y.: Co-operative downloading in vehicular ad-hoc wireless networks. In: Proc. of the 2nd Annual IEEE Conference on Wireless On-demand Network Systems and Services, pp. 32–41 (2005) 16. Qiu, D., Srikant, R.: Modeling and performance analysis of bittorrent-like peerto-peer networks. In: SIGCOMM 2004: Proc. of the 2004 Conference on Applications, Technologies, Architectures, and Protocols for Computer Communications, pp. 367–378 (2004) 17. Sanzgiri, K., Dahill, B., Levine, B.N., Shields, C., Belding-Royer, E.M.: A secure routing protocol for ad hoc networks. In: ICNP 2002: Proceedings of the 10th IEEE International Conference on Network Protocols, pp. 78–89 (2002) 18. Shirai, T., Saito, H., Taura, K.: A fast topology inference: A building block for network-aware parallel processing. In: Proc. of the 16th International Symposium on High Performance Distributed Computing, pp. 11–22. ACM, New York (2007)
378
S.T. O’Neil et al.
19. Stockinger, H., Samar, A., Holtman, K., Allcock, B., Foster, I., Tierney, B.: File and object replication in data grids. In: Proc. of the 10th IEEE International Symposium on High Performance Distributed Computing, p. 76 (2001) 20. Xiang, Z., Zhang, Q., Zhu, W., Zhang, Z., Zhang, Y.: Peer-to-peer based multimedia distribution service. IEEE Transactions on Multimedia 6, 343–355 (2004) 21. Xu, Y., Heidemann, H., Estrin, D.: Geography-informed energy conservation for ad hoc routing. In: Proc. of the 7th Annual ACM International Conference on Mobile Computing and Networking, pp. 70–84 (2001) 22. Yue, Y., Lin, C., Tan, Z.: Analyzing the performance and fairness of bittorrent-like networks using a general fluid model. Comput. Commun. 29(18), 3946–3956 (2006)
Exploiting the Robustness on Power-Law Networks Yilin Shen, Nam P. Nguyen, and My T. Thai Department of Computer Information Science and Engineering University of Florida, Gainesville, FL, 32611 {yshen,nanguyen,mythai}@cise.ufl.edu Abstract. Many complex networks are discovered to follow the powerlaw distribution in degree sequence, ranging from the Internet, WWW to social networks. Unfortunately, there exist a great number of threats to these complex systems. In this context, it is crucial to understand the behaviors of power-law networks under various threats. Although power-law networks have been found robust under random failures but vulnerable to intentional attacks by experimental observations, it remains hard to theoretically assess their robustness so as to design a more stable complex network. In this paper, we assess the vulnerability of power-law networks with respect to their global pairwise connectivity, i.e. the number of connected node-pairs, where a pair of nodes are connected when there is a functional path between them. According to our in-depth probabilistic analysis under the theory of random power-law graph model, our results illustrate the best range of exponential factors in which the power-law networks are almost surely unaffected by any random failures and less likely to be destructed under adversarial attacks. Keywords: Power-Law Networks, Robustness, Probabilistic Analysis.
1
Introduction
One of the most remarkable discoveries in complex networks is the power-law distribution in their degree sequences, ranging from the Internet [10], WWW [5] to social networks [17]. That is, the number of nodes of degree i in these complex networks is proportional to i−β for some exponential factor β. The property of degree heterogeneity indicates that there are only few nodes with a large number of connections in power-law networks, which are often referred to as ‘hub’ nodes. Some questions are raised naturally: Are power-law networks more vulnerable to intentional attacks or random failures? If so, can we accurately assess the robustness of power-law networks under various threats, thereby designing more stable power-law networks by controlling a constant parameter β? There are a great number of studies regarding the tolerance of power-law networks against failures and attacks, in which the authors measured the damage of
This work is partially supported by NSF Career Award 0953284, DTRA, Young Investigator Award, Basic Research Program HDTRA1-09-1-0061 and DTRA HDTRA1-08-10.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 379–390, 2011. c Springer-Verlag Berlin Heidelberg 2011
380
Y. Shen, N.P. Nguyen, and M.T. Thai
attacks in various ways. The most popular measurements include the number of removed edges, average path length or betweenness [12,3], clustering coefficients [14], or degeneration of link latency [13], the available number of compromised s − t flows [1], or vibration of the network [9]. Other researches focus on local nodal centrality, i.e. degree centrality, betweenness centrality or closeness centrality. However, since all these measurements cannot precisely reflect the network fragmentation, they may not reveal the accurate breakdown and damage of the power-law networks although they are usually efficiently computable. To enhance the assessment accuracy in various real networks, a lot of works emerge mainly based on two measurements, the diameter and the size of the largest component in power-law networks. Albert et al. [4] first observed that many power-law networks can tolerate failures to a surprising degree but their survivability decreases rapidly under attacks. That is, the performance of complex systems reduces sharply because of the quick increase of the diameter and the fragmentation in these networks. Holme et al. [11] further investigated the degree of harms to power-law networks under different strategies of attacks. Cohen et al. [7] showed the resilience of Internet to the random breakdown of the nodes based on percolation theory. In [16], Satorras et al. showed that the random uniform immunization of individuals does not lead to the eradication of communications in the whole complex social networks. However, these works did not propose any approaches to investigate an appropriate exponential factor β so as to improve the robustness of power-law networks to the greatest extent. To this end, our work is the first attempt from a theoretical viewpoint in the literature to assess the impact of random failures and intentional attacks on power-law networks based on a more effective measurement as stated in [8], global pairwise connectivity. Compared with the measurements mentioned above and in the survey [14], global pairwise connectivity illustrates more accurate assessment of network robustness to the threats by reflecting functionality between all node-pairs in the network. Thereby, it demonstrates the network fragmentation precisely. According to this measurement, we did an in-depth analysis using probability theory on power-law networks under various failures and attacks and derive two significant conclusions: (1) A complex network can tolerate random attacks if its exponential factor is larger than 2.9; (2) Power-law networks with smaller exponential factor β are more robust under all threats. The rest of paper is organized as follows. In Section 2, we introduce the random power-law model, the measurement of network vulnerability and failure and attack taxonomy. Some useful results in the literature and fundamental results are presented in Section 3. The analysis of the vulnerability of powerlaw networks under random failure, preferential attacks and degree-centrality attacks are proposed in Section 4, Section 5 and Section 6 respectively. At last, all main theorems are further visualized in Fig. 1.
2
Models, Measurement and Threat Taxonomy
In this section, we first introduce the power-law random graph (PLRG) model, one of the most well-known models. Then we propose an effective metric —
Exploiting the Robustness on Power-Law Networks
381
global pairwise connectivity, to measure the vulnerability of power-law networks under various failures and attacks in the next part. Our analysis throughout the whole paper is based on the PLRG model. 2.1
Power-Law Random Graph Model (PLRG)
Given a network represented by an undirected graph G = (V, E) with |V | = n nodes and |E| = m edges, the graph is referred to as power-law graph G(α,β) (PLG) if it follows the important property of complex network, power-law degree distribution. The definition of G(α,β) is as follows. Definition 2.1 ((α, β) Graph G(α,β) ). A graph G(α,β) = (V, E) is called a (α, β) power-law graph if the maximum degree is Δ = eα/β and the number of nodes of degree i is: eα Δ α iβ , if i > 1 or i=1 eiβ is even yi = (2.1) eα + 1, otherwise α where the number of nodes n and edges ∞m 1are almost surely (a.s.) e ζ(β) α and e ζ(β − 1) respectively. Here ζ(t) = i=1 it is the Riemann Zeta function. 1 2 Notice that since n = eα ζ(β) + O(n β − 1) and m = eα ζ(β − 1) + O(n β − 1), there . is only a very small error o(1) when β > 2. For simplicity, we define n = eα ζ(β) . α and m = e ζ(β − 1).
Definition 2.2 (PLRG Model). Let d = (d1 , d2 , . . . , dn ) be a sequence of integers corresponding to (1, . . . , 1, 2, . . . , 2, . . . , Δ) where the number of i is equal to nyi . The PLRG model generates a random graph as follows. Consider D = i=1 di mini-nodes lying in n clusters of each size di where 1 ≤ i ≤ n, we construct a random perfect matching among the mini-nodes and generate a graph on the n original nodes as suggested by this perfect matching in the natural way: two original nodes are connected by an edge if and only if at least one edge in the random perfect matching connects the mini-nodes of their corresponding clusters. 2.2
Vulnerability Measurements
In order to assess the vulnerability more accurately, we study the global pairwise connectivity P in residual power-law networks after the failures and attacks, i.e. the number of connected node-pairs. Clearly, there are a.s. no large connected components when P decreases to some degree. To this end, the fragmentation of the whole network can be accurately assessed by global pairwise connectivity instead of other connectivity measurements [14]. 2.3
Threat Taxonomy
Taking most threats into account, we study the vulnerability of power-law networks under uniform random failure and two types of intentional attacks, preferential attack and degree-centrality attack.
382
Y. Shen, N.P. Nguyen, and M.T. Thai
Definition 2.3 (Uniform Random Failure). Each node in G(α,β) fails randomly with the same probability. Definition 2.4 (Preferential Attack). Each node in G(α,β) is attacked with higher probability if it has a larger degree. Definition 2.5 (Degree-Centrality Attack). The adversary only attacks the set of centrality nodes with maximum degrees in G(α,β) . The residual network of the power-law network G(α,β) is defined as Gr , Gp and Gc after the occurrence of uniform random failure, preferential attack and degreecentrality attack. Their corresponding expected degree sequences are denoted as dr , dp and dc , where the number of dri , dpi and dci are referred to as yir , yip and yic .
3
Preliminaries
In this section, we first present some useful results in the literature. Then we derive some fundamental results in power-law networks, which can be used to evaluate the vulnerability of power-law networks in the rest of paper. The following two lemmas illustrate an important relationship between the size of largest connected components and the degree sequence in random networks. Lemma 3.1 (M. Molloy and B. Reed [15]). In a random graph G with λi n Δ nodes of degree i where i=1 λi = 1 with maximum degree Δ, Q = i≥1 i(i − 2)λi is a metric to decide whether there are giant components in G. The giant components exist if Q > 0 and Δ < n1/4 − . Otherwise, there is a.s. no giant component if Q < 0 and Δ < n1/8 − . Lemma 3.2 (F. Chung et al. [6]). The giant component a.s. exists if the expected average degree d is at least 1, and there is a.s. no giant component if the expected second-order√ average degree d˜ is at most 1. Furthermore, all components have volume at most n log n with probability at least 1 − o(1) if d˜ < 1. Here the expected average degree d and second-order average degree d˜ are defined as n n n d2i d2 1 i=1 ˜ d= di , d = n = i=1 i n i=1 2m i=1 di where di is the elements in the degree sequence. Note that most results in the paper follow from Lemma 3.2 except the assessment of network under random attacks since Lemma 3.2 is comparatively stronger than Lemma 3.1. Specially, from Lemma 3.1, we know n Q= i(i − 2)λi = C d2i − 2di = Cd(d˜ − 2) i≥1
i=1
That is, there is a.s. no giant component when d˜ < 2 but the size of largest connected component can be a.s. decided only when d˜ < 1. Then, we propose our following fundamental results.
Exploiting the Robustness on Power-Law Networks
Corollary 3.1. All connected components a.s. have size at most if d˜ < 1.
1√ 2 n log n
383
+1
Proof. Consider a connected component containing a subset of nodes S, the volume of S is defined as V ol(S) = vi ∈S di . Since there are at least |S|−1 edges √ in a connected component of size |S|, we have √ 2(|S| − 1) ≤ V ol(S) ≤ n log n. Therefore, the size of S is upper bounded by 12 n log n + 1. Lemma 3.3. Suppose that the maximum size of connected components in a graph G = (V, E) is , the pairwise connectivity P is at most n(−1) . 2 Proof. To prove the upper bound, we consider the worst case that the whole network consists of all connected components of size except some leftover nodes. Suppose that there are c1 connect components of size and the number of leftover nodes is c2 , we have n = c1 + c2 . Therefore, the pairwise connectivity P is c2 c2 c1 + c2 n( − 1) P ≤ c1 + ≤ c1 + = = 2 2 2 2 2 2 Theorem 3.1. In a (α, β) graph G(α,β) , – If β < 3.47875, the pairwise connectivity P is Θ(n2 ); – If β ≥ 3.47875, the range of pairwise connectivity P is a.s. at most
2 1 β n c(β)n log n − 1 . 2 where c(β) = 16/ ζ(β) 2 −
ζ(β−2) ζ(β−1)
2 is a constant on any given β.
Proof. When β < 3.47875, according to Lemma 3.1, since Q > 0, there exists one giant component of size Θ(n). Therefore, the pairwise connectivity P is Θ(n2 ). When β ≥ 3.47875, according to Aiello et al. [2], a connected component S in 2 the (α, β) graph a.s. has the size at most c(β)n β log n. Then the upper bound of P follows straightforward from Lemma 3.3.
4
Uniform Random Failures
In this section, we study the global pairwise connectivity P in Gr , i.e. the residual power-law networks under uniform random failures. In other words, each node has the same probability p to fail. Before proving the main theorem (Theorem 4.1), we show the expected degree distribution in Gr as follows. Lemma 4.1. The expected degree distribution of graph Gr is E(yir )
= (1 − p)
i+1
Δ α k e k=i
where degree i is 1 ≤ i ≤ Δ.
i kβ
pk−i
384
Y. Shen, N.P. Nguyen, and M.T. Thai
Proof. Consider some node v of degree k in G(α,β) : if k < i, it is clear that v has probability pk = 0 to become a node of degree i in Gr ; if k ≥ i, v will become a node of of degree i in Gr if and only if v itself does not fail but k − i of its neighbors fail. Hence, the probability pk that a node v of degree k ≥ i in G(α,β)
becomes a node of degree i in Gr is ki (1 −p)[pk−i (1 −p)i ], i.e. ki pk−i (1− p)i+1 . Thus, according to the basic definition of expected value, the expected number of nodes of degree i in Gr is E(yir )
=
Δ k=1
Δ α eα k e k−i i+1 pk β = (1 − p) p k i kβ k=i
Theorem 4.1 (Main Theorem). In a residual graph Gr of G(α,β) after uniform random failures, – If β < β0 , the expected pairwise connectivity E(P) is a.s. Θ(n2 ); – If β ≥ β0 , the range of pairwise connectivity P is a.s. at most 2 1 β 2 n cr (β)n log n − 1 . where β0 satisfies that (1 − p)ζ(β0 − 2) − (2 − p)ζ(β0 − 1) = 0 and cr (β) =
2 16/ ζ(β) 2 − p − (1 − p) ζ(β−2) . ζ(β−1) Proof. Consider Lemma 3.2, unfortunately we cannot apply it here since the ζ(β−2) second-order average degree d˜ = p + (1 − p) ζ(β−1) is always larger than 1 for any p and β. Then we use Lemma 3.1 to find a threshold β0 based on its expected degree distribution and analyze the pairwise connectivity of residual graph Gr in the case of β > β0 and β < β0 respectively. To compute β0 , we calculate Qr in Lemma 3.1 for Gr as follows: Δ Δ α k e k−i Qr = i(i − 2)(1 − p)i+1 p (4.1) i kβ i=1 k=i Δ i 1 i i−j = eα (1 − p) j(j − 2) p (1 − p)j (4.2) β i j i=1 j=1 = eα (1 − p)2
Δ 2 i (1 − p) − i(2 − p) i=1
iβ
. = eα (1 − p)2 [(1 − p)ζ(β − 2) − (2 − p)ζ(β − 1)]
(4.3) (4.4)
where step (4.3) follows similarly from the expected value and variance of binomial distribution. Consider the threshold β0 satisfies (1 − p)ζ(β − 2) − pζ(β − 1) = 0. When β < β0 , we have Qr > 0. Thus, the expected pairwise connectivity E(P) is a.s. Θ(n2 ) according to Lemma 3.1. When β ≥ β0 , we use the following branching process method (Algorithm 1) according to the expected degree sequence E(yir ). Ei and Li are the set of exposed
Exploiting the Robustness on Power-Law Networks
385
Algorithm 1. Branching Process Method 1 2 3 4 5 6 7 8
i ← 0; E0 = L0 = {v} by picking an arbitrary node v; while |Li | = 0 do i ← i + 1; Choose an arbitrary u from Li−1 and expose all its neighbors N (u); Ei = Ei−1 ∪ N (u); Li = (Li \ ({u}) ∪ (N (u) \ Ei−1 ); end
nodes and live nodes in iteration i respectively, where live nodes are referred to as the subset of exposed nodes whose neighbors have not been exposed. Note that |Li | = 0 if and only if the entire component is exposed. For simplicity, we define random variables Ei = |Ei | and Li = |Li |. Let T denote the whole number of iterations in branching process, that is, T also measures the size of connected component since exactly one node is exposed in each iteration. We further define an edge to be a “backedge” if it connects u and some node in Ei−1 . We denote Di = |N (u)| and Bi = |N (u) ∩ Ei−1 | − 1 measuring the degree of the node exposed in iteration i and the number of “backedge”. By definition, we have Li − Li−1 = Di − Bi − 2. Then we calculate E(Di ), E(Bi ) and E(Li ) respectively. Consider one edge in original graph G, it still exists if and only if both endpoints are not failed. That is, the expected number of edges |Er | in Gr is (1 − p)2 |E|. Therefore, Δ
k
α
k−i
e Δ i(1 − p)i+1 k=i ( i ) kβ p E(Di ) = i (1 − p)2 |E| i=1
i2 (1 − p) + ip . 1 ζ(β − 2) = (1 − p) +p β ζ(β − 1) i=1 i ζ(β − 1) Δ
=
Since |N (u) ∩ Ei−1 | ≥ 1, we have E(Bi ) ≥ 0. By substituting E(Di ) and E(Bi ) into Li − Li−1 = Di − 2 − Bi , we have i i E(Li ) = L1 + E(Lj − Lj−1 ) = d0 + E(Dj − Bj − 2) j=2
j=2
ζ(β − 2) ≤ d0 + (i − 1) (1 − p) + p − 2 = d0 − λ(p, β)(i − 1) ζ(β − 1) where λ(p, β) = 2 − p − (1 − p) ζ(β−2) ζ(β−1) and the initial node is assumed to have degree d0 . α Since |Lj − Lj−1 | ≤ Δ = e β , according to Azuma’s martingale inequality, −T 2 2α β
P r [|Li − E(Li )| > T ] ≤ 2e 2ie where i =
2α 16 β (λ(p,β))2 e
2
log n = cr (β)n β log n and T = λ(p, β)i/2. Since we know
E(Li ) + T ≤ d0 − λ(p, β)(i − 1) +
λ(p, β) i<0 2
386
Y. Shen, N.P. Nguyen, and M.T. Thai
for any d0 . Therefore, Pr T >
2α 16 β e log n = P r[T > i] ≤ P r[Li > 0] (λ(p, β))2
≤ P r[Li > E(Li ) + T )] ≤ 2e
−T 2 2α 2ie β
=
2 n2
Therefore, the probability that there is an non-failure node v in a connected 2 component of size larger than cr (β)n β log n is at most n n22 = o(1), i.e. graph Gr 2 has the largest connected component of size a.s. cr (β)n β log n. Thus, the range of pairwise connectivity in Pr follows from Lemma 3.3 straightforward.
5
Preferential Attacks
In this section, we study the global pairwise connectivity P in Gp , i.e. the residual power-law networks under preferential attacks. In preferential attacks, each node in the network is attacked with different probability according to its degree. By defining pi to be the probability of a node of degree i to be attacked, we study the global pairwise connectivity P of complex network under two following preferential attack schemes: interactive attacks and expected attacks, where their corresponding residual graphs are denoted as GIp and GE p respectively.
5.1 Interactive Attacks pi = 1 − iβ1 In this scheme, the intruder can attack the network interactively according to their own preferences. By choosing a different parameter β , the network will be attacked in different degrees. Specifically, a node of degree i in G(α,β) has probability 1 − iβ1 to be attacked in this context. It is easy to see that a node of larger degree, often referred to as a “hub”, has more probability to be attacked. Before proving the main theorem (Theorem 5.1), we prove the expected degree distribution in GIp as follows. Lemma 5.1. In graph G(α,β) , the probability that a node v of degree i incident ix to another node u of degree x is eα ζ(β−1) . Proof. Consider a node v of degree i, in the matching of mini-nodes, at least one of i mini-nodes for v connects to another one of x for node u of degree x. We have
i x ix ix 1 . ix 1 1 f (N − 2) = = + O( 2 ) = α f (N ) N −1 N N e ζ(β − 1) where f (n) = (n−1)!! representing the number of perfect matchings for N nodes and N = eα ζ(β − 1) denotes the number of mini-nodes. Lemma 5.2. For a node v of degree i, the expected number of non-failure neigh −1) bors E(NpI (i)) of v is i ζ(β+β . ζ(β−1)
Exploiting the Robustness on Power-Law Networks
387
ix Proof. According to Lemma 5.1, node v has probability eα ζ(β−1) to connect to node u of degree x. Since node u of degree x has the non-failure probability x1β , then we have the expected non-failure neighbor of v to be Δ ix 1 eα . ζ(β + β − 1) . E(NpI (i)) = =i eα ζ(β − 1) xβ xβ ζ(β − 1) x=1
Lemma 5.3. The expected degree distribution of graph GIp is eα . E(yip ) =
β+β ζ(β−1) i ζ(β+β −1) where i ∈
ζ(β+β −1) ζ(β+β −1) ζ(β+β −1) ζ(β−1) , 2 ζ(β−1) , . . . , Δ ζ(β−1)
.
Proof. Consider the set of nodes of degree i in Gp , they are correspondent to the nodes of degree x in the original graph. Hence, the expected unattacked nodes α eα in this set is xe β x1β = xβ+β . From Lemma 5.4, we know the relation between i . ζ(β+β −1) and x is i = x ζ(β−1) . Therefore, we have the expected number of nodes of degree i in GIp to be
eα
ζ(β−1)
i ζ(β+β −1)
β+β
.
Theorem 5.1 (Main Theorem). In a residual graph GIp of G(α,β) after interactive preferential attacks, – If β + β < 3.47875, the expected pairwise connectivity E(P) is Θ(n2 ); – If β + β ≥ 3.47875, the
range of pairwise connectivity P is a.s. at most 2 1 β 2 n c(β)n log n − 1 . where c(β) = 16/ ζ(β) 2 −
ζ(β−2) ζ(β−1)
2 is a constant on any given β.
Proof. The proof follows the same as Theorem 3.1. 5.2
Expected Attacks
i pi = c eα ζ(β−1)
In expected attacks, the intruders are usually interested in investigating the size of expected number of nodes to attack such that the network can be almost surely fragmented. To this end, we consider that the probability of each node to be attacked is proportional to its degree, i.e. a node of degree i is attacked i with probability pi = c eα ζ(β−1) , in which the expected failure nodes is equal to eα c since i iβ pi = c. Lemma 5.4. For a node v of degree i, the expected number of non-failure neighE bors E(Np (i)) of v is i 1 − eαcζ(β−2) . ζ(β−1)2 ix Proof. According to Lemma 5.1, node v has probability eα ζ(β−1) to connect to node u of degree x. Since node u of degree x has the non-failure probability x 1 − c eα ζ(β−1) , then we have the expected non-failure neighbor of v to be
388
Y. Shen, N.P. Nguyen, and M.T. Thai
. E(Np (i)) = Δ
ix α ζ(β − 1) e x=1
1−
cx eα ζ(β − 1)
eα . cζ(β − 2) = i 1 − xβ eα ζ(β − 1)2
Lemma 5.5. The expected degree distribution of graph GE p is ⎛ β α cζ(β − 2) ci . e ⎝1 − E(yip ) = β 1 − α 2 i e ζ(β − 1) (eα ζ(β − 1)) 1 − where i ∈
1−
cζ(β−2) eα ζ(β−1)2
,2 1 −
ζ(cβ−2) eα ζ(β−1)2
,...,Δ 1 −
⎞ cζ(β−2) eα ζ(β−1)2
cζ(β−2) eα ζ(β−1)2
⎠
.
Proof. The proof follows similarly as the proof in Lemma 5.3. Theorem 5.2 (Main Theorem). In a residual graph GE p of G(α,β) after expected preferential attacks, – The pairwise P is a.s. Θ(n2 ) connectivity Δ eα (1− α cx ) x 1− cζ(β−2)
α 2 x=1 xβ e ζ(β−1) e ζ(β−1) if c < min c >1 ; n−c 3
– The pairwise P is a.s. at most 14 n 2 logn connectivity
ζ(β−2)− cζ(β−3) eα ζ(β−1) if c > max c 1 − eαcζ(β−2) <1 . ζ(β−1)2 ζ(β−1)− cζ(β−2) eα ζ(β−1) Proof. In the proof, we first calculate the expected average degree y E p as
Δ eα cx x 1 − eαcζ(β−2) x=1 xβ 1 − eα ζ(β−1) ζ(β−1)2 . yE = p n−c and second-order average degree y˜pE as
2 Δ eα cζ(β−2) cx 1 − x 1 − α α 2 x=1 xβ e ζ(β−1) e ζ(β−1) .
y˜pE = Δ eα cx x 1 − eαcζ(β−2) x=1 xβ 1 − eα ζ(β−1) ζ(β−1)2 . =
ζ(β − 2) − cζ(β − 2) 1− α e ζ(β − 1)2 ζ(β − 1) −
cζ(β−3) eα ζ(β−1) cζ(β−2) eα ζ(β−1)
According to Lemma 3.2 and Corollary 3.1, there√exists one giant component 1 if y E ˜pE < 1, the p > 1 and all components have size at most 2 n log n + 1 if y proof follows from Lemma 3.3.
6
Degree-Centrality Attacks
Unlike the above random threats, in degree-centrality attack, the intruders intentional attack the “hubs”, that is, the set of nodes with highest degrees. Suppose that all nodes of degree larger than x0 are attacked simultaneously, we have the following results.
Power-Law Network Fragmented
Power-Law Network Unaffacted 0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Uniform Failure Probability p
The Fraction of Attacked Nodes(%)
3.45 3.4 3.35 3.3 3.25 3.2 3.15 3.1 3.05 3 2.95 2.9
The Expected Fraction of Attacked Nodes(%)
Exponential Factor Threshold β0
Exploiting the Robustness on Power-Law Networks
30 25
Power-Law Network Fragmented
20 15 10 5
Power-Law Network Unaffacted
0 2
2.2
2.4
2.6
2.8
3
3.2
3.4
20 15
Power-Law Network Fragmented
10 5 Power-Law Network Unaffacted
0 2
2.5
Exponential Factor β
(a) UR Failures
389
3
3.5
4
Exponential Factor β
(b) EP Attacks
(c) DC Attacks
Fig. 1. The Visualization of Exponential Factor β under various Failures and Attacks: In uniform random (UR) failures, Fig. 1(a) illustrates the relationship between threshold β0 and failure probability p as stated in Theorem 4.1. Power-law networks of exponential factor β > 2.9 are shown to be unaffected under UR failures even though each node fails with unrealistic probability 0.8. With respect to adversarial attacks, Fig. 1(b) and Fig. 1(c) associate the exponential factor β with the expected fraction of attacked nodes under expected preferential (EP) attacks and under degree-centrality (DC) attacks according to Theorem 5.2 and 6.1. The power-law network of β = 2 survives when less than 13% expected fraction of nodes are attacked in EP attacks and less 5% fraction of nodes are attacked in DC attacks. (Note that the shadow area in these two figures are the uncertain area, i.e. power-law networks may be either unaffected or fragmented, which should be avoided.)
Lemma 6.1. For a node v of degree i in original graph G(α,β) , the expected Δ i 1 number of neighbors of degree larger than x0 is ζ(β−1) i=x0 +1 iβ−1 . Proof. According to Lemma 5.4, the probability that a node v of degree i incident ix to a node u of degree x is eα ζ(β−1) . Therefore, we have the expected number of neighbors of degree larger than x0 to be Δ Δ ix eα i 1 . E(Nc (i)) = = α β β−1 e ζ(β − 1) x ζ(β − 1) x=x +1 x x=x +1 0
0
Lemma 6.2. The expected degree sequence in Gc is β x0 α 1 1 c . e E(yi ) = β i ζ(β − 1) x=1 xβ−1 where i ∈
1 ζ(β−1)
x0
1 x=1 xβ−1
,2
1 ζ(β−1)
x0
1 x=1 xβ−1
, . . . , x0
1 ζ(β−1)
x0
1 x=1 xβ−1
.
Theorem 6.1 (Main Theorem). In a residual graph Gc of G(α,β) after degreecentrality attacks, – The pairwise connectivity P is a.s. Θ(n2 ) 2 1 0 1 ( xx=1 ) β−1 x if x0 < min x0 ζ(β−1) x0 1 >1 ; x=1 xβ
3
1 2 – The pairwiseconnectivity P is a.s. at most 4 n log n 1 x0 1 if x0 > max x0 ζ(β−1) x=1 xβ−2 < 1 .
390
Y. Shen, N.P. Nguyen, and M.T. Thai
The proof of Lemma 6.2 and Theorem 6.1 follows from Lemma 6.1 and the proof of Theorem 5.2 respectively. Discussion: Fig. 1 visualizes the above results for main theorems correspondent to the vulnerability of power-law networks under various threats.
References 1. Modeling s-t path availability to support disaster vulnerability assessment of network infrastructure. Computers & Operations Research 36(1), 16–26 (2009) 2. Aiello, W., Chung, F., Lu, L.: A random graph model for power law graphs. Experimental Math. 10, 53–66 (2000) 3. Albert, R., Albert, I., Nakarado, G.L.: Structural vulnerability of the north american power grid. Phys. Rev. E 69(2), 025103 (2004) 4. Albert, R., Jeong, H., Barabasi, A.: Error and attack tolerance of complex networks. Nature 406(6794), 378–382 (2000) 5. Albert, R., Jeong, H., Barabasi, A.L.: The diameter of the world wide web. Nature 401, 130–131 (1999) 6. Chung, F., Lu, L.: Connected components in random graphs with given expected degree sequences. Annals of Combinatorics, 125–145 7. Cohen, R., Erez, K., Ben-Avraham, D., Havlin, S.: Resilience of the Internet to Random Breakdowns. Physical Review Letters 85(21), 4626+ (2000) 8. Dinh, T.N., Xuan, Y., Thai, M.T., Park, E.K., Znati, T.: On approximation of new optimization methods for assessing network vulnerability. In: INFOCOM, pp. 2678–2686 (2010) 9. Estrada, E., Hatano, N.: A vibrational approach to node centrality and vulnerability in complex networks. Physica A: Statistical Mechanics and its Applications 389(17), 3648–3660 (2010) 10. Faloutsos, M., Faloutsos, P., Faloutsos, C.: On power-law relationships of the internet topology. In: Proceedings of the Conference on Applications, Technologies, Architectures, and Protocols for Computer Communication, SIGCOMM 1999, pp. 251–262. ACM, New York (1999) 11. Holme, P., Kim, B.J., Yoon, C.N., Han, S.K.: Attack vulnerability of complex networks. Phys. Rev. E 65(5), 056109 (2002) 12. Kaiser, M., Hilgetag, C.C.: Edge vulnerability in neural and metabolic networks. Biological Cybernetics 90, 311–317 (2004), 10.1007/s00422-004-0479-1 13. Latora, V., Marchiori, M.: Vulnerability and protection of infrastructure networks. Phys. Rev. E 71(1), 015103 (2005) 14. Luciano, Rodrigues, F., Travieso, G., Boas, V.P.R.: Advances in Physics 15. Molloy, M., Reed, B.: A critical point for random graphs with a given degree sequence. Random Struct. Algorithms 6, 161–179 (1995) 16. Satorras, R.P., Vespignani, A.: Immunization of complex networks. Phys. Rev. E 65(3), 036104 (2002) 17. Redner, S.: How popular is your paper? An empirical study of the citation distribution. The European Physical Journal B - Condensed Matter and Complex Systems 4(2), 131–134 (1998)
Competitive Algorithms for Online Pricing Yong Zhang1,2, , Francis Y.L. Chin2, , and Hing-Fung Ting2, 1
Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences, China 2 Department of Computer Science, The University of Hong Kong, Hong Kong {yzhang,chin,hfting}@cs.hku.hk
Abstract. Given a seller with m amount of items, a sequence of users {u1 , u2 , ...} come one by one, the seller must set the unit price and assign some amount of items to each user on his/her arrival. Items can be sold fractionally. Each ui has his/her value function vi (·) such that vi (x) is the highest unit price ui is willing to pay for x items. The objective is to maximize the revenue by setting the price and amount of items for each user. In this paper, we have the following contributions: if the highest value h among all vi (x) is known in advance, we first show the lower bound of the competitive ratio is O(log h), then give an online algorithm with competitive ratio O(log h); if h is not known in advance, we give an −1/2 h online algorithm with competitive ratio O(h3 log ).
1
Introduction
Pricing is an interesting problem from Economics. In computer science, researchers often build theoretical models for some economic events, then solve the problems by using methods from combinatorial optimization. In this paper, we consider the online pricing problem, which is formally defined as follows: Given a seller with m amount of items, a sequence of users {u1 , u2 , ...} come one by one, the seller must set the unit price and assign some amount of items to each user on his/her arrival. Items can be sold fractionally. Each ui has his/her value function vi (·) such that vi (x) is the highest unit price ui is willing to pay for x amount of items. Generally, the more items a user buys, the lower unit price he excepts. Thus, vi (x) is non-increasing. Let h be the highest value among all vi (x), i.e., vi (x) ≤ h for all i and x. When user ui comes, assuming that the seller sets unit price pi and assigns mi items to ui . If pi > vi (mi ), user ui cannot accept this price, thus, no item is bought by ui . Otherwise, pi ≤ vi (mi ), ui will accept this price and pay mi · pi to the seller. If there exist mi > mi such that pi ≤ vi (mi ), user ui is partially satisfied. Otherwise, user ui is totally satisfied. The objective is to maximize the revenue by setting the price and amount of items for each user.
Research supported by Shenzhen New Industry Development Fund under grant No.CXB201005250021A. and Shanghai Key Laboratory of Intelligent Information Processing, China. Grant No. IIPL-2010-010. Research supported by HK RGC grant HKU 7117/09E. Research supported by HK RGC grant HKU-7171/08E.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 391–401, 2011. c Springer-Verlag Berlin Heidelberg 2011
unit price
Y. Zhang, F.Y.L. Chin, and H.-F. Ting
unit price
392
h 2h/3
h/2
h/6 0
amount of items value function for u1
0
3
7 amount of items
value function for u2
Fig. 1. Example of two value functions
For example, consider the two value functions shown in Figure 1. u1 is willing to buy any amount of items with unit price h/2. In another words, if the unit price of items is no more than h/2, u1 wants to buy as much as possible. If the amount of assigned items is less than 3, the highest unit price u2 is willing to pay is h; if the amount of assigned items is between 3 and 7, u2 wants to pay at most 2h/3 for the unit price; if the amount of assigned items is more than 7, u2 can afford at most h/6 for the unit price. Assuming that the seller assigns 4 items with unit price h/2 to u1 and assigns 6 items with unit price 2h/3 to u2 , the total revenue of the seller is 4 · h/2 + 6 · 2h/3 = 6h. In this case, u1 and u2 are both partially satisfied. We consider the online version of the problem, i.e., before the i-th user come, the seller has no information of the j-th user for j ≥ i. To measure the performance of online algorithms, the competitive analysis is generally used, i.e., compare the outputs between the online algorithm and the optimal offline algorithm, which knows the whole information in advance. In the online pricing problem, the output is the total revenue returned from the algorithm. Given the seller has m amount of items and a user sequence σ, let A(m, σ) and O(m, σ) denote the total revenue of an online algorithm A and the optimal offline algorithm O, respectively. The competitive ratio of algorithm A is RA = sup m,σ
O(m, σ) . A(m, σ)
Pricing for items has been well studied during these years. Given n items with unlimited supply, if users are unit-demanded or single-minded, Guruswami et al. [10] showed that a randomized pricing scheme can achieve the revenue within a logarithmic factor of the social welfare. Balcan et al. [3] considered the problem of pricing n items for some unknown users with complex preferences. In some pricing problem, items can be regarded as vertices in a hyper-graph. Each user is interested in some set of items (subgraph of the hyper-graph), and the value function is based on the combination of those items (vertices). The seller
Competitive Algorithms for Online Pricing
393
sets price for each item (vertices), if the total price of the interested set of a user is no more than his threshold, the user will buy the items in his interested set. Elbassioni et al. [7] and Grigoriev et al. [9] have studied the profit maximizing pricing in graphs. To maximize the seller’s revenue, Balcan et al. [1] gave an O(k)-approximation algorithm for single-minded users who wants at most k items. Envy-free is an important property in computational economy, we say a pricing is envy-free if the utility of each user is maximized. Envy-free pricing has been studied in [2,5,6,8,11]. This paper is organized as follows: Section 2 consider the variant in which the highest value h of the value functions is known in advance, we first prove the lower bound of the competitive ratio for this variant is O(log h), then give a deterministic online algorithm whose competitive ratio matches this lower bound. In Section 3, without knowing h in advance, we give a deterministic online algo−1/2 h rithm with competitive ratio O(h3 log ).
2 2.1
h Is Known in Advance Lower Bound
In this subsection, we show the lower bound of the competitive ratio is at least O(log h) for the online pricing problem. Generally, the lower bound of the competitive ratio of an online problem is proved by measuring the performance against an adversary, who knows all information and adjusts the input sequence according to the decisions made by the online algorithms. For this problem, we analyze the pricing procedure step by step. In each step, the adversary decides whether or not sending a user with some fixed value function to the seller. If a user comes, the seller sets the unit price and assigns some amount of items to him. Comparing with the optimal offline pricing scheme, if the total revenue at any step below some threshold, the adversary stops sending users to the seller and the procedure terminates. – step 1: the adversary sends u1 to the seller, such that u1 is willing to pay 20 = 1 for each item. If the seller assigns x1 ≤ m/log h items to u1 , the adversary stops the procedure and no user comes. The revenue of the online algorithm is at most m/log h, while the optimal strategy assigns all items to the first user with the total revenue m. Thus, in this case, the competitive ratio is at least log h. Otherwise, the seller assigns x1 > m/log h items to u1 , then the adversary sends u2 to the seller. – step 2: u2 is willing to pay 21 = 2 for each item. If the seller assigns x2 items to u2 such that x1 + x2 ≤ 2m/log h, since x1 > m/log h, we have x2 < m/log h. The adversary stops the arrival of the following users. The total revenue of the online algorithm is at most x1 +2x2 ≤ 3m/log h, while the optimal strategy assigns all items to u2 with the total revenue 2m. Thus, in this case, the competitive ratio is 2log h/3.
394
Y. Zhang, F.Y.L. Chin, and H.-F. Ting
Otherwise, the seller assigns x2 amount of items to u2 such that x1 + x2 > 2m/log h. ... – step i: user i is willing to pay 2i−1 for item. i If the seller assigns xi items to ui such that j=1 xj ≤ im/log h, the adversary stops the arrival of the following users. Fact 1. The total revenue is at most 2i m/log h. k Proof. From previous steps, j=1 xj > km/log h (k < i). Thus, we have i j=k+1 xj < (i − k)m/log h for (0 ≤ k < i). Therefore, i
2j−1 xj ≤
j=1
i
2j−1 m/log h < 2i m/log h
j=1
The optimal strategy assigns all items to ui with the total revenue 2i−1 m. Thus, in this case, the competitive ratio is at least log h/2. i Otherwise, the seller assigns xi items to ui such that j=1 xi > im/log h. ... – step log h: user ulog h is willing to pay 2log h−1 to each item. Suppose the seller assigns xlog h to ulog h . Note that the amount of aslog h signed items cannot larger than the total amount, i.e., xj ≤ m. j=1 Similar to step i, we can say that the competitive ratio in this case is also at least O(log h). From the above analysis, we have the following conclusion for the lower bound of the competitive ratio. Theorem 1. The competitive ratio of the online pricing problem is at least O(log h). log h Proof. Since j=1 xj cannot be larger than m, the procedure must be terminated at some step. From the above analysis, the competitive ratio is at least O(log h) if the adversary terminates the procedure at any step. Thus, this theorem is true. 2.2
Online Algorithm
In this subsection, we give an online algorithm for this problem and prove that the competitive ratio of our algorithm matches the lower bound O(log h) in Section 2.1. Firstly, we consider a simple example, which give us some heuristic for handling the online pricing problem. Suppose the seller has h items. When the first user comes with the value function v1 (x) = 1 for any x. If the seller sets the unit price to be 1, and assigns all these h items to him, the revenue is h. Then the second user comes with the value function v2 (x) = h for any x. There is no item left for the second user, and the total revenue is h. In this case, the optimal scheme assigns no item to the
Competitive Algorithms for Online Pricing
395
first user, assigns all items to the second user with unit price h. The maximal revenue is h2 . However, if the seller doesn’t assign any item to the first user, no user comes any more and the revenue is zero. In this case, the optimal scheme assigns h items with unit price 1 to the first user and get the revenue h. The above example shows that the online strategy which set the price and the amount of assigned items to the extreme value is not good, the competitive ratio of such online strategies is at least h. From the above example, we have the following idea: Heuristic: when setting the price to some lower value, the amount of assigned items must be bounded by some threshold. In our online algorithm, we set the unit price for each user to the value of some power of 2, say 2i . Associate m/(log h + 1) items to each price level 2i . If all items in price level 2i is assigned to some users, the seller may use the remaining quota from lower price levels to satisfy the user with unit price 2i . When using the remaining quota from lower price levels, the order must be strictly decreasing, i.e., first try price level 2i−1 , then 2i−2 , ... Fact 2. The unit price for any item in price level 2i is at least 2i . The amount of items for price level 2i is wi = m/(log h + 1). Since user with higher price level may use the quota from lower price levels, the maximal amount of items which can be assigned to level 2log h is log h
i=0
m =m log h + 1
The following algorithm describes how to set the unit price and the amount of items when a user comes. In the initial step, compute the maximal possible amount of items which can be used for each price level 2i : xi =
(i + 1) · m log h + 1
In the algorithm Pricing, the values of xi (0 ≤ i ≤ log h) are updated step by step. At any step, xi is the current maximal amount of items which can be used for price level 2i . Suppose at some step, we assign mi items with price 2i , after that step, xi will be modified to xi − mi . If we modify xi , the values of xj (j < i) may be updated too. In Algorithm 2, the strategy for modifying available amount of items, we use the quota for higher price first, thus, the quota for lower price may be left. Note that the quota of items for lower price level can be also used for higher price levels. For example, the amount of available items for price levels are: x0 = 1, x1 = 6, x2 = 8, x3 = 20, and x4 = 24. If we set mi = 10 items with price 24 to some user, the updated amount will be: x0 = 1, x1 = 6, x2 = 8, x3 = 14, and x4 = 14.
396
Y. Zhang, F.Y.L. Chin, and H.-F. Ting
Algorithm 1. Pricing 1: Let yj be the largest amount that user i is willing to buy given price 2j and satisfying yj ≤ m. 2: Let k = arg maxj yj · 2j 3: if xk = 0 then 4: Set unit price to be pi = 2k . 5: Assign mi = min{xk , yk } items to user i. 6: Modify Available Amount of Items. 7: else xk = 0 8: Let k = arg maxj>k yj · 2j such that xk > 0 9: Set the unit price to be pi = 2k . 10: Assign mi = min{xk , yk } items to user i. 11: Modify Available Amount of Items. 12: end if
Algorithm 2. Modify Available Amount of Items: (pi = 2k and mi = min{xk , yk }) 1: if mi = xk then 2: xj = 0 for 0 ≤ j ≤ k 3: else mi = yk 4: Let = arg maxj xk − xj ≥ yk . 5: for j = + 1 to k do 6: xj = xk − yk 7: end for 8: end if
From the algorithm Pricing, we say that the price level 2i is full if xi = 0. After handling the sequence of users by the algorithm Pricing, let k be the highest value such that xj = 0 for any j ≤ k, i.e., all price levels from 20 to 2k are full but price levels 2>k are not full, i.e., xj > 0 for any j ≥ k + 1. Let ALG be the total revenue of the algorithm Pricing, OPT be the optimal revenue of the optimal offline algorithm. Partition OPT into two parts: OPT1 and OPT2. OPT1 denotes the revenue for users with assigned price no more than 2k by the optimal offline algorithm, OPT2 denotes the revenue for users with assigned price more than 2k by the optimal offline algorithm. Lemma 3. The ratio between OPT1 and ALG is at most O(log h). Proof. The total amount of assigned items is at most m, thus, OPT1 is at most m · 2k . Since the price levels from 20 to 2k are all full, from Fact 2, the total revenue for users with price no more than 2k is at least k i=0
m · 2i m m · 2k = 2i ≥ log h + 1 log h + 1 log h + 1
Thus, this lemma is true.
k
i=0
Competitive Algorithms for Online Pricing
397
Lemma 4. The ratio between OPT2 and ALG is at most O(log h). Proof. We prove this lemma by considering the following two cases. – User ui is assigned with unit price p > 2k by the optimal offline algorithm and with unit price 2p > 2k by our algorithm Pricing. Let 2 ≤ p < 2+1 . From the description of the algorithm Pricing, we have yp · 2p ≥ y · 2 , where yp and y are the largest amounts of items user ui is willing to buy given unit price 2p and 2 respectively. Since the price level 2p is not full, that means yp items are all assigned to this user. Thus, the revenue of the algorithm Pricing on user ui is yp · 2p . Since the highest unit price is non-increasing in the value function of any user, we know the largest amount of items ui is willing to buy given unit price p is at most y . Thus, the ratio between the revenues on ui by the optimal offline algorithm and our algorithm Pricing is at most 2. – User ui is assigned with unit price p > 2k by the optimal offline algorithm and with unit price 2p ≤ 2k by our algorithm Pricing. Let 2 ≤ p < 2+1 . Suppose the optimal offline algorithm assigns m items to ui . Similar to the above analysis, we have m ≤ y , where y is the largest amount of items user ui is willing to buy given unit price 2 . Thus, the optimal revenue on ui is p · m ≤ 2 · 2 · y . From our algorithm, we know that yp · 2p ≥ y · 2 . If all these yp items are assigned to ui , the revenue of our algorithm on user ui is no less than half of the optimal revenue on this user. Otherwise, algorithm Pricing assigns xp items to ui such that xp < yp . In this case, algorithm Pricing can only assign xp items to this user, after that, the price level 2p is full. In price level 2p , the amount of items is m/(log h + 1). Since m · 2p yp · 2p y · 2 m · p ≥ ≥ ≥ log h + 1 log h + 1 log h + 1 2(log h + 1) the ratio between the revenues on this user from the optimal offline algorithm and the total revenue in price level 2p from algorithm Pricing is at most 2(log h + 1). Fact 5. For each level 2p ≤ 2k , there is at most one user with assigned amount xp < yp by the online algorithm Pricing. Proof. From Algorithm Pricing, when the seller sets the unit price 2p , the remaining amount for this price level is strictly larger than 0. If xp < yp , the seller will assign all remaining amount of items, say xp , to this user, and then xp = 0. Thus, the seller will not assign items to some user with unit price 2p . From previous analysis, we know that each item in level 2p ≤ 2k is counted at most twice, one for the totally satisfied users and the other for the only one partially satisfied user at price level 2p .
398
Y. Zhang, F.Y.L. Chin, and H.-F. Ting
We may further partition OPT2 into two parts: OPT21 and OPT22. OPT21 is the revenue on those users who are totally satisfied by the algorithm Pricing. OPT22 is the revenue on those users who are partially satisfied by the algorithm Pricing. From above analysis, we know OP T 21 ≤ 2 · ALG and OP T 22 ≤ 2 · ALG · (log h + 1). Thus, OP T 2 = OP T 21 + OP T 22 ≤ 2 · ALG + 2 · ALG · (log h + 1) = O(log h) · ALG.
This lemma is true. Combining the above two lemmas, we have the next result. Theorem 2. The competitive ratio of the algorithm Pricing is O(log h).
3
h Is Not Known in Advance
In Section 2, we assume that the highest unit price among all value functions from all users is known in advance. However, in many realities, the information of a user will be revealed on his arrival. Let hi denote the highest unit price in the value function vi (·). That means user ui is willing to pay unit price hi if the amount of assigned items is less than some value. In this section, we consider the case in which hi can be only known to the seller on the arrival of ui . Since the seller does not know h = maxi hi in advance. When the user with the highest unit price comes, if there is no item for this user, the performance of the seller’s strategy may be not good. For example, in a sequence of some coming users, except the last one, all other users have the value functions with quite low unit price. If the seller assigns all items to these users, the last user with very high unit price can not be satisfied. If the total revenue in this case is O(1), the revenue of the strategy that assigns some items to the last user can be O(h). Thus, the performance ratio is achieving O(h). Similar to Section 2.2, group the prices into levels according to their values: 2 2 p ∈ Lj if 2j ≤ p < 2(j+1) , where j = 0, 1, .... Associate the item set Si to level Li such that |S0 | = m/2, and |Si | = m · 2−i−1 for i > 0. 2 In our algorithm, when assigning items with unit price 2i , we will first use the items from Si . If all items in Si are used up, we will use items from lower level sets in decreasing order, first from Si−1 , then Si−2 , and so on. 2
Fact 6. (1) The price of any assigned item in Si is at least 2i . (2) The amount 2 of items which can be only assigned to users with unit price no less than 2(i+1) is at least m · 2−i−1 . Now we give our algorithm for the online pricing without knowing the highest unit price h in advance. Initially, let xi = m · (1 − 2−i−1 ), which is the largest 2 amount of items for price 2i . 2 From the above algorithm, we say that the price level 2i is full if xi = 0. After handling the sequence of users by the algorithm Pricing2, let k be the highest
Competitive Algorithms for Online Pricing
399
Algorithm 3. Pricing2 1: Let yj be the largest amount that user i is willing to buy given price 2j satisfying yj ≤ m. 2 2: Let k = arg maxj yj · 2j . 3: if xk = 0 then 2 4: Set unit price to be pi = 2k . 5: Assign mi = min{xk , yk } items to user i. 6: Modify Available Amount of Items (Algorithm 2). 7: else xk = 0 2 8: Let k = arg maxj>k yj · 2j such that xk > 0 2 9: Set the unit price to be pi = 2k . 10: Assign mi = min{xk , yk } items to user i. 11: Modify Available Amount of Items (Algorithm 2). 12: end if
2
and
2
value such that xj = 0 for any j ≤ k, i.e., all price levels from 20 to 2k are full 2 but price levels 2>k are not full, i.e., xj > 0 for any j ≥ k + 1. Let ALG be the total revenue of the algorithm Pricing2, OPT be the optimal revenue of the optimal offline algorithm. Partition OPT into two parts: OPT1 and OPT2. OPT1 denotes the revenue for users with assigned price no more 2 than 2k by the optimal offline algorithm, OPT2 denotes the revenue for users 2 with assigned price more than 2k by the optimal offline algorithm. Lemma 7. The ratio between OPT1 and ALG is at most O(hlog
−1/2
h
).
Proof. The total amount of assigned items is at most m, thus, OPT1 is at most 2 m · 2k . 2 In price level 2i , the amount of items is m · 2−i−1 . Note that the price levels 2 from 20 to 2k are all full, the total revenue for users with price no more than 2 2k is at least k 2 2 2i · m · 2−i−1 ≥ m · 2k −k−1 i=0 2
Thus, OP T 1/ALG ≤ 2k+1 . Since h ≥ 2k , we have k ≤ log1/2 h. Therefore, 1/2 −1/2 −1/2 OP T 1 h h ≤ 2k+1 ≤ 2log h+1 = 2 · 2log h log = 2 · hlog . ALG
This lemma is true. Lemma 8. The ratio between OPT2 and ALG is at most O(h3 log
−1/2
h
).
Proof. We prove this lemma by considering the following two cases. 2
– ui is assigned with unit price p > 2k by the optimal offline algorithm and 2 2 with unit price 2p > 2k by our algorithm Pricing2.
400
Y. Zhang, F.Y.L. Chin, and H.-F. Ting 2
2
Let 2 ≤ p < 2(+1) . From the description of the algorithm Pricing2, we 2 2 have yp · 2p ≥ y · 2 , where yp and y are the largest amount of items user 2 2 ui is willing to buy given unit price 2p and 2 respectively. Since the price 2 level 2p is not full, that means yp items are all assigned to this user. Thus, 2 the revenue of the algorithm Pricing2 on user ui is yp · 2p . Since the highest unit price is non-increasing in the value function of any user, we know the largest amount of items ui is willing to buy given unit price p is at most y . 2 The optimal revenue on ui is at most y · 2(+1) . Thus, the ratio between the revenues on ui by the optimal offline algorithm and our algorithm Pricing2 2 is at most 22+1 . Since h ≥ 2 , we have ≤ log1/2 h. Thus, the ratio is at most 1/2 −1/2 h 22+1 ≤ 22 log h+1 ≤ 2 · h2 log 2
– ui is assigned with unit price p > 2k by the optimal offline algorithm and 2 2 with unit price 2p ≤ 22k by our algorithm Pricing2. 2 (+1) . Suppose the optimal offline algorithm assigns m Let 2 ≤ p < 2 items to ui . Similar to the above analysis, we have m ≤ y , where y is the 2 largest amount of items user ui is willing to buy given unit price 2 . Thus, (+1)2 2+1 2 the optimal revenue on ui is p · m ≤ 2 · y = 2 · 2 · y . From our 2 2 algorithm, we know that yp · 2p ≥ y · 2 . If all these yp items are assigned to ui , the ratio between the revenue by our algorithm on user ui and the optimal revenue on this user is at most 22+1 . −1/2 h ). From previous analysis, this ratio is at most O(h2 log Otherwise, algorithm Pricing2 assigns xp items to ui such that xp < yp . In this case, algorithm Pricing2 can only assign xp items to this user, after 2 2 that, the price level 2p is full. Since in price level 2p , the amount of items is m · 2−p−1 , we have 2
2p · m · 2−p−1 ≥2
p2
· yp · 2
(1)
−p−1
2
≥ 2 · y · 2−p−1 2
= 2(+1) · 2−2−1 · y · 2−p−1 ≥ p · m · 2−2−1 · 2−p−1 The ratio between the optimal offline algorithm on those m amount of items total revenue by Pricing2 on item set Sp is at most 22+p+2 ≤ 23+2 ≤ 4 · h3 log 2
−1/2
h
.
2
Fact 9. For each level 2p ≤ 2k , there is at most one user with assigned amount xp < yp by the online algorithm Pricing2.
Proof. Similar to the proof of Fact 5. p2
k2
From previous analysis, we know that each item in level 2 ≤ 2 is counted at most twice: one for the totally satisfied users; the other for the only one 2 partially satisfied user at price level 2p , see equation (1).
Competitive Algorithms for Online Pricing
401
We may further partition OPT2 into two parts: OPT21 and OPT22. OPT21 is the revenue of those users who are totally satisfied by the algorithm Pricing2. OPT22 is the revenue of those users who are partially satisfied by the algorithm −1/2 h Pricing2. From above analysis, we know OP T 21 ≤ O(h2 log ) · ALG and −1/2 h ) · ALG. OP T 22 ≤ O(h3 log Thus, −1/2 h OP T 2 = OP T 21 + OP T 22 ≤ O(h3 log ) · ALG.
This lemma is true. Combining the above two lemmas, we have the next result. Theorem 3. The competitive ratio of the algorithm Pricing2 is O(h3 log
−1/2
h
).
References 1. Balcan, M.-F., Blum, A.: Approximation Algorithms and Online Mechanisms for Item Pricing. Thoery of Computing 3, 179–195 (2007) 2. Cheung, M., Swamy, C.: Approximation Algorithms for Single-minded Envy-free Profit-maximization Problems with Limited Supply. In: Proc. of 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS 2008), pp. 35–44 (2008) 3. Balcan, N., Blum, A., Mansour, Y.: Item pricing for revenue maximization. In: Proc. of the 9th ACM Conference on Electronic Commerce (EC 2008), pp. 50–59 (2008) 4. Bansal, N., Chen, N., Cherniavsky, N., Rurda, A., Schieber, B., Sviridenko, M.: Dynamic pricing for impatient bidders. ACM Transactions on Algorithms 6(2) (March 2010) 5. Chen, N., Deng, X.: Envy-Free Pricing in Multi-item Markets. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010. LNCS, vol. 6199, pp. 418–429. Springer, Heidelberg (2010) 6. Chen, N., Ghosh, A., Vassilvitskii, S.: Optimal envy-free pricing with metric substitutability. In: Proc. of the 9th ACM Conference on Electronic Commerce (EC 2008), pp. 60–69 (2008) 7. Elbassioni, K., Sitters, R., Zhang, Y.: A quasi-PTAS for profit-maximizing pricing on line graphs. In: Arge, L., Hoffmann, M., Welzl, E. (eds.) ESA 2007. LNCS, vol. 4698, pp. 451–462. Springer, Heidelberg (2007) 8. Fiat, A., Wingarten, A.: Envy, Multi Envy, and Revenue Maximization. In: Leonardi, S. (ed.) WINE 2009. LNCS, vol. 5929, pp. 498–504. Springer, Heidelberg (2009) 9. Grigoriev, A., van Loon, J., Sitters, R., Uetz, M.: How to Sell a Graph: Guidelines for Graph Retailers. In: Fomin, F.V. (ed.) WG 2006. LNCS, vol. 4271, pp. 125–136. Springer, Heidelberg (2006) 10. Guruswami, V., Hartline, J., Karlin, A., Kempe, D., Kenyon, C., McSherry, F.: On Profit-Maximizing Envy-Free Pricing. In: Proceedings of the 16th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2005), pp. 1164–1173 (2005) 11. Im, S., Lu, P., Wang, Y.: Envy-Free Pricing with General Supply Constraints. In: Saberi, A. (ed.) WINE 2010. LNCS, vol. 6484, pp. 483–491. Springer, Heidelberg (2010)
Æ
Making Abstraction-Refinement E cient in Model Checking Cong Tian and Zhenhua Duan ICTT and ISN Lab, Xidian University, Xi’an, 710071, P.R. China
Abstract. Abstraction is one of the most important strategies for dealing with the state space explosion problem in model checking. In the abstract model, the state space is largely reduced, however, a counterexample found in such a model may not be a real counterexample. Accordingly, the abstract model needs to be further refined where an NP-hard state separation problem is often involved. In this paper, a novel method is presented, in which extra variables are added to the abstract model for the refinement. With this method, not only the NP-hard state separation problem can be avoided, but also a smaller refined abstract model can be obtained.
1 Introduction Model checking is an important approach for the verification of hardware, software, multi-agent systems, communication protocols, embedded systems and so forth. The term model checking was coined by Clarke and Emerson [1], as well as Sifakis and Queille [2], independently. The earlier model checking algorithms explicitly enumerated the reachable states of the system in order to check the correctness of a given specification. This restricted the capacity of model checkers to systems with a few million states. Since the number of states can grow exponentially in the number of variables, early implementations were only able to handle small designs and did not scale to examples with industrial complexity. To combat this, kinds of methods, such as abstraction, partial order reduction, OBDD, symmetry and bound technique are applied to model checking to reduce the state space for eÆcient verification. Thanks to these eorts, model checking has been one of the most successful verification approaches which is widely adopted in the industrial community. Among the techniques for reducing the state space, abstraction is certainly the most important one. Abstraction technique preserves all the behaviors of the concrete system but may introduce behaviors that are not present originally. Thus, if a property (i.e. a temporal logic formula) is satisfied in the abstract model, it will still be satisfied in the concrete model. However, if a property is unsatisfiable in the abstract model, it may still be satisfied in the concrete model, and none of the behaviors that violate the property in the abstract model can be reproduced in the concrete model. In this case, This research is supported by the NSFC Grant No. 61003078, 60873018, 91018010 and 60910004, National Program on Key Basic Research Project of China (973 Program) Grant No.2010CB328102 and ISN Lab Grant No.ISN1102001. Corresponding author. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 402–413, 2011. c Springer-Verlag Berlin Heidelberg 2011
Making Abstraction-Refinement EÆcient in Model Checking
403
the counterexample is said to be spurious. Thus, when a spurious counterexample is found, the abstraction should be refined in order to eliminate the spurious behaviors. This process is repeated until either a real counterexample is found or the abstract model satisfies the property. There are many techniques for generating the initial abstraction and refining the abstract models. We follow the counterexample guided abstraction and refinement method proposed by Clarke, etc [5]. With this method, abstraction is performed by selecting a set of variables which are insensitive to the desired property to be invisible. In each iteration, a model checker is employed to check whether or not the abstract model satisfies the desired property. If a counterexample is reported, it is simulated with the concrete model by a SAT solver or checked by other algorithms. Then, if the counterexample is checked to be spurious, a set of invisible variables are made visible to refine the abstract model. With this method, to find the coarsest (or smallest) refined model is NP-hard [3]. Further, it is important to find a small set of variables in order to keep the size of the abstract state space smaller. However, to find the smallest set of variables is also NP-hard [9]. To combat this, Integer Linear Program (ILP) based separation algorithm which outputs the minimal separating set is given in [5]. And a polynomial approximation algorithm based on Decision Trees Learning (DTL) is also presented in [5]. Moreover, Heuristic-Guided separating algorithms are presented in [8], and evolutional algorithms are introduced in [9] for the state separation problem. These approximate algorithms are compared with experimental results. In this paper, we follow the abstract method used in [5, 8, 9] by selecting some set of variables to be invisible. Then we evaluate the counterexample with Algorithm C S . When a failure state is achieved, instead of selecting some invisible variables to be visible, extra variables are added to the abstract model for the refinement. With this method, not only the NP-hard state separation problem can be avoided, but also a smaller refined abstract model can be obtained. The rest parts of the paper are organized as follows. The next section briefly presents the related work concerning abstraction refinement in model checking. In section 3, the abstraction algorithm is formalized by making insensitive variables invisible. In section 4, by formally defining spurious counterexamples, the algorithm for checking whether or not a counterexample in the abstract model is spurious is presented. Further, the new abstraction refinement algorithm is given. Subsequently, abstraction model checking framework based on the new proposed algorithms is illustrated in section 5. Finally, conclusions are drawn in section 6.
2 Related Work We focus on the Counter-Example Guided Abstraction Refinement (CEGAR) framework which was first proposed by Kurshan [10]. Recently, some variations of the basic CEGAR were given [5, 11–16]. Most of them use a model checker and try to get rid of spurious counterexamples to achieve a concrete counterexample or a proof of the desired property. The closest works to ours are those where the abstract models are obtained by making some of the variables invisible. To the best of our knowledge, this abstraction method
404
C. Tian and Z. Duan
was first proposed by Clarke, etc. [5, 12]. With their approach, abstraction is performed by selecting a set of variables (or latches in circuits) to be invisible. In each iteration, a standard Ordered Binary Decision Diagram (OBDD)-based symbolic model checker is used to check whether or not the abstract model satisfies the desired property which is described by a formula in temporal logic. If a counterexample is reported by the model checker, it is simulated with the concrete system by a SAT solver. It tells us that the model is satisfiable if the counterexample is a real one, otherwise, the counterexample is a spurious one and a failure state is found which is the last state in the longest prefix of the counterexample that is still satisfiable. Subsequently, the failure state is used to refine the abstraction by making some invisible variables visible. With this method, to find the smallest refined model is NP-hard [3]. To combat this, both optimal exponential and approximate polynomial algorithms are given. The first one is done by using an ILP solver which is known to be NP complete; and the second one is based on machine learning approaches. Some heuristics for refinement variables selection were first presented in [8]. It studied on eective greedy heuristic algorithms on state separation problem. Further, in [6], probabilistic learning approach which utilized the sample learning technique, evolutionary algorithm and eective heuristics were proposed. The performances were illustrated by experiment results.
3 Abstraction Function As usual, a Kripke structure [4] is used to model a system. Let V v1 vn ranging over a finite domain D be the set of variables involved in a system. For any vi V, 1 i n, a set of the valuations of vi is defined by, vi vi d d D where vi means vi is undefined. Further, the set of all the possible states of the system, , is defined by, v1 vn . Let AP be the set of propositions. A Kripke structure over AP is a tuple K (S S 0 R L), where S is the set of states (i.e. a state in S is a valuation of variables in V), S 0 S is the set of initial states, R S S is the transition relation, L : S 2AP is the labeling function. For convenience, s(v) is employed to denote the value of v at state s. A path in a Kripke structure is a sequence of states, s1 s2 , where s1 S 0 and (si si 1 ) R for any i 1. Following the idea given in [5], we separate V into two parts VV and VI with V VV VI . VV stands for the set of visible variables while VI denotes the set of invisible variables. Invisible variables are those that we do not care about and will be ignored when building the abstract model. In the original model K (S S 0 R L), all variables ˆ some are visible (VV V, VI ). To obtain the abstract model Kˆ (Sˆ Sˆ0 Rˆ L), variables, e.g. VX V, are selected to be invisible (VV V VX , VI VX ). Thus, the set of all possible states in the abstract model will be: ˆ v1 vk , where k VV n, and for each 1 i k, vi VV . That is Sˆ ˆ . For a state s S and a state sˆ Sˆ , sˆ is called the mapping of s in the abstract model by making VV visible i s(v) sˆ(v) for all v VV . Formally, sˆ h(s VV ) is used to denote that sˆ is the mapping of s in the abstract model by making VV visible. Inversely, s is called the origin of sˆ, and the set of origins of sˆ is denoted by h ( sˆ VV ).
Making Abstraction-Refinement EÆcient in Model Checking
405
Algorithm 1. A (K VV )
Input: the original model K (S S 0 R L) and a set of selected visible variables VV ˆ L) ˆ Output: the abstract model Kˆ (Sˆ ,Sˆ0 ,R, 1: Sˆ sˆ ˆ there exists s S such that h(s VV ) sˆ; 2: Sˆ0 sˆ Sˆ there exists s S 0 such that h(s VV ) sˆ; 3: Rˆ ( sˆ1 sˆ2 ) sˆ1 sˆ2 Sˆ and there exist s1 s2 S such that h(s1 VV ) sˆ1 h(s2 VV ) sˆ2 and (s1 s2 ) R; 4: L( sˆ) L(s);
Ë
s S h(sVV ) sˆ
5: return Kˆ
(Sˆ
ˆ Sˆ0 Rˆ L);
Therefore, given the original model K (S S 0 R L) and the selected visible variˆ can be obtained by Algorithm A ables VV , the abstract model Kˆ (Sˆ Sˆ0 Rˆ L) as shown below. Example 1. As illustrated in Fig. 1, the original model is a Kripke structure with four states. Initially, the system has four variables v1 , v2 , v3 and v4 . Assume that v3 and v4 are selected to be invisible. By Algorithm A , an abstract model with two states is obtained. In the abstract model, sˆ1 is the projection of s1 and s2 , while sˆ2 is the projection of s3 and s4 . ( sˆ1 sˆ2 ) Rˆ since (s2 s3 ) R, and ( sˆ1 sˆ1 ), ( sˆ2 sˆ2 ) Rˆ because of (s1 s2 ), (s3 s4 ) R. v1 = 1 v2 = 1
v1 = 0 v2 = 0 sˆ1
Abstract model
{p, q}
{p, q, r}
sˆ2 V = {v1 , v2 , v3 , v4 }
Original model
s1
{p}
v1 = 0 v2 = 0 v3 = 0 v4 = 0
{q} s2 v1 = 0 v2 = 0 v3 = 0 v4 = 1
{r, q} s3 v1 = 1 v2 = 1 v3 = 1 v4 = 0
{p} s4 v1 = 1 v2 = 1 v3 = 1 v4 = 1
VV = {v1 , v2 } VI = {v3 , v4 }
Fig. 1. Abstraction
4 Refinement 4.1 Why Refining? It can be observed that the state space is largely reduced in the abstract model. However, when implementing model checking with the abstract model, some reported counterexamples will not be real counterexamples that violate the desired property, since the abstract model contains more paths than the original model. This is further illustrated in the traÆc lights controller example [3] given below. Example 2. For the traÆc light controller in Fig. 2, we want to prove (state stop) (any time, the state of the light will be stop sometimes in the future). By implementing
406
C. Tian and Z. Duan Abstract model
Original model color = red state = stop
s1
color = yellow state = go
s2
color = green state = go
sˆ1
state = stop
V = {color, state} VV = {state} VI = {color}
sˆ2
s3
state = go
Fig. 2. TraÆc Light Controller
model checking with the abstract model in the right hand side of Fig. 2 where the variable color is made invisible, a counterexample, sˆ1 sˆ2 sˆ2 sˆ2 will be reported. However, in the concrete model, such a behavior cannot be found. So, this is not a real counterexample. 4.2 Spurious Counterexamples As pointed in [5, 6], a counterexample in the abstract model which does not exist in the concrete model is called a spurious counterexample. To formally define a spurious counterexample, we first introduce failure states. To this end, In0sˆi , In1sˆi , ..., Innsˆi and In sˆi are defined first: In0sˆi In1sˆi
s s h ( sˆi VV ) s¼ h ( siˆ 1 VV ) and (s¼ s) R s s h ( sˆi VV ) s¼ In0sˆi and (s¼ s) R
Innsˆi
s s h ( sˆi VV ) s¼ Innsˆi 1 and (s¼ s) R
In sˆi
˽ Ini
i0
sˆi
Clearly, In0sˆi denotes the set of states in h ( sˆi VV ) with inputting edges from the states in h ( siˆ 1 VV ), and In1sˆi stands for the set of states in h ( sˆi VV ) with inputting edges from the states in In0sˆi , and In2sˆi means the set of states in h ( sˆi VV ) with inputting edges from the states in In1sˆi , and so on. Thus, In sˆi denotes the set of states in h ( sˆi VV ) that are reachable from some state in h ( siˆ 1 VV ) as illustrated in the lower gray part in
Ë Ini
n 1
Fig. 3. Note that there must exist a natural number n, such that
i0
sˆi
Ën Ini
i0
sˆi
h ( sˆi VV ) is finite. Similarly, Out0sˆi , Out1sˆi , ..., Outnsˆi and Out sˆi can also be defined. Out0sˆi Out1sˆi
s s h ( sˆi VV ) s¼ h ( siˆ 1 VV ) and (s s¼ ) R s s h ( sˆi VV ) s¼ Out0sˆi and (s s¼ ) R
Outnsˆi
s s h ( sˆi VV ) s¼ Outnsˆi 1 and (s s¼ ) R
Out sˆi
˽ Outi
i0
sˆi
since
Making Abstraction-Refinement EÆcient in Model Checking
407
Fig. 3. Insˆi and Out sˆi
Where Out0sˆi denotes the set of states in h ( sˆi VV ) with outputting edges to the states in h ( siˆ 1 VV ), and Out1sˆi stands for the set of states in h ( sˆi VV ) with outputting edges to the states in Out0sˆi , and Out2sˆi means the set of states in h ( sˆi VV ) with outputting edges to the states in Out1sˆi , and so on. Thus, Out sˆi denotes the set of states in h ( sˆi VV ) from which some state in h ( siˆ 1 VV ) are reachable as depicted in the higher gray part in Fig.
Ë Outi
n 1
3. Similar to In sˆi , there must exist a natural number n, such that Accordingly, a failure state can be defined as follows.
i0
sˆi
Ën Outi .
i0
sˆi
Definition 1 (Failure States). A state sˆi in a counterexample ˆ is a failure state if In sˆi , Outsˆi and In sˆi Out sˆi . Further, given a failure state sˆi in a counterexample ˆ , the set of the origins of sˆi , h ( sˆi VV ), is separated into three sets, In sˆi (the set of dead states), Out sˆi (the set of bad states) and h ( sˆi ) ( ) (the set of the isolated states). Note that by the definition of failure state, and cannot be empty sets, while may be empty. Definition 2 (Spurious Counterexamples). A counterexample ˆ in an abstract model Kˆ is spurious if there exists at least one failure state sˆi in ˆ Example 3. Fig. 4 shows a spurious counterexample where the state 3ˆ is a failure state. ˆ 9 is a deadend state, 7 is a bad In the set, h (3ˆ VV ) 7 8 9, of the origins of state 3, state, and 8 is an isolated state. ˆ 1 1 2 3
ˆ 2 4 5
ˆ 3
ˆ 4
7
10
8
11
9
12
6
Fig. 4. A Spurious Path
408
C. Tian and Z. Duan
In [3], Algorithm S P is presented for checking whether or not a counterexample is spurious. And in [5], a SAT solver is used to check the counterexample. We also present Algorithm C S for checking whether or not a counterexample is spurious based on the formal definition of spurious paths. The algorithm takes a counterexample as input and outputs the first failure state as well as , and with respect to the failure state. Note that a counterexample may be a finite path s1 s2 sn , n 1, or an infinite path s1 s2 (si s j) , 1 i j, with a loop suÆx (a suÆx produced by a loop). For the finite counterexample, it will be checked directly while for an infinite one, we need only check its finite prefix such as s1 s2 si s j si . Algorithm 2. C S (ˆ )
ˆ and the Input: a counterexample ˆ sˆ1 sˆ2 sˆn in the abstract model Kˆ (Sˆ Sˆ0 Rˆ L), original model K (S S 0 R L) Output: a failure state s f , , and 1: Initialization: int i 2; 2: while i n 1 do 3: if Insˆi Out sˆi , i i 1; 4: else return s f sˆi , Insˆi , Out sˆi , and h ( sˆi ) ( ); break; 5: end while 6: if i n, return ˆ is a real counterexample;
Compared with Algorithm S P , to check whether or not a state sˆi is a failure state, it only relies on its pre and post states, siˆ 1 and siˆ 1 ; while in Algorithm C S , to check state sˆi , it relies on all states in the prefix, sˆ1 siˆ 1 , of sˆi . Based on this, to check a periodic infinite counterexample, several repetitions of the periodic parts are needed. In contrast, this can be easily done by checking the finite prefix s1 s2 si s j si by Algorithm C S . 4.3 Refining Algorithm When a failure state and the corresponding , and are reported by Algorithm C S , we need to further refine the abstract model such that and are separated into dierent abstract states. This can be achieved by making a set of invisible variables, U VI , visible [5]. With this method, to find the coarsest refined model is NP-hard. Further, to keep the size of the refined abstract state space smaller, it is important to make U as small as possible. However, to find the smallest U is also NP-hard [6]. In [5], an ILP solver is used to obtain the minimal set. However, it is ineÆcient when the problem size is large, since IPL is an NPC problem. To combat this, several approximate polynomial algorithms are proposed [5, 8, 9] with non-optimal results. Moreover, even though a coarser refined abstract model may be produced by making U smaller, it is uncertain that the smallest U will induce the coarsest refined abstract model. Motivated by this, a new refinement approach is proposed by adding extra boolean variables to the set of visible variables. With this approach, not only the NP-hard problem can be avoided but also a coarser refined abstract model can be obtained. The basic idea for the refining algorithm is described below.
Making Abstraction-Refinement EÆcient in Model Checking
s1 s2
s4 s3 s5
s1 s2 s3 s4 s5 si
Vv1 Vv2 3 4 3 4 3 4 3 4 3 4 x y
VI
B 0 0 ⊥ 1 ⊥ ⊥
409
i = 1, 2, 3, 4, 5 x = 3, y = 4 x = 3, y = 4 x = 3, y = 4
Fig. 5. A Failure State s1 s2 s3 s5
s1 s2 s3 s4 s5 si
Vv1 Vv2 4 3 4 3 4 3 4 3 4 3 y x
B 0 0 ⊥ 1 ⊥ ⊥
VI i = 1, 2, 3, 4, 5 x = 3, y = 4 x = 3, y = 4 x = 3, y = 4
s4
Fig. 6. Refined Abstract States
Assume that a failure state is found with s1 s2 , s4 and s3 s5 as illustrated in Fig. 5 where the abstract model is obtained by making Vv1 and Vv2 visible and other variables invisible. To make and separated into two abstract states, an extra boolean variable B is added to the system with the valuation being 0 at the states in , 1 at the state in , and at the states in and other states. That is s1 (B) 0, s2 (B) 0, s4 (B) 1, and si (B) where si S and i 1, 2, or 4. Subsequently, by making VV¼ VV B and VI¼ VI , the failure state is separated into three states in the refined abstract model as illustrated in Fig. 6. Note that, only the failure state is separated into three states, and other states are the same as in the abstract model. Especially, when , the failure state is separated into two new states. Therefore, given a failure state si (as well as , and ) in the abstract model K (S S 0 R L) where S v1 vn and VV v1 vn, to obtain the ˆ a boolean variable B is added as a visible variable abstract model Kˆ (Sˆ Sˆ0 Rˆ L), with s(B) 0 if s , s(B) 1 if s , and s(B) if s ( ). Thus, the set of all possible states in the refined abstract model will be ˆ B , where ˆ (Sˆ Sˆ0 Rˆ L) ˆ B B d d 0 1 . Accordingly, the refined abstract model K can be obtained by Algorithm R. It can be observed that, the new refinement algorithm is linear to the size of the state space, since it only needs to assign value to the new added boolean variable at each state. Further, in each iteration, at most two more states are added (only one node is added when is empty). With the algorithm by choosing some invisible variable visible, when and are separated, other nodes (usually a huge number in the real systems in practise) will also be separated. To illustrate the intrinsic property of the new refining algorithm, a simple example is given below.
410
C. Tian and Z. Duan
Algorithm 3. R(K
B)
Input: the abstract model K (S S 0 R L) with VV being visible; , and reported by Algorithm C S ; the new boolean variable B which will be added ˆ Output: the refined model Kˆ (Sˆ Sˆ0 Rˆ L) 1: s(B) 0 if s ; s(B) 1 if s ; s(B) if s ; 2: Sˆ sˆ ˆ there exists s S such that h(s VV B) sˆ; 3: Sˆ0 sˆ Sˆ there exists s S 0 such that h(s VV B) sˆ; 4: Rˆ ( sˆ1 sˆ2 ) sˆ1 sˆ2 Sˆ and there exist s1 s2 S such that h(s1 VV B) sˆ1 h(s2 VV B) sˆ2 and (s1 s2 ) R; 5: L( sˆ) L(s);
Ë
s S h(sVV B) sˆ
6: return Kˆ
(Sˆ
ˆ Sˆ0 Rˆ L);
Original Model
x1 = 1 x2 = 2 x3 =1
s1
x1 = 1 x2 = 1 x3 =1
s2
x1 = 2 x2 = 1 x3 =1
s3
x1 = 2 x2 = 2 x3 = 2
s4
x1 = 3 x2 = 1 x3 = 2
s5
x1 = 3 x2 = 2 x3 = 2
s6
x1 = 3 x2 = 2 x3 = 1
s7
Abstract Model by making x2 and x3 invisible
x1 = 1
sˆ1
sˆ2
sˆ3
(1)
x1 = 2
x1 = 3
sˆ1
x1 = 1
sˆ2
x1 = 2
sˆ3
x1 = 3
(2)
Fig. 7. Abstraction by making x2 and x3 invisible
Example 4. The Kripke structure illustrated in l.h.s of Fig. 7 (1) presents an original model where three variables x1 , x2 and x3 are involved. Assume that x2 and x3 are insensitive to the property which is expressed in a temporal logic formula. Thus, by making x2 and x3 invisible, the abstract model can be obtained by Algorithm A as illustrated in the r.h.s of Fig. 7 (1). Suppose that a counterexample is found by a model checker as depicted in Fig. 7 (2). Then, by Algorithm C S , it will report that sˆ2 is a failure state, and s3 , s4 . First, we show the refined abstract models by the method in the related works [5, 8, 9, 12]. The refined abstract model obtained by making x2 and x3 visible are illustrated in Fig. 8 (1) and (2) respectively. It can be observed that the one by making x3 visible is the smallest refined model under the method by making some invisible variables visible. Clearly, to find the coarsest refined model, in this way, is an NP-hard problem. By our method, as depicted in Fig. 9, a new boolean variable B is added to the system and made visible. Then the refined abstract model is obtained where only the failure state is separated into two states with other states unchanged. Clearly, the new refining
Making Abstraction-Refinement EÆcient in Model Checking Refined Model by selecting x2 to be visible Original Model
x1 = 1 x2 = 2 x3 =1
s1
x1 = 1 x2 = 1 x3 =1
s2
x1 = 2 x2 = 1 x3 =1
s3
x1 = 2 x2 = 2 x3 = 2
s4
x1 = 3 x2 = 1 x3 = 2
sˆ1
Original Model
x1 = 1 x2 = 2
s6
x1 = 3 x2 = 2 x3 = 1
s7
s1
sˆ2
x1 = 1 x2 = 1
x1 = 1 x2 = 1 x3 =1
s2
sˆ3
x1 = 2 x2 = 1
x1 = 2 x2 = 1 x3 =1
s3
x1 = 2 x2 = 2 x3 = 2
s4
sˆ4
x1 = 2 x2 = 2 x1 = 3 x2 = 1 x3 = 2
s5
sˆ5
x1 = 3 x2 = 1 x1 = 3 x2 = 2 x3 = 2
s6
x1 = 3 x2 = 2 x3 = 1
s7
s5
x1 = 3 x2 = 2 x3 = 2
x1 = 1 x2 = 2 x3 =1
sˆ6
x1 = 3 x2 = 2
411
Refined Model by selecting x3 to be visible
sˆ1
x1 = 1 x3 = 1
sˆ2
x1 = 2 x3 = 1
sˆ3
sˆ4
sˆ5
x1 = 2 x2 = 2
x1 = 3 x2 = 2
x1 = 3 x3 = 1
(2)
(1)
Fig. 8. Refinement by the old algorithm Original Model
x1 = 1 B = ⊥
x2 = 2 x3 =1
s1
x1 = 1 B = ⊥ x2 = 1 x3 =1
s2
x1 = 2 B = 0
x2 = 1 x3 =1
s3
x1 = 2 B = 1
x2 = 2 x3 = 2
s4
x1 = 3 B = ⊥ x2 = 1 x3 = 2
s5
x1 = 3 B = ⊥ x2 = 2 x3 = 2
s6
x2 = 2 x3 = 1
s7
x1 = 3 B = ⊥
Abstract Model by adding boolean variable B
x1 = 1 B = ⊥
sˆ1
sˆ2
x1 = 2 B = 0
sˆ3
x1 = 2 B = 1
sˆ4
x1 = 3 B = ⊥
Fig. 9. Refinement by the new algorithm
algorithm avoids the NP-hard problem for finding the smallest set of visible variables. Moreover, the new refined abstract model is smaller than the best result produced in the method by further making some invisible variables visible.
5 Abstract Model Checking Framework With the new proposed algorithms, the abstract model checking framework is presented. First, the abstract model is obtained by Algorithm A . Then a model checker is employed to check whether or not the abstract model satisfies the desired property. If no errors are found, the model is correct. However, if a counterexample is reported, it is checked by Algorithms C S . If the counterexample is not spurious, it will be a real counterexample that violates the system; otherwise, the counterexample
412
C. Tian and Z. Duan
Algorithm 4. A MC
Input: A model K (S S 0 R L) in Kripke structure, and a desired property in temporal logic Output: a counterexample that violates 1: Initialization: int i 1; 2: Kˆ A (K VI ); 3: MC(Kˆ ); 4: while a counterexample ˆ is found do 5: C S (ˆ ); 6: if ˆ is a real counterexample, return ˆ ; break; 7: else Kˆ R(Kˆ Bi); i i 1; MC(Kˆ ); 8: end while 9: if no counterexample is found, K satisfies .
is spurious, and Algorithm R is used to refine the abstract model by adding a new visible boolean variable B to the system. Then the refined abstract model is checked with the model checker again until either a real counterexample is found or the model is checked to be correct. This process is formally described in Algorithm A MC where a subscript i is used to identify dierent boolean variables that are added to the system in each refinement process. Initially, i is assigned by 1. After each iteration of Algorithm R, i is increased by 1. Basically, finitely many boolean variables will be added since the systems to be verified with model checking are finite systems.
6 Conclusion An eÆcient method for abstraction refinement is given in this paper. With this approach, the NP-hard state separation problem can be avoided, and the smaller refined abstract model can also be obtained. This can improve the abstract based model checking, especially the counterexample guided abstraction refinement model checking. In the near future, the proposed algorithm will be implemented and integrated into the tool CEGAR. Further, some case studies will be conducted to evaluate the algorithm.
References 1. Clarke, E.M., Emerson, E.A.: Desigh and syntesis of of synchronization skeletons using branching time temporal logic. In: Kozen, D. (ed.) Logic of Programs 1981. LNCS, vol. 131. Springer, Heidelberg (1982) 2. Quielle, J.P., Sifakis, J.: Specification and verification of concurrent systems in CESAR. In: Proceedings of the 5th International Symposium on Programming, pp. 337–350 (1981) 3. Clarke, E., Grumberg, O., Jha, S., Lu, Y., Veith, H.: Counterexample guided abstraction refinement. In: Emerson, E., Sistla, A. (eds.) CAV 2000. LNCS, vol. 1855. Springer, Heidelberg (2000) 4. Kripke, S.A.: Semantical analysis of modal logic I: normal propositional calculi. Z. Math. Logik Grund. Math. 9, 67–96 (1963) 5. Clarke, E.M., Gupta, A., Strichman, O.: SAT Based Counterexample-Guided AbstractionRefinement. IEEE Trans. Computer Aided Design 23(7), 1113–1123 (2004)
Making Abstraction-Refinement EÆcient in Model Checking
413
6. He, F., Song, X., Hung, W.N.N., Gu, M., Sun, J.: Integrating Evolutionary Computation with Abstraction Refinement for Model Checking. IEEE Trans. Computers 59(1), 116–126 (2010) 7. Rushby, J.: Integrated formal verification: Using model checking with automated abstraction, invariant generation, and theorem proving. Presented at Theoretical and Practical Aspects of SPIN Model Checking: Proc. 5th and 6th Int. SPIN Workshops, citeseer.nj.nec.com/rushby99integrated.html 8. He, F., Song, X., Gu, M., Sun, J.-G.: Heuristic-Guided Abstraction Refinement. Comput. J. 52(3), 280–287 (2009) 9. He, F., Song, X., Hung, W.N.N., Gu, M., Sun, J.: Integrating Evolutionary Computation with Abstraction Refinement for Model Checking. IEEE Trans. Computers 59(1), 116–126 (2010) 10. Kurshan, R.P.: Computer Aided Verificaton of Coordinating Processes. Princeton Univ. Press, Princeton (1994) 11. Wang, C., Li, B., Jin, H., Hachtel, G.D., Somenzi, F.: Improving Ariadne’s Bundle by Following Multiple Threads in Abstraction Refinement. IEEE Trans. Computer Aided Design 25(11), 2297–2316 (2006) 12. Clarke, E.M., Gupta, A., Kukula, J.H., Strichman, O.: SAT Based Abstraction-Refinement Using ILP and Machine Learning Techniques. In: Brinksma, E., Larsen, K.G. (eds.) CAV 2002. LNCS, vol. 2404, pp. 265–279. Springer, Heidelberg (2002) 13. Chauhan, P., Clarke, E.M., Kukula, J., Sapra, S., Veith, H., Wang, D.: Automated Abstraction Refinement for Model Checking Large State Spaces Using SAT Based Conflict Analysis. In: Aagaard, M.D., O’Leary, J.W. (eds.) FMCAD 2002. LNCS, vol. 2517. Springer, Heidelberg (2002) 14. Henzinger, T.A., Jhala, R., Majumdar, R., Sutre, G.: Lazy Abstraction. In: Proc. Symp. Principles of Programming Languages, pp. 58–70 (2002) 15. Glusman, M., Kamhi, G., Mador-Haim, S., Fraer, R., Vardi, M.Y.: Multiple-Counterexample Guided Iterative Abstraction Refinement: An Industrial Evaluation. In: Garavel, H., Hatcli, J. (eds.) TACAS 2003. LNCS, vol. 2619, pp. 176–191. Springer, Heidelberg (2003) 16. Govindaraju, S.G., Dill, D.L.: Counterexample-Guided Choice of Projections in Approximate Symbolic Model Checking. In: Proc. Int’l Conf. Computer-Aided Design (ICCAD), pp. 115–119 (2000)
An Integer Programming Approach for the Rural Postman Problem with Time Dependent Travel Times Guozhen Tan and Jinghao Sun School of Computer Science and Technology, Dalian University of Technology, Dalian, China [email protected], [email protected]
Abstract. The Chinese Postman Problem is a famous and classical problem in graph theory. This paper introduces a new variant of this problem, namely Rural Postman Problem with Time Dependent Travel Times, which is motivated from scheduling with time dependent processing times. An arc-path formulation of the problem is given and strong valid inequalities are derived. A subset of constraints in this formulation has a strong combinatorial structure, which is used to define the polytope of arc-path alternation sequence. The facial structure of this polytope is investigated and facet defining inequalities are presented which may be helpful to tighten the integer programming formulation. Computational results that verifies the effect of facet defining and strong valid inequalities are presented. Keywords: Time Dependent, Rural Postman Problem, Polyhedral Combinatorics, Valid Inequalities, Arc-Path Formulation.
1
Introduction
Let D(V, A) be a directed time dependent network, where V is the vertex set, A is the arc set, and AR ⊆ A is a set of required arcs. Each arc aij ∈ A starting at time ti is associated with the travel time Dij (ti ). Let v0 ∈ V be the origin vertex and t0 be the starting time. The Rural Postman Problem with Time Dependent Travel Times (RPPTDT) aims to find a minimum travel time tour starting at v0 and at time t0 and passing through each required arc aij ∈ AR at least once. When AR = A, the RPPTDT problem becomes the Chinese Postman Problem with Time Dependent Travel Times, a special case of the RPPTDT. The RPPTDT is motivated from scheduling with time dependent processing times [1] (See Sect. 5 for details). To the author’s knowledge, the RPPTDT problem does not seem to have been studied before but similar timing sensitive arc routing problems have been reported, such as the Arc Routing Problem with Time Dependent Service Costs (ARPTDC) [2] and the Arc Routing with Time Windows (ARPTW) [3]. When there are no such additional timing sensitive constrains, the traditional arc routing problems (without timing constraint) can B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 414–431, 2011. c Springer-Verlag Berlin Heidelberg 2011
Integer Programming Approach for RPPTDT
415
be solved efficiently by using the integer programming approach based on the polyhedral theory [4,5,6]. However, the polyhedral results for the timing sensitive arc routing problems cannot be easily obtained from previous works. Since presently there are two kinds of methods to solve timing sensitive arc routing prblems. The most widely used method for ARPTDC and ARPTW uses a transformation into the corresponding node routing problems. Then the latter problems can be solved by the efficient existing algorithms directly without any modification. As the travel time in the ARPTW and ARPTDC is a known constant, the transformation taking the shortest-path algorithm as their core processes is polynomially bounded [7]. At the very beginning of our research, we expect to solve the RPPTDT by transformation method. However, the RPPTDT is different from ARPTDC and ARPTW as the constant travel time assumption never holds on the time dependent network. Thus the transformation method for the RPPTDT is not algorithmic in nature known that its subproblem becomes the time dependent shortest-path problem which has been proved to be N P-Hard [8]. Therefore, a new methodology for solving RPPTDT should be proposed, and it would be fair to say that the direct integer programming approach with polyhedral result might be the outstanding approaches. In this paper, an integer linear programming for the RPPTDT is proposed, the constraint set of which is divided into two parts. One has a strong combinatorial structure, which defines the polytope of arc-path alternation sequence (APAS), and the other closely related to the time dependent travel times. The facial structure of the APAS polytope is investigated and the facet defining inequalities are derived which may be helpful to tighten the integer programming formulation of RPPTDTs. Moreover, we also propose some further valid inequalities. Computational results verifies the effect of facet defining and strong valid inequalities. The remainder of this paper is organized as follows. Mathematical formulation of the RPPTDT is introduced in Sect. 2. Some results on the RPPTDT polyhedron are presented in Sect. 3. Based on these polyhedral results, a cutting plane algorithm was proposed, and the computational results are reported in Sect. 4. In Sect. 5, we introduce the application of the RPPTDT to scheduling with time dependent processing times. Concluding remarks are made in the last section.
2
Problem Formulation
The RPPTDT is formulated as a mixed integer linear programming (MILP) problem whenever the travel time is a known step function Dij (ti ) of the starting time ti at vertex vi . In this way, the total period associated with each arc (i, j) ∈ A can be divided into several time intervals. Once the time interval during which the postman starts traversing arc (i, j) is known, the travel time of arc (i, j) is a known constant. A travel time step function for arc (i, j) with three time intervals is shown in Figure 1.
416
G.Z. Tan and J.H. Sun
Fig. 1. Travel time step function for arc (i, j) with three time intervals
The MILP for RPPTDT is called “Arc-Path Formulation” since its main idea is to formulate the RPPTDT-tour as the alternation of arcs and paths as follow: f = (v0 − p1 (τ1 ) − a1 (t1 ) − p2 (τ2 ) − · · · − aK (tK ) − pK+1 (τK+1 ) − v0 ) where ak ∈ AR starting at time tk (k = 1, · · · , |AR |) is the kth arc serviced in the RPPTDT-tour, and pk (k = 1, · · · , |AR | + 1) is the path starting at time τk that connects the required arcs ak−1 and ak (in particular, τ1 = t0 ). In the RPPTDT-tour re-formulated above, the starting time is unique for each traverse (service) of an arc in A (AR ). To introduce the new arc-path integer program, we first summarize the notations below. Constants n = number of vertices in V including the origin depot v0 ; m = number of arcs in A; K = number of required arcs in AR ; N + (i) = the set of outgoing vertices of vi ; N − (i) = the set of incoming vertices of vi ; H = number of time intervals associated with each arc (i, j) ∈ A; B = a large number; Tijh = the upper bound of the hth interval associated with arc (i, j) ∈ A (h = 1, · · · , H)– see Figure 1; h Dij = travel time of arc (i, j) starting at vi during the hth time interval. Decision variables 1 : if the kth arc ak seviced in RPPTDT-tour is (i, j) k xij = 0 : otherwise k yij
=
k,h δij
=
1 : if arc (i, j) is contained in the kth path pk of RPPTDT-tour 0 : otherwise
1: 0:
arc (i, j) is serviced as the kth required arc ak during the hth interval otherwise
Integer Programming Approach for RPPTDT
417
1 : arc (i, j) is travesed in the kth path pk during the hth interval = 0 : otherwise
k,h γij
tki = starting time of arc (i, j) if (i, j) is the kth arc serviced in RPPTDT-tour; τik = starting time of arc (i, j) if (i, j) is contained in the kth path of RPPTDTtour. In particular, τ01 and τ0K+1 are the starting time and ending time of RPPTDT-tour respectively. With these notations the RPPTDT may be formulated as follows: K H min
h k,h Dij δij +
k=1 h=1 (i,j)∈AR K S.t. k xij = 1, (i, j) k=1
K+1 H
h k,h Dij γij
(1)
k=1 h=1 (i,j)∈A
∈ AR ,
(2)
k = 1, · · · , K,
(3)
k yij ≤ 1,
vi ∈ V,
k = 1, · · · , K,
(4)
k yji ≤ 1,
vi ∈ V,
k = 1, · · · , K + 1,
(5)
xkij = 1,
(i,j)∈AR
j∈N + (i)
j∈N − (i)
k yij −
j∈N + (i)
k yji =
j∈N − (i)
xk−1 − ji
j∈N − (i)
xkij ,
vi ∈ V,
k = 2, · · · , K,
j∈N + (i)
1 − j∈N + (i) x1ij , i = 0, 1 1 yij − yji = − j∈N + (i) x1ij , i = 0, j∈N + (i) j∈N − (i) xK − 1, i = 0, − K+1 K+1 yij − yji = j∈N (i) ji K i = 0, j∈N − (i) xji , j∈N + (i) j∈N − (i) τ01 ≥ t0 tki ≥ τik , vi τik ≥ tk−1 , i
(6) (7)
(8) (9)
∈ V,
k = 1, 2, . . . , K,
vi ∈ V,
k = 2, . . . , K + 1,
k,h tkj − tki ≥ Dij + δij B−B k,h k k τj − τi ≥ Dij + γij B − B
k = 1, 2, . . . , K; h = 1, · · · , H; (i, j) ∈ AR ;
(10) (11) (12)
k = 1, 2, . . . , K + 1; h = 1, · · · , H; (i, j) ∈ A; (13)
H
k,h δij = xkij
h=1 tki +
tki
≥
∀(i, j) ∈ AR ; k = 1, · · · , K;
k,h B(δij − 1) ≤ Tijh k,h Tijh−1 δij
∀(i, j) ∈ AR ; k = 1, · · · , K; h = 1, · · · , H;
∀(i, j) ∈ AR ; k = 1, · · · , K; h = 1, · · · , H;
(14) (15) (16)
418
G.Z. Tan and J.H. Sun
H
k,h k γij = yij
∀(i, j) ∈ A; k = 1, · · · , K + 1;
(17)
h=1 k,h τik + B(γij − 1) ≤ Tijh k,h τik ≥ Tijh−1 γij
xkij k yij
∀(i, j) ∈ A; k = 1, · · · , K + 1; h = 1, · · · , H;
∀(i, j) ∈ A; k = 1, · · · , K + 1; h = 1, · · · , H.
= {0, 1},
(i, j) ∈ AR ,
= {0, 1},
(i, j) ∈ A,
(18) (19)
k = 1, · · · , K,
(20)
k = 1, · · · , K + 1,
(21)
The objective function (1) minimizes the total travel time of RPPTDT-tour. Constraint (2) ensures that all required arcs must be serviced exactly once. Constraint (3) states that there is only one kth arc serviced in RPPTDTtour (k = 1, · · · , K). Constraints (4) and (5) ensure that each vertex in the kth path pk should be passed at most once (k = 1, · · · , K + 1). In order to explain Constraints (6-8), we first divide the RPPTDT-tour f into three parts: ω1 = (v0 − p1 (τ1 )), ω2 = a1 (t1 ) − p2 (τ2 ) − · · · − pK (τK ) − aK (tK ) and ω3 = (p|A|+1 (τ|A|+1 ) − v0 ). Then, Constraint (6) ensures that each internal vertex vi in the middle part ω2 must meet one of the following four conditions: 1) If vi is the terminus of ak−1 in ω2 , but not the origin of ak , then the out-degree of vi in path pk is one more than its in-degree. 2) Else if vi is the origin of ak , but not the terminus of ak−1 , then the out-degree of vi in path pk is one less than its in-degree. 3) Else if vi is neither the origin of ak nor the terminus of ak−1 , then the out-degree of vi in path pk is equal to its in-degree. 4) Else if the k − 1th and kth required arcs are adjacent with the common vertex vi , then the kth path in f would be void, and the out-degree of vi contained in pk is equal to its in-degree. Constraint (7) describes the following conditions for any vertex vi in the first part ω1 . 1) For i = 0, if v0 is the origin of the first arc serviced in f , then the out-degree of v0 in path p1 is equal to its in-degree. Otherwise the out-degree of v0 in path p1 is one more than its in-degree. 2) For any i = 0, if vi is the internal vertex of the first path in f , then the out-degree of vi in path p1 is equal to its in-degree. Otherwise the out-degree of vi in path p1 is one less than its in-degree. For the last part ω3 , Constraint (8) can also be proposed for similar reason. In constraint (9), t0 is a lower bound of the earliest starting time of the RPPTDT-tour. Constraints (10) and (11) indicate the alternation sequence of arcs and paths in terms of time. Constraint (12) and (13) calculate the travel time of arc (i, j) when the postman services arc (i, j) as the kth required arc or traverses arc (i, j) in the kth path starting at vertex vi during the hth time interval. Constraint (14) ensures that if the postman services arc (i, j) as the kth required arc, then it must depart from vi within one time interval. If the departure time tki of vi belongs to the hth time interval of (i, j), then it is necessary to check whether tki is in the range from the lower bound Tijh−1 to the upper bound Tijh , which are guaranteed by constraints (15) and (16) separately. Constraints (17-19) play a similar role for the arc (i, j) that is traversed in the kth path of the Chinese tour.
Integer Programming Approach for RPPTDT
3
419
Results on RPPTDT Polyhedron
In this section, we summarize some polyhedral results for the RPPTDT, based on which our cutting plane algorithm is developed. According to the formulation in Sect. 2, every RPPTDT-tour in D can be considered as an arc-path alternation sequence. We can associate with this sequence an integer vector f = (y1 , x1 , · · · , xK , yK+1 ), where xk and yk are also k integer vectors, denoted as xk = (xkij : (i, j) ∈ AR ) ∈ BK and yk = (yij : (i, j) ∈ A) ∈ Bm respectively. It is evident that the incidence vector f of each arc-path sequence satisfies Constraints (2-8) and, conversely, each feasible solution of inequality system (2-8) is the incidence vector of an arc-path sequence. Therefore, we will use the Constraints (2-8) which have a strong combinatorial structure to define the polytope of APAS, PAP AS (D), and denote by F the set of the feasible solutions for the APAS polytope PAP AS (D): F = {f ∈ BK
2
+mK+m
: f satisfies Constraints (2-8)}
This representation yields to the definition of PAP AS (D) as the convex hull of all the feasible solution for the APAS polytope: PAP AS (D) = conv(F ). The polyhedral results of PCA (D) are listed as follows. Theorem 1. Dim(PAP AS (D)) = K 2 + (m − n − 2)(K + 1) + 4 if m − n ≥ 1. Theorem 1 exhibits the dimension of the APAS polytope, the details about the proof of which can be found in Appendix A. Next we will introduce a valid inequality in the APAS polytope. Note that k the path indicated by each sub-vector yk = (yij : (i, j) ∈ A) of y would rather be named as “subgraph” than “path”. That is because the extra circuit is not forbidden by Constraints (2-8). When the k − 1th and kth serviced arcs of the RPPTDT-tour are adjacent with a common vertex vs , the vector yk must meet one of the following three cases: 1) the vector yk is void; 2) the arcs of a circuit that passes though vs is contained in yk ; 3) the arcs of a circuit that does not pass though vs is contained in yk . It is easy to see that the “subgraph” indicated by yk is not always a path, but it sometimes contains circuits. The RPPTDT-tour will not be optimal if the associated yk contains circuit discussed in cases (2) and (3). In particular, the RPPTDT-tour taking circuit described in case (3) as yk will not be feasible, because this circuit that is disjoint with the current tour will be never traversed by the postman. The circuit described in case (3) can be called isolated circuit which can be avoided by the following valid inequality. (s,t)∈ωjl
k yst ≥
k ylr − (1 −
(l,r)∈Nl+
xk−1 ij )
j, l ∈ V ;
k = 2, 3, . . . , K + 1
(i,j)∈Nj−
(22) where ωjl is the minimum cut set with the source vertex vj and sink vertex vl in D. When the k −1th arc is (i, j) in D, the inequality in (22) degenerates into k k (s,t)∈ωjl yst ≥ (l,r)∈N + ylr . If an isolated circuit containing any (l, r) ∈ D l
420
G.Z. Tan and J.H. Sun
is added into the kth path of the RPPTDT-tour, then the right side of the inequality is equal to 1 while the left side is equal to 0 as there is no path from source vertex vj to sink vertex vl . Thus the isolated circuits can be forbidden by the inequalities (22), which defines facet of APAS polytope below. Theorem 2. For arbitrary two vertices vj , vl ∈ V and the arc index k, the inequalities (22) defines a facet of PAP AS (D), if the out-degree or the in-degree of each vertex in D is more than 2, and the out-degree or the in-degree of vl is at most 3. Details about the proof of Theorem 2 can be found in Appendix B. To check the effect of the facet defining inequalities (22), we have designed an LP-based heuristic cutting plane algorithm that adds inequalities (22) as cutting planes. Our computational experiments in Sect. 4 show that inequalities (22) can provide a better lower bound. Moreover, as our next theorem shows, inequalities (22) possesses another nice property. Theorem 3. The separation problem for inequalities (22) can be solved in polynomial time. Proof. The separation problem for inequalities (22) is to determine whether a 2 given (rational) vector f ∗ ∈ QK +mK+m satisfies inequalities (22), which can be solved as follows. Firstly, for each vj , vl ∈ V and k = 2, · · · , K + 1, one can k calculate the right-side of inequalities (22) (l,r)∈N + ylr − (1 − (i,j)∈N − xk−1 ij ) l
j
by direct substitution, the result value of which is denoted by ukjl . Then, we define k k the weight wst := yst arc (s, t) ∈ A. Since, for any minimum cut set ωjl , for each ∗ k f satisfies (22) ⇔ ωjl wij ≥ ukjl , one can see that the separation problem for the inequalities (22) reduces to the problem of determining a minimum cut of D with respect to the nonnegative weight function w. Padberg and Rao (1982) have shown that the latter is polynomially solvable. Hence the theorem is proved.
Moreover, as the timing constraints involve a “big” number B that generally results in weak LP relaxations, strong timing constraints should also be derived, the forms of which are listed as follows. Successors’ inequalities: k+1,p k,h δij + γjl ≤ 1 ∀(i, j) ∈ AR ; k = 1, 2, · · · , K; h = 1, 2, · · · , H; (j,l)∈A p∈Ah ijl
k,h γij
+
(23) k,p (γjl
+
k,p δjl )
≤1
∀(i, j) ∈ A; k = 1, 2, · · · , K; h = 1, 2, · · · , H;
(j,l)∈A p∈Ah ijl
(24) Predecessors’ inequalities:
(i,j)∈A
p h∈Bijl
k,h k+1,p γij + δjl ≤1
∀(j, l) ∈ AR ; k = 1, 2, · · · , K; h = 1, 2, · · · , H; (25)
Integer Programming Approach for RPPTDT
(i,j)∈A h∈B p
k−1,h k,h k+1,p (δij + γij ) + γjl ≤1
421
∀(j, l) ∈ A; k = 2, · · · , K; h = 1, 2, · · · , H;
ijl
(26)
where h Ahijl = {p |Tjlp < Tijh−1 + Dij
or
h Tjlp−1 > Tijh + Dij + DIFF}
p h Bijl = {h |Tjlp < Tijh−1 + Dij
or
h Tjlp−1 > Tijh + Dij + DIFF}
and p−1 p DIF F = max{0, Djl − Djl }
Successor constraints (23) and (24) ensure that if the postman services or traverses arc (i, j) starting at vi during the hth time interval, then for any successor arc (j, l) of (i, j), it is impossible to traverse or service (j, l) during the time intervals in Ahijl which includes a term DIFF and has been introduced by Malandraki [9]. The inclusion of the term DIFF allows the travel time step function on (j, l) to behave as if it was a piecewise linear continuous function when the travel time in period p is less than that in the preceding period p − 1, as discussed in [9]. Similarly, the predecessor (25) and (26) constraints restricts the time intervals of all the predecessors of each arc in the Chinese tour.
4
Computational Results
This section summarizes the computational results obtained with a cutting plane algorithm using the facet defining inequalities (22) and valid inequalities (2326). The algorithm is a standard cutting plane method, where an initial linear program with constraints (2-21) is set up that is solved to optimality. One checks whether the optimum solution x∗ represents a Chinese tour and if not tries to find valid inequalities (22) and (23-26) that are violated by x∗ . These cutting planes are added to the current LP and the process is repeated. When the current LP solution is fractional and violates no inequalities (22) and (23-26), apply a heuristic that uses the fractional LP solution x∗ to construct an approximate Chinese tour, calculate an upper bound and stop. This cutting plane algorithm algorithm coded in C++ using Microsoft Visual C++ 6.0 Environment and LINGO library was run on a PC with a Pentium processor at 2.2GHz and 1G RAM. Several randomly generated instances were used for our computational study. Let D = (V, A) be a randomly generated network with vertex set V and arc set A. Suppose |V | = n, then the vertices of V are indexed by the integers 1, 2, · · · , n. Let the period associated with each arc (i, j) ∈ A be divided into H time intervals, then the travel time associated with each arc (i, j) ∈ A is treated as a step function with H time intervals for our computational study. We generate time dependent travel time randomly by the step function generation procedure described in Procedure 4.1.
422
G.Z. Tan and J.H. Sun
Procedure 4.1 1. Let the randomly generated network be D(V, A), and then randomly distribute these |V | vertices of D in the [0, 100]2 square. 2. For each arc (i, j) ∈ A, randomly generate an integer d that is proportional 1 to the Euclidean distance between its two incident vertices. Denote by Dij the travel time of the earliest time interval associated with arc (i, j). Set 1 Dij = d. 3. Generate the duration of each hth interval randomly(h = 1, · · · , H). 4. For each h = 2, · · · , H, and each arc (i, j) ∈ A, randomly generate an integer Δd in a fluctuation interval [−r, r], where r is an arbitrary but fixed positive h 1 integer. Set Dij := Dij + Δd, and ensure that the duration of the hth time h interval is not smaller than its travel time Dij . The algorithm is tested on two sets of randomly generated instances. In all instances, the number of vertices ranges from 10 to 25, and the number of arcs ranges from 20 to 50; the travel time is treated as the step function with 3 and 4 time intervals, and the percentage R of required arcs ranges from 10% to 30%. In table 1 we indicate the characteristics of the three instance sets in terms of the number of time intervals H and percentage R. Table 1. Characteristics of the two instance sets Inst A1-1/A1-4 A2-1/A2-4 A3-1/A3-4
H 3 3 3
R 10% 20% 30%
B1-1/B1-4 B2-1/B2-4 B3-1/B3-4
4 4 4
10% 20% 30%
Computational results obtained by the cutting plane algorithm for all 42 test instances are summarized in Table 2 and Table 3. For each instance, |V | is the number of vertex, and |A| is the number of arcs. LP is the value of the linear programming relaxation of the RPPTDT formulation described in Sect. 2. LB1 is the lower bound obtained by the cutting planes algorithm only using the valid inequalities (23-26), and LB2 is the lower bound obtained by adding both facet defining and valid inequalities (22) and (23-26). U B is the value of the best feasible solution obtained, i.e., the best upper bound. The values of LP , LB1 and LB2 are rounded up to the closest integer. Columns G0 , G1 and G2 display relative gaps between the best feasible solution (U B) and lower bounds LP , LB1 and LB2 , computed as G0 = ((U B − LP )/LP ) × 100, G1 = ((U B − LB1 )/LB1 ) × 100 and G2 = ((U B − LB2 )/LB2 ) × 100. Results presented on Table 2 and Table 3 indicate that the proposed algorithm can solve instances up to 25 vertices and 50 arcs. The relative gap G2 is 3.16%
Integer Programming Approach for RPPTDT
423
Table 2. Computational result of the first group of instances Inst. A1-1 A1-2 A1-3 A1-4 A1-5 A1-6 A1-7
|V | 10 13 15 17 20 22 25
|A| 20 26 30 34 40 44 50
LP 230.67 275.83 260.47 302.78 244.25 261.36 331.52
LB1 231.88 277.56 260.47 305.70 255.36 266.33 331.52
LB2 301.44 311.00 298.30 364.00 300.00 341.67 370.00
UB 308 311 300 377 310 357 378
G0 (%) 33.52 12.75 15.18 24.51 26.92 36.59 14.02
G1 (%) 32.83 12.05 15.18 23.32 21.40 34.04 14.02
G2 (%) 2.18 0.00 0.57 3.57 3.33 4.49 2.16
A2-1 A2-2 A2-3 A2-4 A2-5 A2-6 A2-7
10 13 15 17 20 22 25
20 26 30 34 40 44 50
260.00 342.75 297.44 275.61 279.59 300.18 372.56
260.00 348.00 297.57 277.84 261.00 304.90 377.00
541.27 516.73 577.12 533.00 488.37 574.00 583.00
541 530 591 561 518 577 604
108.08 54.63 98.70 103.55 85.27 92.22 62.12
108.08 52.30 98.61 101.91 98.47 89.24 60.21
0.00 2.71 2.43 5.25 6.07 0.52 3.60
A3-1 A3-2 A3-3 A3-4 A3-5 A3-6 A3-7
10 13 15 17 20 22 25
20 26 30 34 40 44 50
351.00 329.64 366.67 351.47 376.08 388.57 350.51
351.77 330.00 367.21 355.67 378.00 390.91 351.00
601.00 593.38 607.31 591.56 613.07 605.73 637.35
601 620 617 613 627 622 657
71.23 88.08 68.27 74.41 66.72 60.07 87.44
70.85 87.88 68.12 72.64 65.87 59.48 87.18
0.00 4.49 1.60 3.62 2.27 2.69 3.08
for all the 42 instances on average. It is easy to show that the best upper bound U B obtained by the cutting plane heuristic is always very close to the value of the new linear relaxation bound LB2 . Meanwhile, we also find that the changes of percentage R might affect gap G2. For the 21 instances with R = 10%, the relative gap G2 attains 2.42% on average, and it becomes 3.23% and 3.82% on average for those instances with R = 20% and R = 30% respectively. The lower bound LB1 and LB2 obtained by adding cutting planes improves substantially the linear relaxation bound LP of the original formulation for all 42 instances. By comparing columns G0 , G1 and G2 , one can appreciate how much our valid and facet defining inequalities have contributed to the relative gaps. As shown in Table 2 and Table 3, gap G1 is equal to G0 approximately on average, and gap G2 is 66.84% smaller than G0 on average. It is evident that the facet defining inequalities (22) are the most effective, followed by the successor and predecessor inequalities from Sect. 3.
5
Application in Scheduling with Time Dependent Processing Times
The RPPTDT problem can be applied to solving the problem of scheduling with time dependent processing times [1]. In the classical scheduling theory processing
424
G.Z. Tan and J.H. Sun Table 3. Computational result of the second group of instances
Inst. B1-1 B1-2 B1-3 B1-4 B1-5 B1-6 B1-7
|V | 10 13 15 17 20 22 25
|A| 20 26 30 34 40 44 50
LP 174.23 152.67 145.00 114.01 201.29 157.99 162.35
LB1 176.21 155.96 145.00 116.00 217.40 157.99 163.00
LB2 261.00 277.44 266.57 197.00 290.67 247.56 270.00
UB 261 290 274 206 295 258 270
G0 (%) 49.80 89.95 88.97 80.69 46.55 63.30 66.31
G1 (%) 48.12 85.95 88.97 77.59 35.69 63.30 65.64
G2 (%) 0.00 4.53 2.79 4.57 1.49 4.22 0.00
B2-1 B2-2 B2-3 B2-4 B2-5 B2-6 B2-7
10 13 15 17 20 22 25
20 26 30 34 40 44 50
211.75 194.36 203.00 176.49 293.18 300.70 281.60
212.98 196.64 203.00 178.00 296.74 301.00 281.65
402.00 374.70 427.04 370.51 507.00 501.09 483.35
422 408 441 384 513 521 517
99.29 109.92 117.24 117.58 74.98 73.26 83.59
99.06 108.16 117.24 115.73 72.88 73.09 83.56
4.98 8.89 3.27 3.64 1.18 3.97 6.96
B3-1 B3-2 B3-3 B3-4 B3-5 B3-6 B3-7
10 13 15 17 20 22 25
20 26 30 34 40 44 50
299.07 319.33 341.00 375.60 358.06 400.01 390.15
301.72 320.00 341.00 377.00 358.06 400.01 395.00
573.88 588.67 577.31 607.03 612.38 621.09 607.78
600 612 607 632 623 648 630
100.62 91.65 78.01 68.26 73.99 62.00 61.48
98.86 91.25 78.01 67.64 73.99 62.00 59.49
4.55 3.96 5.14 4.11 1.73 4.33 3.66
times of jobs are constant; however, there are many situations where the processing time depends on the starting time of the job. For example, in scheduling of steel rolling mills where the temperature of an ingot, while waiting in a buffer between the furnace and the rolling machines, has dropped below a certain temperature, then the ingot needs to be reheated to bring it up to the temperature required for rolling. In such situations the processing time of a job may be a function of its starting time. Furthermore, we formulate the machine operation process as a directed graph D(V, A), where each state si of machine corresponds to a vertex vi in V , and each transition from machine states si to sj corresponds to an arc (i, j) in A. From this point of view, the process of machining a job Jk can be seen as a sequence of state transitions on the machine. Let the starting state and ending state of this sequence be st and se respectively, and then we can add a new arc (t, e) into the network D to express machining job Jk , which is associated with a time dependent processing time. Note that the starting state of the current job may not be the same as the ending state of its immediate predecessor. It means that machine should reach the starting state of Jk+1 through several extra transitions starting from the ending state of Jk during the process of machining jobs. Thus, the aim of this scheduling problem is to find a feasible job process strategy, such that the processing times of all the jobs and the extra times of additional
Integer Programming Approach for RPPTDT
425
transitions are minimal, which can be equivalently cast as the Rural Postman problem defined on the time dependent network D where an arc associated with each job should be serviced at least once.
6
Conclusions
We proposed a linear integer programming formulation, namely, arc-path formulation, based on arc-path decision variables for the RPPTDT. A subset of the constraints in this formulation has a strong combinatorial structure which defines the polytope of arc-path alternation sequence (APAS) in the RPPTDTtour. A polyhedral investigation of the APAS yielded results on the dimension and facet defining inequalities of the APAS polytope. Moreover, two families of strong valid inequalities are also derived. Further research in this direction will be helpful to strengthen the integer programming formulation of the RPPTDT. Acknowledgments. This research was performed at Dalian University of Technology and was supported by a National Natural Science Foundation of China No.60873256 and National Basic Research Program of China No.2005CB321904. These supports are gratefully acknowledged.
References 1. Sundararaghavan, P.S., Kunnathur, A.S.: Single machine scheduling with start time dependent processing times: Some solvable cases. European Journal of Operational Research 78, 394–403 (1994) 2. Tagmouti, M., Gendreau, M., Potvin, J.Y.: Arc routing problems with timedependent service costs. European Journal of Operational Research 181, 30–39 (2007) 3. Mullaseril, P.A.: Capacitated rural postman problem with time windows and split delivery, Ph.D Thesis. University of Arizona (1996) 4. Ghiani, G., Laporte, G.: A branch-and-cut algorithm for the Undirected Rural Postman Problem. Mathematical Programming 87, 467–481 (2000) 5. Corberan, A., Romero, A., Sanchis, J.M.: The mixed general routing polyhedron. Mathematical Programming 96, 103–137 (2003) 6. Corberan, A., Mejia, G., Sanchis, J.M.: New Results on the Mixed General Routing Problem. Operations Research 52, 363–376 (2005) 7. Longo, H., Arag¨ ao, M.P., Uchoa, E.: Solving capacitated arc routing problems using a transformation to the CVRP. Computers and Operations Research 33, 1823–1837 (2006) 8. Orda, A., Rom, R.: Shortest-path and minimum-delay algorithms in networks with time-dependent edge-length. Journal of ACM 37, 607–625 (1990) 9. Malandraki, C., Daskin, M.S.: Time Dependent Vehicle Routing Problems: Formulations, Properties and Heuristic Algorithms. Transportation Science 26, 185–200 (1992) 10. Bang, J., Gutin, G.: Digraphs: Theory, Algorithms and Applications. Springer, London (2001)
426
G.Z. Tan and J.H. Sun
Appendix A: Dimension of the APAS Polytope In order to prove the dimension of PAP AS (D), we first introduce an approach to construct the affinely independent RPPTDT-tour in F in Sect. 6.1, then analyze the dimension of PAP AS (D) in Sect. 6.2. 6.1
Affinely Independent RPPTDT-Tours in APAS Polytope
To show the facial structure of the APAS polytope PAP AS (D), this section exhibits an approach to find affinely independent RPPTDT-tours in PAP AS (D). According to the definitions of RPPTDT-tour set F and arc array set X , the set of affinely independent RPPTDT-tours in F can be obtained by constructing the linearly independent arc arrays in X . It is evident that the incidence vectors in X correspond to the full array of K arcs in AR . Without loss of generality, let an arbitrary arc array be aK , aK−1 · · · , a1 , then its incidence vector x ∈ X K−1 can be written as (xK , · · · , x1K ), where xlk = (xkij : (i, j) ∈ AR ∧ if aij = 1 , x2 k al , xij = 1; otherwise, xkij = 0) indicates that the kth arc serviced in the RPPTDT-tour is al . Obviously, the cardinality of X is K!, while the number of linearly independent arc arrays in X is much less. See Theorem 4 for more details. Theorem 4. There are (K − 1)2 + 1 linearly independent points in X . Proof. When K = 1, there is only one required arc in AR . It is easy to see that the arc array in X is unique, which by itself is linearly independent. When K = l, assume that there are (l−1)2 +1 linearly independent arc arrays in X , and we will denote by X l the set of these linearly independent arc arrays. Then we will prove that the number of linearly independent arc arrays in X is l2 + 1 for K = l + 1. When K = l + 1, we will construct the linearly independent arc array set X l+1 as follows. Firstly, we will construct the first part of linearly independent arc arrays in X l+1 . For each arc array x ∈ X l , written as (xi1 , · · · , xjl ) (i, j ≤ l), we can append the incidence vector associated with arc al+1 to x, then obtain a new 2 arc array x = (xi1 , · · · , xjl , xl+1 l+1 ). Therefore, we can construct (l − 1) + 1 arc l+1 . arrays taking al+1 as their l + 1th arc, the set of which is denoted as Xl+1 l+1 It is evident that these arc arrays in Xl+1 are linearly independent since the elements in set X l are linearly independent. l+1 taking ai as its lth arc, and other Secondly, denote by xi the arc array in Xl+1 l linearly independent arc arrays can be obtained as follows. For each ith arc ar1 l ray xi = (xj1 , · · · , xil , xl+1 l+1 ) in set {x , · · · , x }, exchange the lth sub-vector with the l + 1th sub-vectors, then a new arc array is obtained as (xj1 , · · · , xl+1 , xil+1 ). l l+1 Thus, we can construct l arc arrays, the set of which is denoted by Xl . It is easy to see that the last arc of the ith arc array in Xll+1 is ai . Therefore, the
Integer Programming Approach for RPPTDT
427
incidence matrix of Xll+1 is non-singular since these l arcs a1 , · · · , al are linearly independent. Furthermore, note that the lth arc of each arc array x ∈ Xll+1 is l+1 and Xll+1 is also non-singular because al+1 , then the incidence matrix of Xl+1 of the linearly independence of the l + 1 arcs a1 , · · · , al+1 . Finally, we need to find the last l − 1 linearly independent arc arrays of X l+1 , the ith arc array of which is constructed as follow (i = 1, · · · , l − 1). For l+1 a given arc array x = (xp1 , · · · , xii , · · · , xql , xl+1 l+1 ) in Xl+1 whose ith arc is ai , exchange the ith and the l + 1th sub-vectors, then a new arc array is constructed q i as (xp1 , · · · , xl+1 i , · · · , xl , xl+1 ). Note that each ith arc array constructed above is marked with al+1 as its ith arc, it is evident that the incidence matrix of X l+1 is non-singular, hence, the l 2 + 1 incidence vectors in X l+1 are linearly independent.
According to the above theorem, it is easy to prove the following theorem. Theorem 5. There are at least (K −1)2 +1 affinely independent RPPTDT-tours in F . Denote by X ∗ the set of linearly independent arc arrays analyzed in Theorem 4, it is easy to show that each arc array corresponds to at least one RPPTDTtour in F . Thus, let the set of affinely independent RPPTDT-tours induced from X ∗ be F ∗ , we can easily concludes that its cardinality is at least (K − 1)2 + 1. 6.2
Proof of the Dimension of PAP AS (D)
In this section, we will show the upper bound and the lower bound of the diE E E mension of PAP AS (D). Let (AE 1 , b1 ) and (A2 , b2 ) be the coefficient matrices associated with the equalities system (2),(3) and equalities system (6-8) respectively. As we know, the number of equalities in Constraints (2) and (3) is 2K, and there are (K + 1)n equalities in Constraints (6-8). The ranks of these two coefficient matrices are calculated in the following lemmas. E Lemma 1. Rank(AE 1 , b1 ) = 2K − 1. E 2 Proof. (AE 1 , b1 ) is a matrix with 2K rows and K + 1 columns, as follow: ⎞ ⎛ 1 1 1 1 ⎜ .. .⎟ .. .. ⎜ . . ... . .. ⎟ ⎟ ⎜ ⎜ 1 1 1 1⎟ ⎟ ⎜ ⎜1 ... 1 1⎟ (27) ⎟ ⎜ ⎜ 1 ... 1 1⎟ ⎟ ⎜ ⎟ ⎜ .. ⎠ ⎝ .
1 ... 1 1
2K×(K 2 +1)
428
G.Z. Tan and J.H. Sun
We transform it with elementary row transformation. Firstly, subtract each elements in the first K rows from the ones in the K + 1th row and obtain the following matrix: ⎞ ⎛ 1 1 1 1 ⎟ ⎜ .. .. .. .. ⎟ ⎜ . . . ... . ⎟ ⎜ ⎟ ⎜ 1 1 1 1 ⎟ ⎜ ⎜ (28) −1 . . . −1 . . . −1 . . . −1 −K + 1 ⎟ ⎟ ⎜ ⎟ ⎜ 1 . . . 1 . . . 1 ⎟ ⎜ ⎟ ⎜ .. .. ⎠ ⎝ . . 1 ... 1
1
2K×(K 2 +1)
Then, add the elements of the K + 2th row to the ones of the K + 1th row, and the elements of the K + 3th row to the ones of the K + 2th row, and so on, until the elements of the 2Kth row to the ones of the 2K − 1th row, as follow: ⎛ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝
1
1 ..
1 ..
. 1
.
1 −1 . . . −1
0 ... 0 0 ... 0
... ...
..
.
. . . . . . −1 . . . −1 −1 . . . −1 . . . .. . −1 . . . ... ... 0 ...
1 .. .
⎞
⎟ ⎟ ⎟ ⎟ 1 1 ⎟ −1 −K + 1 ⎟ ⎟ −1 −K + 2 ⎟ ⎟ ⎟ .. ⎟ . ⎟ ⎠ −1 1 0 0 2K×(K 2 +1)
(29)
According to (29), we know the elements of the last row are all zero, therefore E Rank(AE
1 , b1 ) = 2K − 1. E Lemma 2. Rank((AE 2 , b2 ))=Kn + n − 1. E 2 Proof. (AE 2 , b2 ) is a matrix with (K + 1)n rows and (K + 1)m + m + 1 columns, as follow: ⎞ ⎛ ac f ⎜ bac 0⎟ ⎟ ⎜ ⎜ b a c 0⎟ ⎟ ⎜ ⎜ .. ⎟ .. (30) ⎜ . .⎟ ⎟ ⎜ ⎟ ⎜ bac 0⎟ ⎜ ⎝ b a c 0⎠ b a e (Kn+n)×[(K+1)m+m2 +1]
Note that the above matrix is a partitioned matrix, where a is the incidence matrix of D with n rows and m columns, b and c are the in-arc and out-arc incidence matrix of D with n rows and m columns respectively, e = ( 1 0 0 . . . 0 )T
Integer Programming Approach for RPPTDT
429
is a matrix with n rows and 1 column, and f = ( −1 0 0 . . . 0 )T is a matrix with n rows and 1 column, too. Obviously, b + c = a. We transform it with elementary row transformation. Firstly, add the elements of the second row to the ones of the first row, and the elements of the third row to the ones of the second row, and so on, until the elements of the (K + 1)nth row to the ones of the (K + 1)n − 1th row, as follow: ⎛ ⎞ ac f ⎜a a a c f⎟ ⎜ ⎟ ⎜a a a a a c f⎟ ⎜ ⎟ ⎜ .. ⎟ .. (31) ⎜ . .⎟ ⎜ ⎟ ⎜a a a a a a ... a a a c ⎟ f⎟ ⎜ ⎝a a a a a a ... a a a a c f ⎠ a a a a a a . . . a a a a a a 0 (Kn+n)×[(K+1)m+m2 +1] Obviously, all the rows of the above partitioned matrix are linearly independent. Moreover, all the internal n rows in the kth row of matrix (31) are also E linearly independent (k = 1, · · · , K). So the rank of the first Kn rows of (AE 2 , b2 ) is Kn. As we know, the rank of a is n − 1. So the rank of the matrix in the last E E E row of (AE
2 , b2 ) is n − 1. Therefore, the rank of (A2 , b2 ) is Kn + n − 1. Based on the above Lemmas, the proof of Theorem 1 is given below. Proof. Firstly, determine the upper bound of Dim(PAP AS (D)). Because the 2 equations in (2) and (3) only associate with incidence vector x ∈ BK , and the equations in (6-8) associate with both incidence vector x and y ∈ Bm(K+1) , it is E evident that each row in (AE 2 , b2 ) is not the linear combination of row vectors E E in (A1 , b1 ). According to Lemma 1 and 2, the coefficient matrix (AE , bE ) of equation set (2,3) and (6-8) satisfies Rank(AE , bE ) ≥ Kn + 2K + n − 2. As the 2 PAP AS (D) defines in space Bm(K+1)+K , Dim(PAP AS (D)) ≤ K 2 + (m − n − 2) (K + 1) + 4. Secondly, determine the lower bound of Dim(PAP AS (D)). According to Theorem 5, there are (K −1)2 +1 affinely independent RPPTDTtours F ∗ which are induced from the linearly independent arc array set X ∗ . Moreover, another m − n + 1 affinely independent points, the set of which is denoted as F , can be constructed by the following way. According to the circuit structure of digraphs [10], there exist and only exist m − n + 1 linearly independent circuits in the network D, denoted as C1 , · · · , Cm−n+1 . For a given RPPTDT-tour f ∈ F ∗ , we can obtain a new feasible solution by adding one of the linearly independent circuits to the incidence vector yk of f . Then we can obtain at least m − n + 1 feasible solutions, the set of which is denoted as Fk . Considering that the vector yk might be linear combination of the m − n + 1 circuit vectors, the number of solutions in Fk which are affinely independent with F ∗ is at least m − n. Therefore, for all k = 1, · · · , K + 1, we can exhibit the other (K + 1)(m − n) affinely independent solutions in F , denoted as F . Finally, we will construct the last one affinely independent solution in F as follow. It is easy to see that there must exist two arcs (i, j) and (u, v) which
430
G.Z. Tan and J.H. Sun
are not adjacent, such that the number of paths between the above two arcs is at least 2, because m − n ≥ 1. Let x be an arc array with arcs (i, j) and (u, v) as its k − 1th and kth arc respectively. Then we can exhibit two linearly independent solutions f1 and f2 by connecting arcs (i, j) and (u, v) in x with the two paths respectively. Considering that one of the two paths might be associated with the incidence vector yk in some RPPTDT-tour f ∈ F ∗ , without loss of generality, let f1 be the solution with y k appearing in the F ∗ . Then there is at least one more affinely dependent solution f2 . It is easy to show that the incidence matrix (F ∗ , F , {f2 }) is non-singular. Thus, there are at least K 2 + (m − n − 2)(K + 1) + 5 affinely independent solutions in F . Thus Dim(PAP AS (D)) ≥ K 2 + (m − n − 2)(K + 1) + 4.
Appendix B: Facet Defining Inequalities for the APAS Polytope The proof of Theorem 2 is given below. Proof. we only need to find K 2 + (m − n − 2)(K + 1) + 4 affinely independent points in F satisfying the constraint (22) as an equality. For the given j and k, one can find an arc starting at vertex vj in the connected network D, denoted by (i, j), and let Fijk be the set of RPPTDT-tours whose kth serviced arc is (i, j). These affinely independent points can be found in Fijk as follows. Firstly, according to Theorem 5, there are (K − 2)2 + 1 affinely independent RPPTDT-tours in Fijk , the set of which is denoted as F1 . Without loss of generality, the path connecting each k − 1th and kth (k = 1, · · · , K) serviced arcs of the RPPTDT-tours in F1 is a simple path (if the two arc are adjacent, then the path is void). It means that there is no isolated circuit in each f ∈ F1 . That is, F1 is the first set of affinelly independent RPPTDT-tours satisfying (22) as an equality in F . Secondly, according to the circuit structure of digraphs [10], there are m−n+1 linearly independent circuits in D. For each k = 1, · · · , K + 1, we can construct m − n + 1 affinely independent solutions by adding these linearly independent circuits to yk of a RPPTDT-tour f ∈ F1 . For the case k = k, the circuit added to the k th path does not change the incidence vector yk , which satisfies (22) . Thus the number of affinely independent solutions constructed by adding linearly independent circuit to the k th path is at least m − n + 1 (k = k). On the other hand, for the case k = k, the (22) will be satisfied as an equality if the added circuit is not isolated or does not contain vl , otherwise it will be violated or be satisfied as an inequality. As the out-degree or the in-degree of vl is at most 3, there are at most 3 isolated circuits in D passing though vl . That is, we can construct at least m − n − 2 affinely independent solutions by adding linearly independent circuit to the kth path. Considering that the vector yk might be linear combination of the m − n + 1 circuit vectors (k = 1, · · · , K + 1), at least (m − n)K + m − n − 3 affinely independent solutions can be constructed by adding linearly independent circuit for all k = 1, · · · , K + 1, the set of which is denoted as F2 .
Integer Programming Approach for RPPTDT
431
Thirdly, for each two arcs (s, t) and (u, v) which are not adjacent, there must exist at least three paths connecting vt and vu , denoted as p1tu , p2tu and p3tu , since the assumption that the number of outgoing or incoming arcs of vt exceeds 2. Let x be the arc array containing arcs (s, t) and (u, v) as its k −1th and k th arc respectively. Then we can exhibit three linearly independent solutions, denoted as f1 , f2 and f3 , by connecting arcs (s, t) and (u, v) in x through the paths p1tu , p2tu and p3tu respectively. Considering that one of the three paths might be associated with the incidence vector yk of some RPPTDT-tour in the above F1 , without loss of generality, let p1ut be the path which has been associated with the incidence vector yk of some solution in F1 . Then there is at least two more affinely independent solutions f2 and f3 . For all k = 1, · · · , K + 1, we can exhibit 2K affinely independent solutions satisfying (22) as an equality, which is denoted as F3 . It is easy to show that the incidence matrix of (F1 , F2 , F3 ) is non singular, hence, the number of affinely independent solutions in F is at least K 2 + (m − n − 2)(K + 1) + 4.
Property Testing for Cyclic Groups and Beyond Fran¸cois Le Gall1 and Yuichi Yoshida2,
2
1 Department of Computer Science Graduate School of Information Science and Technology The University of Tokyo [email protected] School of Informatics, Kyoto University, and Preferred Infrastructure, Inc. [email protected]
Abstract. This paper studies the problem of testing if an input (Γ, ◦), where Γ is a finite set of unknown size and ◦ is a binary operation over Γ given as an oracle, is close to a specified class of groups. Friedl et al. [Efficient testing of groups, STOC’05] have constructed an efficient tester using poly(log |Γ |) queries for the class of abelian groups. We focus in this paper on subclasses of abelian groups, and show that these problems are much harder: Ω(|Γ |1/6 ) queries are necessary to test if the input is close to a cyclic group, and Ω(|Γ |c ) queries for some constant c are necessary to test more generally if the input is close to an abelian group generated by k elements, for any fixed integer k ≥ 1. We also show that knowledge of the size of the ground set Γ helps only for k = 1, in which case we construct an efficient tester using poly(log |Γ |) queries; for any other value k ≥ 2 the query complexity remains Ω(|Γ |c ). All our upper and lower bounds hold for both the edit distance and the Hamming distance. These are, to the best of our knowledge, the first nontrivial lower bounds for such group-theoretic problems in the property testing model and, in particular, they imply the first exponential separations between the classical and quantum query complexities of testing closeness to classes of groups.
1
Introduction
Background: Property testing is concerned with the task of deciding whether an object given as an oracle has (or is close to having) some expected property. Many properties including algebraic function properties, graph properties, computational geometry properties and regular languages have been proved to be efficiently testable. We refer to, for example, Refs. [7,13,16] for surveys on property testing. In this paper, we focus on property testing of group-theoretic properties. An example is testing whether a function f : G → H, where H and G are groups, is a homomorphism. It is well known that such a test can be done efficiently [3,4,17]. Another kind of group-theoretic problems deals with the case where the input consists of both a finite set Γ and a binary operation ◦ : Γ × Γ → Γ over
Part of this work was conducted while the author was visiting Rutgers University.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 432–443, 2011. c Springer-Verlag Berlin Heidelberg 2011
Property Testing for Cyclic Groups and Beyond
433
it given as an oracle. An algorithm testing associativity of the oracle in time O(|Γ |2 ) has been constructed by Rajagopalan and Schulman [15], improving the straightforward O(|Γ |3 )-time algorithm. They also showed that Ω(|Γ |2 ) queries are necessary for this task. Erg¨ un et al. [8] have proposed an algorithm us˜ |) queries testing if ◦ is close to associative, and an algorithm using ing O(|Γ ˜ |3/2 ) queries testing if (Γ, ◦) is close to being both associative and cancellaO(|Γ tive (i.e., close to the operation of a group). They also showed how these results can be used to check whether the input (Γ, ◦) is close to an abelian group with ˜ |3/2 ) queries. The notion of closeness discussed in Erg¨ O(|Γ un et al.’s work refer to the Hamming distance of multiplication tables, i.e., the number of entries in the multiplication table of (Γ, ◦) that have to be modified to obtain a binary operation satisfying the prescribed property. Friedl et al. [9] have shown that, when considering closeness with respect to the edit distance of multiplication tables instead of the Hamming distance (i.e., by allowing deletion and insertion of rows and columns), there exists an algorithm with query and time complexities polynomial in log |Γ | that tests whether (Γ, ◦) is close to an abelian group. An open question is to understand for which other classes of groups such a test can be done efficiently and, on the other hand, if nontrivial lower bounds can be proved for specific classes of groups. Notice that the algorithm in Ref. [9] has been obtained by first constructing a simple quantum algorithm that tests in poly(log |Γ |) time if an input (Γ, ◦) is close to an abelian group (based on a quantum algorithm by Cheung and Mosca [5] computing efficiently the decomposition of a black-box abelian group on a quantum computer), and then replacing the quantum part by clever classical tests. One can find this surprising since, classically, computing the decomposition of a black-box abelian group is known to be hard [2]. This indicates that, in some cases, new ideas in classical property testing can be derived from a study of quantum testers. One can naturally wonder if all efficient quantum algorithms testing closeness to a given class of groups can be converted into efficient classical testers in a similar way. This question is especially motivated by the fact that Inui and Le Gall [10] have constructed a quantum algorithm with query complexity polynomial in log |Γ | that tests whether (Γ, ◦) is close to a solvable group (note that the class of solvable groups includes all abelian groups), and that their techniques can also be used to test efficiently closeness to several subclasses of abelian groups on a quantum computer, as discussed later. Our contributions: In this paper we investigate these questions by focusing on subclasses of abelian groups. We show lower and upper bounds on the randomized (i.e., non-quantum) query complexity of testing if the input is close to a cyclic group, and more generally on the randomized query complexity of testing if the input is close to an abelian group generated by k elements (i.e., the class of groups of the form Zm1 × · · · × Zmr where 1 ≤ r ≤ k and m1 , . . . , mr are positive integers), for any fixed k ≥ 1 and for both the edit distance and the Hamming distance. We prove in particular that their complexities vary dramatically according to the value of k and according to the assumption that the size of Γ is known or not. Table 1 gives an overview of our results.
434
F. Le Gall and Y. Yoshida
Table 1. Lower and upper bounds on the randomized query complexity of testing if (Γ, ◦) is close to specific classes of groups. Here denotes the distance parameter, see Section 2 for details. Target group abelian group cyclic group (size unknown) abelian group with k generators [k: fixed integer > 1] cyclic group (size known)
Distance edit or Hamming edit edit or Hamming
Bound ˜ O(|Γ |3/2 ) O(poly(−1 , log |Γ |)) Ω(|Γ |1/6 ) 1
4
edit or Hamming Ω(|Γ | 6 − 6(3k+1) )
Reference [8] [9] here (Th. 1) here (Th. 2)
edit or Hamming O(poly(−1 , log |Γ |)) here (Th. 3)
Our results show that, with respect to the edit distance, testing closeness to subclasses of abelian groups generally requires exponentially more queries than testing closeness to the whole class of abelian groups. We believe that this puts in perspective Friedl et al.’s work [9] and indicates both the strength and the limitations of their results. The lower bounds we give in Theorems 1 and 2 also prove the first exponential separations between the quantum and randomized query complexities of testing closeness to a class of groups. Indeed, the same arguments as in Ref. [10] easily show that, when the edit distance is considered, testing if the input is close to an abelian group generated by k elements can be done using poly(−1 , log |Γ |) queries on a quantum computer, for any value of k and even if |Γ | is unknown. While this refutes the possibility that all efficient quantum algorithms testing closeness to a given class of groups can be converted into efficient classical testers, this also exhibits a new set of computational problems for which quantum computation can be shown to be strictly more efficient than classical computation. Relation with other works: While Ivanyos [11] gave heuristic arguments indicating that testing closeness to a group may be hard in general, we are not aware of any (nontrivial) proven lower bounds on the query complexity of testing closeness to a group-theoretic property prior to the present work. Notice that a few strong lower bounds are known for related computational problems, but in different settings. Babai [1] and Babai and Szemer´edi [2] showed that computing the order of an elementary abelian group in the black-box setting requires exponential time — this task is indeed one of the sometimes called “abelian obstacles” to efficient computation in black-box groups. Cleve [6] also showed strong lower bounds on the query complexity of order finding (in a model based on hidden permutations rather than on an explicit group-theoretic structure). These results are deeply connected to the subject of the present paper and inspired some of our investigations, but do not give bounds in the property testing setting. The proof techniques we introduce in the present paper are indeed especially tailored for this setting. Organization of the paper and short description of our techniques: Section 3 deals with the case where |Γ | is unknown. Our lower bound on the complexity of testing closeness to a cyclic group (Theorem 1) is proven in a way
Property Testing for Cyclic Groups and Beyond
435
that can informally be described as follows. We introduce two distributions of inputs: one consisting of cyclic groups of the form Zp2 , and another consisting of groups of the form Zp ×Zp , where p is an unknown prime number chosen in a large enough set of primes. We observe that each group in the latter distribution is far with respect to the edit distance (and thus with respect to the Hamming distance too) from any cyclic group. We then prove that a deterministic algorithm with o(|Γ |1/6 ) queries cannot distinguish those distributions with high probability. Section 4 focuses on testing closeness to the class of groups generated by k > 1 elements, and proves Theorem 2 in a similar way. For example, when k > 1 is a fixed odd integer, we introduce two distributions consisting of groups isomorphic (k+1)/2 (k−1)/2 (k−1)/2 (k+3)/2 to Gp = Zp2 ×Zp and to Hp = Zp2 ×Zp , respectively. Notice that Gp and Hp have the same size. While each group in the first distribution is generated by k elements, we observe that each group in the second distribution is far from any group generated by k elements. We then show that any deterministic algorithm with o(p(k−1)/4 ) = o(|Γ |1/6−4/6(3k+1) ) queries cannot distinguish those distributions with high probability, even if p (and thus |Γ |) is known. Section 5 is devoted to constructing an efficient tester for testing closeness to cyclic groups when the size |Γ | of the ground set is known. The idea behind the tester we propose is that, when the size |Γ | of the ground set is given, we know that if (Γ, ◦) is a cyclic group, then it is isomorphic to the group Z|Γ | . We then take a random element γ of Γ and define the map f : Z|Γ | → Γ by f (i) = γ i for any i ∈ {0, . . . , |Γ | − 1} (here the powers are defined carefully to take into consideration the case where the operation ◦ is not associative). If (Γ, ◦) is a cyclic group, then γ is a generating element with non negligible probability, in which case the map f will be a group isomorphism. Our algorithm will first test if the map f is close to a homomorphism, and then perform additional tests to check that f behaves correctly on any proper subgroup of Z|Γ | .
2
Definitions
Let Γ be a finite set and ◦ : Γ × Γ → Γ be a binary operation on it. Such a couple (Γ, ◦) is called a magma. We first define the Hamming distance between two magmas over the same ground set. Definition 1. Let (Γ, ◦) and (Γ, ∗) be two magmas over the same ground set Γ . The Hamming distance between ◦ and ∗, denoted HamΓ (◦, ∗), is HamΓ (◦, ∗) = |{(x, y) ∈ Γ × Γ | x ◦ y = x ∗ y}|. We now define the edit distance between tables. A table of size k is a function T from Π × Π → N where Π is an arbitrary subset of N (the set of natural numbers) of size k. We consider three operations to transform a table to another. An exchange operation replaces, for two elements a, b ∈ Π, the value T (a, b) by an arbitrary element of N. Its cost is one. An insert operation on T adds a new element a ∈ N\Π: the new table is the extension of T to the domain (Π ∩ {a}) × (Π ∩ {a}), giving a table of size (k + 1) where the 2k + 1 new values of the function are set arbitrarily. Its cost is 2k + 1. A delete operation on T
436
F. Le Gall and Y. Yoshida
removes an element a ∈ Π: the new table is the restriction of T to the domain (Π\{a}) × (Π\{a}), giving a table of size (k − 1). Its cost is 2k − 1. The edit distance between two tables T and T is the minimum cost needed to transform T to T by the above exchange, insert and delete operations. A multiplication table for a magma (Γ, ◦) is a table T : Π ×Π → N of size |Γ | for which the values are in one-to-one correspondence with elements in Γ , i.e., there exists a bijection σ : Π → Γ such that T (a, b) = σ −1 (σ(a)◦ σ(b)) for any a, b ∈ Π. We now define the edit distance between two magmas, which will enable us to compare magmas with distinct grounds sets, and especially magmas with ground sets of different sizes. This is the same definition as the one used in Ref. [9]. Definition 2. The edit distance between two magmas (Γ, ◦) and (Γ , ∗), denoted edit((Γ, ◦), (Γ , ∗)), is the minimum edit distance between T and T where T (resp. T ) runs over all tables corresponding to a multiplication table for (Γ, ◦) (resp. (Γ , ∗)). We now explain the concept of distance to a class of groups. Definition 3. Let C be a class of groups and (Γ, ◦) be a magma. We say that (Γ, ◦) is δ-far from C with respect to the Hamming distance if min
∗ : Γ ×Γ →Γ (Γ,∗) is a group in C
HamΓ (◦, ∗) ≥ δ|Γ |2 .
We say that (Γ, ◦) is δ-far from C with respect to the edit distance if min
(Γ ,∗) (Γ ,∗) is a group in C
edit((Γ, ◦), (Γ , ∗)) ≥ δ|Γ |2 .
Notice that if a magma (Γ, ◦) is δ-far from a class of groups C with respect to the edit distance, then (Γ, ◦) is δ-far from C with respect to Hamming distance. The converse is obviously false in general. Since some of our results assume that the size of Γ is not known, we cannot suppose that the set Γ is given explicitly. Instead we suppose that an upper bound q of the size of Γ is given, and that each element in Γ is represented uniquely by a binary string of length log2 q. One oracle is available that generates a string representing a random element of Γ , and another oracle is available that computes a string representing the product of two elements of Γ . We call this representation a binary structure for (Γ, ◦). This is essentially the same model as the one used in Ref. [9,10] and in the black-box group literature (see, e.g., Ref. [2]). The formal definition follows. Definition 4. A binary structure for a magma (Γ, ◦) is a triple (q, O1 , O2 ) such that q is an integer satisfying q ≥ |Γ |, and O1 , O2 are two oracles satisfying the following conditions: (i) there exists an injective map π from Γ to Σ = {0, 1}log2 q ; (ii) the oracle O1 chooses an element x ∈ Γ uniformly at random and outputs the (unique) string z ∈ Σ such that z = π(x).
Property Testing for Cyclic Groups and Beyond
437
(iii) on two strings z1 , z2 in the set π(Γ ), the oracle O2 takes the (unique) element x ∈ Γ such that x = π −1 (z1 ) ◦ π −1 (z2 ) and outputs π(x). (The action of O2 on strings in Σ\π(Γ ) is arbitrary.) We now give the formal definition of an -tester. Definition 5. Let C be a class of groups and let be any value such that 0 < ≤ 1. An -tester with respect to the edit distance (resp., to the Hamming distance) for C is a randomized algorithm A such that, on any binary structure for a magma (Γ, ◦), (i) A outputs “PASS” with probability at least 2/3 if (Γ, ◦) satisfies property C ; (ii) A outputs “FAIL” with probability at least 2/3 if (Γ, ◦) is -far from C with respect to the edit distance (resp., to the Hamming distance).
3
A Lower Bound for Testing Cyclic Groups
Suppose that we only know that an input instance (Γ, ◦) satisfies |Γ | ≤ q, where q is an integer known beforehand. In this section, we show that any randomized algorithm then requires Ω(q 1/6 ) queries to test whether (Γ, ◦) is close to the class of cyclic groups. More precisely, we prove the following result. Theorem 1. Suppose that the size of the ground set is unknown and suppose that ≤ 1/23. Then the query complexity of any -tester for the class of cyclic 1 groups, with respect to the Hamming distance or the edit distance, is Ω(q 6 ). Theorem 1 is proved using Yao’s minimax principle. Specifically, we introduce two distributions of instances DY and DN such that every instance in DY is a cyclic group and every instance in DN is far from the class of cyclic groups. Then we construct the input distribution D as the distribution that takes an instance from DY with probability 1/2 and from DN with probability 1/2. If we can show that any deterministic algorithm, given D as an input distribution, requires Ω(q 1/6 ) queries to correctly decide whether an input instance is generated by DY or DN with high probability under the input distribution, we conclude that any randomized algorithm also requires Ω(q 1/6 ) queries to test whether an input is close to a cyclic group. We now explain in details the construction of the distribution D. Define q = √ q and let R be the set of primes in {q /2, . . . , q }. From the prime number theorem, we have |R| = Ω(q / log q ). We define DY as the distribution over binary structures (q, O1 , O2 ) for Zp2 where the prime p is chosen uniformly at random from R and the injective map π : Zp2 → {0, 1}log2 q hidden behind the oracles is also chosen uniformly at random. We define DN as a distribution over binary structures for Z2p in the same manner. Indeed, the order of any instance generated by those distributions is at most q. Every instance in DY is a cyclic group. From Lemma 1 below, we know that every instance in DN is 1/23-far (with respect to the edit distance, and thus with respect to the Hamming distance too) from the class of cyclic groups. Its proof is included for completeness in the full version of the paper [14].
438
F. Le Gall and Y. Yoshida
Lemma 1 ([11,12]). Let (G, ◦) and (H, ∗) be two nonisomorphic groups. Then 1 edit((G, ◦), (H, ∗)) ≥ 23 max(|G|2 , |H|2 ). In order to complete the proof of Theorem 1, it only remains to show that distinguishing the two distributions DY and DN is hard. This is the purpose of the following proposition. Proposition 1. Any deterministic algorithm that decides with probability larger than 2/3 whether the input is from the distribution DY or from the distribution DN must use Ω(q 1/6 ) queries. Let us first give a very brief overview of the proof of Proposition 1. We begin by showing how the distributions DY and DN described above can equivalently be created by first taking a random sequence of strings, and then using some constructions CY and CN , respectively, which are much easier to deal with. In particular, the map π in the constructions CY and CN is created “on the fly” during the computation using the concept of a reduced decision tree. We then show (in Lemma 2) a Ω(q 1/6 )-query lower bound for distinguishing CY and CN . Proof (of Proposition 1). Let A be a deterministic algorithm with query complexity t. We suppose that t ≤ q, otherwise there is nothing to do. The algorithm A can be seen as a decision tree of depth t. Each internal node in the decision tree corresponds to a query to either O1 or O2 , and each edge from such a node corresponds to an answer for it. The queries to O2 are labelled as O2 (s, s ), for elements s and s in Σ = {0, 1}log2 q . Each answer of a query is a binary string in Σ. Each leaf of the decision tree represents a YES or NO decision (deciding whether the input is from DY or from DN , respectively). Since we want to prove a lower bound on the query complexity of A , we can make freely a modification that gives a higher success probability on all inputs (and thus makes the algorithm A more powerful). We then suppose that, when A goes through an edge corresponding to a string already seen during the computation, then A immediately stops and outputs the correct answer. With this modification, A reaches a leaf if and only if it did not see the same string twice. We refer to Figure 1(a) for an illustration. We first consider the slightly simpler case where the algorithm A only uses strings obtained from previous oracle calls as the argument of a query to O2 . In other words, we suppose that, whenever an internal node v labelled by O2 (s, s ) is reached, then both s and s necessarily label some edge in the path from the root of the tree to v (notice that this is the case for the algorithm of Figure 1(a)). We will discuss at the end of the proof how to deal with the general case where A can also query O2 on strings created by itself (e.g., on the all zero string or on strings taken randomly in Σ). Let us fix a sequence = (σ1 , . . . , σ|Σ| ) of distinct strings in Σ. Starting from the root u of the decision tree (located at level i = 1), for each internal node located at level i ∈ {1, . . . , t}, we only keep the outgoing branches labelled by strings σ1 , . . . , σi , and we call the edge corresponding to σi an unseen edge (remember that t ≤ q ≤ |Σ|). This construction gives a subtree of the decision
Property Testing for Cyclic Groups and Beyond O1 s1
s1 s2 s3
O1
s2
s3
O2 (s2 , s2 )
O2 (s3 , s3 )
s4
s4
s3 O2 (s3 , s3 )
s1 s2 s3 s4
O2 (s2 , s3 ) s1 s2
s3 s4 O2 (s4 , s3 )
s3 s4
s1 s2
(a)
439
O2 (s4 , s3 )
s3 s4
s1
s3 s4
(b)
Fig. 1. (a) The decision tree of a deterministic algorithm for q = 4 and Σ = {s1 , s2 , s3 , s4 }. A dotted arrow means that the computation stops and that the correct answer is systematically output. The leaves are the squared nodes. (b) The reduced decision tree associated with the sequence = (s3 , s4 , s1 , s2 ). The unseen edges are represented by plain arrows.
tree rooted at u that we call the reduced decision tree associated with . Note that this subtree has exactly one leaf. See Figure 1(b) for an illustration. Let us fix p ∈ R and let G be either Zp2 or Z2p with the group operation denoted additively. We now describe a process, invisible to the algorithm A , which constructs, using the sequence , a map π : G → Σ defining a binary structure (q, O1 , O2 ) for G. The map π is constructed “on the fly” during the computation. The algorithm starts from the root and follows the computation through the reduced decision tree associated with . On a node corresponding to a call to O1 , the oracle O1 chooses a random element x of the group. If this element has not already appeared, then π(x) is fixed to the string of the unseen edge of this node. The oracle O1 outputs this string to the algorithm A , while x is kept invisible to A . If the element x has already appeared, then the process immediately stops — this is coherent with our convention that A stops whenever the same string is seen twice. On a node corresponding to a call to O2 (s, s ), the elements x and x such that π(x) = s and π(x ) = s have necessarily been already obtained at a previous step from our assumption. If the element x + x has not already appeared, then π(x + x ) is fixed to the string of the unseen edge of this node. Otherwise the process stops. By repeating this, the part of the map π related to the computation (i.e., the correspondence between elements and strings for all the elements appearing in the computation) is completely defined by and by the elements chosen by the oracle O1 . If necessary, the map π can then be completed. On the example of Figure 1(b), if the input is Z4 = {0, 1, 2, 3} and O1 chooses the element 3, then the path followed is the path starting from the root labelled by s3 , s4 , s1 which defines π(3) = s3 , π(2) = s4 , and π(1) = s1 . For a fixed sequence , let CY (resp. CN ) be the “on the fly” construction for Zp2 (resp. Z2p ) obtained by first choosing p uniformly at random from R, and then defining π while running the algorithm, as detailed above. The distribution DY (resp. DN ) coincides with the distribution that takes a sequence
= (σ1 , . . . , σ|Σ| ) of |Σ| strings in Σ uniformly at random without repetition and
440
F. Le Gall and Y. Yoshida
then create binary structures (q, O1 , O2 ) using CY (resp. CN ). Thus, to prove Proposition 1, it suffices to use the following lemma. Lemma 2. Let be any fixed sequence of |Σ| distinct strings in Σ. If A decides correctly with probability larger than 2/3 whether the input has been created using CY or using CN , then t = Ω(q 1/6 ). Proof (of Lemma 2). Let v1 , . . . , vn be the set of nodes in the reduced decision tree associated with , and let S ⊆ {1, . . . , n} (resp., T ⊆ {1, . . . , n}) be the set of indexes i such that vi is a query to O2 (resp., to O1 ). Notice that |S| + |T | ≤ t. For each index j ∈ T , we set αj as a random variable representing the element chosen by O1 at node vj . Here, αj ∈ Zp2 when CY generates Zp2 , and αj ∈ Z2p when CN generates Z2p . Since only additions are allowed as operations on the set {α j }j∈T , the output to a query vi for i ∈ S can be expressed as π(ai ) where ai = j∈T kji αj is a linear combination of the variables in {αj }j∈T . Here all coefficients kji are non-negative and at least one coefficient must be positive. We define the function aii = ai − ai = j∈T (kji − kji )αj for every i = i ∈ S. Without loss of generality, we assume that each aii is a nonzero polynomial (i.e., there exists at least one index j such that kji = kji ). This is because, otherwise, the element (and the string) appearing at node vi is always the same as the element (and the string) appearing at node vi , and thus one of the two nodes vi and vi can be removed from the decision tree. For any positive integer m, we say that aii is constantly zero modulo m if m divides kji − kji for all indexes j ∈ T . We say that a prime p ∈ R is good if there exist i = i ∈ S such that the function aii is constantly zero modulo p. We say that p ∈ R is bad if, for all i = i ∈ S, the function aii is not constantly zero modulo p (as shown later, when p is bad, it is difficult to distinguish if the input is Zp2 or Z2p ). We denote by RG ( ) ⊆ R the set of good primes. 1/3
|R| We first suppose that |RG ( )| > |R|/6. Let M denote the value log 2/3 q . As sume the existence of a subset RG ( ) ⊆ RG ( ) of size |RG ( )| ≥ M such that there exist i = i ∈ S for which aii is constantly zero modulo p for every p ∈ RG ( ). Since all p ∈ RG ( ) are primes, andaii is not the zero-polynomial, aii must have a nonzero coefficient divisible by p∈R () p. To create such a coefG ficient, we must have t ≥ log2 p∈R () p = Ω(|RG ( )| log q ) = Ω((|R| log q )1/3 ). G Now assume that there exists no such subset RG ( ). Then, for each i = i ∈ S, at most M primes p have the property that aii is constantly zero modulo p. This implies that |RG ( )| ≤ M · |S|(|S| − 1)/2 ≤ M · t(t − 1)/2. Since |RG ( )| > |R|/6, it follows that t = Ω((|R| log q )1/3 ). Thus, for both cases, we have t = Ω((|R| log q )1/3 ) = Ω(q 1/6 ). Hereafter we suppose that |RG ( )| ≤ |R|/6. Assume that the leaf of the reduced decision tree corresponds to a YES decision. Recall that, if the computation does not reach the leaf, A always outputs the correct answer. From these observations, we give the following upper bound on the overall success probability:
r+(1−r)(ρY ·1+(1−ρY )·1) r+(1−r)(ρN ·1+(1−ρN )·0) 1+r+(1−r)ρN + = , 2 2 2
Property Testing for Cyclic Groups and Beyond
441
G ()| where r = |R|R| is the probability of p being good, and ρY (resp., ρN ) is the probability that A does not reach the leaf conditioned on the event that the instance is from CY (resp., from CN ) and p is a bad prime. Since |RG ( )| ≤ |R|/6, 7 5 the above success probability has upper bound 12 + 12 ρN . When the leaf of the reduced decision tree corresponds to a NO decision, a similar calculation gives 7 5 that the overall success probability is at most 12 + 12 ρY . We now give an upper bound on ρY and ρN . Let us fix p ∈ R\RG ( ). Since p is bad, each aii for i = i ∈ S is not constantly zero modulo p. When CY generates Zp2 , the probability that aii becomes 0 after substituting values into {αj }j∈T is then exactly 1/p2 (since the values of each αj uniformly distribute over Zp2 and there is a unique solution in Zp2 to the equation aii = 0 once all but one values are fixed). By the union bound, the probability ρY thus satisfies ρY ≤ |S|(|S|−1) ≤ t(t−1) ≤ 2 · t(t−1) . Similarly, when CN generates Z2p , the probability 2p2 2p2 (q )2 that aii becomes 0 after substituting values into {αj }j∈T is also exactly 1/p2 . Thus, the probability ρN also satisfies ρN ≤ |S|(|S|−1) ≤ t(t−1) ≤ 2 · t(t−1) . 2p2 2p2 (q )2 To achieve overall success probability at least 2/3, we must have either ρY ≥ 1/5 or ρN ≥ 1/5, and thus t = Ω(q ) = Ω(q 1/2 ).
Finally, we briefly explain how to deal with the general case where A can make binary strings by itself and use them as arguments to O2 . The difference is that now a string s not seen before can appear as an argument to O2 . Basically, what we need to change is the following two points: First, in the “on the fly” construction of π from , if such a query appears then an element x is taken uniformly at random from the set of elements of the input group not already labelled, and the identification π(x) = s is done. Second, in the proof of Lemma 2, another random variable is introduced to represent the element associated with s. With these modifications the same lower bound t = Ω(q 1/6 ) holds. This concludes the proof of Proposition 1.
4
A Lower Bound for Testing the Number of Generators in a Group
In this section we show that, even if the size of the ground set Γ is known, it is hard to test whether (Γ, ◦) is close to an abelian group generated by k elements for any value k ≥ 2. We prove the following theorem using a method similar to the proof of Theorem 1. See the full version of the paper [14] for details. Theorem 2. Let k ≥ 2 be an integer and suppose that ≤ 1/23. Then the query complexity of any -tester for the class of abelian groups generated by k elements is 1 2 Ω(|Γ | 6 − 6(3k+2) ) if k is even, 1
4
Ω(|Γ | 6 − 6(3k+1) )
if k is odd.
Moreover, these bounds hold with respect to either the Hamming distance or the edit distance, and even when |Γ | is known.
442
5
F. Le Gall and Y. Yoshida
Testing If the Input Is Cyclic When |Γ | Is Known
In this section we study the problem of testing, when |Γ | is known, if the input (Γ, ◦) is a cyclic group or is far from the class of cyclic groups. Let us denote m = |Γ |, and suppose that we also know its factorization m = pe11 · · · perr where the pi ’s are distinct primes. Let Cm = {0, . . . , m − 1} be the cyclic group of integers modulo m and, for any i ∈ {1, . . . , r}, denote by Cm,i = {0, pmi , . . . , (pi − 1) pmi } its subgroup of order pi . The group operation in Cm is denoted additively. Algorithm CyclicTest input: a magma (Γ, ◦) given as a binary structure (q, O1 , O2 ) the size m = |Γ | and its factorization m = pe11 · · · perr 1 decision ← FAIL; counter ← 0; 2 while decision = FAIL and counter ≤ d1 = Θ(log log m) do 3 decision ← PASS; 4 Take an element γ uniformly at random in Γ ; 5 Repeat the following test d2 = Θ(−1 log log log m) times: 6 take two elements x, y uniformly at random in Cm ; 7 if fγ (x + y) = fγ (x) ◦ fγ (y) then decision ← FAIL; 8 for i ∈ {1, . . . , r} do 9 take two arbitrary distinct elements x, y in Cm,i ; 10 take d3 = Θ(log log log m) elements u1 , . . . , ud3 at random in Cm ; 11 if there exists j ∈ {1, . . . , d3 } such that fγ (x + uj ) = fγ (y + uj ) 12 then decision ← FAIL; 13 counter ← counter +1; 14 output decision; Fig. 2. Algorithm CyclicTest
For any γ ∈ Γ , we now define a map fγ : Cm → Γ such that fγ (a) represents the a-th power of γ. Since the case where ◦ is not associative has to be taken in consideration and since we want to evaluate efficiently f , this map is defined using the following rules. ⎧ fγ (1) = γ ⎪ ⎪ ⎨ fγ (a) = γ ◦ f (a − 1) if 2 ≤ a ≤ m − 1 and a is odd f (a) = f (a/2) ◦ f (a/2) if 2 ≤ a ≤ m − 1 and a is even ⎪ γ γ γ ⎪ ⎩ fγ (0) = γ ◦ f (m − 1) The value of fγ (a) can then be computed with O(log m) uses of the operation ◦. Notice that if (Γ, ◦) is a group, then fγ (a) = γ a for any a ∈ {0, . . . , m − 1}. For any > 0, our -tester for cyclic groups is denoted CyclicTest and is described in Figure 2. The input (Γ, ◦) is given as a binary structure (q, O1 , O2 ) with q ≥ m. In the description of Figure 2, operations in (Γ, ◦), such as taking a random element or computing the product of two elements, are implicitly performed by using the oracles O1 and O2 . The correctness of this algorithm and upper bounds on its complexity are shown in the following theorem. A proof is given in the full version of the paper [14].
Property Testing for Cyclic Groups and Beyond
443
Theorem 3. For any value > 0, Algorithm CyclicTest is an -tester for cyclic groups with respect to both the edit distance and the Hamming distance.
m Its query and time complexities are O (log m + log log ) · log q · log log log m . Acknowledgments. The authors are grateful to G´abor Ivanyos for communicating to them Lemma 1 and an outline of its proof. FLG acknowledges support from the JSPS, under the grant-in-aid for research activity start-up No. 22800006.
References 1. Babai, L.: Local expansion of vertex-transitive graphs and random generation in finite groups. In: Proc. of STOC 1991, pp. 164–174 (1991) 2. Babai, L., Szemer´edi, E.: On the complexity of matrix group problems I. In: Proc. of FOCS 1984, pp. 229–240 (1984) 3. Ben Or, M., Coppersmith, D., Luby, M., Rubinfeld, R.: Non-abelian homomorphism testing, and distributions close to their self-convolutions. In: Jansen, K., Khanna, S., Rolim, J.D.P., Ron, D. (eds.) RANDOM 2004 and APPROX 2004. LNCS, vol. 3122, pp. 273–285. Springer, Heidelberg (2004) 4. Blum, M., Luby, M., Rubinfeld, R.: Self-testing/correcting with applications to numerical problems. J. Comput. Syst. Sci. 47(3), 549–595 (1993) 5. Cheung, K., Mosca, M.: Decomposing finite abelian groups. Quantum Information and Computation 1(3), 26–32 (2001) 6. Cleve, R.: The query complexity of order-finding. Inf. Comput. 192(2), 162–171 (2004) 7. Czumaj, A., Sohler, C.: Survey on sublinear-time algorithms. Bulletin of the EATCS 89, 23–47 (2006) 8. Erg¨ un, F., Kannan, S., Kumar, R., Rubinfeld, R., Viswanathan, M.: Spot-checkers. J. Comput. Syst. Sci. 60(3), 717–751 (2000) 9. Friedl, K., Ivanyos, G., Santha, M.: Efficient testing of groups. In: Proc. of STOC 2005, pp. 157–166 (2005) 10. Inui, Y., Le Gall, F.: Quantum property testing of group solvability. Algorithmica 59(1), 35–47 (2011) 11. Ivanyos, G.: Classical and quantum algorithms for algebraic problems. Thesis for the degree “Doctor of the Hungarian Academy of Sciences” (2007) 12. Ivanyos, G.: Personal Communication (2010) 13. Kiwi, M.A., Magniez, F., Santha, M.: Exact and approximate testing/correcting of algebraic functions: A survey. In: Khosrovshahi, G.B., Shokoufandeh, A., Shokrollahi, M.A. (eds.) Theoretical Aspects of Computer Science 2000. LNCS, vol. 2292, pp. 30–83. Springer, Heidelberg (2002) 14. Le Gall, F., Yoshida, Y.: Property testing for cyclic groups and beyond, Full version of the present paper available at http://arxiv.org/abs/1105.1842 15. Rajagopalan, S., Schulman, L.J.: Verification of identities. SIAM J. Comput. 29(4), 1155–1163 (2000) 16. Ron, D.: Property testing. In: Handbook of Randomized Computing, pp. 597–649. Kluwer Academic Publishers, Dordrecht (2001) 17. Shpilka, A., Wigderson, A.: Derandomizing homomorphism testing in general groups. SIAM J. Comput. 36(4), 1215–1230 (2006)
Canonizing Hypergraphs under Abelian Group Action V. Arvind1 and Johannes K¨obler2 1 2
The Institute of Mathematical Sciences, Chennai 600 113, India [email protected] Institut f¨ ur Informatik, Humboldt Universit¨ at zu Berlin, Germany [email protected]
Abstract. We study the problem of canonizing hypergraphs under Abelian group action and show tight complexity bounds. Our approach is algebraic. We transform the problem of graph canonization to the problem of canonizing associated algebraic structures for which we develop a parallel algorithm. Specifically, we show that the problem of computing canonical labelings for hypergraphs of color class size 2 is computable in FL⊕L . For general hypergraphs, under Abelian permutation group action, for the canonization problem we show an upper bound of randomized FLGapL (which is contained in randomized NC2 ). This is a nearly tight characterization since the problem is hard for the complexity class FLGapL .1 The problem is also in deterministic NC3 .
1
Introduction
Computing canonical forms for combinatorial and algebraic structures is a fundamental algorithmic problem. Graph canonization, in particular, has received a lot of attention for its close connection to the graph isomorphism problem GI. Two graphs X1 = (V1 , E1 ) and X2 = (V2 , E2 ) are isomorphic (denoted X1 ∼ = X2 ) if there is a bijection φ : V1 → V2 such that for all e = {u, v} ⊆ V , {u, v} ∈ E1 if and only if {φ(u), φ(v)} ∈ E2 . A mapping f : K → K on a class K of graphs is a canonizing function for K if for all pairs of isomorphic graphs X ∼ = X ∼ in K, f (X) = f (X ) and f (X) = X. We say that f assigns a canonical form to each isomorphism class of K. We could define f (X) as the lexicographically least graph in K isomorphic to X. However, this particular canonizing function is known to be NP-hard to compute [7, Section 3.1] for certain graph orderings on the class of all (finite) graphs; although it is computable in FPNP by prefix search. It is a long-standing open question, whether there is some canonizing function for graphs that is polynomial-time computable. No better bound than FPNP is known for general graphs (for any canonizing function). Further, it is an intriguing open question if graph canonization is polynomial-time equivalent to graph isomorphism. For natural subclasses of graphs for which graph isomorphism has 1
The class FLGapL consists of all functions computable by a logspace machine with oracle access to the integer determinant.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 444–455, 2011. c Springer-Verlag Berlin Heidelberg 2011
Canonizing Hypergraphs under Abelian Group Action
445
an efficient algorithm there is usually an accompanying canonization algorithm [7] of comparable complexity (see, e.g., [16,12,9]); but finding such a canonization procedure often requires substantial additional efforts (cf., e.g., [7,4]). In their seminal work, Babai and Luks [7] introduced a group theoretic approach to tackle the graph canonization problem; it is the same approach which they use for GI. This approach has yielded the best running time bound to date for graph isomorphism testing and graph canonization: a deterministic algorithm √ of running time c n log n , an nO(log n) time algorithm for canonization of tournaments, and an nO(b) time algorithm for graphs with maximum degree b [7]. The latter two results rely on the special structure of the automorphism groups of the considered graphs. In general, all the canonization algorithms in [7] exploit the structure of permutation groups. The best known hardness result for general graph isomorphism due to Tor´ an [18] is the class DET of problems NC1 Turing reducible to computing the integer determinant (a subclass of NC2 ). Therefore, it is natural to conjecture that, for polynomial-time solvable restricted versions of graph isomorphism, both isomorphism and canonization have NC algorithms. It is natural to ask whether graph canonization under solvable permutation groups, shown to be in P in [7], also has an NC algorithm. Solvable permutation groups are algorithmically well-studied. Exploiting the structure of solvable permutation groups, it is shown by Luks and McKenzie [14] that several natural group theoretic problems have NC3 algorithms for solvable permutation groups. However, it is not clear to us if the techniques of [14] can be directly used to canonize graphs under solvable group action. In particular, we do not see how to parallelize the Babai-Luks graph canonization procedure [7]. Broadly speaking, the Babai-Luks algorithm is based on a “divide and conquer” strategy. It uses the group structure to decompose the domain into orbits, and then sequentially canonizes the induced substructures on the orbits. Typically, it works as follows: given a graph G = (V, E) and a subgroup H of Sn w.r.t. which we wish to canonize G, we will decompose G into an ordered list of smaller graphs/structures G1 , G2 , . . . , Gk , and canonize G1 first to obtain a canonizing subcoset H1 σ1 ⊂ H, and then canonize G2 w.r.t. H1 σ1 and so on until all the smaller structures are canonized. Then the canonical form and canonizing coset for G can be recovered from the final canonizing coset. We note one problem with directly parallelizing the above algorithm: if we compute the canonizing cosets for the graphs Gi in parallel, these cosets for the different Gi may have no element in common which can be used to canonize the entire graph G. Results of This Paper In this paper we address the problem of designing parallel algorithms for canonizing graphs (and even hypergraphs) under the action of Abelian permutation groups. We can exploit the structure of finite abelian groups and transform the problem of canonization to a linear algebraic problem which has parallel (i.e. NC) algorithms. More precisely, we can transform the problem of canonizing graphs
446
V. Arvind and J. K¨ obler
under Abelian groups to computing canonical forms for certain linear algebraic objects (like matrices over finite rings). In fact, we consider the canonization of hypergraphs and not just graphs under the action of Abelian groups. Despite the fact that hypergraph canonization is, in general, polynomial-time reducible to graph canonization (just as hypergraph isomorphism reduces to graph isomorphism by a natural encoding of a hypergraph as a bipartite graph), this reduction does not seem to carry over to the case when we restrict the action on the vertices by a given group G, without changing the structure of the given group. We overcome this problem by dealing with hypergraphs directly. Our results are the following: – The first problem we study is the canonization of 2-bounded hypergraphs: I.e. hypergraphs where the vertex set is colored with color classes of size at most 2. We considered the isomorphism problem for 2-bounded hypergraphs in [5] and showed that it is ⊕L complete, which is in interesting contrast to the logspace completeness of isomorphism testing of usual graphs with color classes of size 2 [11]. In this paper we show that even the canonization of 2-bounded hypergraphs is logspace reducible to ⊕L. Since the natural group action here, when the vertex set is partitioned into color classes of size 2, is the elementary Abelian 2-group (equivalently, we can consider the group as the vector space Fm 2 acting on the m color classes), this is the simplest instance of canonization under an Abelian group action. Our algorithm reduces the problem to linear computations over F2 and hence we obtain the ⊕L upper bound. – Motivated by the above problem, we consider canonization of arbitrary hypergraphs under Abelian permutation group action. We can suitably generalize the approach used for 2-bounded hypergraphs in order to get an upper bound of randomized NC2 (in fact, randomized FLGapL ). Since the problem can be shown hard for GapL even for usual graphs, this too is a fairly tight characterization. The problem is also in deterministic NC3 .
2
Complexity Classes
In this section we recall definitions of some complexity classes relevant to this paper. Let Σ denote the finite alphabet in which input instances are encoded as strings. A language L ⊆ Σ ∗ is the set of “yes” instances of a decision problem. Let P denote the class of languages accepted by deterministic polynomial time Turing machines. Likewise, let L denote the class of languages accepted by deterministic logspace Turing machines. It is useful to also define the corresponding function class FL consisting of functions f : Σ ∗ −→ Σ ∗ that are computable by deterministic logspace transducers: in a logspace transducer, we note that the input tape is read-only, the worktape is logarithmically space bounded, and the output tape is write-only with a 1-way head. The nondeterministic class NL consists of languages accepted by nondeterministic logarithmic space bounded Turing machines. Logspace counting classes were introduced in [8,3,2], analogous to #P, GapP, and Modk P. These complexity
Canonizing Hypergraphs under Abelian Group Action
447
classes have provided a tight classification of many natural computational problems between L and NC2 [1]. We formally define the class GapL which is required for the present paper. Definition 1. GapL is the class of functions f : Σ ∗ → Z, for which there is a logspace bounded nondeterministic Turing machine M such that on input x ∈ Σ ∗ , we have f (x) = accM (x) − rejM (x), where accM (x) is the number of accepting paths of M on input x and rejM (x) is the number of rejecting paths. The class FLGapL consists of functions f : Σ ∗ → Σ ∗ computable by a deterministic logspace oracle transducer that has access to a GapL oracle.2 Recall that logspace-uniform NCk , for a positive integer k, consists of all languages that are computable by a family of polynomial-size, O(logk n) depth circuits {Cn }. Furthermore, there is a uniform logspace deterministic Turing machine that takes 0n as input and outputs the circuit Cn . The corresponding function classes are, by abuse of notation, also denoted by NCk (instead of FNCk ). A language L is said to be in randomized NCk if there is a family of polynomialsize, O(logk n) depth circuits {Cn } and a polynomial r(n) such that for all x ∈ Σ n and for a uniformly picked random string w ∈ {0, 1}r(n), Prob[x ∈ L iff Cn (x, w) = 1] ≥ 2/3. Similarly, a function f is said to be in randomized FLGapL if there is an FLGapL transducer M and a polynomial r(n) such that for all x ∈ Σ n and for a uniformly picked random string w ∈ {0, 1}r(n), Prob[M (x, w) = f (x)] ≥ 2/3. Notice that M has two-way access to the probabilistic bits, in contrast to the usual way that randomized logspace classes such as RL and PL are defined. Further notice that the success probability of a randomized FLGapL machine 1 can be amplified from 2/3 to 1 − 2p(n) for any polynomial p(n) by a majority voting procedure as follows: For each i, we can compute the ith bit of f (x) with 1 probability 1 − 2p(n) by computing the majority of the ith bits of M (x, wj ) for independently randomly picked wj , 1 ≤ j ≤ q(n), for a suitably large polynomial q(n). The probability that all the bits of f (x) are correctly computed by this (x)| method is clearly at least 1 − |f as desired. 2p(n) By choosing p(n) suitably large we can see using a standard argument that randomized FLGapL is contained in FLGapL /poly.3 Finally, we note that it is wellknown that FLGapL is contained in NC2 (cf. [2]) and randomized FLGapL is contained in randomized NC2 . 2
3
To explain the oracle access mechanism more precisely, the FL machine will write each GapL query onto a query tape, from left to right, in a write-only mode. The oracle answer to the query, which is an integer, is written on a read-only answer tape. Note that the FL machine can access any specific bit of the query answer but can store only logarithmically many of them on its working tape. Indeed, using standard probability amplification techniques, we can see that randomized FLGapL coincides with FLGapL /poly with the additional property that a random string is a correct advice string with high probability.
448
3
V. Arvind and J. K¨ obler
Preliminary Observations
For an integer k, [k] denotes the set {1, . . . , k}. For a finite set A, we use A to denote its cardinality. We next recall definitions and some basic facts about permutation groups [19,13]. A permutation group G is a subgroup of Sym(V ), where Sym(V ) is the group of all permutations on an n-element set V . We write H ≤ G when H is a subgroup of G. The image of v ∈ V under g ∈ G is denoted vg . This can be extended to subsets (i.e. unary relations) W ⊆ V by letting W g = {wg | w ∈ W } and more generally to arbitrary relations and operations over V . We apply permutations from left to right so that v gh = (v g )h . The set v G = {v g | g ∈ G} is the G-orbit of v. A permutation group G ≤ Sym(V ) is transitive on V if v G = V for v ∈ V . For S ⊆ Sym(V ), the group S generated by S is the smallest subgroup of Sym(V ) containing S. As V is finite, every element of the group S is expressible as a product of elements of S. We proceed with some general definitions and observations on canonization under group action. We say that a group G is acting on a set A, if there is an (injective) homomorphism τ : G → Sym(A) from G into the symmetric group Sym(A) on A. The action of an element g ∈ G on A is g : a → τ (g)(a). If X = (V, E) is a graph with vertex set V ⊆ A, we denote the image (V τ (g) , {eτ (g) | e ∈ E}) of X under τ (g) by X τ (g) or simply by X g when τ is clear from the context. Let X = (V, E) and X = (V, E ) be two graphs and let G be a group acting on the vertex set V . Then X and X are called G-isomorphic (denoted by X ∼ =G X ), if there is an element g ∈ G such that X = X g . We denote the set of all G-isomorphisms between X and X by Iso G (X, X ) = {g ∈ G | X = X g }. The set Iso G (X, X) of all G-automorphisms of X forms a subgroup of G and is denoted by Aut G (X). It is easy to see that for any two G-isomorphic graphs X and X , Iso G (X, X ) forms a right coset Aut G (X)g of Aut G (X), where g is an arbitrary G-isomorphism between X and X . Furthermore, Aut G (X)g = gAut G (X ), i.e., Aut G (X ) is a conjugate subgroup of Aut G (X). Let K be a class of graphs over the same vertex set V and let G be a group acting on V . Then a function c : K → G is called a G-canonical labeling for K, if ∀X, X ∈ K : X ∼ =G X ⇒ X c(X) = (X )c(X ) .
The graph X c(X) is called the G-canon of X (w.r.t. the canonical labeling c). The set {g ∈ G | X g = X c(X)} has the form Aut G (X)c(X) and is called the G-canonical labeling coset of X. It is straightforward to extend the definitions of G-isomorphism, Gautomorphism and G-canonical labeling to hypergraphs as well as to finite structures with arbitrary relations and operations. In the case G = Sym(V ) we usually omit the reference to G.
Canonizing Hypergraphs under Abelian Group Action
449
In the following useful lemma we show that under certain conditions it is possible to transform a canonical labeling c for a class of structures S to a canonical labeling c for a class of structures S. Lemma 2. Let G act on two classes of structures S and S . Suppose r : S → S is a mapping such that for all G-isomorphic structures X, X ∈ S it holds that the structures r(X) and r(X ) are G-isomorphic too and all G-isomorphisms between r(X) and r(X ) are also G-isomorphisms between X and X . Then any G-canonical labeling c for S yields a G-canonical labeling c : X → c (r(X)) for S. Proof. It suffices to show for all X, X ∈ S that X ∼ =G X implies X c(X) = c(X ) ∼ (X ) . By assumption, X =G X implies that ∅ = Iso G (r(X), r(X )) ⊆ Iso G (X, X ), and hence it follows that X∼ =G X ⇒ r(X) ∼ =G r(X )
⇔ r(X)c (r(X)) = r(X )c (r(X
))
⇔ c (r(X))c (r(X ))−1 ∈ Iso G (r(X), r(X )) ⇒ c (r(X))c (r(X ))−1 ∈ Iso G (X, X )
⇔ X c (r(X))c (r(X
))−1
= X
⇔ X c(X) = (X )c(X ) .
In combination with the above lemma the next lemma provides a way to reduce the canonization problem for a class of combinatorial structures to an algebraic canonization problem. Lemma 3. Let c be a G-canonical labeling for a class of structures S. Then for any X ∈ S and g ∈ G with X g ∈ S it holds that Iso G (X, X g ) = Iso G (c(X)−1 Aut G (X), c(X g )−1 Aut G (X g )). Proof. For any g ∈ G we can write the coset Iso G (X, X g ) = Aut G (X)g as Iso G (Aut G (X), Aut G (X)g). Hence using the equality Aut G (X)g = gAut G (X g ) it follows that Iso G (X, X g ) = Iso G (Aut G (X), gAut G (X g )) = Iso G (c(X)−1 Aut G (X), c(X)−1 gAut G (X g )). g
Since the canon X c(X) of X coincides with the canon (X g )c(X ) of X g , and since c(X)−1 gAut G (X g ) as well as c(X g )−1 Aut G (X g ) consist of all group elements that map this canon to X g , it follows that the latter two cosets coincide as well. We will also make use of the following lemma. It provides a way to reduce the canonization problem for a set {S1 , . . . , Sm } of structures to the problem of canonizing the single structures Si individually.
450
V. Arvind and J. K¨ obler
Lemma 4. Let G act on a class of structures S. Suppose that each S ∈ S has the same G-automorphism group Aut G (S) and that c is a G-canonical labeling for S. Then for any set {S1 , . . . , Sm } of structures from S, a G-canonical labeling cˆ({S1 , . . . , Sm }) = g can be computed by picking g as the labeling in {c(S1 ), . . . , c(Sm )} that yields the lexicographically smallest set {S1 , . . . , Sm }g . Proof. Suppose that the sets {S1 , . . . , Sm } and {S1 , . . . , Sm } are G-isomorphic g via g ∈ G and let π ∈ Sm be a permutation such that Si = Sπ(i) . Since c(Si ) is a ˆ G-canonical labeling for Si , c(Si ) maps Si to the canonical form Si of Si . Further, g c(S ) c(Sig ) maps Sig to the same canonical form Sˆi , implying that Si i = (Sig )c(Si ) which in turn implies that gc(Sig )(c(Si ))−1 ∈ Aut(Si ). Since all the structures gc(Sig )
Sj have the same G-automorphism group, it follows that Sj hence,
c(Si )
= Sj
and
g
c(Sπ(i) ) g c(Si ) } = {S1g , . . . , Sm } = {S1 , . . . , Sm }c(Si ) . {S1 , . . . , Sm Thus it is guaranteed that cˆ({S1 , . . . , Sm }) = cˆ({S1 , . . . , Sm }).
4
Canonizing Hypergraphs with Color Classes of Size 2
In this section we consider the problem of canonizing 2-bounded hypergraphs X, i.e. X has colored vertices such that each color class has at most 2 vertices. We show that the problem is in FL⊕L . Let X = (V, E) be a 2-bounded hypergraph with n color classes C1 , . . . , Cn . We can assume w.l.o.g. that each color class Ci has exactly two vertices and write Ci = {v0i , v1i }. In order to canonize X, for each color class Ci we have to decide which one of v0i and v1i is the first vertex in the canonical labeling of X. In other words, it suffices to canonize X under the elementary Abelian 2-group action consisting of one independent transposition for each color class. We can consider the group as the vector space Fn2 acting on the hyperedges in E as follows: a i vector x = (x1 , . . . , xn ) ∈ Fn2 maps e to the hyperedge ex = {vj⊕x | vji ∈ e}. i It is useful to represent a hyperedge e ∈ E as a vector e = (e1 , . . . , en ) ∈ (F2 ∪ {∗})n, where ei = 0, if e ∩ Ci = {v0i }, ei = 1, if e ∩ Ci = {v1i }, and ei = ∗ otherwise. Now each vector x ∈ Fn2 maps e to the hyperedge e ⊕ x, where the star is treated as an absorbing element (i.e. a ⊕ ∗ = ∗ for a ∈ F2 ). Since we wish to solve the canonization problem using linear algebra over F2 we need to get rid of this absorbing element ∗, which does not behave as a field element. To this end, we canonically decompose E into homogeneous pieces E1 , · · · , Ek as follows. For each hyperedge e, let the type of e be the n-vector type(e) = ( e ∩ C1 , · · · , e ∩ Cn ) with entries from {0, 1, 2}. Notice that a hyperedge e has a ∗ in the j th position iff its type type(e) has a 0 or 2 in the j th coordinate. We partition the set E of hyperedges into subsets E1 , . . . , Ek corresponding to the distinct hyperedge types. The lexicographical ordering on the types naturally induces a canonical ordering E1 , · · · , Ek on the homogeneous pieces.
Canonizing Hypergraphs under Abelian Group Action
451
Algorithm Overview. We now give an intuitive sketch of how our algorithm canonizes a 2-bounded hypergraph X. We first canonically decompose E into the homogeneous pieces E1 , · · · , Ek as described above. Then we show how to canonize each Ei individually and obtain its canonical labeling coset Aut(Ei )⊕ui , which is actually an affine subspace of Fn2 . The sequential approach of [7] would iteratively proceed by canonizing E2 w.r.t. the affine subspace Aut(E1 ) ⊕ u1 to obtain an affine subspace H2 ⊕ h2 , and then canonize E3 w.r.t. H2 ⊕ h2 and so on, until all the homogeneous pieces are canonized. However, it does not seem possible to carry this sequential procedure in FL⊕L . Also, computing all the Aut(Ei ) ⊕ ui in parallel and taking their intersection will fail because the intersection will, in general, have no common elements. Our solution turns out to be quite surprising. Instead of canonizing the hypergraph X we show that it suffices to canonize the tuple of affine subspaces (Aut(E1 ) ⊕ u1 , . . . , Aut(Ek ) ⊕ uk ) under the natural additive Fn2 action. In fact, the resulting canonical labeling coset also turns out to yield a canonical labeling coset for the hypergraph X itself! Further, it turns out that canonizing the tuple of affine subspaces (Aut(E1 ) ⊕ u1 , . . . , Aut(Ek ) ⊕ uk ) can be solved using some linear algebra over F2 . Here we crucially exploit the fact that the cosets Aut(Ei ) ⊕ ui are affine subspaces of Fn2 and we can compute their “dual objects”. We can then paste these dual objects together into a single object which we canonize using linear algebra computation. We now proceed with the details. We solve the problem of canonizing a 2bounded hypergraph X via the following chain of reductions: – Canonize a sequence (E1 , . . . , Ek ) of subsets Ei ⊆ {0, 1, ∗}n under the Fn2 action x : (E1 , . . . , Ek ) → (E1 ⊕ x, . . . , Ek ⊕ x), provided that any two elements e, e in the same set Ei have stars at identical positions. – Canonize a sequence (H1 ⊕ u1 , . . . , Hk ⊕ uk ) of affine subspaces of Fn2 under the Fn2 -action x : (H1 ⊕ u1 , . . . , Hk ⊕ uk ) → (H1 ⊕ u1 ⊕ x, . . . , Hk ⊕ uk ⊕ x), where the subspaces Hi are given by spanning sets. – Canonize a sequence (B1 , b1 , · · · , Bk , bk ) of pairs (Bi , bi ) consisting of an (li × n)-matrix Bi over F2 and a vector bi ∈ Fl2i under the Fn2 -action x : (B1 , b1 , · · · , Bk , bk ) → (B1 , B1 x ⊕ b1 , · · · , Bk , Bk x ⊕ bk ). – Canonize a single such pair (B, b) under the Fn2 -action x : (B, b) → (B, Bx ⊕ b). Using this chain of reductions, we transform X in FL⊕L into a pair (B, b) consisting of an (l × n)-matrix B and a vector b ∈ Fl2 such that for any two isomorphic hypergraphs X and X the corresponding pairs (B, b) and (B , b ) fulfill the following two properties: B = B and for any vector x ∈ Fn2 , x is an isomorphism between X and X iff Bx ⊕ b = b . As we let x ∈ Fn2 act on the pair (B, b) via (B, b) → (B, Bx + b), this means that for any two isomorphic hypergraphs X and X we have Iso Fn2 (X, X ) = Iso Fn2 ((B, b), (B , b )). Hence we can apply Lemma 2 to derive from any Fn2 -canonical labeling c ∈ FL⊕L for the pairs (B, b) an FL⊕L computable Fn2 -canonical labeling c for the hypergraphs X. We next explain how the four reduction steps can be performed. In the first step we transform X into the sequence r1 (X) = (E1 , · · · , Ek ) of its homogeneous
452
V. Arvind and J. K¨ obler
pieces as described above. It is easy to see that the transformation r1 can be performed in FL and that for any two isomorphic hypergraphs X and X we have Iso Fn2 (X, X ) = Iso Fn2 (r1 (X), r1 (X )). In the second step we let Hi = Aut(Ei ) ⊆ Fn2 be the group of all automorphisms of Ei , i.e. Hi = {x ∈ Fn2 | Ei ⊕ x = Ei }. Further we pick a canonical labeling ui in Fn2 such that the subset Ei ⊕ ui becomes lexicographically least. Notice that Hi ⊕ui is a Fn2 -canonical labeling coset for Ei . The next lemma shows that the transformation r2 : (E1 , · · · , Ek ) → (Aut(E1 ) ⊕ u1 , . . . , Aut(Ek ) ⊕ uk ) can be performed in logspace. Lemma 5. Let Ei be any homogeneous piece of the 2-bounded hypergraph E with n color classes. An Fn2 -canonical labeling coset Aut(Ei ) ⊕ ui for Ei can be computed in logspace, where ui ∈ Fn2 and Aut(Ei ), the automorphism group of Ei , is a subspace of Fn2 . Proof. Let h be an arbitrary hyperedge in Ei and let Ui , Wi ⊂ Fn2 be the subspaces defined as Ui = {v ∈ Fn2 | vj = 0 if hj = ∗} and Wi = {v ∈ Fn2 | vj = 0 if hj = ∗}. Further, for a hyperedge e ∈ {0, 1, ∗}n let eˆ ∈ Fn2 be the vector with eˆj = 0 whenever ej = ∗ and eˆj = ej , otherwise. We first show how to canonize a single hyperedge e of Ei . Notice that Aut(e) = Ui , since exactly the vectors in Ui leave e invariant. Hence, it is easy to see that Ui ⊕ eˆ is an Fn2 -canonical labeling coset for e. Since all hyperedges e in Ei have the same automorphism group Ui , we can apply Lemma 4 to get a canonical labeling ui for Ei . In fact, it suffices to cycle ˆi = {ˆ through all vectors eˆ ∈ E e | e ∈ Ei } and pick ui such that the subset Ei ⊕ui becomes lexicographically least. Clearly, ui can be computed in logspace. It remains to compute (a spanning set for) Aut(Ei ). Clearly, a vector u ∈ ˆi ⊕ u = E ˆi , which implies that any such u is an Wi belongs to Aut(Ei ) iff E automorphism of Ei only if it is expressible as a difference of two elements from ˆi . We can cycle through all such pairwise differences u and include u in a set E ˆi ⊕ u = E ˆi , which can be checked in logspace. Then, the vectors in Si Si iff E along with a spanning set for Ui will give us a spanning set for the automorphism group Aut(Ei ). Clearly, if the two homogeneous pieces Ei and Ei are isomorphic, then Aut(Ei ) = Aut(Ei ) and by Lemma 3 it follows for any v ∈ Fn2 that v maps Ei to Ei iff v maps Aut(Ei ) ⊕ ui to Aut(Ei ) ⊕ ui . Hence it follows that Iso Fn2 ((E1 , · · · , Ek ), (E1 , · · · , Ek )) = Iso Fn2 (r2 (E1 , · · · , Ek ), r2 (E1 , · · · , Ek )). In order to describe the third reduction step r3 : (H1 ⊕ u1 , . . . , Hk ⊕ uk ) → (B1 , b1 , . . . , Bk , bk ), let Bi denote the subspace of Fn2 spanned by the rows of Bi . Observe that the null space null(Bi) = {x ∈ Fn2 | Bi x = 0} of Bi is precisely the set of all automorphisms of (Bi , bi ). Hence the automorphism group Aut(Bi , bi ) coincides with the dual space {x ∈ Fn2 | ∀ rows y of Bi : y T x = 0} of Bi in Fn2 . For each i, we choose Bi as an (li × n)-matrix over F2 such that Hi coincides with the dual space of Bi , i.e. Hi = {x ∈ Fn2 | Bi x = 0}. Further, we let bi be the vector bi = Bi ui .
Canonizing Hypergraphs under Abelian Group Action
453
As shown in [8], in FL⊕L we can compute for a given matrix B a matrix B whose rows form a basis of the dual space of B . This shows that r3 is computable in FL⊕L . Further it is easy to see that Hi ⊕ ui ⊕ v = Hi ⊕ ui iff Bi v⊕bi = bi , implying that Iso((H1 ⊕u1 , . . . , Hk ⊕uk ), (H1 ⊕u1 , . . . , Hk ⊕uk )) = Iso(r3 (H1 ⊕ u1 , . . . , Hk ⊕ uk ), r3 (H1 ⊕ u1 , . . . , Hk ⊕ uk )). Finally, in the last reduction step we form the pair r4 (B1 , b1 , . . . , Bk , bk ) = k (B, b) by letting B denote the (l × n)-matrix over F2 with l = i=1 li rows obtained by combining B1 , · · · , Bk into a single matrix B and letting b = (b1 , · · · , bk ) ∈ Fl2 . Then it is obvious that r4 ∈ FL and that Iso((B1 , b1 , . . . , Bk , bk ), (B1 , b1 , . . . , Bk , bk )) = Iso(r4 (B1 , b1 , . . . , Bk , bk ), r4 (B1 , b1 , . . . , Bk , bk )). The next lemma shows how a single pair (B, b) can be canonized. ⊥
Lemma 6. For any (l × n)-matrix B and any vector b ∈ Fl2 we can compute in FL⊕L a Fn2 -canonical labeling coset B ⊥ ⊕ u under the action x : (B, b) → (B, Bx ⊕ b). Proof. In order to find a Fn2 -canonical labeling u, we first compute the lexicoˆ graphically least maximal independent set of columns of the matrix B. Let B denote the (l × t)-submatrix of B defined by this set of columns. Then the action of any vector x ∈ Fn2 on (B, b) is equivalent to the action of a vector x ∈ Fn2 that ˆ has non-zero coefficients only at positions that correspond to the columns of B. ˆ Hence, the group action can be expressed as y : b → By ⊕ b, where we think of ˆ y ∈ Ft2 as a subvector of x whose coefficients correspond to the columns of B. Now, we compute a lexicographically least maximal independent set of rows ˆ Let B ˜ denote that (t × t)-matrix, and let b denote the corresponding tof B. ˜ is invertible, there is a unique solution z ∈ Ft dimensional subvector of b. Since B 2 ˜ ⊕ b = 0. All other entries of Bz ˆ ⊕ b are uniquely defined since B ˜ such that Bz ˆ The canonical labeling u consists of a maximal independent set of rows of B. ˆ and zero is defined as z in the coordinates corresponding to the columns of B elsewhere. Putting it all together, we have proven the following result. Theorem 7. We can compute canonical labeling cosets for 2-bounded hypergraphs in FL⊕L .
5
Canonizing Hypergraphs under Abelian Groups
Let G ≤ Sym(V ) be an Abelian permutation group given by a generating set S = {g1 , · · · , gr } ⊆ G. Our aim is to develop a parallel algorithm for canonizing a given hypergraph X under G action, broadly on the same lines as in Section 4. The strategy will be to decompose X into homogeneous pieces (X1 , X2 , . . . , Xk ) s.t. for each Xi we can compute its canonical labeling coset Aut(Xi )gi . Then the problem of canonizing (X1 , X2 , . . . , Xk ) reduces to canonizing the tuple of cosets Aut(Xi )gi . To get the desired upper bound requires some linear algebraic techniques developed in McKenzie and Cook’s work [15] on Abelian permutation group
454
V. Arvind and J. K¨ obler
problems. Using their algorithms yields us a deterministic NC3 canonization procedure. Alternatively, we can use the more recent randomized NC2 algorithms for the same problems [6] to get a randomized NC2 upper bound for canonization. The problem is also in randomized FLGapL .4 We omit the proof due to space restrictions. Theorem 8. In randomized FLGapL we can compute a canonizing function for hypergraphs under abelian permutation group action. Finally, we point out that the problem of testing graph isomorphism under abelian permutation group action can be shown to be hard for LGapL . Hence, our upper bound is a nearly tight classification of canonization under abelian permutation group action. We can show this by giving a logspace reduction from the feasibility of linear equations Bx = b (mod q) for composite q (encoded in unary) to isomorphism testing under abelian permutation group action. Since the former problem is hard for GapL [15,6], the claim follows. A formal proof will be given in the full version. Theorem 9. Checking if two graphs are isomorphic under abelian permutation group action is hard for GapL under logspace Turing reductions.
References 1. Allender, E.: Arithmetic Circuits and Counting Complexity Classes. In: Krajicek, J., di Matematica, Q. (eds.) Complexity of Computations and Proofs. Seconda Universita di Napoli, vol. 13, pp. 33–72 (2004) 2. Allender, E., Ogihara, M.: Relationships among PL, #L and the determinant. RAIRO - Theoretical Informatics and Applications 30(1), 1–21 (1996) ` 3. Alvarez, C., Jenner, B.: A Very Hard log-Space Counting Class. Theoretical Computer Science 107(1), 3–30 (1993) 4. Arvind, V., Das, B., Mukhopadhyay, P.: On isomorphism and canonization of tournaments and hypertournaments. In: Asano, T. (ed.) ISAAC 2006. LNCS, vol. 4288, pp. 449–459. Springer, Heidelberg (2006) 5. Arvind, V., K¨ obler, J.: Hypergraph isomorphism testing for bounded color classes. In: Durand, B., Thomas, W. (eds.) STACS 2006. LNCS, vol. 3884, pp. 384–395. Springer, Heidelberg (2006) 6. Arvind, V., Vijayaraghavan, T.C.: The complexity of solving linear equations over a finite ring. In: Diekert, V., Durand, B. (eds.) STACS 2005. LNCS, vol. 3404, pp. 472–484. Springer, Heidelberg (2005) 7. Babai, L., Luks, E.: Canonical labeling of graphs. In: Proc. 15th ACM Symposium on Theory of Computing, pp. 171–183 (1983) 8. Buntrock, G., Damm, C., Hertrampf, U., Meinel, C.: Structure and importance of logspace-MOD classes. Mathematical Systems Theory 25, 223–237 (1992) 4
More precisely, in [6] the upper bound stated for these problems is FLGapL /poly, where a large fraction of advice strings are correct. This coincides with randomized FLGapL as mentioned in Section 2.
Canonizing Hypergraphs under Abelian Group Action
455
9. Buss, S.: Alogtime algorithms for tree isomorphism, comparison, and canonization. In: Gottlob, G., Leitsch, A., Mundici, D. (eds.) KGC 1997. LNCS, vol. 1289, pp. 18–33. Springer, Heidelberg (1997) 10. Furst, M., Hopcroft, J., Luks, E.: Polynomial time algorithms for permutation groups. In: Proc. 21st IEEE Symposium on the Foundations of Computer Science, pp. 36–41. IEEE Computer Society Press, Los Alamitos (1980) 11. Jenner, B., K¨ obler, J., McKenzie, P., Tor´ an, J.: Completeness results for graph isomorphism. Journal of Computer and System Sciences 66, 549–566 (2003) 12. Lindell, S.: A logspace algorithm for tree canonization. In: Proc. 24th ACM Symposium on Theory of Computing, pp. 400–404. ACM Press, New York (1992) 13. Luks, E.M.: Permutation groups and polynomial time computations. In: Finkelstein, L., Kantor, W.M. (eds.) Groups and Computation. DIMACS Series in Discrete Mathematics and Theoretical Computer Science, vol. 11, pp. 139–175. American Mathematical Society, Providence (1993) 14. Luks, E.M., McKenzie, P.: Parallel algorithms for solvable permutation groups. Journal of Computer and System Sciences 37(1), 39–62 (1988) 15. McKenzie, P., Cook, S.A.: The parallel complexity of abelian permutation group problems. SIAM Journal on Computing 16(3), 880–909 (1987) 16. Miller, G.L., Reif, J.H.: Parallel tree contraction. Part 2: Further applications. SIAM Journal on Computing 20(6), 1128–1147 (1991) 17. Reingold, O.: Undirected st-connectivity in log-space. In: Proc. 37th ACM Symposium on Theory of Computing, pp. 376–385. ACM Press, New York (2005) 18. Tor´ an, J.: On the hardness of graph isomorphism. SIAM Journal on Computing 33(5), 1093–1108 (2004) 19. Wielandt, H.: Permutation Groups. Academic Press, New York (1964)
Linear Time Algorithms for the Basis of Abelian Groups Gregory Karagiorgos1 and Dimitrios Poulakis2 1
Department of Technology of Informatics and Telecommunications, T.E.I of Kalamata / Branch of Sparta, Kladas, 23100 Sparta, Greece [email protected], [email protected] 2 Aristotle University of Thessaloniki, Department of Mathematics, Thessaloniki 54124, Greece [email protected]
Abstract. In this paper we present two deterministic algorithms such that given an abelian group G with N elements and the prime factorization of N , it computes a basis of G in time O(N ). Keywords: Deterministic Linear Algorithms, Abelian group, basis of abelian group, order.
1
Introduction
Since the early developmental period of computational complexity, the study of groups was an important topic. In the last decades, interest in studying the computational complexity of groups has raised dramatically due to the increasing significant of its relationship with public key cryptography [15], quantum computing [6,14,17], and error-correcting codes [7]. A finite abelian group can be decomposed to a direct sum of cyclic groups with prime-power order. The set of generators with exactly one from each of those cyclic groups form a basis of the abelian group. The elements of a basis of a finite abelian group and their orders fully determine its structure. Therefore, the development of efficient algorithms for this task has fundamental significance in all the above applications. Moreover, finding a basis of an abelian group is the generalization of the integer factorization problem, one of the fundamental problems in computer science. In [4], Chen gave an O(N 2 ) time algorithm for finding a basis of a finite abelian group G. Recently, in [5], Chen and Fu showed two O(N ) time deterministic algorithms for this task based on a O(N ) time algorithm obtained by Kavitha [13] for computing the orders of all elements of G. In case where G is represented by an explicit set of generators, deterministic algorithms are presented in [10], [19], [3] and [12]. Furthermore, a randomized algorithm is proposed in [5]. When G is represented by a set of defining relations that is associated with an integer matrix M (G), the computation of the structure of G can be reduced to computing the Smith Normal Form of M (G). One such approach can be found in [11]. Finally, B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 456–466, 2011. c Springer-Verlag Berlin Heidelberg 2011
Linear Time Algorithms for the Basis of Abelian Groups
457
in [2], an algorithm is given for computing the structure of G, as well as a set of generators of G, based on Gr¨ obner bases techniques. In this paper we obtain two deterministic O(N ) time algorithms for the computation of a basis of a finite abelian group G with N elements. As an application of our result we obtain a result of Kavitha [13] which states that group isomorphism for abelian groups with N elements can be determined in O(N ) time. Although our algorithms have the same time complexity than that of Chen and Fu [5], our approach is quite different. The paper is organized as follows. In Section 2 we recall some definitions from Group Theory. Section 3 is devoted to the presentation of our results. In Section 4, we give some auxiliary results which are necessary for the presentation of our algorithms. In Section 5, using the algorithms of Section 4, we develop two algorithms for the computation of a basis of a finite abelian group. Furthermore, using this result, we prove, that abelian group isomorphism can be tested in linear time. Finally, the last section concludes the paper.
2
Preliminaries
In this section we recall some definitions from Group Theory. 1. Let (G, +) be a finite abelian group. We denote by |G| the cardinality of a group G. For x ∈ G, the order of x, denoted by ord(x), is the smallest positive integer k ≥ 1 such that kx = 0, where 0 is the identity in G. 2. Let x be an element of a group G such that ord(x) = k. The set < x >= {x, 2x, 3x, . . . , kx = 0} is a subgroup of G called the cyclic group generated by x. 3. Let H1 , . . . , Hr be subgroups of G. The set H1 + · · · + Hr = {x1 + · · · + xr / xi ∈ Hi , i = 1, . . . , r} is a subgroup of G called the sum of H1 , . . . , Hr . 4. If for every i = 1, . . . , r, we have Hi ∩ (H1 + · · · + Hi−1 + Hi+1 + · · · + Hr ) = {0}, then the set H = H1 + · · · + Hr is called direct sum of H1 , . . . , Hr and in this case we write H = H1 ⊕ · · · ⊕ Hr . 5. Let S ⊆ G. The group < S >=
x∈S
is called the group generated by S.
<x>
458
G. Karagiorgos and D. Poulakis
6. Suppose now that G has N elements and N = pa1 1 · · · pakk is the prime factorization of N . It is well known that any finite Abelian group G of order N > 1, can be represented as G∼ = G(p1 ) ⊕ · · · ⊕ G(pk ), where G(pi ) is a subgroup of G of order pai i (i = 1, . . . , k) [16, Theorem 16, page 96] and is called the pi -primary component of G. 7. Furthermore, each G(pi ) can be decomposed to a direct sum of cyclic groups G(pi ) ∼ =< xi,1 > ⊕ · · · ⊕ < xi,μ(pi ) > and the order of xi,j (j = 1, . . . , μ(pi )) is a power of pi . The set of elements xi,j (i = 1, . . . , k, j = 1, . . . , μ(pi )) is called a basis of G. Finally, if x is a real number, then we denote by x , as usually, the smallest integer z such that x ≤ z. We assume that groups are represented by their multiplication tables. For a group G with N elements, we define the multiplication table M of G to be a two-dimensional N × N array of elements of G, indexed in both dimensions by the elements of G, such that for all a, b ∈ G, M (a, b) = a + b. This is equivalent to the multiplication oracle where each group operation can be performed in constant time. We work in the unit cost RAM model. So random access in constant time is assumed. Our algorithms always work with O(log N ) bit numbers and we assume that arithmetic operations and comparisons on O(log N ) bits take constant time. Since the input size is Θ(N 2 ), it is reasonable to assume that arithmetic operations and comparisons on O(log N ) bits take constant time, and the same assumption was used in the O(N ) algorithm by Kavitha [13] for computing the orders of all elements of a finite group. We show that our algorithm performs O(N ) arithmetic operations and comparisons on O(log N ) bit numbers.
3
Our Results
Our main result is the following theorem. Theorem 1. Let G be an abelian group with N elements. Suppose the prime factorization of N is given. Then, there is a deterministic algorithm for computing a basis of G in O(N ) time. A consequence of Theorem 1 is the following result which is proved in [13]. Corollary 1. Group isomorphism for abelian group with N elements can be determined in O(N ) time.
Linear Time Algorithms for the Basis of Abelian Groups
459
For the proof of Theorem 1, we give two algorithms. In general, the basic idea of our algorithms is the construction of bases of successively larger subgroups of the p-primary components G(p) of G combining an algorithm of Teske [18] and an algorithm of Beynon and Iliopoulos [1], until a basis of G(p) is obtained. In the first algorithm, we achieve this construction simultaneously for each G(p) by selecting elements of G and computing their order and the orders of their images in G(p). In the second algorithm, using an algorithm of Kavitha [13], we decompose G into their primary components G(p) and we work in each G(p) separately.
4
Auxiliary Results
In this section we give some results necessary for the presentation of our algorithms. We denote by G an abelian group with N elements. 4.1
The Extended Discrete Logarithm Problem
Suppose B = {b1 , . . . , bn } is a subset of G such that the group H =< B > is the direct sum of the cyclic groups < bi > (i = 1, . . . , n). The extended discrete logarithm problem (EDLP) is the following problem: Given a set B ⊆ G as above and w ∈ G, determine the smallest positive integer z with zw ∈ H and integers z1 , . . . , zn with 0 ≤ zi < ord(bi) (i = 1, . . . , k) satisfying n z i bi . zw = i=1
Note that z ≤ ord(w). If z = ord(w), then H∩ < w >= {0}. In [18], an algorithm is presented which solves the EDLP. We assume that the baby-step giant-step method is used to implement it [18, Remark 4.1, page 529]. The number of group operations needed for its application is O(max{p1/2 n e(p)}), where the maximum is taken over all prime divisors of N and pe(p) is the smallest power of p such that pe(p) x = 0, for every x ∈ G(p). It is called SOLVE-EDLP. Thus, we have SOLVE-EDLP(w, B) = (z, z1 , . . . , zn ). 4.2
The BASIS Algorithm
Let p be a prime divisor of N and G(p) the p-component of G. Suppose that C = {c1 , . . . , cn } is a subset of G(p) such that the group H =< C > is the direct sum of the cyclic groups < ci > (i = 1, . . . , n). If x ∈ G(p), then we denote by H the group generated by the set C ∪ {x}. Suppose that the orders of elements of C are known and we have a relation of the form pl x =
n i=1
δi ci ,
460
G. Karagiorgos and D. Poulakis
where l, δi ∈ Z, l ≥ 0 and 0 ≤ δi < ord(ci ) (i = 1, . . . , n). In [1], an algorithm is given for the computation of a basis C for H called BASIS which needs O((log |H |)2 ) group operations and O((log |H |)2 log log |H |) arithmetic operations. Then we write BASIS(C, x, (pl , δ1 , . . . , δn )) = C . 4.3
The ORDER-FINDING Algorithm
In [13] an algorithm is presented, called ORDER-FINDING algorithm, such that given any group with N elements, it can compute the orders of all its elements in O(N ) time. 4.4
2
(log N ) Computing the Order of an Element in O( log )-Time log N
Let G be an abelian group with N elements and N = pa1 1 · · · pakk the prime factorization of N . Let x ∈ G and m = ord(x). Then m|N and so, m = pb11 · · · pbkk , where 0 ≤ bi ≤ ai (i = 1, . . . , k). Furthermore, the element xi = (m/pbi i )x has order pbi i and we have < x >=< x1 > ⊕ · · · ⊕ < xk > . ([16, page 96]). The following algorithm computes m, the elements xi (i = 1, . . . , k) and theirs orders pbi i . Algorithm 1. ORDER (x) a
% N = pa1 1 . . . pkk % Where x ∈ G 1: m = N 2: for i = 1 to k 3: for bi = 0 to ai 4: if pbi (m/pai i )x = 0 5: break 6: end if 7: end for 8: m = m/pai i −bi 9: end for 10: for i = 1 to k 11: compute mi = m/pbi i . 12: end for 13: for i = 1 to k 14: compute xi = mi x. 15: end for 16: return [x, m, (x1 , pb11 ), . . . , (xk , pbkk )] b
% Where ord(x) = m = pb11 · · · pkk , xi = (m/pbi i )x and ord(xi ) = pbi i .
Linear Time Algorithms for the Basis of Abelian Groups
461
Proof of Correctness: For every i = 1, . . . , k the algorithm computes bi such that pbi (m/pai i )x = 0 and pbi −1 (m/pai i )x = 0. Finally, we have mx = 0, m = pb11 · · · pbkk
and (m/pi )x = 0
(i = 1, . . . , k),
whence it follows that ord(x) = m. Furthermore, ord(xi ) = pbi i . Proof of Time Complexity: For the computation of pai i , m/pai i , pbi i and mi (i = 1, . . . , k), the algorithm ORDER requires O(a1 + · · ·+ ak ) arithmetic operations. Since we have a1 + · · · + ak = O(log N ), the algorithm needs O(log N ) arithmetic operations. By [8, page 69], the computation of (m/pai i )x needs O(log(m/pai i )) group operations. Next, for j = 1, . . . , bi we compute (m/pai i )x). pji (m/pai i )x = pi (pj−1 i The computation of every pji (m/pai i )x requires O(log pi ) group operations. Thus, the group operations needed for Steps 3 and 4 is O(log(m/pai i ) + ai log pi ) = O(log m). Furthermore, the computation of mi x needs O(log mi ) group operations. Therefore, we have O(k log N ) group operations. By [9, page 355], we have k = O(log N/ log log N ). Thus, the algorithm ORDER needs O((log N )2 / log log N ) group operations and so, its time complexity is O((log N )2 / log log N ).
5
Presentation of Our Algorithms
In this section we develop two algorithms for computing a finite abelian group basis. Our algorithms accepts as input a finite abelian group G with N elements and the prime factorization of N . We keep the same notations as in the previous sections. We denote by τ (N ) the number of positive divisors of N . 5.1
First Proof of O(N )-Time Algorithm
In this subsection we present our first algorithm for the computation of a basis of G. The main idea of this algorithm is the following: In each step j of the algorithm, we select an element xj ∈ G and using the algorithm ORDER we compute the order of xj , the elements xj,i (i = 1, . . . , k) and theirs orders. Next, using the algorithms SOLVE-EDLP and BASIS we construct a basis Bj (pi ) of a subgroup of G(pi ) and so we deduce a basis of the direct sum Gj of these subgroups. We repeat this procedure until |Gj | = |G|.
462
G. Karagiorgos and D. Poulakis
Algorithm 2. Computation of a basis of Abelian group - BASIS1 % N = pa1 1 . . . pakk 1: Set B0 (pi ) = Ø, (i = 1, . . . , k) and G0 = {0} 2: for j = 1, 2, 3 . . . r, where r ≤ τ (N ) 3: Choose xj ∈ G \ Gj−1 b b 4: Call ORDER(xj ) = [xj , mj , (xj,1 , p1j,1 ), . . . , (xj,k , pkj,k )] 5: for i = 1, . . . , k 6: Call SOLVE-EDLP(xj,i , Bj−1 (pi )) = (zj,i , zj,i,1 , . . . , zj,i,m(j−1,i) ). k 7: Compute the largest integer kj,i ≥ 0 such that pi j,i divides zj,i 8: if kj,i = 0, then 9: Bj (pi ) = Bj−1 (pi ) 10: else k 11: sj,i = zj,i /pi j,i and hj,i = sj,i xj,i k 12: Call BASIS(Bj−1 (pi ), hj,i , (pi j,i , zj,i,1 , . . . , zj,i,m(j−1,i) )) = Bj (pi ) 13: Set Bj (pi ) = {bj,i,1 , . . . , bj,i,m(j,i) } and compute βj,i = ord(bj,i,1 ) . . .ord(bj,i,m(j,i) ) 14: end if 15: end for 16: if there is i such that βj,i = pai i , then compute the elements of Gj =< Bj (p1 ) > + . . . + < Bj (pk ) > 17: end if 18: end for For every i = 1, . . . , k output the elements of Br (pi ) with theirs orders.
Proof of Correctness: For every j = 1, . . . , r, the algorithm SOLVE-EDLP gives elements zji , zj,i,1 , . . . , zj,i,m(j−1,i) such that
m(j−1,i)
zj,i xj,i =
zj,i,s bj,i,s .
s=1 k
The algorithm BASIS applied on Bj−1 (pi ), hj,i , pi j,i and zj,i,1 , . . . , zj,i,m(j−1,i) gives the basis Bj (pi ) of the group < {xj,i }∪Bj−1 (pi ) >. If βj,i = pai i , then Bj (pi ) is a basis for G(pi ). Thus, the procedure continuous until for every i = 1, . . . , k a basis for G(pi ) is obtained. Proof of Time Complexity: We denote by μ(pi ) the number of cyclic subgroups e(p ) which are direct factors of G(pi ) and by pi i the smallest prime power such e(pi ) that pi x = 0, for every x ∈ G(pi ). Let Gr = G. A bound for r is given by the number of divisors of N which is τ (N ) = O(N ), where > 0 is arbitrarily small [9, Theorem 315, page 260]. Thus, we have r = O(N ). In Step 4, we repeat r times the procedure ORDER, and so the time complexity of this step is O(N (log N )2 / log log N ). In Step 6 the use of SOLVE-EDLP requires O(r
k i=1
1/2
e(pi )pi μ(pi )−1 ) = O(N )
Linear Time Algorithms for the Basis of Abelian Groups
463
group operations. Steps 7 and 11 need k r k log sj,i ) = O(r log pai i ) = O(N log N ) = O(N ) O( j=1 i=1
i=1
group operations and O(r(a1 + · · · + ak ) log N ) = O(N (log N )2 ) = O(N ) arithmetic operations. We set Gj (pi ) =< Bj,i >. Step 12 uses the procedure BASIS and so, its time complexity is k t O( (log |Gj (pi )|)2 log log |Gj (pi )|) = O(N (log N )2 ). j=1 i=1
The computation of the elements of Gj requires |Gj | group operations. In Step 16 we have to compute the elements of the subgroups |Gj | (j = 1, . . . , r − 1). Since |Gj−1 | divides |Gj | and |Gj−1 | < |Gj |, then 2|Gj−1 | ≤ |Gj |. Then it follows r−1
|Gj | ≤ 2|Gr−1 | ≤ N.
j=1
Hence, the computation of elements of |Gj | (j = 1, . . . , r − 1) needs at most N group operations. Therefore, the time complexity of the algorithm is O(N ). 5.2
Second Proof of O(N )-Time Algorithm
Next, we give a variant of the previous algorithm. First of all, in Step 1 of the later algorithm, we use an array ORD[1 . . . N ] to store the orders of the elements of G. When the ORDER − F IN DIN G algorithm, in this step, terminates we will have ORD[x] = ord(x) for all x ∈ G. Also, in Step 2, we will use two arrays namely, P RIM E − ODR[1 . . . log N ] and IN T EGER − ORD[1 . . . log N ] to store pi s in some power and the corresponding integer value, respectively. Using these informations storing in the above tables, we can compute all elements of each G(pi ). For every i = 1, . . . , k we work with G(pi ) and we construct a basis for it as follows: For each step j we select an element xj ∈ G(pi ) and using the algorithms SOLVE-EDLP and BASIS we construct a basis Bj (pi ) of a subgroup of G(pi ). We repeat this procedure until | < Bj (pi ) > | = pai i .
464
G. Karagiorgos and D. Poulakis
Algorithm 3. Computation of a basis of Abelian group - BASIS2 % N = pa1 1 . . . pakk 1: Call ORDER-FINDING(G) 2: Compute p1 , p21 . . . pa1 1 , . . . , pk , p2k , . . . , pak1 and store them in IN T EGER − ORD table and the appropriate prime factorization in P RIM E − ORD table 3: for each x ∈ G Check the ORD[x], if it exists in table IN T EGER − ORD, and from P RIM E − ORD table find the appropriate pi -primary component of G and update it as follows: G(pi ) = G(pi ) {x}, where 1 ≤ i ≤ k 4: end for 5: for i = 1, . . . , k a 6: if there is x ∈ G(pi ) with ord(x) = pi i , then output x and stop 7: else 8: Set G0 (pi ) = {0}, B0 (pi ) = Ø 9: end if 10: for j = 1, 2, 3, . . . , ri , where ri ≤ ai 11: Choose xj ∈ G(pi ) \ Gj−1 (pi ) 12: Call SOLVE-EDLP(xj , Bj−1 (pi )) = (zj , zj,1 , . . . , zj,m(j−1) ) k 13: Compute the largest integer kj ≥ 0 such that pi j divides zj 14: if kj = 0, then 15: Bj (pi ) = Bj−1 (pi ) 16: else k 17: sj = zj /pi j and hj = sj xj k 18: Call BASIS(Bj−1 (pi ), hj , (pi j , zj,1 , . . . , zj,m(j−1) )) = Bj (pi ) 19: Set Bj (pi ) = {bj,1 , . . . , bj,m(j) } and compute βj,i = ord(bj,1 ) · · ·ord(bj,m(j) ) 20: if βj,i = pai i , then compute the elements of Gj (pi ) =< Bj (pi ) > 21: end if 22: end if 23: end for 24: end for For every i = 1, . . . , k output the elements of Br(i) (pi ) with theirs orders.
Proof of Correctness: Using the algorithm ORDER-FINDING we can determine the elements of the group G(pi ) (i = 1, . . . , k). Next, we follow the same procedure for every G(pi ) as in the previous algorithm. Proof of Time Complexity: The algorithm ORDER-FINDING has running time O(N ). All the other procedures, as we have seen in the previous algorithm have running time O(N ). Thus the time complexity of our algorithm is O(N ) . 5.3
Proof of Corollary 1
Let G1 and G2 two abelian groups with N elements. The √ factorization of N into product of prime numbers, can be computed in time O( N ). Two abelian groups with N elements are isomorphic if and only if G1 has a basis {x1 , . . . , xk }
Linear Time Algorithms for the Basis of Abelian Groups
465
and G2 a basis {y1 , . . . , yl } such that k = l and ord(xi ) = ord(yi) (i = 1, . . . , k). Thus, the result follows from Theorem 1.
6
Conclusion
In this paper we present two deterministic algorithms for the computation of a basis of an abelian group with N elements in time O(N ). An interesting problem of further research is the development of deterministic algorithms of lower time complexity for classes of specific groups, as for instance the groups of elliptic curves over finite fields. In a future work we plan to deal with this problem and also to try to apply the method of the present paper in other problems in group theory. Acknowledgments. The first author gratefully acknowledges the Department of Informatics and Telecommunications of the University of Athens in which a part of his work was carried out and the support of the project Autonomic Network Architecture (ANA), under contract number IST-27489, which is funded by the IST FET Program of the European Commision.
References 1. Beynon, W.M., Iliopoulos, C.S.: Computing a basis for a finite abelian p-group. Information Processing Letters 20, 161–163 (1985) 2. Borges-Quintana, M., Borges-Trenard, M.A., Martinez-Moro, E.: On the use of Grobner Bases for Computing the structure of finite abelian groups. In: Ganzha, V.G., Mayr, E.W., Vorozhtsov, E.V. (eds.) CASC 2005. LNCS, vol. 3718, pp. 52– 64. Springer, Heidelberg (2005) 3. Buchmann, J., Schmidt, A.: Computing the structure of a finite abelian group. Mathematics of Computation 74, 2017–2026 (2005) 4. Chen, L.: Algorithms and their complexity analysis for some problems in finite group. Journal of Sandong Normal University 2, 27–33 (1984) (in Chinese) 5. Chen, L., Fu, B.: Linear and Sublinear Time Algorithms for the Basis of Abelian groups. Theoretical Computer Science (2010), doi:10.1016/j.tcs.2010.06.011 6. Cheung, K.H., Mosca, M.: Decomposing finite abelian groups. Journal of Quantum Information and Computation 1(3), 26–32 (2001) 7. Dinur, I., Grigorescu, E., Kopparty, S., Sudan, M.: Decodability of Group Homomorphisms beyond the Johnson Bound. ECCC Report, No 20 (2008) and in 40th STOC 275-284 (2008) 8. Gathen, J., Gerhard, J.: Modern Computer Algebra. Cambridge University Press, Cambridge (1999) 9. Hardy, G.H., Wright, E.M.: An Introduction to the Theory of Numbers, 5th edn. Oxford University Press, Oxford (1979) 10. Iliopoulos, C.S.: Analysis of algorithms on problems in general abelian groups. Information Processing Letters 20, 215–220 (1985) 11. Iliopoulos, C.S.: Worst-case complexity bounds on algorithms for computing the canonical structure of finite abelian groups and the Hermite and Smith normal forms of an integer matrix. SIAM Journal of Computing 18(4), 658–669 (1989)
466
G. Karagiorgos and D. Poulakis
12. Karagiorgos, G., Poulakis, D.: An Algorithm for Computing a Basis of a Finite Abelian Group. In: Winkler, F., D¨ onch, C. (eds.) CAI 2011. LNCS, vol. 6742, pp. 174–184. Springer, Heidelberg (to appear, 2011) 13. Kavitha, T.: Linear time algorithms for abelian group isomorphism and related problems. Journal of Computer and System Sciences 73(6), 986–996 (2007) 14. Kitaev, A.Y.: Quantum computations: algorithms and error correction. Russian Math. Surveys 52(6), 1191–1249 (1997) 15. Koblitz, N., Menezes, N., Alfred, J.: A survey of public-key cryptosystems. SIAM Review 46(4), 599–634 (2004) 16. Ledermann, W.: Introduction to group theory. Longman Group Limited, London (1973) 17. Lomont, C.: The hidden subgroup problem - review and open problems (2004), http://arxiv.org/abs/quantph/0411037 18. Teske, E.: The Pohlig-Hellman Method Generalized for Group Structure Computation. Journal of Symbolic Computation 27, 521–534 (1999) 19. Teske, E.: A space efficient algorithm for group structure computation. Mathematics of Computation 67(224), 1637–1663 (1998)
Characterizations of Locally Testable Linearand Affine-Invariant Families Angsheng Li and Yicheng Pan State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences {angsheng,yicheng}@ios.ac.cn
Abstract. The linear- or affine-invariance is the property of a function family that is closed under linear- or affine- transformations on the domain, and closed under linear combinations of functions, respectively. Both the linear- and affine-invariant families of functions are generalizations of many symmetric families, for instance, the low degree polynomials. Kaufman and Sudan [21] started the study of algebraic properties test by introducing the notions of “constraint” and “ characterization” to characterize the locally testable affine- and linear-invariant families of functions over finite fields of constant size. In this article, it is shown that, for any finite field F of size q and characteristic p, and its arbitrary extension field K of size Q, if an affineinvariant family F ⊆ {Kn → F} has a k-local constraint, then it is 2Q
2Q
+4
k -locally testable for k = k p Q p ; and that if a linear-invariant family F ⊆ {Kn → F} has a k-local characterization, then it is k 2Q
4(
Q
+1)
locally testable for k = 2k p Q p . Consequently, for any prime field F of size q, any positive integer k, we have that for any affine-invariant family F over field F, the four notions of “the constraint”, “the characterization”, “the formal characterization” and “the local testability” are equivalent modulo a poly(k, q) of the corresponding localities; and that for any linear-invariant family, the notions of “the characterization”, “the formal characterization” and “the local testability” are equivalent modulo a poly(k, q) of the corresponding localities. The results significantly improve, and are in contrast to the characterizations in [21], which have locality exponential in Q, even if the field K is prime. In the research above, a missing result is a characterization of linearinvariant function families by the more natural notion of constraint. For this, we show that a single strong local constraint is sufficient to characterize the local testability of a linear-invariant Boolean function family, and that for any finite field F of size q greater than 2, there exists a linear-invariant function family F over F such that it has a strong 2d −1 local constraint, but is not q q−1 -locally testable. The proof for this result provides an appealing approach towards more negative results in the theme of characterization of locally testable algebraic properties, which is rare, and of course, significant.
The research is partially supported by NSFC distinguished young investigator award number 60325206, and its matching fund from the Hundred-Talent Program of the Chinese Academy of Sciences. Both authors are partially supported by the Grand Project “Network Algorithms and Digital Information” of the Institute of software, Chinese Academy of Sciences. Corresponding author: Yicheng Pan. The proofs in this paper were given in 2009.
468
A. Li and Y. Pan Keywords: Error correcting codes, Locally testable codes, (Algebraic) Property tests.
1
Introduction
Property test, which is a relaxation of the decision problems, is the task to decide efficiently whether a given function f belongs to a function family that possesses a property or far from it. Property test was formulated by Rubinfeld and Sudan [25] for the first time in the context of linear functions and was applied to combinatorial objects, especially to graph properties, by Goldreich, Goldwasser and Ron [12]. The testing of algebraic properties has achieved much progress since [9] and [25], including the test of functions satisfying some functional equations ([24]), leading to new error-correcting codes ([2], [20], [17], [19] et al.). For graph properties, the class of properties in the dense graph model that can be tested with a constant number of queries has been well understood ([1], [11]). In the negative side, [12], [10], [14] and [7], [15] have given several lower bounds on the query complexity for graph-theoretic and algebraic property test. A function family F is k-locally testable if there is a randomized test, which queries the values of a given function f on at most k inputs, and accepts f ∈ F with probability 1, and rejects f ∈ F with probability lower-bounded by a quantity proportional to the distance between f and F . In the theme of algebraic property test, an important open question is: what are the essential features of local testability? This question has been well answered for graph property test (in the dense graph model) in [1] and [11], in which it is shown that the feature of the “regular-reducibility” is a necessary and sufficient condition for the locally testable graph properties. A similar characterization in algebraic setting was completely missing, until Kaufman and Sudan [21], who started this topic. The two classical algebraic property tests, that is, the linearity and the lowdegree tests, are both essential ingredients for the PCP characterizations of NP ([3], [8], [22] et al.) and of various locally testable codes ([13], [6] et al.). These have already been extensively studied by different people in a series of papers such as ([3], [4], [5], [16] et al.). Kaufman and Sudan [21] pioneered the study of characterizing algebraic properties test by considering the local testability of linear- and affine-invariant families over finite fields, which is a significant generalization of the linearity and the low-degree tests. The linear/affine-invariance is a property for a function set over finite fields that is closed under linear/affine transformations on the domain and linear combinations of functions. Formally, a family of functions F ⊆ {Kn → F}, where Kn is a vector space over finite field K and F is a subfield of K, is said to be linear-invariant if (1) for any linear map L : Kn → Kn , f ∈ F implies f ◦ L ∈ F , and (2) for any f, g ∈ F and any α, β ∈ F, αf +βg ∈ F . A family F ⊆ {Kn → F} is said to be affine-invariant if (1) for any affine map A : Kn → Kn , f ∈ F implies f ◦ A ∈ F , and (2) for any f, g ∈ F and any α, β ∈ F, αf + βg ∈ F . Note that an affine-invariant family is also linear-invariant. Kaufman and Sudan [21] used the notions of “constraint” and “characterization” (See definitions below) to characterize these two kinds of function families. They showed that for a function family F ⊆ {Kn → F} with |K| = O(1), if F is affine-invariant, then there exists a single O(1)-local constraint on F if and only if F is O(1)-locally testable, and that if F is linear-invariant,
Characterizations of Locally Testable Linear- and Affine-Invariant Families
469
then F has a O(1)-local characterization if and only if F is O(1)-locally testable. The proofs of these results provided basic analysis to study the characterizations of locally testable algebraic properties. We say that a family F ⊆ {Kn → F} has a k-local constraint C, if there exist k distinct points x1 , . . . , xk ∈ Kn and subset V Fk , such that for every f ∈ F , f (x1 ), . . . , f (xk ) ∈ V , where we denote C by (x1 , . . . , xk ; V ). We say that F has a k-local characterization, if there exists a set C of k-local constraints such that f ∈ F if and only if for every C ∈ C , C is a constraint of f . We say that F has a k-local formal characterization if there exists a positive integer m, k distinct linear transformations l1 , . . . , lk : (Kn )m → Kn , and a subset V Fk , such that f ∈ F if and only if for any x1 , . . . , xm ∈ Kn , f (y1 ), . . . , f (yk ) ∈ V , where yi = li (x1 , . . . , xm ) for i ∈ [k]. In the definition of k-local constraint, we pick k points in the domain to restrict the values of F to some subset V of Fk . By definition, if F is an F-linear family, then V could be a non-trivial linear subspace inside Fk . A k-local constraint consists of a projection to k positions on the domain of F and a nontrivial subspace which we observe through this small window. This is a succinct necessary condition for k-locally testable families with one-sided error, since some nontrivial features should be observed as a proof of non-membership. A k-local characterization is also necessary by a similar reason. A formal characterization is a set of constraints which are located at an “orbit” of a single one. That is, given a single constraint, all the others are obtained by linear transformations of this constraint. We consider as a central question that how to characterize the locally testable linear- and affine-invariant families by constraints, and ask: Are there any more accurate relationship between the localities of tests and constraints? Is “constraint” or “characterization” sufficient to characterize the two families over general fields? In the negative side, Grigorescu, Kaufman and Sudan [15] constructed an affine-invariant family mapping F2t to subfield F2 and showed that it has an 8-local constraint, but is not o(t)-locally testable. This is an interesting negative result, however, it is very specific. It is interesting to us that to develop a systematic methodology to prove negative results in the theme of characterization of locally testable properties, for which the present paper paves a way. Our research includes both positive and negative results on the topic of characterizing the locally testable algebraic properties. Precisely: We show that an affine-invariant family F ⊆ {Kn → F} having a k-local 2Q 2Q constraint is k -locally testable for k = k p Q p +4 (Theorem 1), and that a linear-invariant family F ⊆ {Kn → F} having a k-local characterization is k 2Q Q locally testable for k = 2k p Q4( p +1) (Theorem 2), where |K| = Q and p is the characteristic of field K. In both cases, the exponent terms of k are reduced to sub-linear of Q from the quadratic of Q in [21]. In the case of prime field K, the results reduce the locality k from exponential of Q in Kaufman and Sudan [21] to a polynomial of Q. Based on this progress, we show that for an affine-invariant family, the notions of “the constraint”, “the characterization”, “the formal characterization” and “the local testability” are equivalent up to a poly(k, Q) on their localities (Theorem 3); and that for a linear-invariant family, the notions of “the characterization”, “the formal characterization” and “the local testability” are equivalent up to a poly(k, Q) on their localities (Theorem 4).
470
A. Li and Y. Pan
It seems to us that these positive results have already exhausted the currently available technical resources, in the sense that more general results need radically new ideas. Local constraints are the more natural necessary conditions for locally testable linear-invariant function families. Therefore it is important to investigate the possibility for the characterization of the linear-invariant function families by constraints. For linear-invariant families not containing nonzero constant, all the functions in it take value 0 at point 0n , hence (0n ; {0}) is a natural 1-local constraint on the families. This is a trivial constraint which leads to the failure of characterizing local testability by constraints of small locality. For example, the family F = {f ∈ {Fn2 → F2 }|f (0) = 0, degree(f ) ≤ d < n} has the trivial 1-local constraint (0n ; {0}), but is not 2d − 1-locally testable ([2]). To rule out this trivial constraint, we introduce the notion of strong local constraint by slightly modifying the notion of local constraint. We say that a constraint C = (x1 , . . . , xk ; V ) is strong if for every i, 1 ≤ i ≤ k, xi = 0. We show that a single strong local constraint is sufficient to characterize the local testability of a linear-invariant Boolean function family, and that for any finite field F of size q greater than 2, there exists a linear-invariant function family F over F such that d it has a strong 2-local constraint, but is not q q−1 −1 -locally testable, from which we know that the two notions “local constraint” and “strong local constraint” are different, and that the characterization of locally testable linear-invariant function families over a finite field F depends on the properties of the filed F. The positive results are achieved by a better understanding of the mathematical structures of linear/affine-invariant families by introducing new notions of the characteristic-based representation, and the characteristic-based degree. In addition, we associate precisely the constraints and characterizations of function families with the dimensions of their domains, and study the total expansion of functions of low dimension in higher dimension spaces. The negative results are achieved by introducing a new coding scheme, the modular homogeneous Reed-Muller codes. This is a coding scheme associated with some typical linearinvariant function families. It is completely different from the (generalized) ReedMuller codes. Fortunately, it still has some nice structural properties similar to that of the standard Reed-Muller codes. The point is that a basis of a linearinvariant family corresponds to a generator matrix of the modular homogeneous Reed-Muller codes, and that the rank of the matrix essentially represents the locality of constraints and testability. The proof for the negative results provides a rare and successful methodology to prove more negative results for characterizing the locally testable algebraic properties.
2
Theorems and Methods
We denote by F a finite field with characteristic p and |F| = q = ps . Denote by K an extension field of F with |K| = Q = q t . For an integer vector d = (d1 , . . . , dn ) d and variables x = (x1 , . . . , xn ), let x be the monomial xd11 · · · xdnn . The degree n d d d of x is defined to be deg(x ) = i=1 di . For a polynomial f = d cd x , define the support of f , sup(f ), to be the set of monomials with cd = 0. Define the support of a family F as sup(F ) = f ∈F sup(f ). For two functions f , g, let f ◦ g(·) = f (g(·)). The distance between f and g is defined by δ(f, g) = P rx [f (x) = g(x)]. f is δ-close to a family F if there exists a g ∈ F such that
Characterizations of Locally Testable Linear- and Affine-Invariant Families
471
δ(f, g) ≤ δ, and δ-far otherwise. Let F ⊆ {Kn → F} be a family. For any integer l ≥ n, define the linear span of F on Kl over F, denoted by LKl -SPANF (F ), to be the smallest linear-invariant family that contains F in {Kl → F}. Similarly, define the affine span of F on Kl over F, denoted by AKl -SPANF (F ), to be the smallest affine-invariant family that contains F in Kl → F}. If K and F are clear from the context, we write Ll -SPAN(F ) and Al -SPAN(F ). If l = n, we also write L-SPAN(F ) and A-SPAN(F ). Let Fn ⊆ {Dn → F} be a family of functions in n variables, each of which varies over domain D. Let F = {Fn }n be a set of families that have a certain property. We define the local testability of families and properties as follows. Definition 1. (k-local testability) For a positive integer k, real numbers 0 < δ ≤ 1 and 0 ≤ ε1 < ε2 ≤ 1: (1) We say that a function family Fn is (k, δ, ε1 , ε2 )-locally testable if there exists a probabilistic algorithm that queries the value of a given function f randomly on at most k inputs (possibly adaptively), and accepts every f ∈ Fn with probability at least 1 − ε1 , and rejects every f that is δ-far from Fn with probability at most 1 − ε2 . (2) We say that F = {Fn }n is k-locally testable, if there exist 0 < δ ≤ 1 and 0 ≤ ε1 < ε2 ≤ 1 such that for every n, Fn is (k, δ, ε1 + o(1), ε2 + o(1))-locally testable, where o(1) goes to zero as n → ∞. This definition allows adaptive queries and two-sided errors. For non-adaptive test (the locations of queries are independent of the function f that is being tested) and perfect completeness test (the case that the algorithm accepts every function f ∈ Fn with probability 1), Ben-Sasson et al. [7] established a useful relationship between these specific tests and the general test in the case that when F is linear, meaning that for F = {Fn }n , Fn is linear for every n. In this case, we have: Lemma 1. ([7] Theorem 3.3) Let F = {Fn }n be a linear property having a twosided error adaptive (k, δ, ε1 , ε2 )-local test, then it has a non-adaptive (k, δ, 0, ε2 − ε1 )-local test. Now we describe our main theorems, including both positive and negative results. Let F be a field with characteristic p and |F| = q = ps . Let K be the extension field of F with size |K| = Q = q t . Then we show that: Theorem 1. Let F ⊆ {Kn → F} be an affine-invariant family having a k-local 2Q 2Q constraint. Then F is k -locally testable with k = k p Q p +4 . Specifically, there exists a k -local test accepts every f ∈ F with probability 1, and rejects f that is 1 δ-far from F with probability min{ δ2 , (2k +1)(k −1) }. Theorem 2. Let F ⊆ {Kn → F} be a linear-invariant family having a k2Q Q local characterization. Then F is k -locally testable with k = 2k p Q4( p +1) . Specifically, there exists a k -local test accepts every f ∈ F with probability 1, 1 and rejects each f that is δ-far from F with probability min{ δ2 , (2k +1)(k −1) }. If K = F is a prime field and k = O(1), then the family F in both Theorems 1 and 2 has a poly(Q)-local test. The proofs of Theorems 1 and 2 give some nice characterizations of locally testable linear- and affine-invariant families. In fact, we have:
472
A. Li and Y. Pan
Theorem 3. Let F be a prime field of size q and F ⊆ {Fn → F} be an affineinvariant family. Then the following statements are equivalent with each other: (1) F is poly(k, q)-locally testable; (2) F has a poly(k, q)-local characterization; (3) F has a poly(k, q)-local constraint; and (4) F has a poly(k, q)-local formal characterization. Theorem 4. Let F be a prime field of size q and F ⊆ {Fn → F} be a linearinvariant family. Then the following statements are equivalent with each other: (1) F is poly(k, q)-locally testable; (2) F has a poly(k, q)-local characterization; and (3) F has a poly(k, q)-local formal characterization. Proof. (Sketch proof of Theorems 3 and 4) Theorems 3 and 4 essentially follow from Theorems 1 and 2, by combining them with some basic reductions. It is an important open problem to extend the characterization theorems to function families over general fields. Another interesting question is that whether the two characterization theorems above (in the case of prime fields) could be improved such that the localities are independent of the characteristic q. By comparing Theorems 3 and 4, we notice that there is a missing characterization for linear-invariant families by local constraints (in Theorem 4). The reason for this is that for the constraints of linear-invariant families, we do not have a lower bound of locality similar to that for the case of the affine-invariant families. So it is a natural question that whether a single strong constraint is sufficient to characterize a linear-invariant family? We investigate this problem. Recall that the family F = {f ∈ {Fn2 → F2 }|f (0) = 0, degree(f ) ≤ d < n} has the trivial 1-local constraint (0n ; {0}), but is not 2d − 1-locally testable, giving a counterexample for the case of simple constraint. Let Fˆn = {f : Fn2 → F2 |f (0) = 0}. We say that a linear-invariant family Fn ⊆ {Fn2 → F2 } is nontrivial if Fn = Fˆn and Fn = {Fn2 → F2 }. First, we have: Theorem 5. (Characterizing Boolean function families) Let Fn ⊆ {Fn2 → F2 } be a linear-invariant family. (1) If Fn has a strong k-local constraint, then it is O(k)-locally testable, furthermore, there exists a O(k)-local test accepting every f ∈ Fn with probability 1, while rejecting f which is δ-far from Fn with probability min{ δ2 , Ω( k12 )}. (2) For any nontrivial linear-invariant family Fn ⊆ {Fn2 → F2 }, and any integer k, Fn is poly(k)-locally testable if and only if Fn has a strong poly(k)local constraint. However, for function families over a finite field of size q > 2, it is impossible to characterize the local testability of linear invariance by even the notion of the strong local constraints. Theorem 6. (Strong constraint vs locally testable function family). Let F be a finite field of size q > 2. Then there exists a linear-invariant family Fn ⊆ {Fn → F} satisfying (1) Fn has a strong 2-local constraint, and d (2) Fn is not q q−1 −1 -locally testable, where d is the greatest degree of polynomials in Fn .
Characterizations of Locally Testable Linear- and Affine-Invariant Families
473
The theorems in the present paper provide an algebraic method to study the query complexity of various locally testable codes. For instance, by using Theorem 5 (1), an easy algebraic argument has already built an almost tight query complexity for the local testers of the classical Reed-Muller codes. Overview of Our Methods. Before proving the theorems, we outline the technical contributions of this paper. 1) Characteristic-based degree. (We remark that Kaufman and Sudan [21] has used this degree representation in the proof of their monomial spread lemma.) What we find here is that this is a general notion which can be used to refine and analyze structures of various families. A technical point of [21] is the linearinvariance degree. It is defined to be the largest degree of the functions in F , for which there is at least one monomial having the same degree module Q − 1, but it is not in F . This is a weak estimator of the locality of formal characterization in the sense that even a family with large linear-invariance degree could have a formal characterization of very small locality. The reason for such a case is that even if F has large degree functions, it may have few functions in their linear Q Q and affine span. For example, for f (x) = x p , since for any x, y ∈ K, (x + y) p = Q Q x p +y p , in the linear and affine span of f , there is no monomial with less degree other than constants that appears. This suggests that the monomials having degree pi on every individual variable play a different role from those that do not have the regular degree as above. Intuitively, the family containing the latter monomials is larger than that containing only the former monomials. Therefore we introduce a new notion, the characteristic-based degree, to build the upper and lower bounds for formal characterizations and constraints (characterizations). By using the characteristic-based degree, we can prove better locality bounds for local tests. We define the characteristic-based degree of a monomial to be the summation of the coefficients in the p-adic representation of the degree of variables, and the characteristic-based degree on the j-th level to be the summation of those coefficients associated with pj (see Definition 2 below). A key observation is that, for a fixed degree and a monomial m, the larger characteristic-based degree of m is, the more monomials are contained in the support of the linear/affine span of m. By the monomial extraction lemma ([21]), such monomials (in the case of K = F) or their traces (in the case of K = F) consist of the bases of the linear/affine span of m. To understand the notions, we look at a simple example. Let K = F, p = 3, q = p2 = 9. The L-SPAN(x5 y 2 ) contains all the monomials on x, y of degree exactly 7, but the L-SPAN(x6 y) does not contain x5 y 2 in its support, and is just a subset of L-SPAN(x5 y 2 ); the A-SPAN(x8 y) contains all the monomials on x, y of degree within 9, but the A-SPAN(x6 y 3 ) only contains x3 , y 3 , x6 , y 6 , x3 y 3 , x9 , y 9 , x6 y 3 , x3 y 6 in its support. Moreover, the definition of local constraints implies that a large function family requires constraints on large locality. We show that the characteristic-based degree bounds the locality of constraints, characterizations and formal characterizations, which leads to our main results. 2) Extending monomials to high dimensional domain. We associate the constraints and characterizations precisely with the number of variables on which a family is defined, since a family having a characterization of small locality does not necessarily have that small locality on high dimensional domain. However,
474
A. Li and Y. Pan
we know that the affine span of a monomial with a large number of variables does not have any constraint of small locality. We show that many other monomials with a small number of variables have the same affine span on high dimensional domain if they have similar characteristic-based degree structures, and thus their affine span cannot have constraints of small locality. This is the reason why we can improve Kaufman and Sudan’s results even if K is a prime field, in which case the characteristic-based degree is exactly the general degree. 3) The Modular Homogeneous Reed-Muller Codes. In the last paragraphes, we mentioned that the affine span of a monomial with a large number of variables does not have any constraint of small locality, which is an obstacle to build lower bounds for locality of constraints on linear-invariant families. To remove this obstacle, we introduce a new coding scheme, the modular homogeneous ReedMuller Codes, which is associated with the linear-invariant families naturally. This procedure is similar to that we associate the affine-invariant families with the traditional generalized Reed-Muller codes. A crucial point is that a basis of a linear-invariant family corresponds to a generator matrix of the modular homogeneous Reed-Muller codes, and that the linear dependency and independency of columns of the matrix essentially represents the locality of constraints and testability. This observation allows us to prove a structural lemma (Lemma 5) of the modular homogeneous Reed-Muller codes. Lemma 5 implies that the given family in Theorem 6 has the dual of a large BCH code as a sub-code corresponding to the matrix H. Simultaneously, ˜ it is also a sub-code of the dual of a small BCH code corresponding to matrix H. Based on this, and by the dual weight analysis, we show that the first property leads to the nonexistence of small locality of strong constraint when q > 2, and that the second property implies that a codeword in the large BCH code attacks any local test of small locality for Fn . This is the intuition of Theorem 6. The detailed proofs of our theorems are referred to the full version. We only describe the sketch proof and the key lemmas in this extended abstract.
3
Constraints on Affine/Linear-Invariant Families
In this section, we bound the localities in the case of K = F. Firstly, we study the relationship between constraints and affine-invariant families which will be the ingredients for the proof of Theorems 1 and 3 in the case of K = F. Secondly, we turn to linear-invariant families and prove Theorems 5 and 6. Definition 2. (characteristic-based degree) Let m = cd xd be a monomial in {Fn → F}, where d = (d1 , . . . , dn ) ∈ {0, . . . , q − 1}n . For every i ∈ [n], let di = di0 + di1 p + . . . + di,s−1 ps−1 . Define the characteristic-based degree of m to n s−1 be dch (m) = dij . For every j ∈ {0, . . . , s − 1}, define the characteristici=1 j=0
based degree on the j-th level of m to be dch,j (m) =
n
dij . For a function f ,
i=1
the characteristic-based degree of f is defined to be dch (f ) = max{dch (m)|m ∈ sup(f )}. For a family F , the characteristic-based degree of F is defined to be dch (F ) = max{dch (f )|f ∈ F }. Then we show that a linear-invariant family has an upper bound of the locality of formal characterizations.
Characterizations of Locally Testable Linear- and Affine-Invariant Families
475
Lemma 2. Let F ⊆ {Fn → F} be a linear-invariant family with dch (F ) = dch . Then F has a q l -local formal characterization for l = 2dpch + 3. Lemma 2 is also true for affine-invariant families. It follows from the fact that, if a function f : Fn → F is not in F and n ≥ 2dpch + 3, then there exists a linear transformation L : Fn−1 → Fn , such that f ◦ L ∈ F |n−1 , where F |n−1 = {f ◦ L|f ∈ F , L : Fn−1 → Fn is linear }. Then we show that an affine-invariant family has a lower bound on the locality of constraints. Lemma 3. Let F ⊆ {Fn → F} be an affine-invariant family with dch (F ) = dch . Then F has no q l -local constraints for l ≤ dchq−q . Lemma 3 follows essentially from the lower bound l on the dual weight of the Generalized Reed-Muller Codes. That is, A-SPAN( i=1 xi ) has no constraints of lol cality q q . We say that a k-local formal characterization given by m, l1 , . . . , lk , V is 2-ary independent if for every i ∈ {2, . . . , k}, l1 is linearly independent to li . To complete our proof, we define Definition 3. (Linear-invariant test) For a family F which has a k-local formal characterization (l1 , . . . , lk ; V ), given a function f ∈ {Kn → F}, pick x1 , . . . , xm from Kn uniformly at random. Accept if and only if f (y1 ), . . . , f (yk ) ∈ V , where yi = li (x1 , . . . , xm ) for all i ∈ [k]. Kaufman and Sudan showed that Lemma 4. ([21] Theorem 2.9) Let F be a linear-invariant family which has a 2-ary independent k-local formal characterization. Then F is k-locally testable. That is, for every f ∈ F , the linear-invariant test always accepts f , and for any 1 δ-far f , it rejects with probability min{ δ2 , (2k+1)(k−1) }. Next, we show that a single strong constraint is sufficient to characterize a linearinvariant family over the Boolean field, but not strong enough to characterize the linear-invariant function families over any larger fields. Therefore the characterization of the linear-invariant function families depend on the properties of the field. To prove these results, we need a new coding scheme: the modular homogeneous Reed-Muller codes below. Definition 4. (Modular homogeneous Reed-Muller codes) Let Fq be a finite field, and d be a positive integer. We define the d-th order modular homogeneous Reed-Muller code, denoted by M HRMq (n, d), to be the set of all polynomials spanned by the monomials of degree d in n variables over Fq , for all d satisfying the following properties: (1)1 ≤ d ≤ d, and (2) d ≡ d mod (q − 1). For this new coding scheme, we have a nice structural property as follows. Lemma 5. (Structural lemma). Let Fn = M HRMq (n, d), m = q n − 1, d = h(q − 1) + r, 0 ≤ r < q − 1, α be a primitive root of Fqn , β = αq−1 , γ = αr , h n −1 −1 t = qq−1 (r + 1) and u = qq−1 − 1. ˜ Then the matrices H and H below
476
A. Li and Y. Pan
⎛
⎞ 1 γβ (γβ)2 · · · (γβ)m−1 ⎜1 γβ 2 (γβ 2 )2 · · · (γβ 2 )m−1 ⎟ ⎜ ⎟ H = ⎜. . ⎟, .. .. ⎝ .. .. ⎠ . . t t 2 t m−1 1 γβ (γβ ) · · · (γβ ) ⎛ ⎞ 1 γ γ 2 · · · γ m−1 ⎜1 γβ (γβ)2 · · · (γβ)m−1 ⎟ ⎜ ⎟ 2 2 2 2 m−1 ⎟ ˜ =⎜ H ⎜1 γβ (γβ ) · · · (γβ ) ⎟ ⎜ .. .. ⎟ .. .. ⎝. . ⎠ . . 1 γβ u (γβ u )2 · · · (γβ u )m−1 satisfy the following properties: for any positive integer k, (1) If any k columns in H are F-linear independent, then Fn has no strong k-local constraint, and ˜ that are F-linear dependent, then Fn has a (2) If there are k columns in H strong k-local constraint. By using this lemma, we are able to prove both Theorem 5 and Theorem 6. Proof. (Sketch proof of Theorems 5 and 6) In the case of q = 2, Lemma 5 gives a lower bound for a linear-invariant family. By a similar argument to that of Lemma 2, we have an upper bound that Fn has a 2-ary independent 2d+2 -local formal characterization. Combining this with Lemma 4, Theorem 5 follows. For the case of q > 2, define Fn = Ln -SPAN(x1 · · · xd ), where d is a positive integer satisfying that d < n and (q − 1)|d. We know that Fn is exactly M HRMq (n, d), ˜ in and then Theorem 6 follows immediately from the rank analysis of H and H Lemma 5.
4
Characterizations for Linear-Invariant Families
In this section, we build a lower bound on the locality of characterizations. Lemma 6. Let F {Fn+1 → F} be a non-trivial linear-invariant family with characteristic-based degree dch . Then F has no characterization of locality q
dch −2q q
.
Lemma 6 follows essentially from the lower bound on the dual weight of Generalized Reed-Muller Codes. Define F1 = SPAN{y e m |m ∈ A-SPAN(m), e ∈ [q − 1], deg(m ) + e ≡ d mod (q − 1)} and F2 = {m |m is a monomial in F[x, y], deg(m ) ≡ d mod (q − 1), degy (m ) ≥ 1}. We show that F1 has no condch (m)−q
q straint of locality q which is not a constraint on F2 . We also show that there is a constraint C in F , such that C is a constraint on F1 but not on F2 . Then Lemma 6 follows.
5
Generalization to Extension Fields
In this section, we complete the proof of Theorems 1 and 2. First we build the upper and lower bounds of the localities needed for the case of K ⊃ F.
Characterizations of Locally Testable Linear- and Affine-Invariant Families
477
Definition 5. Let m = cxd be a monomial, where d = d1 , . . . , dn . Define b(d) to be the smallest positive integer b such that for every i ∈ [n], di · q b ≡ b(d) di mod (Q − 1). We say that c ∈ K is d-admissible if cq = c. For a dadmissible coefficient c, define the trace of the monomial m = cxd to be T r(m) = b−1 m + mq + · · · + mq , where b = b(d). We know that an affine-(or linear-)invariant families can be constructed by affine(or linear) transformations (over Kn ) and span (over F) on the traces of a set of monomials with admissible coefficients. We have the following: Lemma 7. Let m = xd and m = xe be two monomials mapping from Kn to F. If for every j ∈ {0, . . . , t − 1} (recall that |F| = q, |K| = Q = q t ), dch,j (m ) = dch,j (m), and b(d) = t, then T r(m) ∈ L-SPAN(T r(m )). Lemma 7 ensures that we can implement a similar analysis to that in sections 3 and 4. We will have similar upper and lower bounds. Formally, Lemma 8. Let F ⊆ {Kn → F} be a linear-invariant family with dch (F ) = dch . Then F has a Ql -local formal characterization for l = 2dpch + 3. Lemma 9. Let F ⊆ {Kn → F} be an affine-invariant family with dch (F ) = dch . Then F has no Ql -local constraints for l ≤ dchQ−Q . Lemma 10. Let F {Kn+1 → F} be a non-trivial linear-invariant family with characteristic-based degree dch . Then F has no characterization of locality dch −2Q Q Q . Now we are ready to prove Theorems 1 and 2. Proof. (Sketch proof of Theorems 1 and 2). We consider two cases: Case 1. K = F. In this case, Theorem 1 follows from Lemmas 6, 2, and 4, and Theorem 2 follows from Lemmas 2, 3, and 4. Case 2. K ⊃ F. Theorem 1 follows from Lemmas 8, 9 and 4, and Theorem 2 follows from Lemmas 8, 10 and 4.
References 1. Alon, N., Fischer, E., Newman, I., Shapira, A.: A combinatorial characterization of the testable graph properties: It’s all about regularity. In: Proc. 38th ACM Symp. on Theory of Computing, pp. 251–260 (2006) 2. Alon, N., Kaufman, T., Krivelevich, M., Litsyn, S., Ron, D.: Testing low-degree polynomials over GF(2). In: Arora, S., Jansen, K., Rolim, J.D.P., Sahai, A. (eds.) RANDOM 2003 and APPROX 2003. LNCS, vol. 2764, pp. 188–199. Springer, Heidelberg (2003) 3. Arora, S., Safra, S.: Probabilistic checking of proofs: a new characterization of NP. Journal of the ACM 45(1), 70–122 (1998) 4. Arora, S., Sudan, M.: Improved low-degree testing and its applications. Combinatorica 23(3), 365–426 (2003) 5. Bellare, M., Coppersmith, D., H˚ astad, J., Kiwi, M., Sudan, M.: Linearity testing in characteristic two. IEEE Transactions on Information Theory 42(6), 1781–1796 (1996)
478
A. Li and Y. Pan
6. Ben-Sasson, E., Goldreich, O., Harsha, P., Sudan, M., Vadhan, S.: Robust PCPs of proximity, shorter PCPs and applications to coding. In: Proc. 34th ACM Symp. on Theory of Computing, pp. 1–10 (2004) 7. Ben-Sasson, E., Harsha, P., Raskhodnikova, S.: Some 3CNF properties are hard to test. SIAM Journal on Computing 35(1), 1–21 (2005); Prelimibary version in Proc. STOC 2003 8. Ben-Sasson, E., Sudan, M., Vadhan, S., Wigderson, A.: Randomness-efficient low degree tests and short PCPs via epsilon-biased sets. In: Proc. 35th ACM Symp. on Theory of Computing, pp. 612–621 (2003) 9. Blum, M., Luby, M., Rubenfeld, R.: Self-testing/correcting with applications to numerical problems. Journal of Computer and System Sciences 47(3), 549–595 (1993) 10. Bogdanov, A., Obata, K., Trevisan, L.: A lower bound for testing 3-colorability in bounded-degree graphs. In: Proc. 43rd Annual Symposium on Foundations of Computer Science, pp. 93–102. IEEE Computer Society, Los Alamitos (2002) 11. Borgs, C., Chayes, J., Lov´ asz, L., S´ os, V.T., Szegedy, B., Vesztergombi, K.: Graph limits and parameter testing. In: Proc. 38th ACM Symp. on Theory of Computing, pp. 261–270 (2006) 12. Goldreich, O., Goldwasser, S., Ron, D.: Property testing and its connection to learning and approximation. Journal of the ACM 45(4), 653–750 (1998) 13. Goldreich, O., Sudan, M.: Locally testable codes and PCPs of almost-linear length. Journal of the ACM 53(4), 558–655 (2006) 14. Goldreich, O., Trevisan, L.: Three theorems regarding testing graph properties. In: Proc. 42nd Annual Symposium on Foundations of Computer Science, pp. 460–469. IEEE Computer Society, Los Alamitos (2001) 15. Grigorescu, E., Kaufman, T., Sudan, M.: 2-transitivity is insufficient for local testability. In: Proc. 23rd IEEE Conference on Computational Complexity, pp. 259–267 (2008) 16. H˚ astad, J., Wigderson, A.: Simple analysis of graph tests on linearity and PCP. Random Structures and Algorithms 22(2), 139–160 (2003) 17. Jutla, C.S., Patthak, A.C., Rudra, A., Zuckerman, D.: Testing low-degree polynomials over prime fields. In: Proc. 45th Annual Symposium on Foundations of Computer Science, pp. 423–432. IEEE Computer Society, Los Alamitos (2004) 18. Kasami, T., Lin, S., Peterson, W.W.: New generalization of the Reed-Muller codes - Part I: Primitive codes. IEEE Transactions on Information Theory 14, 189–199 (1968) 19. Kaufman, T., Litsyn, S.: Almost orthogonal linear codes are locally testable. In: Proc. 46th Annual Symposium on Foundations of Computer Science, pp. 317–326 (2005) 20. Kaufman, T., Ron, D.: Testing polynomials over general fields. In: Proc. 45th Annual Symposium on Foundations of Computer Science, pp. 413–422 (2004) 21. Kaufman, T., Sudan, M.: Algebraic property testing: the role of invariance. In: Proc. 40th ACM Symp. on Theory of Computing, pp. 403–412 (2008); Full version on Electronic Colloquium on Computational Complexity, Technical Report No. TR 07-111, November 2 (2007) 22. Moshkovitz, D., Raz, R.: Sub-constant error low degree test of almost-linear size. In: Proc. 38th ACM Symp. on Theory of Computing, pp. 21–30 (2006) 23. MacWilliams, F.J., Sloane, N.J.A.: The Theory of Error Correcting Codes. North Holland, Amsterdam (1977) 24. Rubinfeld, R.: Robust functional equations and their applications to program testing. SIAM Journal on Computing 28(6), 1972–1997 (1999) 25. Rubinfeld, R., Sudan, M.: Robust characterizations of polynomials with applications to program testing. SIAM Journal on Computing 25(2), 252–271 (1996)
A New Conditionally Anonymous Ring Signature Shengke Zeng, Shaoquan Jiang, and Zhiguang Qin University of Electronic Science and Technology of China {doris82414,jiangshq}@sina.com
Abstract. A conditionally anonymous ring signature, first studied by Komano et al. (RSA06) (termed as a deniable ring signature), is a ring signature except that the anonymity is conditional. Specifically, it allows an entity to confirm/refute that he generated a signature. A group signature also has conditional anonymity since a group manager can revoke a signer’s anonymity. However, the group in this case is fixed, unlike a ring signature where a group is ad hoc. In this paper, we construct a new conditionally anonymous ring signature. Our signing/verification algorithms are asymptotically most efficient, compared with all known schemes. Our confirmation/disavowal protocols are non-interactive with constant costs while the known schemes have a cost linear in either ring size n or security parameter s. Keywords: Conditional Anonymity, Bilinear Pairing, Ring Signature.
1
Introduction
A ring signature, initiated by Rivest et al. [12], is a primitive that allows a signer to represent a group (called a ring) to sign a message while remaining unconditionally anonymous in the ring. This unconditional anonymity is not always desired as it allows a malicious signer to sign a message without being responsible for the consequence. A group signature (e.g.,[6]) can avoid this problem as a group manager can revoke the signer identity using a trap door. However, the group in a group signature is fixed from the beginning while it is formed in an ad hoc manner in a ring signature. A conditionally anonymous ring signature was first proposed by Komano et al. [9] (termed as a deniable ring signature). Under this notion, a signer can represent a ring to sign a message anonymously while the anonymity is conditional: a signer can confirm the fact of signing through a confirmation protocol and a non-signer can refute the claim of signing through a disavowal protocol. This model of conditional anonymity is from the undeniable signature by Chaum and van Antwerpen [5][4], where the signature is not publicly verifiable until a signer confirms that he is the real signer through a confirmation protocol. Our work is motivated by Komano et al. [9] and tries to propose a more efficient conditionally anonymous ring signature scheme. B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 479–491, 2011. c Springer-Verlag Berlin Heidelberg 2011
480
S. Zeng, S. Jiang, and Z. Qin
Naor proposed a deniable ring authentication [11], in which a prover P can convince a verifier V that a message m is from a ring L while P is fully anonymous in L. In addition, V can not prove to the third party that m is obtained from P . His scheme is an interactive protocol and the anonymity inherits from the unconditional anonymity of a ring signature. Wu et al. [13] proposed a new notion of Ad Hoc group signature, which has the same motivation as a conditionally anonymous ring signature although their model is slightly different. They constructed schemes from the accumulator [2] and knowledge signature [3]. Liu et al.[10] proposed revocable ring signature scheme, in which the identity of the actual signer can be revoked by a set of authorities. Fujisaki [8] proposed a traceable ring signature, where the signer’s identity can be traced only if he conducts a double signing on the same message and ring. Although this is useful in e-voting, it is not a conditionally anonymous ring signature we are discussing in this paper. Contribution. Under the security model of Komano et al. [9], we propose a new conditionally anonymous ring signature. Our scheme is more efficient than [9]. Asymptotically (in ring size n), our signing and verification are respectively 4 times faster than [9]. Our confirmation and disavowal protocols are both noninteractive and have constant costs while theirs has O(s) rounds and O(s) exps. Ad hoc group signature [13] has the same motivation as a conditionally anonymous ring signature. In their construction, each ring needs to pre-compute a group parameter using n exps. This pre-computation is useful only if the group changes slowly. This paper considers the general ring signature setting where a ring dynamically changes. Under this setting, their signing/verification needs about n exps. Their confirmation/disavowal protocol (termed as self-traceability protocol in [13]) is also non-interactive but it needs about 2n exps. Their security is based on a new assumption (called DFDH assumption) while ours is based on standard assumptions: DBDH assumption and ECDL assumption. See Definition 1 and 2. All the above three works are in the random oracle model. Detailed comparison is shown in Table 1. Table 1. Comparison between [9], [13] and Our Scheme Signing Verification Confirmation Disavowal Assumption Cost Cost Cost Interactive Cost Interactive [9] (4n − 1)e 4ne (4s)e Yes (4s)e Yes standard [13] (n + 1)e (n + 2)e (2n + 10)e No (2n + 10)e No non-standard ours 1p+4e+nm 2p+3e+nm 3p+6e No 3p+7e No standard
p: pairing; e: exponentiation; m: scalar multiplication; n : ring size; s : security parameter.
2
Preliminaries
In this section we briefly introduce bilinear maps over an elliptic curve and hardness assumptions from it. G1 is an additive cyclic group over an elliptic
A New Conditionally Anonymous Ring Signature
481
curve and G2 is a multiplicative cyclic group. Both of them have a prime order q. P is a random generator of G1 . A bilinear map eˆ : G1 × G1 → G2 is a map satisfying the following: 1. Bilinearity. ∀ P, Q ∈ G1 , ∀ a, b ∈ Zq , eˆ(aP, bQ) = eˆ(P, Q)ab . 2. Non-degeneracy. eˆ(P, Q) = 1 for some Q ∈ G1 \{O} iff P = O (zero in G1 ). 3. Computability. ∀ P, Q ∈ G1 , eˆ(P, Q) can be computed efficiently. Definition 1 (Decisional Bilinear Diffie-Hellman Assumption). Decisional Bilinear Diffie-Hellman (DBDH) assumptions states that no probabilistic polynomial time adversary D can distinguish (aP, bP, cP, eˆ(P, P )abc ) from (aP, bP, cP, R) with non-negligible advantage, where a, b, c ← Zq and R ← G2 . Definition 2 (Elliptic Curve Discrete Logarithm Assumption). Elliptic Curve Discrete Logarithm (EC-DL) Assumption over G1 states that for any probabilistic polynomial time adversary D, Pr[D(aP, P, G1 ) = a : a ← Zq ] is negligible.
3
Model of Conditionally Anonymous Ring Signature
We present a model of [9] (termed as “deniable ring signature” in [9]) for a conditionally anonymous ring signature (we change its name as it seems more intuitive). 3.1
Syntax
As mentioned before, similar to a ring signature, a signer can represent the ring (or group) to sign a message while remaining anonymous among this ring. However, this anonymity is conditional: when one signed a signature, he can confirm this through a confirmation protocol; when one did not sign a signature, he can disavow this through a disavowal protocol. Definition 3. A conditionally anonymous ring signature consists of the following algorithms. Let the universe of members U = {1, · · · , χ}. 1. A probabilistic key generation algorithm K, given a security parameter s, outputs public and private keys (pki , ski ) for member i. 2. A probabilistic signing algorithm S, given a message m, a private key skk of signer k, and the public keys pk1 , · · · , pkn of set L = {u1 , · · · , un }, outputs a tuple (m, σ, L). For simplicity, we do not distinguish i and its public key pki . 3. A deterministic verification algorithm V, given (m, σ, L), determines whether σ is a valid signature for (m, L). 4. A confirmation protocol C, executed between a signer k and a verifier with a common input (m, L, σ, k). A signer also inputs his secret key skk . Finally, a verifier either accepts or rejects the signer’s confirmation. 5. A disavowal protocol D, executed between a member i ∈ L and verifier with input common (m, σ, L, i). The member i also has ski as his secret input. Finally, a verifier either accepts or rejects the signer’s disavowal.
482
3.2
S. Zeng, S. Jiang, and Z. Qin
Oracles
In this subsection, we introduce some oracles utilized in the security models. signing oracle Osig (i, m, L). It should hold i ∈ L. Upon this, a ring signature σ on (m, L) using ski is returned. corruption oracle Ocor (i). The secret key ski of member i is returned. oracle OC/D (i, m, σ, L). It consists of confirmation oracle and disavowal oracle. For the former, the oracle uses ski to interact with the adversary to prove that σ is consistent with pki . The adversary either accepts or rejects the proof. A disavowal oracle is similarly defined. 3.3
Security Model
The security of a conditionally anonymous ring signature scheme is formulated in four properties: anonymity, unforgeability, traceability and non-frameability. They are now introduced as follows. Anonymity. The anonymity essentially means that given a signature no one can tell the identity of the actual signer. Formally, for any distinguisher D, consider the following game (denoted by an anonymity game): – Initially, D receives pki for all i ∈ U. – D can query oracles Osig , Ocor , OC/D adaptively and receive the answer properly. – D outputs (m, pki0 , pki1 , L) for i0 , i1 ∈ L as his challenge. In turn, the challenger takes b ← {0, 1}, uses skib to generate and return a signature σ on (m, L) to D. – D can continue to query oracles Osig , Ocor , OC/D , except that he does not request OC/D to confirm that i0 or i1 is/isnot the signer for (m, L, σ) and that i0 and i1 are uncorrupted. At the end of game, D generates a guess bit b for b. Denote Succanon (D) the anon success event of D in the game. Define AdvD (s) = | Pr[Succanon (D)] − 12 |. Definition 4. A ring signature is conditionally anonymous if for any probabilistic anon polynomial time distinguisher D, AdvD (s) is negligible in security parameter s. Unforgeability. A conditionally anonymous ring signature is unforgeable if it is infeasible for any forger to forge a signature on uncorrupted L. Formally, for any forger F , consider the following game (denoted by an unforgeability game): – Initially, F receives pki for all i ∈ U . – F can query oracles Osig , Ocor , OC/D adaptively and receive the answer properly. At the end of game, F generates a forgery (m∗ , L∗ , σ∗ ). F succeeds if (m∗ , L∗ , σ∗ ) passes the signature verification while (m∗ , L∗ ) was never queried to Osig oracle and no i ∈ L∗ is corrupted. Denote the success probability of F by Pr[Succuf (F )].
A New Conditionally Anonymous Ring Signature
483
Definition 5. A conditionally anonymous ring signature scheme is unforgeable, if for any probabilistic polynomial time forger F , Pr[Succuf (F )] is negligible. Traceability. Traceability essentially means for any consistent ring signature, it is impossible that any member of its ring L can deny generating it. Formally, for an adversary A, consider the following game (called traceability game): – Initially, A receives pki for all i ∈ U. – A can query oracles Osig , Ocor , OC/D adaptively and receive the answer properly. At the end of game, A outputs a signature (m, σ, L) and plays the role of each j ∈ L to execute the disavowal protocol with the challenger. A succeeds if the challenger is convinced for all j ∈ L. Pr[Succtr (A)] denote the success probability of A. Definition 6. A conditionally anonymous ring signature scheme is traceable, if for any probabilistic polynomial time adversary A, Pr[Succtr (A)] is negligible. Non-Frameability. Non-frameability essentially means that if one did not generate a signature, then he should be able to prove this using a disavow protocol. Formally, we consider the following game (called non-frameability game): – Initially, A receives pki for all i ∈ U. – A can query oracles Osig , Ocor , OC/D adaptively and receives the answer properly. At the end of game, A outputs a valid signature (m, σ, L) and uncorrupted j ∈ L such that (j, m, L) was never queried to Osig oracle. Then challenger uses skj to execute the disavowal protocol with A. A succeeds if the challenger fails to disavow. Let Pr[Succnf (A)] denote the success probability of A. Definition 7. A conditionally anonymous ring signature is non-frameable, if for any probabilistic polynomial time adversary A, Pr[Succnf (A)] is negligible.
4
Construction
In this section, we introduce our new conditionally anonymous ring signature scheme. Setup. s ∈ N is a security parameter, groups (G1 , +) and (G2 , ×) are of large prime order q, P is the generator of G1 . eˆ : G1 × G1 → G2 is a bilinear map. H0 : {0, 1}∗ → G1 and H1 : {0, 1}∗ → Zq are two hash functions. Key Generation. Take ti ← Zq as the private key for member i. Ti = ti P is his public key, where in this paper a ← S means taking a random element from set S. Signing. Given message m and ring L = T1 ||T2 || · · · ||Tn , signer k ∈ L (when it is clear, we do not distinguish k and Tk ) first generates a partial signature (ρ, r0 ):
484
S. Zeng, S. Jiang, and Z. Qin
1. Take r0 ← {0, 1}s , compute μ0 = H0 (0, r0 , m, L), μ1 = H0 (1, r0 , m, L); 2. Compute ρ = eˆ(μ1 , μ0 )tk . Then, signer generates a proof π1 that ρ = eˆ(μ1 , μ0 )tk holds for some k ∈ L without revealing k. Generically, OR protocol [7] can do this but it requires a multiple of n pairings, inefficient! We can do this efficiently as follows. 3. Take d, r1 ← Zq , compute M = eˆ(P, P )d , N = eˆ(μ1 , μ0 )d , R = ρr1 ; 4. Take Ui ← G1 for each i = k, compute hi = H1 (m, M, N, R, ρ, Ui ); 5. Compute Uk = r1 Tk − i=k (Ui + hi Ti − hi Tk ), hk = H1 (m, M, N, R, ρ, Uk ), n e = d − ( i=1 hi + r1 )tk . Finally, let π1 =(M, N, R, {Ui }ni=1 , e). The complete signature is σ = (ρ, r0 , π1 ). Verification. Upon σ = (ρ, r0 , π1 ) and (m, L), let π1 = (M, N, R, {Ui }ni=1 , e). Verifier does the following to verify that (ρ, r0 ) is consistent with (k, m, L) for some k ∈ L. 1. Compute hi = H1 (m, M, N, R, ρ, Ui ), for all i ∈ {1, 2, · · · , n}; 2. Check ?
M = eˆ(P, P )e · eˆ(P, ?
N =ρ
n
i=1
n
(Ui + hi Ti )),
(1)
i=1 hi
· R · eˆ(μ1 , μ0 )e .
(2)
It accepts if and only n n if Eqn. (1)(2) both hold. Completeness. Note i=1 (Ui +h i Ti ) = (r1 + i=1 hi )Tk . Hence, the right side of n e Eqn (1) is e ˆ (P, P ) · e ˆ (P, (r + h )T ) = e ˆ (P, P )d = M. On the other hand, 1 i=1 i k n n e+tk ( i=1 hi +r1 ) = d. Hence, the right side of Eqn (2)=ˆ e(μ1 , μ0 )e ·ρ i=1 hi ·R = N. Remark 1. π1 in fact demonstrates the knowledge of tk . Indeed, M, N, R, m, Ui are the input to compute hi for each i ∈ L and hence they (also implying d, r1 ) are fixed before computing hi . Assume the forgery is σ = (ρ, r0 , M, N, R, {Ui }ni=1 , e). Let hk be the latest computed variable among {hi }ni=1 . If we change hk to hk (under the random oracle model), then the forgery will accordingly change to σ = (ρ, r0 , M, N, R, {Ui}ni=1 , e ) so that hi = hi for i = k. Using verification in Eqn.(1)(2) for σ and σ , we have that (e − e ) + (hk − hk )tk = 0 and (e − e ) + (hk − hk )t = 0, where ρ = eˆ(μ0 , μ1 )t . Hence, t = tk = (e − e)/(hk − hk ). For anonymity, Eqn. (1)(2) do not leak anything about k as the verification is symmetric on L and ρ = eˆ(μ0 , μ1 )tk does not leak k. Confirmation. The actual signer k uses this protocol to prove that the partial ring signature (ρ, r0 ) is indeed produced by him w.r.t. (m, L). 1. He takes d ← Zq , and computes M = eˆ(P, P )d , N = eˆ(μ1 , μ0 )d , hk = H1 (M , N , ρ), e = d − hk · tk ; 2. He sends the proof π2 = (e , M , N ) to the verifier;
A New Conditionally Anonymous Ring Signature
485
3. Verifier computes hk = H1 (M , N , ρ); ? ? 4. Verifier checks that M = eˆ(P, P )e · eˆ(P, Tk )hk , and N = ρhk · eˆ(μ1 , μ0 )e ; Verifier accepts if and only if both equations hold. Disavowal. Upon signature (ρ, r0 , π1 ) on (m, L), a non-signer ∈ L to prove that he did not generate this signature. To do this, he proves that ρ is consistent with T : 1. He computes ρ = eˆ(μ1 , μ0 )t and generates a proof π3 using confirmation protocol proving that T and ρ are consistent in t . Finally, he sends π3 , ρ to verifier. 2. Verifier checks ρ = ρ and π3 is valid. He accepts if and only If both hold. 4.1
Performance
Our signing algorithm needs 1 pairing, 4 exps and n scalar multiplications; verification algorithm needs 2 pairings, 3 exps and n scalar multiplications; confirmation needs 3 pairings and 6 exps; disavowal needs 3 pairings and 7 exps, where counts simple strategies (e.g., in signing algorithm, the calculation r1 Tk + ni=1 hi Tk = (r1 + ni=1 hi )Tk costs one scalar multiplication; eˆ(P, P ) is fixed and can be pre-computed). In contrast, for the scheme in [9], signing algorithm costs (4n − 1) exps; verification algorithm costs 4n exps; confirmation costs 4s exps; disavowal costs 4s exps. It is known that a scalar multiplication is faster than an exp under the same parameter size. Hence, asymptotically, our signing/verification is at least 4 times faster than [9]; Disavowal/confirmation is respectively much faster than theirs. We notice that their confirmation scheme seemingly can also use Fiat-Shamir transform (hence can be more efficient) but it is unclear whether such a technique is also applicable to their disavowal protocol as a care must be taken that such a proof should not give adversary some knowledge to forge a signature w.r.t. an honest user (i.e., framing). In terms of our scheme, such a care means ρ should not give adversary an advantage to frame. In the construction of [13], one needs to first conduct n exps to compute a public group parameter. This parameter is unlikely to be pre-computable if the ring is dynamically changing. So in this scenario, their signing/verification should count this cost and hence need about n exps. Similarly, their confirmation/disavowal protocol is also non-interactive but in this scenario it needs about 2n exps. For the size of the signature, the scheme of [13] generates the signature with constant size, and the size of signature in [9] and ours are 2n + O(1) field elements. The security in [13] is based on a new assumption whereas ours is based on standard assumptions. Comparison with [9] and [13] is summarized in Table 1.
5
Security
Anonymity. Our anonymity idea is simple. Equations (1)(2) are symmetric on members in L. Further, the partial signature (ρ, r0 ) does not leak any information about signer k, due to DBDH assumption. However, the anonymity
486
S. Zeng, S. Jiang, and Z. Qin
must be proved when adversary has access to signing, confirmation/disavowal and corruption oracles. So it needs some care to reduce the anonymity to the DBDH assumption. Theorem 1. Our construction is conditionally anonymous under DBDH assumption if H0 and H1 are random oracles. Proof. Assume D is a distinguisher who breaks the anonymity with non-negligible advantage. We construct an adversary B to break the DBDH assumption. Upon a challenge (P, A = aP, B = bP, C = cP, Z), his goal is to distinguish Z = eˆ(P, P )abc or Z is random in G2 . B uses this challenge tuple to simulate an anonymity game with D and uses it to distinguish Z. Detailed simulation follows. Setup. For U = {1, 2, · · · , χ}, B takes k ← U, and sets the public key Tk = C. For user i = k, B defines Ti = ti P normally by taking ti ← Zq . B provides D with parameters (q, G1 , G2 , eˆ, χ, P, H0 , H1 , {Ti }χi=1 ). B maintains oracles H0 and H1 as follows. H0 oracle for a query of form (0, m, r0 , L): B maintains a list L1 (initially empty). He first checks if (0, m, r0 , L) was queried to H0 . If no, B tosses a coin ∈ {0, 1} with Pr[coin = 0] = δ (δ is chosen later). B takes x ← Zq and inserts (0, m, r0 , L, x, coin) into L1 . In any case, he extracts a record (0, m, r0 , L, x, coin) from L1 . If coin = 0, B answers H0 (0, m, r0 , L)=xP . If coin = 1, B replies H0 (0, m, r0 , L)=x(aP ) to D. H0 oracle for a query of form (1, m, r0 , L): B maintains a list L2 (initially empty). He first checks if (1, m, r0 , L) was queried to H0 . If no, B chooses a random value y ∈ Zq , and inserts the tuple (1, m, r0 , L, y) into L2 . In any case, B can extract a record (1, m, r0 , L, y) from L2 . B returns H0 (1, m, r0 , L) = y(bP ). H0 oracle for a query z of not the above two forms: B maintains a list L3 (initially empty). If z was not queried to H0 , B takes ξ randomly from G2 and inserts (z, ξ) into L3 . In any case, he extracts a record (z, ξ) from L3 and replies with ξ. H1 oracle for query z: B maintains a list L4 (initially empty). Upon a query z, if it was not queried before, then he takes ξ randomly from Zq and inserts (z, ξ) into L4 . In any case, he extracts a record (z, ξ) from L4 and returns ξ. B answers other oracles queries from D as follows: Query on Ocor (i): If i = k, B terminates with Fail; otherwise, normally returns ti . Query on Osig (i, m, L): Let L = T1 T2 · · · Tn (L ⊆ U). If i = k, B proceeds normally using the signing key ti . If i = k, B simulates (ρ, r0 , π1 ) as follows: - ρ: B first takes r0 ← {0, 1}s . The probability that ∃(0, m, r0 , L, ·, ·) ∈ L1 is |L1 |/2s , which is negligible, ignored. Thus, B queries (0, m, r0 , L) to H0 oracle and let the (new) record for it in L1 is (0, m, r0 , L, x, coin). If coin = 1, aborts; otherwise, he queries (1, m, r0 , L) to H0 oracle and assume the record for it in L2 is (1, m, r0 , L, y). B computes (ρ, r0 ) = (ˆ e(μ1 , μ0 )tk , r0 ) = (ˆ e(y(bP ), xP )c , r0 ) = xy (ˆ e(B, C) , r0 ). - π1 : B simulates the proof π1 as follows:
A New Conditionally Anonymous Ring Signature
1. Take d ← Zq , compute M = eˆ(P, P )d , N = eˆ(μ1 , μ0 )d ; 2. Take Ui ← G1 , hi ← Zq for each i ∈ L\{k}; n 3. Take z, hk ← Zq , compute Uk = zP − i=k Ui − i=1 hi Ti , R =
487
eˆ(μ ,μ0 )z 1 . n ρ i=1 hi
(Note: r1 in the signing algorithm is implicitly fixed here by z with z = n n i=1 hi +r1 )tk ,μ0 )z eˆ(μ1 ,μ0 )( 1 (r1 + i=1 hi )tk . R = eˆ(μ = = ρr1 , consistent with n n h h ·t i=1 i i=1 i k ρ
eˆ(μ1 ,μ0 )
the specification); n 4. Let e = d − z. (By the note above, e = d − ( i=1 hi + r1 )tk , consistent with the specification!); 5. For each i, define hi = H1 (m, M, N, R, ρ, Ui ) and update L4 for this correspondingly. As {Ui }ni=1 are uniformly random in G1 , the probability that (m, M, N, R, ρ, Ui ) for some i was queried to H1 is negligible, ignored! Hence, this update for L4 is consistent. Finally, define π1 = (M, N, R, {Ui}ni=1 , e) Finally, B returns the ring signature σ = (ρ, r0 , π1 ) to D. Query on OC/D : Confirmation. For a partial signature (ρ, r0 ) by user i ∈ L on m, B needs to simulate the confirmation oracle to prove that ρ is consistent with Ti . If i = k, B uses ti to do this normally. If i = k, B first extracts a tuple (0, m, r0 , L, x, coin) in L1 (it exists since by definition we only confirm a signature by the simulator which implies that μ0 has been computed by H0 through L1 ). If coin = 1, B aborts with failure. Otherwise, it simulates the confirmation oracle as follows: 1. Take e , hk ← Zq ; 2. Compute M = eˆ(P, P )e · eˆ(P, Tk )hk , which can be expressed as eˆ(P, P )e +tk hk = eˆ(P, P )d for a hidden d = e + tk hk . Let the record for defining μ1 in L2 be (1, m, r0 , L, y), and compute N = ρhk · eˆ(μ1 , μ0 )e = ρhk · eˆ(B, P )xye , which also can be expressed as eˆ(μ1 , μ0 )e +tk hk = eˆ(μ1 , μ0 )d ; 3. Define hk = H1 (M , N , ρ) and update L4 for this correspondingly. As e is random in Zq , the probability that (M , N , ρ) was previously queried to H1 , is negligible, ignored! Hence, the update for L4 is consistent. 4. Return the proof π2 =(e , M , N ). Disavowal. B simulates member i ∈ L to disavow generating a given ring signature (m, L, ρ0 , r0 , π1 ). Using confirmation oracle, it can be done simply: 1. B computes ρi = eˆ(μ0 , μ1 )ti (if i = k, computes ρi as in the signing oracle). 2. B simulates π3 as in the confirmation oracle that ρi is consistent with Ti . 3. Finally, send ρi and π3 to D. Challenge. Now assume D outputs a message m∗ , ring L∗ and a pair (u, ) as his anonymity challenge. If neither of u or is k, aborts; otherwise, assume k = u. Then B flips a fair coin θ. If θ = 0, B simulates the challenge as follows. 1. ρ0 : B takes r0∗ ← Zq , and queries (1, m∗ , r0∗ , L) to oracle H0 . After this, let the record in L2 for this is (1, m∗ , r0∗ , L, y). Then B queries (0, m∗ , r0∗ , L) to H0 oracle. After this, let the record in L1 for this be (0, m∗ , r0∗ , L, x, coin). If coin = 0, aborts with failure; otherwise, compute ρ0 = Z xy . Note when Z = eˆ(P, P )abc , ρ0 = eˆ(axP, byP )c = eˆ(μ0 , μ1 )c = eˆ(μ0 , μ1 )tk , consistent!
488
S. Zeng, S. Jiang, and Z. Qin n
2. π10 : B chooses e, r1 , {hj }nj=1 ∈ Zq , computes M = eˆ(P, P )e · eˆ(P, C) j=1 hj +r1 n = eˆ(P, P )e+( j=1 hj +r1 )tk = eˆ(P, P )d for a hidden d, N = eˆ(A, B)exy · n n Z xy( j=1 hj +r1 ) . When Z = eˆ(P, P )abc , N = eˆ(μ1 , μ0 )e+( j=1 hj +r1 )c = eˆ(μ1 , μ0 )d , consistent. When Z is random, N is random. Then B computes r1 xyr1 R , and = ρ = Z for j = k, B chooses Uj ∈ G1 , computes Uk = r1 Tk − ∗ j=k (Uj +hj Tj )+ j=k hj Tk (perfectly simulated). Since {Uj }j∈L (includn ∗ ing j = k) are uniformly in G1 , the probability that (m , M, N, R, ρ0 , Uj ) was queried H1 before, is negligible (ignore!). Hence, it is consistent to define hj = H1 (m, M, N, R, ρ0 , Uj ) for j ∈ L∗ and update L4 correspondingly. From our simulation, when Z = eˆ(P, P )abc , the adversary’s view in this simulation is according to the real distribution. If θ=1, B computes member ’s ring signature (ρ1 , π11 ) using t normally. In any case, B provides (ρθ , π1θ ) to D. Guess. Assume D outputs a guess bit θ for θ. If θ = θ , B guesses Z is eˆ(P, P )abc ; otherwise, B guesses Z is random. Analysis. We first assume that the abortion event does not occur in the simanon ulation. In the real world, assume D has advantage AdvD = D to distinguish the members k and . When θ = 1, since Z is not used in the simulator, the success probability of B is exactly 1/2. In the case of θ = 0, the success probability of B is Pr[θ = θ = 0 ∧ (Z = eˆ(P, P )abc )] + Pr[θ = 0, θ = 1 ∧ (Z = random )]. Note Pr[Z = eˆ(P, P )abc ] = Pr[Z = random ] = 1/2. And also note that when Z = eˆ(P, P )abc , the adversary’s view is identical to the real anonymity game. Hence, the first part is 1/2(1/2 + D ). On the other hand, when Z is random, (ρ0 , π10 ) is independent of the signer identity. Hence, the second part =1/4. Combining all the cases together, we have that the success probability of B is 1/2 + 1/2 D , contradiction to DBDH assumption. Our analysis is based on the assumption that no abortion event occurs. However, there are three types of abortion events: (1) the chosen anonymity pair by D does not contain member k. This abort ion does not occur with probability 1/χ; (2) for H0 oracle, it won’t abort only if the coin in the challenge simulation is coin = 1, and for other cases coin = 0. This occurs with probability 1/χ·δ qH0 (1− δ), where qH0 is the number of H0 queries. This value is maximized at δopt = qH0 /(qH0 + 1); (3) when member k is corrupted, abortion event occurs. However, when this occurs, it is impossible for D to choose k as the test member because the definition requires that D can not query Ocor for the test members. Hence, conditional on abortion event in (1) will not occur, this case does not occur too. Summarizing the cases, we conclude the probability that B can solve DBDH problem is at least 12 + 2eχ2 (qDH +1) (here e is the base of the natural 0 logarithm), which is non-negligibly better than 1/2. Unforgeability. We consider the unforgeability of our scheme. The basic idea is outlined in Remark 1. We give a formal proof in this section, where we will use Forking Lemma [1]. It essentially means that if an attacker breaks a system
A New Conditionally Anonymous Ring Signature
489
with a good probability, then when we rewind this attacker, it will succeed with a related result. In our system, these related results will allow us to extract the system secret. Theorem 2. Our construction is unforgeable under ECDL assumption if H0 and H1 are random oracles. Proof. Assume F is a forger with non-negligible success probability. We construct an adversary B to break ECDL assumption. Given a challenge (P, C = cP ), B needs to compute c. B constructs an algorithm A with input (P, cP ) (A will be used in the Forking Lemma [1]). A chooses member k from U randomly, and sets the public key of member k as Tk = C. For user i = k, A defines Ti normally by taking ti randomly from Zq . A provides F with parameters (q, G1 , G2 , eˆ, P, H0 , H1 , χ, {Ti }χi=1 ). A runs F against the unforgeability game and answers his oracle queries as follows. H0 -query z: A maintains a list L1 (initially empty). He first checks if z was queried to H0 . If no, A takes ξ ← Zq , and inserts the tuple (z, ξ) into L1 . In any case, A extracts a record (z, ξ) from L1 and returns H0 (z) = ξP . B answers queries H1 (z) and Ocor (i) as described in the Theorem 1 Query on Osig (i, m, L): Let L = T1 T2 · · · Tn (L ⊆ U). If i = k, A proceeds normally as he knows the secret key ti . If i = k, A simulates ρ, r0 , π1 as follows: (ρ, r0 ): Take r0 ← Zq . For a = 0, 1, let μa = H0 (a, m, r0 , L) = ξa P using the record in L1 . Then A computes ρ = eˆ(μ1 , μ0 )tk = eˆ(ξ1 P, ξ0 P )tk = eˆ(P, C)ξ0 ξ1 . π1 : A simulates the proof π1 as described in Theorem 1 (without using tk ). Finally, A returns σ = (ρ, r0 , π1 ) to F . Query on OC/D : The simulation exactly follows that in Theorem 1. Notice that abortion event there occurs only if H0 (input) is not xP for a known x (i.e., case coin = 1). Here no abortion occurs as H0 (input) is always xP for a known x. Disavowal oracle can be straightforward using the confirmation oracle. Finally, F outputs a forged proof π1∗ = (M ∗ , N ∗ , R∗ , {Ui∗ }ni=1 , e∗ ) on its chosen message m∗ and ring L∗ . If F ’s forgery is valid and k ∈ L∗ , A returns ω ∗ = (m∗ , L∗ , ρ∗ , r0∗ , M ∗ , N ∗ , R∗ , {Ui∗ }ni=1 , e∗ ). Note that A accepts only if ρ∗ is consistent with Tk (note that he can verify this himself by checking that ρ = eˆ(μ0 , μ1 )ti for all i ∈ L∗ \{k} using ti (known)). We claim that the accepting probability acc of A is χ1 F . Before abortion, the view of F is real. This implies that k is the forgery signer identity with probability 1/χ. Further, the forgery by member k with probability F /χ. On the other hand, when k is corrupted, a forgery can not be generated with k ∈ L. Hence, the accepting probability acc of A is still: acc = χ1 F . This completes the description of A. Now we consider the algorithm B who wants to solve ECDLP. On input public key Tk = C, B runs the forking algorithm FA (C) (with advantage f rk) twice to return I ∗ , ω ∗ = (m∗ , L∗ , ρ∗ , r0∗ , M ∗ , N ∗ , R∗ , {Ui∗ }, e∗ ) and I , ω = (m , L , ρ , r0 , M , N , R , {Ui }, e ). H defined in FA (x) code of Forking Lemma is H1 here. Define I ∗ (resp. I ) to be the index of random outputs by H1 such that γI ∗ (resp. γI ) is used to define the final hi in
490
S. Zeng, S. Jiang, and Z. Qin
computing ω ∗ (reps. ω ). If I ∗ = I , then prior to receiving γI ∗ and γI , the whole randomness for computing ω ∗ and ω are identical. Hence, in this case, m∗ = m , L∗ = L , M ∗ = M , N ∗ = N , R∗ = R , ρ∗ = ρ (as they are the H1 query input to obtain γI ∗ (respectively γI ))and Ui∗ = Ui for each i ∈ L∗ = L (each appears in the input for computing hi and must occur before γI ∗ or γI is received). Assume γI ∗ (resp. γI ) is used to define h∗i0 (resp. hi0 ) for i0 ∈ L∗ = L . Then, M∗ M = eˆ(P, ni=1 (Ui∗ + h∗i Ti )) and eˆ(P,P ˆ(P, ni=1 (Ui + hi Ti )) = e eˆ(P,P )e∗ )e ∗
From this, we have eˆ(P, P )e n
∗ i=1 hi
−e
= eˆ(P, (hi0 −h∗i0 )Ti0 ). (e∗ −e )+(h∗i0 −hi0 )ti0 = ∗
n
h
0. Similarly, (ρ∗ ) ·R∗ ·ˆ e(μ1 , μ0 )e = (ρ∗ ) i=1 i ·R · eˆ(μ1 , μ0 )e , which gives ∗ ∗ (e − e ) + (hi0 − hi0 )tk = 0. Hence i0 = k and tk = ti0 = (e∗ − e )(hk − h∗k )−1 . 2 By Forking Lemma, the success probability of B is B ≥ f rk ≥ acc − 21s ≥ qH 2F χ2 ·qH1
1
−
1 2s ,
which is non-negligible.
Traceability. We need to show that there does not exist an attacker, who comes up with a signature (σ = (ρ, r0 , π1 ), m, L) such that every j ∈ L can disavow (i.e., no one can be traced). Our idea is that when the signature is consistent, ρ must be consistent with Tk for some k ∈ L. This can be shown by applying Forking Lemma and using Eqn. (1)(2). Then, for a consistent k to disavow, he must generate some ρ (different from ρ = eˆ(μ0 , μ1 )tk ) and prove it is consistent with Tk using the confirmation protocol. This is impossible as the soundness error of this protocol is negligible, which can be shown using Forking Lemma and verification equations for N and M . Proof details will appear in the full paper. Theorem 3. Our construction is traceable if H0 and H1 are random oracles. Non-frameability. Non-frameability essentially states that the adversary can not generate a signature such that an honest member did not sign it while he can not disavow. Our proof idea is that if the signature is consistent, then using Forking Lemma, we can show that ρ = eˆ(μ0 , μ1 )tk for some k ∈ L. If k is uncorrupted and did not sign the signature, then we can reduce the attacker to break ECDL assumption. The details will appear in the full paper. Theorem 4. Our construction is non-frameable if H0 and H1 are random oracles and ECDL assumption holds.
6
Conclusion
In this paper, we construct a conditionally anonymous ring signature scheme. Like a traditional ring signature, the identity of the signer is anonymous. However, this anonymity is conditional: when one signed the signature, he can confirm this through a confirmation protocol; when he did not sign a message, he disavows through a disavowal protocol. Our protocol is more efficient than previous protocols and is secure under standard assumptions. In addition, our confirmation protocol is non-interactive.
A New Conditionally Anonymous Ring Signature
491
Acknowledgments. This work is supported by NSFC (No. 60973161), Government Basic Research Support for Universities (No. ZYGX2010X015) and Funds of Ministry of Education for Doctoral Program (No. 200806140010). Shengke Zeng is currently a visiting Ph.D student at Communication Security Lab, University of Waterloo.
References 1. Bellare, M., Neven, G.: Multi-Signatures in the Plain Public-Key Model and a General Forking Lemma. In: ACM CCS 2006, pp. 390–399. ACM Press, New York (2006) 2. Benaloh, J., de Mare, M.: One-way Accumulators: A Decentralized Alternative to Digital Signatures. In: Helleseth, T. (ed.) EUROCRYPT 1993. LNCS, vol. 765, pp. 274–285. Springer, Heidelberg (1994) 3. Camenisch, J., Michels, M.: A Group Signature Scheme Based on An RSA Variant. In: Ohta, K., Pei, D. (eds.) ASIACRYPT 1998. LNCS, vol. 1514, pp. 160–174. Springer, Heidelberg (1998) 4. Chaum, D.: Zero-knowledge Undeniable Signatures. In: Damg˚ ard, I.B. (ed.) EUROCRYPT 1990. LNCS, vol. 473, pp. 458–464. Springer, Heidelberg (1991) 5. Chaum, D., van Antwerpen, H.: Undeniable Signatures. In: Brassard, G. (ed.) CRYPTO 1989. LNCS, vol. 435, pp. 212–216. Springer, Heidelberg (1990) 6. Chaum, D., van Heyst, E.: Group Signature. In: Davies, D.W. (ed.) EUROCRYPT 1991. LNCS, vol. 547, pp. 257–265. Springer, Heidelberg (1991) 7. Cramer, R., Damgard, I., Schoenmakers, B.: Proofs of Partial Knowledge and Simplified Design of Witness Hiding Protocols. In: Desmedt, Y.G. (ed.) CRYPTO 1994. LNCS, vol. 839, pp. 174–187. Springer, Heidelberg (1994) 8. Fujisaki, E., Suzuki, K.: Traceable Ring Signature. In: Okamoto, T., Wang, X. (eds.) PKC 2007. LNCS, vol. 4450, pp. 181–200. Springer, Heidelberg (2007) 9. Komano, Y., Ohta, K.: Shimbo, Atsushi, Kawamura, S.: Toward the Fair Anonymous Signatures: Deniable Ring Signatures. In: Pointcheval, D. (ed.) CT-RSA 2006. LNCS, vol. 3860, pp. 174–191. Springer, Heidelberg (2006) 10. Liu, D., Liu, J., Mu, Y., Susilo, W., Wong, D.: Revocable Ring Signature. Journal of Computer Science and Technology 22(6), 785–794 (2007) 11. Naor, M.: Deniable Ring Authentication. In: Yung, M. (ed.) CRYPTO 2002. LNCS, vol. 2442, pp. 481–498. Springer, Heidelberg (2002) 12. Rivest, R.L., Shamir, A., Tauman, Y.: How to Leak a Secret. In: Boyd, C. (ed.) ASIACRYPT 2001. LNCS, vol. 2248, pp. 552–565. Springer, Heidelberg (2001) 13. Wu, Q., Susilo, W., Mu, Y., Zhang, F.: Ad Hoc Group Signatures. In: Yoshiura, H., Sakurai, K., Rannenberg, K., Murayama, Y., Kawamura, S.-i. (eds.) IWSEC 2006. LNCS, vol. 4266, pp. 120–135. Springer, Heidelberg (2006)
On the Right-Seed Array of a String Michalis Christou1 , Maxime Crochemore1,2 , Ondrej Guth4, , Costas S. Iliopoulos1,3 , and Solon P. Pissis1 1
4
Dept. of Informatics, King’s College London, London WC2R 2LS, UK {michalis.christou,mac,csi,pississo}@dcs.kcl.ac.uk 2 Universit´e Paris-Est, France 3 Digital Ecosystems & Business Intelligence Institute, Curtin University GPO Box U1987 Perth WA 6845, Australia Dept. of Theoretical Computer Science, Faculty of Information Technology, Czech Technical University in Prague [email protected]
Abstract. We consider the problem of finding the repetitive structure of a given fixed string y. A factor u of y is a cover of y, if every letter of y falls within some occurrence of u in y. A factor v of y is a seed of y, if it is a cover of a superstring of y. There exist linear-time algorithms for solving the minimal cover problem. The minimal seed problem is of much higher algorithmic difficulty, and no linear-time algorithm is known. In this article, we solve one of its variants – computing the minimal and maximal right-seed array of a given string. A right seed of y is the shortest suffix of y that it is a cover of a superstring of y. An integer array RS is the minimal right-seed (resp. maximal right-seed) array of y, if RS [i] is the minimal (resp. maximal) length of right seeds of y[0 . . i]. We present an O(n log n) time algorithm that computes the minimal right-seed array of a given string, and a linear-time solution to compute the maximal right-seed array by detecting border-free prefixes of the given string. Keywords: algorithms on strings, periodicity, covers, seeds.
Introduction The notion of periodicity in strings is well studied in many fields like combinatorics on words, pattern matching, data compression and automata theory (see [16,17]), because it is of paramount importance in several applications, not to talk about its theoretical aspects. The concept of quasiperiodicity is a generalization of the notion of periodicity, and was defined by Apostolico and Ehrenfeucht in [2]. In a periodic repetition the occurrences of the single periods do not overlap. In contrast, the quasiperiods of a quasiperiodic string may overlap. We call a factor u of y a cover of y, if every
The author has been supported by the Ministry of Education, Youth and Sports of Czech Republic under research program MSM 6840770014, and by the Czech Science Foundation as project No. 201/09/0807.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 492–502, 2011. c Springer-Verlag Berlin Heidelberg 2011
On the Right-Seed Array of a String
493
letter of y is within some occurrence of u in y. Note that we consider the aligned covers, where the cover u of y needs to be a border of y. The array C is called the minimal cover (resp. maximal cover) array of y of length n, if for each i, 0 ≤ i < n, C [i] stores the length of the shortest (resp. longest) cover of y[0 . . i]. Apostolico and Breslauer [1,4] gave an online linear runtime algorithm computing the minimal cover array of a string. Their algorithm preprocesses the string to find the periods of each prefix of the string [8], using the KMP algorithm [14], in linear time. In addition, Li and Smyth [15] provided an algorithm, having the same characteristics, for computing the maximal cover array of a given string, which gives also all the covers of every prefix of the string. In this article, we consider the so-called seeds, which are regularities of strings strongly related to the notion of cover. They were first defined and studied by Iliopoulos, Moore and Park [13]. The notion of seed is an extension of the definition of a cover of a string, as it is a cover of a superstring of the word. A right seed of y, dual notion of the left seed firstly defined in [5], is the shortest suffix of y that is a cover of a superstring of y. The array RS is called the minimal (resp. maximal) right-seed array of y, |y| = n, if for each i, 0 ≤ i < n, RS [i] is the minimal (resp. maximal) length of right seeds of y[0 . . i]. Note the right seed array of y is not the left-seed array of the reverse of y. Finding left seeds is easier than finding right seeds, as left seeds start from the beginning of the string, while right seeds are expanded from the end of each prefix of the string. Recently in [5], Christou et al. presented a linear-time algorithm for computing the minimal left-seed array of a given string. In particular, they used Apostolico and Breslauer’s algorithm, for computing the minimal cover array of a string [1,4], to compute the length of the left seeds of all prefixes of a given string. In addition, they provided a linear-time solution to compute the maximal left-seed array by detecting border-free prefixes of the given string. In this article, we present an algorithm, that uses a variant of the partitioning algorithm designed by Crochemore [7] (see also [8], Chapter 9), for computing the minimal right-seed array of a given string in O(n log n) time. In addition, for the sake of completeness, we give a linear-time solution to compute the maximal right-seed array, similarly as shown in [5]. The rest of the article is structured as follows. In Section 1, we present the basic definitions used throughout the article, and we define the problems solved. In Section 2, we prove some properties of the right seeds used later for the design and analysis of the provided algorithms. In Section 3, we describe our algorithms for computing the minimal and the maximal right-seed array of a given string. Finally, we briefly conclude, and give some future proposals in Section 4.
1
Definitions and Problems
Throughout this article we consider a string y, |y| = n, on a fixed alphabet. It is represented as y[0 . . n − 1]. A string w is a factor of y if y = uwv for two strings u and v. It is a prefix of y if u is empty and a suffix of y if v is empty. A string u is a border of y if u is both a prefix and a suffix of y. The border of y, denoted
494
M. Christou et al.
by Border(y), is the length of the longest border of y. A string u is a period of y, if y is a prefix of uk for some positive integer k (i.e. y is a prefix of uy). The period of y, denoted by Per(y), is the length of the shortest period of y. For a string x = x[0 . . m − 1] such that x and y share a common part x[m − . . m − 1] = y[0 . . − 1] for some ≥ 1, the string x[0 . . m − 1]y[ . . n − 1] = x[0 . . m − − 1]y[0 . . n − 1] is a superposition of x and y with an overlap of length . A string x, |x| = m, is a cover of y if both m < n and there exists a set of positions P ⊆ {0, . . . , n − m} that satisfies both y[i . . i + m − 1] = x for all i ∈ P and i∈P {i, . . . , i + m − 1} = {0, . . . , n − 1}. The minimal cover array C of y is the array of integers for which C [i], 0 ≤ i ≤ n − 1, stores the length of the shortest cover of the prefix y[0 . . i]. A factor v of y is a seed of y, if it is a cover of a superstring of y. A right seed of y is a suffix of y that it is a cover of a superstring of y of the form wy, where w is a possibly empty string. The minimal right seed is the shortest right seed of y. The maximal right seed is the longest right seed of y that is shorter than y (or empty string if none). The minimal right-seed array RS of y is the array of integers for which RS [i], 0 ≤ i ≤ n − 1, stores the length of minimal right seed of y[0 . . i]. The maximal right-seed array RS M of y is the array of integers for which RS M [i], 0 ≤ i ≤ n − 1, stores the length of maximal right seed of y[0 . . i]. The following table provides C , RS , and RS M for the string y = abaababaabaabab. i y[i] C [i] RS [i] RS M [i]
0 a 1 1 0
1 b 2 2 0
2 a 3 2 2
3 a 4 3 3
4 b 5 3 4
5 a 3 3 5
6 b 7 5 6
7 a 3 3 7
8 a 9 5 8
9 b 5 5 9
10 a 3 3 10
11 a 12 8 11
12 b 5 5 12
13 a 3 3 13
14 b 15 8 14
We consider the following problems: Problem 1 (Computing the minimal right-seed array). Compute the minimal right-seed array RS for some string y. Problem 2 (Computing the maximal right-seed array). Compute the maximal right-seed array RS M for some string y.
2
Properties
In this section, we prove some useful properties for minimal and maximal right seeds of y. The following lemma gives the necessary and sufficient condition for a suffix of a string to be a right seed of that string. A similar lemma giving the necessary and sufficient condition for a prefix of a string to be a left seed of that string is given in [5]. Lemma 1. A string z is a right seed of y iff z is a cover of a suffix of y whose length is at least the period of y. Proof. Direct: Suppose a string z is a cover of a suffix of y, say vu, |vu| ≥ Per(y), where |u| = Per(y) and |v| ≥ 0. By periodicity, y[0] = y[k] for some
On the Right-Seed Array of a String
495
k ∈ {n − |u|, . . . , n − 1}. Then we can easily see that z is also a cover of vy[n − |u| . . k − 1]y = vum , m ∈ N. Therefore z is a right seed of y. Reverse: Let z be a right seed of y. – If |z| ≤ Border(y): a prefix v of z (possibly empty) is a suffix of the border y[|u| . . n − 1], where |u| = Per(y) (consider the right seed that covers y[n − |u|]). Then z is a cover of vu (a suffix of y). – If |z| > Border(y): suppose z is not a cover of a suffix of y of length longer or equal to Per(y). Let v be a border of y such that |v| = Border(y). Then v is a factor of z, such that z = xvw, where x and w are non-empty words (consider the right seed that covers y[0 . . |v|]). This gives vw a longest border for y, which is a contradiction. Lemma 2. Let Per(y) = k, then – if k = n, then there is no maximal right seed for y. – if k < n, then the maximal right seed of y is y[1 . . n − 1] Proof. – if k = n, by definition, the maximal right seed is shorter than n. Let y[j . . n−1] be the maximal right seed of y, with 0 < j ≤ n−1. Then, in order to cover y, a non-empty suffix of y[j . . n − 1], say w, is a prefix of y (consider the maximal right seed that covers y[0]). Then n − |w| gives a shorter period for y, which is a contradiction. – if k < n, then the maximal right seed of y is y[1 . . n − 1], as it is a cover of the superstring y[0 . . n − 1 − Border(y)]y of y, and it has the maximum length allowed, which is n − 1.
3
The Algorithms
In this section, we describe our algorithms for solving Problem 1 and Problem 2. For solving Problem 1, we use a variant of the partitioning algorithm in [7,13] to find the sets of ending positions of all the occurrences of each factor in the string. We are then able to find which suffix of each prefix of the string is covered by that factor, and check for right seeds using Lemma 1. Problem 2 reduces to detecting border-free prefixes of the given string. 3.1
A Brief Description of the Partitioning Algorithm
In the following lines, we give a brief description of the partitioning algorithm used for solving Problem 1. For a factor w in a string y, the set of end positions of all the occurrences of w in y, gives us the end set of w. We define an equivalence relation ≈ on positions of y such that i ≈ j iff y[i − + 1 . . i] = y[j − + 1 . . j]. Therefore, depending on the length of the factor, we get equivalence classes for each length , 1 ≤ ≤ n. Equivalence classes for = 1 are found by going over y once, and keeping the occurrences of each letter in separate sets. For larger , we consider classes of the previous level to make a refinement on them, and calculate the
496
M. Christou et al.
classes of that level. So on level , 1 < ≤ n, we refine a class C by a class D, by splitting C in classes {i ∈ C/i − 1 ∈ D}, {i ∈ C/i − 1 ∈ / D}. In order to achieve a good running time, we do not use all classes for refinement; only classes of the previous level, which were split two levels before, are used. From those, we can omit the largest (old sets) siblings of each family, and use only the small ones (new sets) for the computation. We terminate the algorithm when all classes reach a singleton stage. In Fig. 1, the classes of ≈ , = 1, 2, . . . , 8, for the string y = abaababaa baabab are illustrated. The partitioning algorithm creates two types of sets at each round of equivalent classes; the old and the new ones (see Fig. 1). A set is called old, if it has been created by deletion of elements from its parent set (i.e. it consists of remaining elements only). A set is called new, if it is composed from deleted elements from its parent set. Hence, the partitioning algorithm on y will give us distinct end sets Ei with their corresponding factor length range (mini , maxi ), as shown in the example below. Example 1. Let us consider y = abaababaabaabab, the example string from Fig. 1. Then, in level order, E3 is the set {3, 8, 11} with corresponding factor length range (2, 4). Proposition 1 ([13]). The number of distinct end sets in the partitioning for a string of length n is O(n). Proposition 2 ([7]). The complexity of the partitioning algorithm for a string of length n is O(number of elements of new sets), where the number of elements of new sets in the partitioning is bounded above by n log n. i y[i]
0 a
1 b
2 a
3 a
4 b
5 a
6 b
7 a
8 a
9 b
10 a
11 a
12 b
13 a
14 b
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 {1, 4, 6, 9, 12, 14}b
{0, 2, 3, 5, 7, 8, 10, 11, 13} a {3, 8, 11}aa
{3, 8, 11}baa
{2, 5, 7, 10, 13}aba
{3, 8, 11}abaa {11}aabaa
{1, 4, 6, 9, 12, 14}ab
{2, 5, 7, 10, 13}ba
{8}babaa
{5, 10, 13}aaba {5, 10, 13}baaba {5, 10, 13}abaaba
{13}aabaaba
{10}babaaba
{7}baba
{4, 9, 12}aab
{6, 14}bab
{4, 9, 12}baab
{6, 14}abab
{4, 9, 12}abaab
{6, 14}aabab
{12}aabaab
{9}babaab
{6, 14}baabab {6, 14}abaabab {14}aabaabab
Fig. 1. Classes of equivalence and their refinements for string y = abaababaabaabab. The sets considered for the computation of the partitioning are shown in bold.
On the Right-Seed Array of a String
3.2
497
Computing the Minimal and the Maximal Right-Seed Array
With the help of the partitioning algorithm, we can proceed in computing the minimal right-seed array of y as follows. While executing the partitioning algorithm, we also maintain the following data structures: – For each end set Ei = {a1 , a2 , . . ak }, with corresponding factor length , of y, such that k > 1. 1. Gap list Gap(aj ) = aj+1 − aj , j ∈ {1, 2, . . . , k − 1}
(1)
2. cover value An end set Ei , with corresponding factor length , is said to have cover value equal to the first element of the set that has Gap value greater than . This value gives the last element coverable in each set by its equivalent factor, starting from the first element of the set. – For each distinct end set Ei = {a1 , a2 , . . . , ak }, with corresponding factor length range (mini , maxi ), of y, such that k > 1. 1. C array An array C, such that C[j] is the j th cover value appeared in Ei in ascending order. 2. D array An array D, such that D[j] is the factor length of Ei when j th cover value first appears. 3. first value A value first, which gives the first element that has not been assigned a minimal right seed in the set or any of its ancestors. Below, we show how to update the above mentioned data structures in time O(n log n). – In new sets: When a new set of size m is created, we can update all relevant data structures in O(m) time. By running over the elements of the set in order, we can easily update the cover value, Gap list, and the C and D arrays. – In old sets: An old set is created from its parent set, by deletion of d elements from it. When an element j is deleted from its parent set, we can easily update the Gap values of its neighbors. All these operations take time O(d), where d is the number of elements of new sibling sets of the old set. Updating the cover value is more difficult, as new data structures have to be created, but is still under control, as of Lemma 3, below. The C and D arrays are updated when a new cover value is found. Lemma 3. In a chain of old sets with a new set of size m as a root, the the cover values are calculated in the whole chain in O(m) time.
498
M. Christou et al.
Proof. We create a queue Q that initially includes the Gap list of the first old set in the chain. When a new gap is created by deletion of an element in subsequent old sets, two gaps are merged. Then, we stack the new gap on top of the second gap, that is used to form it in Q, and so on (those gaps have the same element on their right edge). We also keep pointers on the new gaps, formed in the corresponding First-appear() list (those lists are kept in a different queue), where is the length of the corresponding factor of the set. Pointers for deleted gaps are added in the corresponding Delete() list (those lists are kept in a different queue, as well). We then go over the First-appear and Delete queues, which mark the beginning of a distinct old set. Gaps in the corresponding First-appear() list are moved to the right of the element at their bottom, and gaps that are in the corresponding Delete() list are deleted, maintaining the structure of Q. We then search for cover value in Q, by popping out gaps from Q, until the first gap in Q is greater than (cover is the element on the left edge of last gap considered), or Q becomes empty (cover is the element on the right edge of the last gap considered). Whenever a gap, that has stacked elements on it, is popped out of Q, its stacked elements are passed to an element out of the queue called start, whose right element is taken to be the first gap in Q . If cover found is smaller than next length to be encountered in First-appear queue, we check for more cover changes as before. It is easy to observe that Q has at most 2s − 3 elements, where s is the size of the first old block in the chain. Thus, we can create the lists First-appear, Delete and queue Q in O(m) time. We check for covers when a distinct old set is encountered for first time (at most m such sets). While inside that set, cover changes are made iff the gap after a cover gets equal to the length for that class (at most |Q| such cases). Failed attempts are made at most once for each element of Q, therefore at most |Q| failed attempts. Therefore, the maintenance of the above data structures takes time O(number of elements of new sets), where the number of elements of new sets in the partitioning is bounded above by n log n, as of Proposition 2. Before proceeding with calculating the minimal right-seed array of y, we also prove the following auxiliary lemma. Lemma 4. Let an end set Ei = {a1 , a2 , . . . , ak } of y with corresponding factor z, |z| = . Then z is a right seed for some set {y[0 . . a1 ], y[0 . . a2 ], . . . , y[0 . . as ]}, where 0 ≤ s ≤ k, s = 0 gives us the empty set. Proof. Let at the first element of Ei such that z is not a right seed of y[0 . . at ]. If there exists no such element, then s = k and z is a right seed for {y[0 . . a1 ], y[0 . . a2 ], . . y[0 . . ak ]}. If there exists no element aq ∈ Ei greater than at , such that z is a right seed of y[0 . . aq ], then s = t − 1, and the required set S is: S=
∅, s=0 {y[0 . . a1 ], y[0 . . a2 ], . . y[0 . . at−1 ]}, otherwise
(2)
On the Right-Seed Array of a String
499
Suppose that there exists an element aq ∈ Ei greater than at such that z is a right seed of y[0 . . aq ], i.e. it covers a superstring u, where u = vy[0 . . aq ] and v is a possibly empty string. Therefore, there exists an occurrence of z in u ending in some p ∈ {y[at − ], . . , y[at − 1]}. Thus z is a cover of vy[0 . . p]. But there also exists an occurrence of z in y ending in y[at ]. This shows that z is a cover of vy[0 . . at ], and hence a right seed of y[0 . . at ], which gives a contradiction. We are now in a position to calculate the minimal right-seed array of y by operating on the distinct sets, while running over them in a level order traversal of the partition tree. The value first is passed from a parent set to the child set. If first is in the set, we do not need to update the value. If first is not in a new child set, it can be easily updated by searching for the smallest element which is greater or equal to first in the new set; running over the elements of the set (Lemma 4), takes time O(size of the new set). If first is not in the old child set, we need to find the value just after it (Lemma 4), by searching in the elements of the parent set after first ; this takes time O(k), where k is the number of elements of new sibling sets of the old set. Keeping first value increases the time requirements for the partitioning algorithm only by a constant factor. The period array P of y is the array of integers for which P [i], 0 ≤ i ≤ n − 1, stores the period of y[0 . . i]. The period of y[0 . . i], P [i], gives also the minimal right seed that can occur only once (that is why, in the next lines, we exclude distinct sets of size one; if they have not been assigned a right seed yet, then P [i] gives the length of their minimal right seed). The array P can be computed using KMP algorithm in linear time [8,14]. Having obtained the distinct end sets Ei with their corresponding factor length range (mini , maxi ) using the partitioning algorithm, we can then proceed in finding the minimal right-seed array of y as follows. Let Ei a distinct end set with corresponding factor z, where |z| = , and let δ denote the first element of the set, then the following hold. – If first ≤ cover , by Lemma 1, the length of the minimal right seed for y[0 . . first] is max{, P [first] − (first − δ)} (3) If there are no such lengths in the factor length range of Ei , we stop operations in that set (as a consequence of Lemma 4). – If first > cover , we move to the smallest factor length, denoted by γ, where first ≤ cover . This is easily found using the corresponding arrays C and D for Ei . By Lemma 1, the length of the minimal right seed for y[0 . . first] is max{γ, P [first] − (first − δ)}
(4)
If there are no such lengths in the factor length range of Ei , we stop operations in that set (as a consequence of Lemma 4). If the minimal right seed of y[0 . . first] is found, we assign the smallest element of Ei which is greater than first, as a new value for first, and continue searching
500
M. Christou et al.
from Ei with corresponding factor length the last length assigned as a minimal right seed length (as a consequence of Lemma 4). Reporting minimal right seeds takes time Θ(n), i.e. one report for each position, as constant time is needed for each report. Failed attempts are made: – at most one per report (when after the report, the next element of the set does not give a minimal right seed) – at most two per distinct set (one at the start of searching in the set, and one on a failure finding a suitable class for a future minimal right seed) Therefore failed attempts are of O(n), and as constant time is needed for each report, the overall time needed for failed attempts is O(n). Also going over the cover changes takes time proportional to reporting cover values, which is O(n log n). Theorem 1. Computing the minimal right-seed array of a given string y can be done in O(n log n) time, where |y| = n. Proof. By Proposition 2, executing the partitioning algorithm takes time O(n log n). Maintaining the Gap list and the value cover increases the time requirements for the partitioning algorithm by a constant factor. Maintaining the array C and the array D is of no extra cost to maintaining the value cover . Maintaining the value first also increases the time requirements for the partitioning algorithm by a constant factor. The KMP algorithm, used for computing the period array P , runs in linear time [14]. Reporting the minimal right seeds requires Θ(n) time, i.e. one report for each position. Failed attempts are at most O(n). Going over the cover changes, while searching for minimal right seeds, takes time proportional to reporting cover values, which is O(n log n). Hence, in overall, the described algorithm runs in O(n log n) time. For solving Problem 2, we can use Lemma 2 to obtain the following two cases. – if P [i] = i + 1, then RS M [i] = 0 – if P [i] < i + 1, then RS M [i] = i Hence, we obtain the following result. Theorem 2. Computing the maximal right-seed array of a given string y can be done in Θ(n) time, where |y| = n.
4
Further Works
Recently in [5], Christou et al. presented a linear-time algorithm for computing the minimal left-seed array of a given string, and a linear-time solution to compute the maximal left-seed array. In this article, we have provided an O(n log n) time algorithm for computing the minimal right-seed array of a given string, and
On the Right-Seed Array of a String
501
a linear-time solution to compute the maximal right-seed array. Further work can be done on designing a linear-time algorithm for computing the minimal right-seed array. Recently in [9], Crochemore et al, provided linear-time algorithms for checking the validity of minimal and maximal cover arrays and inferring strings from valid minimal and maximal cover arrays. Their result completed the series of algorithmic characterizations of data structures that store fundamental features of strings. They concern Border arrays [10,11] and Prefix arrays [6] that store periods of all the prefixes of a string, as well as the element of Suffix arrays [3,12] that memorizes the list of positions of lexicographically sorted suffixes of the string. The algorithms may be regarded as reverse engineering processes and, beyond their obvious theoretical interest, they are useful to test the validity of some constructions. Hence, further work can be done on the following relevant problems as well: Let A be an integer array of length n. Question: Decide if A is the right-seed (resp. left-seed) array of some string. Question: When A is a valid right-seed (resp. left-seed) array, exhibit a string over an unbounded alphabet, whose rightseed (resp. left-seed) array is A.
References 1. Apostolico, A., Breslauer, D.: Of periods, quasiperiods, repetitions and covers. In: Mycielski, J., Rozenberg, G., Salomaa, A. (eds.) Structures in Logic and Computer Science. LNCS, vol. 1261, pp. 236–248. Springer, Heidelberg (1997) 2. Apostolico, A., Ehrenfeucht, A.: Efficient detection of quasiperiodicities in strings. Theor. Comput. Sci. 119(2), 247–265 (1993) 3. Bannai, H., Inenaga, S., Shinohara, A., Takeda, M.: Inferring strings from graphs and arrays. In: Rovan, B., Vojt´ aˇs, P. (eds.) MFCS 2003. LNCS, vol. 2747, pp. 208–217. Springer, Heidelberg (2003) 4. Breslauer, D.: An on-line string superprimitivity test. Inf. Process. Lett. 44(6), 345–347 (1992) 5. Christou, M., Crochemore, M., Iliopoulos, C.S., Kubica, M., Pissis, S.P., Radoszewski, J., Rytter, W., Szreder, B., Wale´ n, T.: Efficient seeds computation revisited. In: Giancarlo, R., Manzini, G. (eds.) CPM 2011. LNCS, vol. 6661, pp. 350–363. Springer, Heidelberg (accepted, 2011) 6. Clement, J., Crochemore, M., Rindone, G.: Reverse engineering prefix tables. In: Albers, S., Marion, J.-Y. (eds.) 26th International Symposium on Theoretical Aspects of Computer Science (STACS 2009), pp. 289–300. Schloss Dagstuhl - LeibnizZentrum fuer Informatik, Dagstuhl, Germany (2009), http://drops.dagstuhl.de/opus/volltexte/2009/1825 7. Crochemore, M.: An optimal algorithm for computing the repetitions in a word. Inf. Process. Lett. 12(5), 244–250 (1981) 8. Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press, New York (2007) 9. Crochemore, M., Iliopoulos, C., Pissis, S., Tischler, G.: Cover array string reconstruction. In: Amir, A., Parida, L. (eds.) CPM 2010. LNCS, vol. 6129, pp. 251–259. Springer, Heidelberg (2010)
502
M. Christou et al.
10. Duval, J.-P., Lecroq, T., Lefebvre, A.: Border array on bounded alphabet. Journal of Automata, Languages and Combinatorics 10(1), 51–60 (2005) 11. Franek, F., Gao, S., Lu, W., Ryan, P.J., Smyth, W.F., Sun, Y., Yang, L.: Verifying a Border array in linear time. J. Combinatorial Math. and Combinatorial Computing 42, 223–236 (2002) 12. Franek, F., Smyth, W.F.: Reconstructing a Suffix Array. J. Foundations of Computer Sci. 17(6), 1281–1295 (2006) 13. Iliopoulos, C.S., Moore, D.W.G., Park, K.: Covering a string. Algorithmica 16, 289–297 (1996) 14. Knuth, D.E., Morris, J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977) 15. Li, Y., Smyth, W.F.: Computing the cover array in linear time. Algorithmica 32(1), 95–106 (2002) 16. Lothaire, M. (ed.): Algebraic Combinatorics on Words. Cambridge University Press, Cambridge (2001) 17. Lothaire, M. (ed.): Appplied Combinatorics on Words. Cambridge University Press, Cambridge (2005)
Compressed Directed Acyclic Word Graph with Application in Local Alignment Do Huy Hoang and Sung Wing Kin National University of Singapore, COM 1, 13 Computing Drive, Singapore 117417 {hoang,ksung}@comp.nus.edu.sg
Abstract. Suffix tree, suffix array, and directed acyclic word graph (DAWG) are data-structures for indexing a text. Although they enable efficient pattern matching, their data-structures require O(n log n) bits, which make them impractical to index long text like human genome. Recently, the development of compressed data-structures allow us to simulate suffix tree and suffix array using O(n) bits. However, there is still no O(n)-bit data-structure for DAWG with full functionality. This work introduces an O(n)-bit data-structure for simulating DAWG. Besides, we also propose an application of DAWG to improve the time complexity for the local alignment problem. In this application, the previously proposed solutions using BWT (a version of compressed suffix tree) run in O(n2 m) worst case time and O(nm0.628 ) average case time where n and m are the lengths of the database and the query, respectively. Using compressed DAWG proposed in this paper, the problem can be solved in O(nm) worst case time and the same average case time.
1
Introduction
Text indexing is well-studied in the literature. In text indexing, a given input text is indexed as a data-structure to facilitate efficient pattern searching. Once a text is indexed, many string related problems can be solved efficiently. For example, computing the number of occurrences of a string, finding the longest repeated substring, finding repetitions in a text, searching for a square, computing the longest common substring of a finite set of strings, on-line substring matching, and approximate string matching [16,21]. Those solutions find applications in many research areas including compression algorithms [19], information retrieval [7], text database and biological sequence database [11]. Among all text indexing data-structures, suffix tree [22] and suffix array [14] are the most popular structures. Both suffix tree and suffix array index all possible suffixes of the text. Another variant is directed acyclic word graph (DAWG) [3]. This data-structure uses a directed acyclic graph to model all possible substrings of the text. However, all above data-structures require O(n log n)-bit space, where n is the length of the text. When the text is long (e.g. human genome whose length is 3 billions basepairs), those data-structures become impractical since they consume B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 503–518, 2011. c Springer-Verlag Berlin Heidelberg 2011
504
D.H. Hoang and S.W. Kin
too much memory. Recently, due to the advance in compression methods, both suffix tree and suffix array can be stored in only O(n) bits [18,9]. Whereas previous works on DAWG data structures [3,4,8] focus on explicit construction of DAWG and its variants. They are not only require much memory but also unable to return the locations of the indexed sub-string. Recently, Li et al. [12] also independently presents a DAWG by mapping its nodes to ranges of the reversed suffix array. However, their version can only perform forward enumerate of the nodes of the DAWG. A practical, full functional and small data structure for DAWG is still needed. In this paper, we propose a compressed data-structure for DAWG which requires only O(n) bits. Our data-structure supports navigation of the DAWG in constant time and decodes each of the locations of the substrings represented in some node in O(log n) time. In addition, this paper also describes one problem which can be solved more efficienly by using the DAWG than suffix tree. This application is called local alignment; the input is a database S of total length n and a query sequence P of length m. Our aim is to find the best local alignment between the pattern P and the database S which maximizes the number of matches. This problem can be solved in Θ(nm) time by the Smith-Waterman algorithm [20]. However, when the database S is known in advance, we can improve the running time. There are two groups of methods (see [21] for a detailed survey of the methods). One group is heuristics like Oasis[15] and CPS-tree[23] which do not provide any bound. Second group includes Navarro’s method[17] and Lam et. al. method[10] which can gaurantee some average time bound. Specifically, the previously proposed solutions in [10] built suffix tree or Burrow Wheeler Transform (BWT) data-structures for S. Then, the best local alignment between P and S can be computed in O(n2 m) worst case time and O(n0.628 m) expected time for the edit distance function or a scoring function similar to BLAST [1]. We showed that, by building the compressed DAWG for S instead of suffix tree, the worst case time can be improved to O(nm) while the expected time and space are remained the same. The rest of the paper is organized as follows. In Section 2, we review existing data-structures. Section 3 describes how to simulate the DAWG. Section 4 shows the application of the DAWG in the local alignment problem.
2
Basic Concepts and Definitions
Let Σ be a finite alphabet and Σ ∗ be the set of all strings over Σ. The empty string is denoted by ε. If S = xyz for strings x, y, z ∈ Σ ∗ , then x, y, and z are denoted as prefix, substring, and suffix, respectively, of S. For any S ∈ Σ ∗ , let |S| be the length of S. 2.1
Suffix Array and Suffix Tree
Consider a string S with a special terminating character $. The suffix array AS is an array of the lexically sorted suffixes of S. i.e. AS [i] is the i-th lexically
Compressed Directed Acyclic Word Graph with Application
505
smallest suffix of S. Any substring x of S can be represented by a pair of indexes (st, ed), called suffix range, such that AS [st] and AS [ed] are respectively the lexically smallest and largest suffixes which have x as their prefix. This implies that x occurs at positions AS [st], AS [st + 1], . . . , AS [ed] in S. See Fig. 1(a) for example. The operation lookup(i) returns AS [i]. Consider a suffix range (st, ed) in AS for some string P [1..m], the operation backward-search(st, ed, c) returns another suffix range (st , ed ) for cP [1..m]. For a string S with the special terminating character $, the suffix tree TS of the string S is a tree whose edges are labeled with strings such that every suffix of S corresponds to exactly one path from the tree’s root to a leaf. Figure 1(b) shows an example suffix tree for cbcba$. For every node u in the suffix tree TS , the string on the path from the root to u is called the path label of the node u, denoted as label(u). In this work, we require the following operations on the suffix tree: – parent(u): return the parent node of node u. – leaf-rank(u): returns the number of leaves less than or equal to u in preorder sequence. – leaf-select(i): returns the leaf of the suffix tree which has rank i. – leftmost-child(u): returns the leftmost child of the subtree rooted at u. – rightmost-child(u): returns the rightmost child of the subtree rooted at u. – lca(u, v): returns the lowest common ancestor of two leaves u and v. – depth(u): returns the depth of u. (i.e. the number of nodes from u to the root minus one). – level-ancestor(u, d): returns the ancestor of u with depth d. – suffix-link(u) returns a node v such that label(v) equals the string label(u) with the first character removed. Suffix tree and suffix array are closely related. If the children of each node in the suffix tree TS are ordered lexically according to the labels of the edges, the suffixes corresponding to the leaves of TS are ordered exactly the same as that of the suffix array AS . Therefore, the rank-i leaf of TS is one-to-one mapped to AS [i]. For any node w in the suffix tree TS , let u and v be the leftmost and the rightmost leaves, respectively. The suffix range of label(w) is (leaf-rank(u), leaf-rank(v)). In the suffix tree, some leaves hang on the tree by edges whose labels are just the single terminal character $. These are called trivial leaves; all remaining nodes in the tree are called non-trivial nodes. In Fig. 1, leaf number 6 is a trivial leaf. 2.2
Advanced Data-Structures for Suffix Array and Suffix Tree
For a text of length n, storing its suffix array or suffix tree explicitly requires O(n log n) bits, which is space inefficient. Several compressed variations of suffix array and suffix tree whose sizes are in O(n) bits have been proposed to address the space problem. For instance, Ferragina and Manzini introduced FMindex [5], a type of suffix array, which can be stored in O(n) bits and supports
506
D.H. Hoang and S.W. Kin
Index Start position 1 6 2 5 3 4 4 2 5 3 6 1
Suffix $ a$ ba$ bcba$ cba$ cbcba$ (a)
$
a
c
b
b
$
6
5 a $
c
a
b
$
a $
4
2
c b a $
3
1
(b)
Fig. 1. Suffix array and suffix tree of “cbcba”. The suffix ranges for “b” and “cb” are (3,4) and (5,6), respectively. Note that backward search(3,4,“c”) returns (5,6).
backward-search(st, ed, c) in constant time. Using the idea of Grossi et al. [6], Sadakane [18], and Jansson et al. [9], we can construct an O(n)-bit data-structure which supports suffix-link(u) and all the tree operations in constant time. Below three lemmas summarize the space and the operations supported by these data-structures. Lemma 1. (Jasson et al. [9]) Given a tree T , there is an O(n) bits data structure that supports the following operations in constant time: parent(u), leaf rank(u), leaf select(i), leftmost child(u), rightmost child(u) and lca(u, v), depth(u) and level-ancestor(u, d). Lemma 2. (Sadakane [18]) Given a sequence S of length n, the suffix tree TS can be stored using O(n) bits and supports the operation suffix-link(u) in constant time. Lemma 3. (Ferragina and Manzini [5]) Given the O(n)-bit FM-index of the sequence S, for every suffix range (st, ed) of the suffix array and every character c, the operation backward-search(st, ed, c) runs in constant time; and the operation lookup(i) runs in O(log n) time. 2.3
Directed Acyclic Word Graph
Apart from suffix tree, we can index a text S using a directed acyclic word graph (DAWG). Prior to define the DAWG, we first define the end-set equivalent relation. Let S = a1 a2 . . . an (ai ∈ Σ) be a string in Σ ∗ . For any non-empty string y ∈ Σ ∗ , its end-set in S is defined as end-setS (y) = i | y = ai−|y|+1 . . . ai . In particular, end-setS (ε) = {0, 1, 2, . . . , n}. An end-set equivalent class is a set of substrings of S which have the same end-set. For any substring x of S, we denote [x]S as the end-set equivalent class containing the string x, i.e., [x]S = {y | y ∈ Σ ∗ , end-setS (x) = end-setS (y)}. Note that [x]S = [y]S if and only if end-setS (x) = end-setS (y) for any strings x and y. Moreover, the set of all end-set equivalent classes of S forms a partition of all substrings of S. The DAWG DS for a string S is defined as a directed acyclic graph (V, E) such that V is the set of all end-set equivalent classes of S and E = {([x]S , [xa]S ) | x and xa are substrings of S, end-setS (x) = end-setS (xa)}. Furthermore, every edge ([x]S , [xa]S ) is labeled by the character a. Denote c(u,v) as the edge label of an edge (u, v).
Compressed Directed Acyclic Word Graph with Application
0,1, 2,3,4,5
507
H
a
a b
b
c
1
c
a c
2, 4
b
c
b
b
3, 5 2
bc, c ab
c
c b
3
b
abc
b
b abcb, bcb, cb
4 c 5
c abcbc, bcbc, cbc
Fig. 2. DAWG of string “abcbc” (left: with end-set, right: with set path labels)
In the DAWG DS , [ε]S = {0, 1, . . . , n} is the only node with in-degree zero. Hence, [ε]S is called the source node. For every path P in DS starting from the source node, let its path label be the string obtained by concatenating all labels of the edges on P . A DAWG DS has an important property: For every node u in DS , the set of path labels of all paths between the source node and u equals the end-set equivalent class of u. For example,Fig. 2 shows the DAWG for S = abcbc. We have end-setS (bc) = end-setS (c) = {3, 5}. Hence, {bc, c} forms an end-set equivalent class. The following theorem obtained from [3] states the size bound of a DAWG. Note that the size bound is tight. The upper bounds for the number of nodes and edges are achieved when S = abn and S = abn c respectively, for some distinct letters a, b, c ∈ Σ. Theorem 1. (Blumer et al. [3]) Consider any string S of length at least 3 (i.e. n ≥ 3). The Directed Acyclic Word Graph DS for S has at most 2n − 1 states, and 3n − 4 transition edges (regardless of the size of Σ). For any string x, we denote x as the reverse sequence of x. Consider a string S, let DS be the DAWG of S and TS be the suffix tree of S. For every non-trivial node u in TS , let γ(u) be [label(u)]S . The following lemma states the relationship between a DAWG and a suffix tree. Lemma 4. (Blumer et al. [3]) The function γ is a one-to-one correspondence mapping from the non-trivial nodes of TS to the nodes of DS . For example, for the suffix tree in Fig. 1(b) and the DAWG in Fig. 2, the internal node of the suffix tree with path label “cb” maps to the node [cb]S = [bc]S = {bc, c} in the DAWG. In fact, every non-trivial node in the suffix tree maps to a node in the DAWG, and vice versa. Precisely, The root of the suffix tree maps to the source node of the DAWG, the internal node with path label “b” maps to node {“b”}, the internal node with path label “cb” maps to node {“bc”, “c”}, leaf 5 maps to node {“a”}, leaf 4 maps to node {“ab”}, leaf 2 maps to node {“abcb”,“bcb”,“cb”}, leaf 3 maps to node {“abc”}, and leaf 1 maps to node {“abcbc”,“bcbc”,“cbc”}.
508
3
D.H. Hoang and S.W. Kin
Simulating DAWG
Consider a sequence S of length n, this section describes an O(n)-bit datastructure for the DAWG DS which supports the following four operations to navigate in the graph in constant time: – Get-Source(): returns the source node of DS ; – Find-Child(u, c): returns the child v of u in DS s.t. the edge (u, v) is labeled by c. – Parent-Count(u): returns the number of parents of u in DS . – Extract-Parent(u, i): returns the i-th parent where 1 ≤ i ≤ Parent-Count(u). In addition, we also support two operations which help to extract the substring information of each node. The first operation, denoted End-Set-Count(u), returns the number of members of the end-set at node u in constant time. The second operation, denoted Extract-End-Set(u, i), returns the i-th end point in the set in O(log n) time. To support the operations, we can store the nodes and the edges of DS directly. However, such a data-structure requires O(n log n)-bit space. Instead, this section shows that, given the FM-index of S (see Lemmas 3) and the compressed suffix tree of S (see Lemma 2), we can simulate the DAWG DS and support all three operations in constant time with O(n) bits space. First, we analyse the space complexity. Both the FM-index of S and the compressed suffix tree TS can be stored in O(n) bits. Next, we describe how to represent the nodes in the DAWG DS . Lemma 4 implies that each non-trivial node u in TS is one-to-one corresponding to a node γ(u) in DS . Hence, in our simulation, the non-trivial node u in TS represents the node γ(u) in DS . Below four subsections describe how can we support the following operations: Get-Source(), Find-Child(u, c), Parent-Count(u), Extract-Parent(u, i), End-Set-Count(u) and Extract-End-Point(u, i). The implementation details is shown in Listings 1.1, 1.2, 1.3 and 1.4. 1
function Get−S o u r c e ( ) { return t h e r o o t node o f TS ; }
Listing 1.1. Operation Get-source: returns the source node of DS 1 2 3 4 5 6 7
function Find−C h i l d ( u , c ) st, ed = leftmost-child(u), rightmost-child(u) ; st , ed = backward-search(st, ed, c) ; i f ( (st , ed ) i s a v a l i d r a n g e ) l, r = leaf-select(st ), leaf-select(ed ) ; return lca(l, r) ; e l s e return n i l ;
Listing 1.2. Operation Find-Child: finds the child node v of u such that the edge label of (u v) is c 1 2
function Parent−Count ( u ) i f ( u i s t h e r o o t node ) return 0 ; /∗ no parent for source node ∗/
Compressed Directed Acyclic Word Graph with Application
v = parent(u) ; b = suffix-link(u) ; i f ( v i s t h e r o o t node ) /∗ The list is [b, p2 , .., pk−1 , v], where pi is parent∗/ return depth(b) − depth(v) + 1 ; /∗ of pi−1 , p2 is parent of b, v is parent of pk−1 ∗/ else e = suffix-link(v) ; /∗ The list is [b, p2 , .., pk−1 , e) ∗/ return depth(e) − depth(b) ; /∗ (exluding e) ∗/
3 4 5 6 7 8 9 10 11 12 13
509
function E x t r a c t −P a r e n t ( u , i ) b = suffix-link(u) ; return level-ancestor(b, depth(b) + i − 1 )
Listing 1.3. Operation Parent-Count and Extract-Parent: use to list parents of the node u in DS 1 2 3 4 5 6 7
function End−Set−Count ( u ) st, ed = leftmost-child(u), rightmost-child(u) ; return ed − st + 1 ; function E x t r a c t −End−P o i n t ( u , i ) st = leftmost-child(u) ; return n + 1 − lookup(i + st − 1) ;
Listing 1.4. Operations End-Set-Count and Extract-End-Point
3.1
Get-Source Operation
The source node in DS is [ε]S , which is represented by the root in TS . Hence, the operation Get-Source() just returns the root in TS , which takes constant time. 3.2
End-Set Operations
Since each node in the DAWG DS is represented directly by a node in the suffix tree TS . Consider a non-trivial node u in TS , operations End-Set-Count(u) and Extract-End-Point(u, i) can be used to list the ending locations of label(u) in string S. In fact, these ending locations can be derived from the starting location of label(u) in S. By definition, the starting locations of label(u) in S are {AS [i] | i = st, . . . ed} where st = leftmost child(u) and ed = rightmost child(u). Hence, the ending locations of label(u) in S are {n+1−AS [i] | i = st, . . . , ed}. Line 2 in Listings 1.4 captures st and ed. The size of the end-set is thus ed − st + 1. To extract each ending location, we can use operation Extract-End-Point(u, i). Line 7 captures AS [i + st − 1] by calling the lookup operation of the FM-index of S and reports the locations. Since the lookup operation in FM-index takes O(log n) time, the cost of extracting each end point is O(log n) time. 3.3
Child Operation
Consider a non-trivial node u in TS which represents the node γ(u) in DS . This section describes the operation Find-ChildS (u, c) which returns a non-trivial node v in TS such that γ(v) is the child of γ(u) with edge label c. Our solution is based on the following two lemmas:
510
D.H. Hoang and S.W. Kin
Lemma 5. Consider a string S, the DAWG DS , and the suffix tree TS . For any non-trivial node u in TS , if v = Find-Child(u, c) is not nil in TS , then (γ(u), γ(v)) is an edge in DS with edge label c. Lemma 6. For any node u in TS , if Find-child(u, c) is nil, then γ(u) will not have any child with edge label c in DS . Based on the above lemmas, given a non-trivial node u in TS which represents the node γ(u) in DS , the algorithm Find-childS (u, c) in Listing 1.2 returns another non-trivial node v in TS such that γ(v) is the child of γ(u) with edge label c. Since backward-search(st, ed, c), lefmost-child(u), rightmost-child(u), leaf-select(i), lca(u, v) each take O(1) time, Find-childS (u, c) can be computed in O(1) time. 3.4
Parent Operations
Consider a non-trivial node u in TS which represents the node γ(u) in DS . This section describes the operation Parent-Count(u) and Extract-Parent(u, i) which can be used to list all parents of γ(u). Precisely, we present a constant time algorithm which finds two non-trivial nodes b and e in TS where e is the ancestor of b in TS . We show that γ(p) is a parent of γ(u) in DS if and only if node p is in the path between b and e in TS . Our solution is based on the following lemmas. Lemma 7. Consider a non-trivial node u such that u is not the root of TS , let v be u’s parent and x = label(v) and xy = label(u). For any non-empty prefix z of y, we have γ(u) = [(xy)]S = [(xz)]S . In fact, γ(u) = {(xz) | z is a non-empty prefix of y}. For any non-trivial node u in TS , below two lemmas states how to find the parents of γ(u) in DS . Lemma 8 covers the case when u’s parent is not a root node of TS ; and Lemma 9 covers the other case. Lemma 8. Consider a non-trivial node u whose parent, v, is not the root node in TS . Suppose suffix-link(u) = b and suffix-link(v) = e. For every node p in the path from b to e (excluding e) in TS , γ(p) is a parent of γ(u) in DS . Lemma 9. Consider a non-trivial node u whose parent is the root node of TS . Suppose suffix-link(u) = b. The set of parents of γ(u) in DS is {γ(p) | p is the path from b to the root in TS }. Based on the above lemmas, the algorithms in Listing 1.3 can list all parents of u in DS . In the operation Parent-Count(u), line 6 corresponds to the case in Lemma 9, and line 8-9 corresponds to the case in Lemma 8. In the operation Extract-Parent(u, i), since the last node in the list is always an ancestor of the first node b = suffix-link(u), the interested node is the i-th parent of b in TS . The operation level-ancestor (in Lemma 1) is used to compute the answer.
Compressed Directed Acyclic Word Graph with Application
4
511
Application of DAWG in Local Alignment
This section studies the local alignment problem. Consider a database S of length n. For any string P of length m, our aim is to compute the best local alignment between P and S. By indexing the database S using an O(n)-bit Burrow Wheeler Transform (BWT) data-structure, Lam et al. [10] showed that under a scoring function similar to BLAST, the best local alignment between any query pattern P and S can be computed using O(n0.628 m) expected time and O(n2 m) worst case time. In this work, we show that, by replacing the BWT data-structure by the O(n)-bit compressed DAWG, we can narrow down the gap between the worst case and the expected case. Specifically, the worst case time can be improved from O(n2 m) to O(mn) while the expected running time remains the same. 4.1
Definitions of Global, Local, and Meaningful Alignments
Let X and Y be two strings in Σ ∗ . A space “−” is a special character that is not in these two strings. An alignment A of X and Y are two equal length strings X and Y that may contain spaces, such that (i) removing spaces from X and Y will get back X and Y , respectively; and (ii) for any i, X [i] and Y [i] cannot be both spaces. For every i, the pair of characters X [i] and Y [i] is called an indel if one of them is the space character, a match if they are the same, and a mismatch otherwise. The alignment score of an alignment A equals i δ(X [i], Y [i]), where δ is a scoring scheme defined over the character pairs. Let S be a string of n characters and P be a pattern of m characters. Below, we define the global alignment problem and the local alignment problem. – The global alignment problem is to find an alignment A between S and P which maximizes A’s alignment score with respect to a scoring scheme δ. Such score is denoted as global-score(S, P ). – The local alignment problem is to find an alignment A between any substring of S and any substring of P which maximizes A’s alignment score. Such score is denoted as local-score(S, P ). Precisely, local-score(S, P ) = max{global-score(S[h..i], P [k..j]) | 1 ≤ h ≤ i ≤ n, 1 ≤ k ≤ j ≤ m}. In practical situations, people use alignment to find string similarity; therefore, they are only interested in alignment which has enough matches (e.g. more than 50% of the positions are matches). In [10], the meaningful alignment is defined as follow: – Consider a scoring scheme δ where mismatches and indels have negative score. Let A = (X , Y ) be an alignment of two strings X and Y . A is called a meaningful alignment if and only if the alignment scores of all the nonempty prefixes of the aligned strings X and Y is greater than zero, i.e., global-score(X [1..i], Y [1..i]) > 0 for all i = 1, . . . , |X |. Otherwise, A is said to be meaningless. Note that from this point, we only consider scoring scheme where mismatch and indel have negative scores. And, we only consider local alignment score which is greater than or equal to zero.
512
D.H. Hoang and S.W. Kin
Consider two strings S and P , we define meaningful-score(S, P ) as the best meaningful alignment score between S and P if one exists. If it does not exist, meaningful-score(S, P ) is −∞. Authors in [10] showed the following relationship between local alignment and meaningful alignment: Lemma 10. We have local-score(S, P ) = 4.2
max
1≤h≤i≤n,1≤k≤j≤m
meaningful-score(S[h..i], P [k..j])
Local Alignment Using DAWG
Consider a database S and a pattern P . Let DS = (V, E) be the DAWG of S (i.e. the DAWG of the concatenation of all strings in S separated by $). Recall that each node u ∈ V represents the set of path labels of all possible paths from the source node to u. These sets form a partition of all substrings of S. Given a node u, we say a string x ∈ u if x is a path label of a path from the source node to u. This section derives a dynamic programming solution to compute local-score(P, S). First, we define a recursive formula. For every j ≤ |P |, for every node u ∈ DS , we denote Nj [u] = maxk≤j,y∈u meaningful-score(P [k..j], y). Below lemma states the recursive formula for computing Nj [v]. Lemma 11. The meaningful alignment score Nj [u] defined above satisfies the following recursive formula: Nj [ε] = 0
∀j = 0..m
N0 [u] = −∞ ∀u ∈ V − {ε} ⎧ ⎛ ⎞ ⎪ ⎨Nj−1 [v] + δ(P [j], c(v,u) ) (Case A) ⎜ ⎟ Nj [u] = filter ⎝ max Nj−1 [u] + δ(P [j], −) (Case B) ⎠ (v,u)∈E ⎪ ⎩ Nj [v] + δ(−, c(v,u) ) (Case C)
(1)
where filter(x) = x if x > 0; and −∞, otherwise. By Lemma 10, we have local-score(P, S) = maxj=1..|P |,u∈DS Nj [u]. Using the recursive equation in Lemma 11, we obtain the dynamic programming algorithm in Listing 1.5. Below two lemmas analyse the time and space complexity of the algorithm. 1 2 3 4 5 6 7 8
I n i t i a l i z e N0 [u] f o r a l l u f o r ( j = 1 t o m) /∗ u s i n g f o r m u l a from Lemma 11 ∗/ foreach ( p o s i t i v e e n t r y Nj−1 [v] and e d g e (v, u) ) Update Nj [u] = max{Nj [u], Nj−1 [v] + δ(P [j], c(v,u) )} ( Case A) Update Nj [v] = max{Nj [v], Nj−1 [v] + δ(P [j], −)} ( Case B) foreach ( positive entry Nj [v] i n any t o p o . o r d e r o f v and e d g e (v, u) ) Update Nj [u] = max{Nj [u], Nj [v] + δ(−, c(v,u) )} ( Case C)
Listing 1.5. Complete algorithm
Lemma 12. Let m = |P | and n = |T |. local-score(P, S) can be computed in O(mn) worst case time using O(n log n) worst case bits memory.
Compressed Directed Acyclic Word Graph with Application
513
The following lemma gives some analysis on the average case behaviour of the algorithm to compute local alignment using the formula in Lemma 11. Lemma 13. The expected running time and memory to find the meaningful alignment using DAWG is bounded by the expected number of distinct substrings in S and substrings in P in which meaningful alignment score is greater than zero. From the above lemma, the problem of estimating the average running time becomes the problem of estimating the number of substring pairs which have positive meaningful score. We do not notice any direct result on this bound; however, there are a few results on measuring the average number of pairs of strings which have Hamming distance within certain bound. For example, Baeza-Yates [2] analysed the all-against-all alignment problem (set of strings against themselves) on suffix tree. The core of the analysis is measuring the average number of comparisons while searching a random string over a trie allowing errors. This yields an O(nα m log n) bound on our problem where α is a constant which is less than one. Maaß [13] analysed the time for searching a pattern on a trie of n random strings allowing at most D Hamming’s errors. In the case where D is less than (σ − 1)/σ logσ n where σ = |Σ|, the average number of comparison is sub-linear (o(n)). We can use this result to obtain a bound of sub-quadratic o(nm) on the average case where match is 1 and mismatch is less than or equal to -1. Lam et al. [10] studied a specific case of allowing Hamming errors where match is 1 and mismatch is -3. This score roughly approximates the score used by BLAST. They proved that the running time is bound by O(n0.628 m). Their experiments also suggested that in scoring model with gap penalty (gap score is -3), the expected running time is also roughly O(n0.628 m). Lemma 14. The expected running time to find the meaningful alignment using DAWG is at least as good as the expected running time of BWT-SW [10]. (i.e. O(n0.628 m) for their alignment score.) For simplicity, the above discussion only focuses on computing the maximum alignment score, i.e., the entry Nj [u] which is the maximum. In real-life, we may also want to recover the regions in S containing the alignments represented by Nj [u]. In this case, the value of Nj [u] is not enough. We need to compute two more numbers Ij,u and Lj,u such that meaningful-score(P [Ij,u ..j], S ) = Nj [u] where S is a length-Lj,u substring belongs to u. Then, using the operations End-Set-Count(u) and Extract-End-Point(u, i), we can enumerate all alignments represented by Nj [u], i.e., {(P [Ij,u ..j], S[q − Lj,u ..q]) | q ∈ end-setS (u)}. Ij,u and Lj,u can be computed by dynamic programming along with Nj [u]. For the base cases, we have Ij,ε equals j and Lj,ε equals −1. Then, depend on the outcome of Equation 1, Ij,u and Lj,u can be updated using the following equations:⎧ ⎧ ⎪ ⎪ ⎨Ij−1,v if (A) happens ⎨Lj−1,v + 1 if (A) happens Lj,u = Lj−1,u Ij,u = Ij−1,u if (B) happens if (B) happens ⎪ ⎪ ⎩ ⎩ Ij,v Ij,v + 1 if (C) happens if (C) happens
514
D.H. Hoang and S.W. Kin
For time and space complexities, note that Lj,u and Ij,u can be computed using the same time and space complexities as Nj [u]. After that, all alignments represented by Nj [u] can be reported using O(occ log n) time, where occ is the number of such alignments.
References 1. Altschul, S., Gish, W., Miller, W., Myers, E., Lipman, D.: Basic local alignment search tool. Journal of Molecular Biology 215(3), 403–410 (1990) 2. Baeza-Yates, R., Gonnet, G.: A fast algorithm on average for all-against-all sequence matching. In: Proc. of SPIRE 1999 (1999) 3. Blumer, A., Blumer, J., Haussler, D., Ehrenfeucht, A., Chen, M., Seiferas, J.: The smallest automaton recognizing the subwords of a text. TCS 40, 31–55 (1985) 4. Crochemore, M., V´erin, R.: On compact directed acyclic word graphs. In: Mycielski, J., Rozenberg, G., Salomaa, A. (eds.) Structures in Logic and Computer Science. LNCS, vol. 1261, pp. 192–211. Springer, Heidelberg (1997) 5. Ferragina, P., Manzini, G.: Opportunistic data structures with applications. In: FOCS, p. 390 (2000) 6. Grossi, R., Gupta, A., Vitter, J.: High-order entropy-compressed text indexes. In: ACM-SIAM (2003) 7. Huang, J., Powers, D.: Suffix tree based approach for chinese information retrieval. In: 8th Conf. on ISDA (2008) 8. Inenaga, S., Takeda, M.: Sparse compact directed acyclic word graphs. In: Proc. Prague Stringology Conf., pp. 197–211 (2006) 9. Jansson, J., Sadakane, K., Sung, W.K.: Ultra-succinct representation of ordered trees. In: ACM-SIAM (2007) 10. Lam, T.W., Sung, W.K., Tam, S.L., Wong, C.K., Yiu, S.M.: Compressed indexing and local alignment of dna. Bioinformatics 24(6), 791–797 (2008) 11. Langmead, B., Trapnell, C., Pop, M., Salzberg, S.: Ultrafast and memory-efficient alignment of short dna sequences to the human genome. Genome Biol. 10, 25 (2009) 12. Li, H., Durbin, R.: Fast and accurate long-read alignment with burrows-wheeler transform. Bioinformatics 26(5), 589 (2010) 13. Maaß, M.: Average-case analysis of approximate trie search. Algorithmica 46(3), 469–491 (2006) 14. Manber, U., Myers, G.: Suffix arrays: a new method for on-line string searches. In: Proc. of ACM-SIAM. SIAM, Philadelphia (1990) 15. Meek, C., Patel, J.M., Kasetty, S.: Oasis: an online and accurate technique for local-alignment searches on biological sequences. In: VLDB (2003) 16. Navarro, G.: A guided tour to approximate string matching. CSUR 33, 88 (2001) 17. Navarro, G., Baeza-Yates, R.: A hybrid indexing method for approximate string matching. Journal of Discrete Algorithms 1, 205–239 (2000) 18. Sadakane, K.: Compressed suffix trees with full functionality. TOCS 41, 589–607 (2007) 19. Senft, M.: Suffix tree based data compression. In: Vojt´ aˇs, P., Bielikov´ a, M., Charron-Bost, B., S´ ykora, O. (eds.) SOFSEM 2005. LNCS, vol. 3381, pp. 350– 359. Springer, Heidelberg (2005) 20. Smith, T.F., Waterman, M.S.: Identification of common molecular subsequences. J. Mol. Biol. 147, 195–197 (1981)
Compressed Directed Acyclic Word Graph with Application
515
21. Sung, W.-K.: Indexed approximate string matching. In: Encyclopedia of Algorithms. Springer, Heidelberg (2008) 22. Weiner, P.: Linear pattern matching algorithms. In: IEEE SWAT (1973) 23. Wong, S., Sung, W., Wong, L.: CPS-tree: A compact partitioned suffix tree for disk-based indexing on large genome sequences. In: ICDE (2007)
A
Appendix
(Proof for Lemma 5 in Section 3.3) Proof. Suppose x is the path label of u in TS . Line 2 in Listing 1.2 converts the node u to the suffix range (st, ed) in AS which represents the same substring x. By the definition of backward-search(st, ed, c), line 3 finds the suffix range (st , ed ) in AS which represents cx. Since v is not nil, (st , ed ) is a valid range. After the computation in line 5, st and ed are mapped back to two leaves l and r, respectively, of TS . Note that label(l) and label(r) both share cx as the prefix. Hence, cx should be a prefix of the path label of v = lca(l, r). In addition, since cx does not contain the terminal character $, v should be a non-trivial node. As label(v) is at least longer than x = label(u), u and v are different nodes in TS . By Lemma 4, γ(u) = [x]S and γ(v) = [xc]S are different. By the definition of DS , (γ(u), γ(v)) = ([x]S , [xc]S ) is an edge in DS with edge label c. (Proof for Lemma 6 in Section 3.3) Proof. By contrary, assume that there is a node γ(v) in DS such that (γ(u), γ(v)) is an edge in DS with label c. Let x = label(u) in TS . By definition, x is one of the path labels from the source node to γ(u) in DS . Since γ(v) is a child of γ(u) with edge label c, xc is a substring of S. However, since backward-search(st, ed, c) does not return a valid range, cx is not a substring of S, i.e. xc is not a substring of S, which is a contradiction. (Proof for Lemma 7 in Section 3.4) Proof. Let {oi } be the set of starting positions where xy occurs in S. By definition, end-setS ((xy)) = {n − oi}. Consider a string xz where z is some non-empty prefix of y. Since there is no branch between u and v in TS , xz is the prefix of all suffixes represented by the leaves under the subtree at u. Hence, the set of starting locations of xz in S and that of xy are exactly the same, which is {oi }. By definition, end-setS ((xz)) = {n − oi + 1}. Hence, γ(u) = [(xy)]S = [(xz)]S . Note that only xz can occur at {oi } in S for all non-empty prefix z of y. Thus, γ(u) = {(xz) | z is a non-empty prefix of y}. (Proof for Lemma 8 in Section 3.4) Proof. Since v is not the root node, let ax and axy be the path labels of v and u, respectively, in TS where a ∈ Σ and x, y ∈ Σ ∗ . By the definition of suffix link, we have x = label(e) and xy = label(b). Note that a suffix link from a non-trivial node points to another non-trivial node.
516
D.H. Hoang and S.W. Kin
(Necessary condition) For any node p on the path from b to e in TS , the path label of p is label(p) = xz where z is some non-empty prefix of y. Since p and u are two different nodes in TS , γ(p) and γ(u) are two different nodes in DS (see Lemma 4). From Lemma 7, γ(u) = [(axy)]S = [(axz)]S . By definition of DAWG, (γ(p), γ(u)) = ([(xz)]S , [(axz)]S ) is an edge in DS with edge label a. This implies that γ(p) is a parent of γ(u). (Sufficient condition) Note that label(v) = ax and label(u) = axy in TS . By Lemma 7, γ(u) = {(axz) | z is non-empty prefix of y}. Suppose γ(p) is parent of γ(u) in DS . By definition of DAWG, γ(p) must be [(xz)]S for some z is nonempty prefix of y. This implies that the path label of p in TS is xz. Thus, p is a node on the path from b to e excluding e. (Proof for Lemma 9 in Section 3.4) Proof. Let v be the root node of TS . Let ax be the path label of u. We have label(b) = x. From Lemma 7, γ(u) = [z]S where z is any non-empty prefix of x. Since every node p on the path from the root to b (excluding the root) has a path label which is a non-empty prefix of x. Similar to the argument in Lemma 8, we can show that γ(p) is a parent of γ(u). In addition, the source node of DS , γ(v) = [ε]S , is also a parent of γ(u) since γ(v) = [ε]S and γ(u) = [z]S = [a]S . (Proof for Lemma 11 in Section 4.2) Proof. Let score(x, y) be the short name for meaningful-score(x, y). Proof by induction: The base case where u = ε or j = 0 is obviously hold. Given any topological order π = π1 π2 . . . πk of the nodes of DS (note that π1 = [ε]S ), assume Nj [u] satisfies the recursive relation for all j ≤ l and u = π1 , . . . , πi−1 , πi except Nl [πi ]. Below, we show that the following equation is correct for j = l and u = πi , that is: ⎧ ⎛ ⎞ ⎪ ⎨Nl−1 [v] + δ(P [l], c(v,πi ) ) ⎜ ⎟ filter ⎝ max max score(x, y) Nl−1 [πi ] + δ(P [l], −) ⎠= (v,πi )∈E ⎪ x=P [k..l],y∈πi ,k≤l ⎩ Nl [v] + δ(−, c(v,πi ) ) (2) where filter(x) = x if x > 0; and −∞, otherwise We will prove both LHS ≤ RHS and LHS ≥ RHS. (LHS ≤ RHS) Let A = Nl−1 [v] + δ(P [l], c(v,πi ) ), B = Nl−1 [πi ] + δ(P [l], −) and C = Nl [v] + δ(−, c(v,πi ) ). Note that filter(max(v,πi )∈E {A, B, C}) = max(v,πi )∈E {filter(A), filter(B), filter(C)}. If any of A, B or C is not positive, after applying filter it becomes −∞. Then, we do not need to care about that term any more. Consider A = Nl−1 [v] + δ(P [l], c(v,πi ) ). If A is positive, base on the inductive assumption, we have Nl−1 [v] = maxx=P [k..l−1],y∈v,k≤l−1 score(x, y). Let (X1 , Y1 ) = arg maxx=P [k..l−1],y∈v,k≤l−1 score(x, y). Consider a string Xa = X1 · P [l] and Ya = Y1 · c(v,πi ) . One of the alignment of Xa and Ya can be found by taking the alignment of X1 and Y1 and respectively adding P [l] and
Compressed Directed Acyclic Word Graph with Application
517
c(v,πi ) at each end of the string. Therefore, A ≤ score(Xa , Ya ). (In fact, we can proof that A = score(Xa , Ya ), but it is not necessary.) As Xa is a substring of P ending at l and Ya is a string in πi , this means filter(Nl−1 [v] + δ(P [l], c(v,πi ) )) ≤ score(Xa , Ya ) ≤ RHS. Consider B = Nl−1 [v] + δ(P [l], −), similar to the previous case for A, let (X2 , Y2 ) = arg maxx=P [k..l−1],y∈πi ,k≤l−1 score(x, y), then choose Xb = X2 · P [l] and Yb = Y2 . For C = Nl [v] + δ(−, c(v,πi ) ), let (X3 , Y3 ) = arg maxx=P [k..l],y∈v,k≤l score(x, y), choose Xc = X3 and Yc = Y3 · c(v,πi ) . We both have filter(B) ≤ score(Xb , Yb ) and filter(C) ≤ score(Xc , Yc ). Therefore, we have max{filter(A), filter(B), filter(C)} ≤ max{score(Xa , Ya ), score(Xb , Yb ), score(Xc , Yc )} ≤ RHS. That implies LHS ≤ RHS. (LHS ≥ RHS) By definition, meaningful score is either a positive number or −∞. If RHS is −∞, this implies no meaningful alignment exists between any substring of P ends at j and any substring of S represented by a node πi . Obviously, LHS ≥ RHS is still correct. If RHS is a positive number, let (X, Y ) = arg maxx=P [k..l],y∈πi ,k≤l score(x, y). X should equal to a substring of P which ends at l, and Y should equal to a substring of S represented by a node u in DS . Let (X , Y ) be the best alignment of (X, Y ). Let a, b be the last character of X and Y , respectively. There are three cases for a and b: (i) a, b ∈ Σ, (ii) a ∈ Σ and b = −, (iii) a = − and b ∈ Σ. In case (i), the last characters of X, Y are respectively a and b . Let Xm and Ym be the strings obtained by removing the last character from X and Y , respectively. Xm should equal to a substring ends at l; and Ym should equal to a path label of a parent node of πi . In this case, we have score(Xm , Ym ) ≥ score(X, Y )− δ(a, b). As, Nl−1 [v] = maxx=P [k..l−1],y∈v score(x, y), Nl−1 [v] ≥ score(Xm , Ym ). Hence, LHS ≥ score(Xm , Ym ) + δ(a, b) ≥ score(X, Y ). Similarly, we can also prove LHS ≥ score(X, Y ) in cases (ii) and (iii). (Proof for Lemma 13 in Section 4.2) Proof. Each entry Nj [u] is computed from positive entries among (Nj−1 [v1 ],. . . , Nj−1 [vk ]), (Nj [v1 ],. . . , Nj [vk ]) and Nj−1 [u] where (v1 , u), . . . , (vk , u) are edges in DS . Therefore, the expected running time and memory is in the order of the number of positive entries in N and the number of visited edges (v, u). Since, any node v in DS has at most |Σ| out-going edges (one for each character in Σ). The number of visited edges is proportional to the number of positive entries. Consider a positive positive entry Nj [u], since Nj [u] = maxk≤j,y∈u meaningful-score(P [k..j], y). It is obviously that each positive entry corresponds to distinct substring y in S and a substring x in P in which meaningful alignment score is greater than zero. (Proof for Lemma 12 in Section 4.2) Proof. The number of entries in the array Nj [u] is O(mn). Note that in the recursive formula, for each j, each edge (v, u) of the graph DS is visited once. Since there are only O(n) nodes and edges in DS (Theorem 1), the worst case running time is O(mn).
518
D.H. Hoang and S.W. Kin
For every node u, the entries Nj [u] only depend on Nj−1 [u]. Therefore, after Nj [u] has been computed, the memory for Nj−2 [u] down to N0 [u] can be freed. Thus, the maximal required memory is O(n log n) bits. (Proof for Lemma 14 in Section 4.2) Proof. In the algorithm BWT-SW, the string S is organized in a suffix tree TS . The alignment process computes and keeps the meaningful alignment scores between path label of nodes of TS and substrings of the pattern string P . Note that each node of the DAWG DS can be seen as the combination of multiple nodes of the suffix tree TS . Therefore, each entry computed in BWT-SW can be mapped to an entry of Nj [u]. (Multiple entries in BWT-SW can be mapped to the same entry Nj [u] in our algorithm.) The expected asymptotic running time of our algorithm is thus bounded by that of BWT-SW.
Unavoidable Regularities in Long Words with Bounded Number of Symbol Occurrences Juha Kortelainen1, Tuomas Kortelainen2, and Ari Vesanen1 1
2
Department of Information Processing Science, University of Oulu Mathematics Division, Department of Electrical and Information Engineering, University of Oulu
Abstract. Traditionally in combinatorics on words one studies unavoidable regularities that appear in sufficiently long strings over a fixed size alphabet. Inspired by permutation problems originating from information security, another viewpoint is taken in this paper. We focus on combinatorial properties of long words in which the number of occurrences of any symbol is restritced by a fixed given constant. More precisely, we show that for all positive integers m and q there exists the least positive q−1 integer N (m, q) which is smaller than m2 and satifies the following: If α is a word such that (i) |alph(α)| ≥ N (m, q) (i.e., the cardinality of the alphabet of α is at least N (m, q)); and (ii) |α|a ≤ q for each a ∈ alph(α) (i.e., the number of occurrences of any symbol of alph(α) in α is at most q), then there exist a set A ⊆ alph(α) of cardinality |A| = m, an integer p ∈ {1, 2, . . . , q}, and permutations σ1 , σ2 , . . . , σp : {1, 2, . . . , m} → {1, 2, . . . , m} for which + + + + + πA (α) ∈ a+ σ1 (1) · · · aσ1 (m) aσ2 (1) · · · aσ2 (m) · · · aσp (1) · · · aσp (m) .
Here A = {a1 , a2 , . . . , am } and πA is the projection morphism from alph(α)∗ into A∗ . Finally, we demonstrate how problems such as the one above are connected to constructing multicollision attacks on so called generalized iterated hash functions.
1
Introduction
In combinatorics on words, the theory of ’unavoidable regularities’ usually concerns properties of long words over a fixed finite alphabet. Famous classical results in general combinatorics and algebra such as theorems of Ramsey, Shirshov and van der Waerden can then be straightforwardly exploited ([8], [5], [20], [21], [22]). The theory can be applied in the study of finiteness conditions for semigroups and (through the concept of syntactic monoid) also in regular languages and finite automata. More recent and important results of combinatorics on words can be found for instance in [4, 10–14]. Combinatorial problems are also encountered in information security, for example, when studying generalized iterated hash functions. Given a message B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 519–530, 2011. c Springer-Verlag Berlin Heidelberg 2011
520
J. Kortelainen, T. Kortelainen, and A. Vesanen
x = x1 x2 · · · xn where x1 , x2 , . . . , xn are the (equally long) blocks of x, the value of a generalized iterated hash function on x is based on the values of a finite compression function on the message blocks x1 , x2 , . . . , xn . A word w over the alphabet {1, 2, . . . , n} may then tell us in which order and how many times each block xi is used by the compression function when producing the value of the respective generalized iterated hash function. Since the length of messages vary, we get to consider sequences of words w1 , w2 , . . . in which, for each n ∈ {1, 2, . . .}, the word wn ∈ {1, 2, . . . , n}∗ is related to messages with n blocks. Practical applications state one more limitation: given a message of any length, a fixed block is to be consumed by the compression function only a restricted number (q, say) of times when computing the generalized iterated hash function value. Thus in the sequence w1 , w2 , . . . we assume that for each n ∈ {1, 2, . . .} and m ∈ {1, 2, . . . , n}, the number |wn |m of occurrences of the symbol m in the word wn is at most q. What can be said about the general combinatorial properties of the word wn when n grows? More generally: what sort of unavoidable regularities appear in sufficiently long words when the number of occurrences of any symbol in the word is bounded by a fixed constant? As is easy to imagine, the regularities in the words wn weaken the respective generalized iterated hash function against multicollision attacks. This topic was first studied in [9]; also see [15, 16, 19]. Our main result (see the abstract) implies that the realization of a succesful multicollision attack against any q-bounded generalized iterated hash function requires substantially less resources than was known before. The proof of the main result is a mathematical realization of an originally geometrical idea. In the case q = 2 the boundary value N (m, 2) is even optimal. This paper is organized in the following way. The next section contains the necessary basic definitions and concepts. In the third section the main combinatorial result of the paper is proved and compared to previous accomplishments. The fourth employs previous results and a generalized version of Hall’s matching theorem to further investigate unavoidable regularities. In the fifth section the connection of our results to multicollisions in generalized iterated hash functions is described. Finally, the last sections contain conclusions and further research proposals.
2
Basics on Alphabets and Words
Denote by N+ the set of all positive integers, i.e., N+ = {1, 2, . . .}. Then N = N+ ∪ {0} is the set of all natural numbers. For each l ∈ N+ , denote Nl = {1, 2, . . . , l}. For any finite set S, let |S| be the cardinality of S that is to say, the number of elements in S. Given a nonnegative real number x, denote by x (respectively, x) the largest integer less than or equal to x (respectively, the smallest integer greater than or equal to x). An alphabet is any finite, nonempty set of abstract symbols called letters or symbols. Let A be an alphabet. A word (over A) is any finite sequence of symbols
Unavoidable Regularities in Long Words with Bounded Number
521
(in A). Thus, assuming that w is a word over A, we can write w = x1 x2 · · · xn , where n is a nonnegative integer and xi ∈ A for i = 1, 2, . . . , n. Here n is the length |w| of w. Notice that n may be equal to zero; then w is the empty word, often denoted by , which contains no letters. For each a ∈ A, let |w|a be the number of occurrences of the letter a in w, and let alph(w) denote the set of all letters occurring in w at least once. The powers of the word w are defined recursively as: w0 = , w1 = u, and wi+1 = wi w for i ∈ N+ . Let w+ = {wi | i ∈ N+ }. The word w ∈ A∗ is a permutation of A, if |w|a = 1 for each a ∈ A. For each n ∈ N, denote by An the set of all words of length n over A. Let A∗ be the set of all words over A and A+ = A∗ \ {}. The projection morphism πB from A∗ into B ∗ , where B ⊆ A is nonempty, is defined by πB (c) = c if c ∈ B and πB (c) = if c ∈ A \ B. Given a word w over the alphabet A, define the word (w)B as follows: (w)B = if πB (w) = and + + (w)B = a1 a2 · · · as if πB (w) ∈ a+ 1 a2 · · · as , where s ∈ N+ , a1 , a2 , . . . , as ∈ B, and ai = ai+1 for i = 1, 2, . . . , s − 1.
3
The Main Theorem
In this section we study unavoidable regularities which are satisfied by any sufficiently long word in which the number of occurrences of each symbol is bounded by a fixed constant. This certainly implies that the alphabet of the string under inspection is very large. We write our main result in the form of classical combinatorial theorems such as Ramsey, Van der Waerden and Shirshov. Theorem 1. For all positive integers m and q there exists a (minimal) positive integer N (m, q) such that the following is true. Let α be a word for which |alph(α)| ≥ N (m, q) and |α|a ≤ q for each a ∈ alph(α). There then exist A ⊆ alph(α) with |A| = m and p ∈ {1, 2, . . . , q} as well as words α1 , α2 , . . . , αp such that α = α1 α2 · · · αp and for all i ∈ {1, 2, . . . , p}, the word (αi )A is a permutation of A. Proof. We proceed by induction on q. Consider first the case q = 1. Assume that m ∈ N+ and α is a word such that |α| ≥ m and |α|a = 1 for each a ∈ alph(α). Choosing p = 1 and letting A ⊆ alph(α) be such that |A| = m, we note that (α)A is a permutation of A. Thus N (m, 1) exists and is less than or equal to m. Trivially N (m, 1) ≥ m, so we conclude that N (m, 1) = m. Let us now turn to the general case. Let q ≥ 2 and α be a word such that alph(α) ≥ N (m2 − m + 1, q − 1) and |α|a ≤ q for all a ∈ alph(α). Suppose that β is the word achieved from α when, for each a ∈ alph(α) such that |α|a = q, the q th occurrence of the symbol a is erased. Since |alph(β)| = |alph(α)| ≥ N (m2 − m + 1, q − 1), there exist, by the induction hypothesis, B ⊆ alph(α), |B| = m2 − m + 1, p ∈ {1, 2, . . . , q − 1}, and words β1 , β2 , . . . , βp such that β = β1 β2 · · · βp and for each i ∈ {1, 2, . . . , p}, the word (βi )B is a permutation of B. Certainly B ⊆ alph(βi ) ⊆ alph(β) for i = 1, 2, . . . , p.
522
J. Kortelainen, T. Kortelainen, and A. Vesanen
Let α1 , α2 , . . . , αp be words such that α = α1 α2 · · · αp and βi is a subword of αi for i = 1, 2, . . . , p such that for each i ∈ {1, 2, . . . , p − 1} and b ∈ B we have |αi |b = |βi |b . Since β is a subword of α and βp contains an occurrence of b for each b ∈ B, the words α1 , α2 , . . . , αp clearly exist. Note that, by the facts above, we have πB (βi ) = πB (αi ) for i = 1, 2, . . . , p − 1. Claim. 1 Let b ∈ B. If |α|b < q, then |αi |b = |βi |b for i = 1, 2, . . . , p. If |α|b = q, then |αi |b = |βi |b for i = 1, 2, . . . , p − 1 and |αp |b = |βp |b + 1. Proof. By the definition of the words β and α1 , α2 , . . . , αp , the following hold: (1) (2)
|αi |b = |βi |b for i = 1, 2, . . . p − 1 and |αp |b ≥ |βp |b p p |β|b + 1 = (Σi=1 |βi |b ) + 1 ≥ Σi=1 |αi |b = |α|b ≥ |β|b
If |α|b < q, then |α|b = |β|b and, by (1) and (2), the equality |αp |b = |βp |b holds. If |α|b = q, then |α|b = |β|b + 1 and, again by (1) and (2), we have |αp |b = |βp |b + 1. d
2
−m+1 where Assume, without loss of generality, that πB (βp ) = ad11 ad22 · · · amm2 −m+1 dj ∈ N+ for j = 1, 2, . . . , m2 − m + 1 and a1 , a2 , . . . , am2 −m+1 are the m2 − m + 1 (pairwise distinct) symbols of B. Write πB (βp ) in the form πB (βp ) = d(i−1)m+1 d(i−1)m+2 i·m γ1 γ2 · · · γm , where γi = a(i−1)m+1 a(i−1)m+2 · · · adi·m for i = 1, 2, . . . , m − 1 and
d
(m−1)m+1 . Then |alph(γi )| = m for i = 1, 2, . . . m − 1 and |alph(γm )| = 1. γm = a(m−1)m+1 Let δ1 , δ2 , . . . , δm be words such that αp = δ1 δ2 . . . δm , γi is a subword of δi and alph(δi ) ∩ alph(γi+1 γi+2 · · · γm ) = ∅ for i = 1, 2, . . . , m − 1. Since, by the definition of β, the dth i occurrence of ai in αp lies before the first occurrence of ai+1 for each i ∈ {1, 2, . . . , m2 − m}, the words δ1 , δ2 , . . . , δm certainly can be found.
Claim. 2 Let i ∈ {1, 2, . . . , m−1} and a ∈ alph(γi ). Then |δi+1 δi+2 · · · δm |a ≤ 1. Proof. Suppose that Claim 2 does not hold, i.e., |δi+1 δi+2 · · · δm |a ≥ 2. Then |αp |a = |δi |a + |δi+1 δi+2 · · · δm |a ≥ |γi |a + 2 = |βp |a + 2 and we have a contradiction with Claim 1. For each i ∈ {1, 2, . . . , m}, let bi ∈ alph(γi ) be a symbol that does not occur in δi+1 δi+2 · · · δm , if such a symbol exists. By the definition of δ1 , δ2 , . . . δm , such a bi does not occur in δ1 δ2 · · · δi−1 . Are we able to find m symbols b1 , b2 , . . . , bm ? If so, choose A = {b1 , b2 , . . . , bm } and note that α = α1 α2 . . . αp and (αi )A is a permutation of A for i = 1, 2, . . . , p. Suppose that j ∈ {1, 2, ..., m − 1} is such that each symbol in alph(γj ) occurs in δj+1 δj+2 · · · δm . By Claim 2, all these occurrences are the last ones of the respective symbol in α. Recall that |alph(γj )| = m. Choose A = alph(γj ), αp = δ1 δ2 · · · δj , and αp+1 = δj+1 δj+2 · · · δm . Then α = α1 α2 . . . αp−1 αp αp+1 and (α1 )A , (α2 )A , . . . , (αp−1 )A , (αp )A , (αp+1 )A are permutations of A. Since p < q, we have p + 1 ≤ q. We may deduce that N (m, q) exists and is less than or equal to N (m2 − m + 1, q − 1). The induction is thus extended and our proof is complete.
Unavoidable Regularities in Long Words with Bounded Number
523
The fact that the number N (m, q) exists for each m, q ∈ N+ was implicitly shown already in Lemma 5 of [9] (see also Theorem 4.10 in [16] and Theorem 3 in [7]). The cited results imply that for all m, q ∈ N+ , N (m, q) ≤ rq msq where the parameters rq and sq are defined recursively by the equations r1 = s1 = 1 and ri+1 = isi +1 risi +1 and si+1 = s2i + 1 for i ∈ N+ . As pointed out in [16], the above upper bound rq msq for N (m, q) is triple-exponential with respect to q. For the parameter sq even a rigorous value can be found: Example 2.2 in q−1 [1] allows us to deduce that sq = k 2 for each q ∈ N+ , where k = 1.502837... The proof of Theorem 1 gives a better estimation for the number N (m, q). Certainly q N (m, q + 1) ≤ N (m2 − m + 1, q) ≤ m2 for all m, q ∈ N+ . Again, using the results of [1] on doubly exponential sequences, one can show that 2q 1 N (m, q) ≤ km + . 2 Here the parameter km is defined by √ ∞ −n−1 4yn2 + 1 4m − 3 km = exp Σn=0 2 ln 2 4yn2 where yn satisfies the recurrence equation yn+1 = yn2 −yn +1, y1 = m (n ∈ N+ ). q 2q Clearly km + 12 ≤ m2 . We omit the detailed considerations. Remark 1. Let m ∈ N+ . In the case q = 2, the previous theorem gives us the boundary value N (m, 2) ≤ m2 − m + 1. Let A = {ai,j |i = 1, 2, . . . , m − 1, j = 1, 2, . . . , m} be an alphabet of m(m − 1) symbols. Let furthermore γi = ai,1 ai,2 · · · ai,m−1 ai,m ai,m−1 ai,m−2 · · · ai,1 for i = 1, 2, . . . , m − 1 and α = γ1 γ2 · · · γm−1 . It is quite straightforward to see that there does not exist an m-letter subalphabet of A such that either (i) (α)A is a permutation of A or (ii) there exists a factorization α = α1 α2 such that (α1 )A and (α2 )A are both permutations of A. Thus N (m, 2) = m2 − m + 1 for m ∈ N+ .
4
Further Considerations on Permutations
We wish to further study the mutual structure of permutations in long words guaranteed by Theorem 1. By increasing the length of the word α the permutations are forced to possess certain stronger structural properties. The motives are, besides our interest in combinatorics on words, in information security applications.
524
J. Kortelainen, T. Kortelainen, and A. Vesanen
The concept of a multicollision in a hash function is defined in Section 5. At this moment it is sufficient to know that in order to create a large multicollision set, the following requirements should be satisfied. We need permutations β1 , β2 , . . ., βp of a sufficiently large alphabet B such that when factoring βi = βi1 βi2 · · · βidi into di ∈ N+ subwords of equal length for i = 1, 2, . . . , p, where dj+1 divides dj , the following holds: for each i ∈ {1, 2, . . . , p − 1} and j1 ∈ {1, 2, . . . , di } there exists j2 ∈ {1, 2, . . . , di+1 } such that alph(βij1 ) ⊆ alph(β(i+1) j2 ). Only then we can, starting from the first permutation β1 , carry out our attack successfully. Assume now that A and α = α1 α2 · · · αp are as in Theorem 1, i.e., for all i ∈ {1, 2, . . . , p}, the word (αi )A is a permutation of A. We shall now present the results that allow us to attain the alphabet B from A, and the permutations β1 , β2 , . . . , βp from α1 , α2 , . . . , αp , respectively, when the alphabet alph(α) is sufficiently large (or, equivalently, when the word α is long enough). As the first step of our reasoning we need an application of the famous Hall’s Matching Theorem. For the proof, see [16] and [9]. Theorem 2 (Partition Theorem). Let k and d be positive integers and A be a set with cardinality |A| = k d3 . Furthermore, let {Bi }ki=1 and {Cj }kj=1 be partitions of A such that |Bi | = |Cj | (= d3 ) for i, j = 1, 2, . . . , k. There then exists a permutation σ : {1, 2, . . . , k} → {1, 2, . . . , k} such that |Bi ∩ Cσ(i) | ≥ d for i = 1, 2, . . . , k. The next theorem is also picked from [16]. It is an inductive and nontrivial generalization of the Partition Theorem to different sizes of factorizations of words. Theorem 3 (Factorization Theorem). Let d0 , d1 , d2 , . . . , dr , where r ∈ N+ , be positive integers such that di divides di−1 for i = 1, 2, . . . , r, A an alphabet of cardinality |A| = d0 d21 d22 · · · d2r , and w1 , w2 , . . . , wr+1 permutations of A. Then there exists a subset B of A of cardinality |B| = d0 such that the following conditions are satisfied. (1) For any i ∈ {1, 2, . . . , r}, if πB (wi ) = x1 x2 · · · xdi is the factorization of πB (wi ) and πB (wi+1 ) = y1 y2 · · · ydi is the factorization of πB (wi+1 ) into di equally long (= dd0i ) blocks, then for each j ∈ {1, 2, . . . , di }, there exists j ∈ {1, 2, . . . , di } such that alph(xj ) = alph(yj ); and (2) If wr+1 = u1 u2 · · · udr is the factorization wr+1 into dr equally long (= d0 d21 d22 · · · d2r−1 dr ) blocks, then πB (wr+1 ) = πB (u1 )πB (u2 ) · · · πB (udr ) is the factorization of πB (wr+1 ) into dr equally long (= ddr0 ) blocks. Allowing the parameters d1 , d2 , . . . , dr in the previous theorem be equal, we get the following Corollary 1. Let d0 , d and r be positive integers such that d divides d0 , A an alphabet of cardinality |A| = d0 d2r , and w1 , w2 , . . . , wr+1 permutations of A. Then there exists a subset B of A of cardinality |B| = d0 satisfying the following.
Unavoidable Regularities in Long Words with Bounded Number
525
Let p, q ∈ {1, 2, . . . , r + 1} and πB (wp ) = x1 x2 · · · xd the factorization of πB (wp ) and πB (wq ) = y1 y2 · · · yd the factorization of πB (wq ) into d equally long (= dd0 ) blocks, then for each i ∈ {1, 2, . . . , d}, there exists j ∈ {1, 2, . . . , d} such that alph(xi ) = alph(yj ). Proof. Choose di = d for i = 1, 2, . . . , r in the Factorization Theorem. Our claim is then induced by property (1) of the theorem. The last result of this section combines our main result (Theorem 1) to the previous combinatorial accomplishments. Theorem 4 is indispensable in the attack constrution of Section 5. Theorem 4. Let α be a word and k ≥ 2, n ≥ 1, and q ≥ 2 integers such that 2
(1) |alph(α)| ≥ N (n(q−1) k 2q−3 , q); and (2) |α|a ≤ q for each a ∈ alph(α) . Then there exists B ⊆ alph(α), p ∈ {1, 2, . . . , q} and a factorization α = α1 α2 · · · αp for which (3) |B| = np−1 k; (4) B ⊆ alph(αi ) and (αi )B is a permutation of B for i = 1, 2, . . . , p; and (5) For any i ∈ {1, 2, . . . , p − 1}, if (αi )B = z1 z2 · · · znp−i k is the factorization of of (αi )B into np−i k equally long (= ni−1 ) blocks and (αi+1 )B = u1 u2 · · · unp−i−1 k the factorization of (αi+1 )B into np−i−1 equally long (= ni ) blocks, then for each j1 ∈ {1, 2, . . . , np−i k}, there exists j2 ∈ {1, 2, . . . , np−i−1 k} such that alph(zj1 ) ⊆ alph(uj2 ). We omit the proof of Theorem 4 due to lack of space; an analogous consideration can be found in [16].
5
Connections to Multicollision Attacks on Generalized Iterated Hash Functions
In this section a compact introduction to (generalized) iterated hash functions is given. We then wish to point out the significance of our main results to the complexity of so called multicollision attacks in the beforementioned hash functions. A message is any nonempty word over the (finite) message block alphabet B. Let H be an alphabet of hash values; assume that |H| < |B|. Let f : H ×B → H be a mapping. Call f a compression function (with |H| hash values and |B| message block symbols).1 1
In the literature, a compression function f of block size m and length n (m, n ∈ N+ , m > n) is usually defined to be a mapping: {0, 1}n × {0, 1}m → {0, 1}n . We wish to simplify the notation and, without loss of generality, use here the symbols H (to replace {0, 1}n ) and B (to replace {0, 1}m ).
526
J. Kortelainen, T. Kortelainen, and A. Vesanen
Define the function f + : H × B + → H inductively as follows. For each h ∈ H, b ∈ B and x ∈ B + , let f + (h, b) = f (h, b) and f + (h, b x) = f + (f (h, b), x). Note that f + is nothing but an iterative generalization of the compression function f . Let l ∈ N+ and α be a word such that alph(α) = Nl . Then α = i1 i2 · · · is , where s ∈ N+ , s ≥ l, and ij ∈ Nl for j = 1, 2, . . . , s. Define the iterated compression function fα : H × B l → H (based on α and f ) by fα (h, b1 b2 · · · bl ) = f +(h, bi1 bi2 · · · bis ) for each h ∈ H and b1 , b2 , . . . , bl ∈ B. Here clearly α only declares how many times and in which order the message blocks b1 , b2 , . . . , bl are used when creating the (hash) value fα (h, b1 b2 . . . bl ) of the message b1 b2 · · · bl . Given k ∈ N+ and h0 ∈ H, a k-collision (with initial value h0 ) in the iterated compression function fα is a set C ⊆ B l of k messages such that for all u, v ∈ C we have fα (h0 , u) = fα (h0 , v). For each j ∈ N+ , let now αj ∈ N+ ˆ= j be such that alph(αj ) = Nj . Denote α + (α1 , α2 , . . .). Define the generalized iterated hash function Hα,f : H×B → H ˆ (based on α ˆ and f ) as follows: Given the initial value h0 ∈ H and the message x ∈ B j , j ∈ N+ , let Hα,f ˆ (h0 , x) = fαj (h0 , x) . Thus, given any message x of j block symbols and hash value h0 , to obtain the value Hα,f ˆ and compute ˆ (h0 , x), we just pick the word αj from the sequence α fαj (h0 , x). For more details, see [16] and [9]. Remark 2. A traditional iterated hash function H : B + → H based on f (with initial value h0 ∈ H) can of course be defined by H(u) = f + (h0 , u) for each u ∈ B + . On the other hand H is a generalized iterated hash function Hα,f : ˆ H × B + → H based on α ˆ and f where α ˆ = (1, 1 · 2, 1 · 2 · 3, . . .) and the initial value is fixed as h0 . Given k ∈ N+ and h0 ∈ H, a k-collision in the generalized iterated hash function Hα,f (with initial value h0 ) is a set C of k messages such that for all u, v ∈ C, ˆ |u| = |v| and Hα,f ˆ (h0 , u) = Hα,f ˆ (h0 , v). Now suppose that C is a k-collision in Hα,f with initial value h0 . Let l ∈ N+ be such that C ⊆ B l , i.e., the length ˆ of each message in C is l. Then, by definition, for each u, v ∈ C, the equality fαl (h0 , u) = fαl (h0 , v) holds. Since alph(αl ) = Nl (and thus each symbol in Nl occurs in alph(α)), the set C is a k-collision in fαl with initial value h0 . Thus, a k-collision in the generalized iterated hash function Hα,f ˆ necessarily by definition, is a k-collision in the iterated compression function fαl for some l ∈ N+ . Now, in our security model, the attacker tries to find a k-collision in Hα,f ˆ . We assume that the attacker knows how Hα,f depends on the respective compression ˆ function f (i.e., the attacker knows α ˆ ), but sees f only as a black box. She/he does not know anything about the internal structure of f and can only make queries (i.e., pairs (h, x) ∈ H ×B m ) on f and get the respective responses (values f (h, x) ∈ H).
Unavoidable Regularities in Long Words with Bounded Number
527
We thus define the complexity of a k-collision in Hα,f to be the expected ˆ number of queries on the compression function f that is needed to create multicollision with size k. According to the (generalized) birthday paradox, a k-collision for the compres(k−1) 1 sion function can be found (with probability approx. 12 ) by hashing (k!) k |H| k messages [23] if we assume that there is no memory restrictions. Two remarks can be made immediately: √ • In the case k = 2 approximately 2 · |H| hashings (queries on f ) are needed; intuitively most of us would expect the number to be around |H|/2. • For each k in N+ , finding a (k + 1)-collision consumes much more resources than finding a k-collision. The paper [15] presents a clever way to find a 2r -collision in the traditional iterated hash function H (see Remark 2) for any r ∈ N+ . The attacker starts from the initial value h0 and searches two distinct message block symbols b1 , b1 such that f (h0 , b1 ) = f (h0 , b1 ) and denotes h1 =f (h0 , b1 ). By the birthday paradox, the expected number of queries on f is a ˜ |H|, where a ˜ is approximately 2.5. Then, for each i = 2, 3, . . . , r − 1, the attacker continues by searching message block symbols bi and bi such that bi = bi and f (hi−1 , bi ) = f (hi−1 , bi ) and and stating hi = f (hi−1 , bi ). Now the set C = {b1 , b1 } × {b2 , b2 } × · · · × {br , br } is r 2 -collision in H. The expected number of queries on f is clearly a ˜ r |H|, i.e., the work the attacker is expected to do is only r times greater than the work she or he has to do to find a single 2-collision. The question arises whether or not the ideas of Joux can be applied in a more broad setting, i.e., can Joux’s approach be used to multicollisions in certain generalized iterated hash functions? In the following we shall see that this indeed is possible. Call the sequence α ˆ = (α1 , α2 . . .) q-bounded, q ∈ N+ , if |αj |i ≤ q for each j ∈ N+ and i ∈ Nj . The generalized iterated hash function Hα,f is q-bounded if α ˆ is q-bounded. Note ˆ that Joux’s method is easy to apply to any 1-bounded generalized iterated hash function. Assume from now on, that H = {0, 1}n and B = {0, 1}m , where m, n ∈ N+ , m > n. Can Joux’s method furthermore be adapted to q-bounded generalized iterated hash functions, when q > 1? This question has been investigated first for 2bounded hash functions in [19] and then for any q-bounded hash functions in [9] (see also [16]). It turned out that it is possible to create 2k -collision in any n q-bounded generalized iterated hash function with O(g(n, q, k) 2 2 ) queries on f , where g(n, q, k) is function of n, q and k which is polynomial with respect to n and k but triple exponential with respect to q. The idea behind the successful construction of the attack is the fact that since α ˆ is q-bounded, unavoidable regularities start to appear in the word αl of α ˆ when l is increased. More accurately, choosing l large enough, yet so that |alph(αl )| depends only polynomially on n and k (albeit triple exponentially in q), a number p ∈ {1, 2, . . . , q} and a set set A ⊆ alph(αl ) of cardinality |A| = np−1 k can be found such that
528
J. Kortelainen, T. Kortelainen, and A. Vesanen
(P1) αl = β1 β2 · · · βp the word (βi )A is a permutation of A for i = 1, 2, . . . , p; and (P2) for any i ∈ {1, 2, . . . , p − 1}, if (βi )A = z1 z2 · · · znp−i k is a factorization of (βi )A such that |alph(zj )| = ni−1 for j = 1, 2, . . . np−i k and (βi+1 )A = u1 u2 · · · unp−i+1 k is a factorization of (βi+1 )A such that |alph(uj )| = ni for j = 1, 2, . . . np−i+1 k, then for each j1 ∈ {1, 2, . . . , np−i k}, there exists j2 ∈ {1, 2, . . . , np−i−1 k} such that alph(zj1 ) ⊆ alph(uj2 ). The property (P1) allows the attacker construct a 2|A| -collision C1 in fβ1 with n any initial value h0 so that the expected number of queries on f is O(|β1 | 2 2 ). The property (P2) ensures that based on the multicollision guaranteed by (P1), p−i the attacker can proceed and, for i = 2, 3, . . . , p, create a 2n k -collision Ci in n fβ1 β2 ···βi so that the expected number of queries on f is a ˜|β1 β2 · · · βi | 2 2 . Thus n finally a 2k -collision of complexity a˜|α| 2 2 in Hα,f is generated. ˆ Finally on the basis of the previous attack construction and Theorem 4, the following can be proved. Theorem 5. Let m, n and q be positive integers such that m > n and q > 1, f : {0, 1}n × {0, 1}m → {0, 1}n a compression function, and α ˆ = (α1 , α2 , . . .) a q-bounded sequence of words such that alph(αl ) = Nl for each l ∈ N+ . Then, for each k ∈ N+ , there exists a 2k -collision attack on the generalized iterated hash function Hα,f such that the expected number of queries on f is equal to ˆ 2 n a ˜ q N (n(q−1) k 2q−3 , q) 2 2 . Remark 3. Now N (m, q) < m2
q−1
implies that
2
2 q−1
N (n(q−1) k 2q−3 , q) < n(q−1)
2
k (2q−3) 2
q−1
.
It is thus evident that the attack complexity given in Theorem 5 is much smaller n than the complexity O(rq (k 3 n3(q−3)+2 )sq 2 2 ) permitted by Theorem 2 in [9] (see also Theorem 5.4 in [16]).
6
Generalization in Practice
Certain generalizations of the classic iterative structure of hash functions have already been applied in practice. The so called Hash Twice is studied in [3]; it can be interpreted as a generalized iterated hash function Hβ,f where the sequence ˆ ˆ β = (β1 , β2 , . . .) consists of words βi = 1 · 2 · · · i · 1 · 2 · · · i for i ∈ N+ and f is the compression function of HashTwice. Clearly in Hash-Twice each block of the message is used two times in the hashing process. In the paper [17], Liskov presents the Zipper Hash construction which uses two so–called weak compression functions. Thinking these compression functions as a pair of random oracles g = (f1 , f2 ), the Zipper Hash effectively works as a generalized iterated hash function Hγˆ,g where γˆ = (γ1 , γ2 . . .) and γi = 1 · 2 · · · i · i · (i − 1) · · · 1 and g is as above. Each message block is used twice and on the second round of compression, the order of message blocks is the mirror image of the original one.
Unavoidable Regularities in Long Words with Bounded Number
529
It is easy to see that both Hash Twice and Zipper Hash are vulnerable to large multicollision attacks. To create a 2k -collision, we simply choose i = n · k and attack against the generalized iterated compression function fβi (Hash Twice) and gγi (Zipper Hash). For Hash Twice we put βi = α1 α2 where α1 = α2 = 1 · 2 · · · i and for Zipper Hash γi = δ1 δ2 where δ1 = 1 · 2 · · · i and δ2 = i · (i − 1) · · · 2 · 1. Properties (3), (4) and (5) of Theorem 4 are satisfied, so a 2k –collision n of complexity a˜ n k 2 2 +1 in any of the two hash functions can be created. From a practical point of view it is clear that the attacker should be forced to do the maximal amount of work when searching a multicollision in a q– bounded generalized iterated hash function. This is likely to happen when the factorization α = α1 α2 · · · αp in Theorem 4 contains the greatest possible number of permutations, i.e., when p = q. A smaller number of permutations allows the construction of larger multicollisions with less resources. To prove this claim rigorously as well as to create sequences α ˆ = (α1 , α2 , . . . , ) that provide the best possible security against multicollision attacks on the respective generalized iterated hash functions is an interesting topic for future research.
7
Conclusion
We have stated reasons to consider combinatorics on words from a fresh viewpoint and taken some small steps in the new research frame. The results imply more efficient attacks on generalized iterated hash functions and, from their part, confirm the fact that the iterative structure possesses certain security weaknesses. Research Problem. We have shown that N (m, 2) = m2 −m+1 for all m ∈ N+ (see Remark 1). It is probable that N (m, q) is much smaller than N (m2 −m+1, q −1) when q > 2 (see the proof of Theorem 1); furthermore, we have not estimated N (m, q) from below at all. Find reasonable lower and upper bounds to N (m, q) for m ≥ 2, q > 2.
References 1. Aho, A., Sloane, N.: Some doubly exponential sequences. Fibonacci Quart. 11, 429–437 (1970) 2. Anderson, S.: Graph Theory and Finite Combinatorics, Markham, Chicago (1970) 3. Andreeva, E., Bouillaguet, C., Dunkelman, O., Kelsey, J.: Herding, Second Preimage and Trojan Message Attacks beyond Merkle-Damgård. In: Jacobson Jr., M.J., Rijmen, V., Safavi-Naini, R. (eds.) SAC 2009. LNCS, vol. 5867, pp. 393–414. Springer, Heidelberg (2009) 4. Czeizler, E., Holub, Š., Karhumäki, J., Laine, M.: Intricacies of simple word equations: an example. Int. J. Found. Comput. Sci. 18(6), 1167–1175 (2007) 5. DeLuca, A., Varrichio, S.: Finiteness and Regularity in Semigroups and Formal Languages. Springer, Heidelberg (1999) 6. Dilworth, R.: A decomposition theorem for partially ordered sets. Ann. of Math. 51, 161–166 (1950)
530
J. Kortelainen, T. Kortelainen, and A. Vesanen
7. Halunen, K., Kortelainen, J., Kortelainen, T.: Multicollision Attacks on Generalized Iterated Hash Functions. In: Autexier, S., Calmet, J., Delahaye, D., Ion, P.D.F., Rideau, L., Rioboo, R., Sexton, A.P. (eds.) AISC 2010. LNCS, vol. 6167, pp. 85–93. Springer, Heidelberg (2010) 8. Harrison, M.: Introduction to Formal Language Theory. Addison-Wesley, Reading (1978) 9. Hoch, J., Shamir, A.: Breaking the ICE - finding multicollisions in iterated concatenated and expanded (ICE) hash functions. In: Robshaw, M.J.B. (ed.) FSE 2006. LNCS, vol. 4047, pp. 179–194. Springer, Heidelberg (2006) 10. Holub, Š.: Local and global cyclicity in free semigroups. Theor. Comput. Sci. 262(1), 25–36 (2001) 11. Holub, Š.: Binary equality sets are generated by two words. J. Algebra 259(1), 1–42 (2003) 12. Holub, Š., Nowotka, D.: The Ehrenfeucht-Silberger Problem. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5555, pp. 537–548. Springer, Heidelberg (2009) 13. Holub, Š., Nowotka, D.: On the relation between periodicity and unbordered factors of finite words. Int. J. Found. Comput. Sci. 21(4), 633–645 (2010) 14. Holub, Š., Saari, K.: On highly palindromic words. Discrete Appl. Math. 157(5), 953–959 (2009) 15. Joux, A.: Multicollisions in iterated hash functions. Application to cascaded constructions. In: Franklin, M. (ed.) CRYPTO 2004. LNCS, vol. 3152, pp. 306–316. Springer, Heidelberg (2004) 16. Kortelainen, J., Halunen, K., Kortelainen, T.: Multicollision Attacks and Generalized Iterated Hash Functions. J. Math. Cryptol. 4, 239–270 (2010) 17. Liskov, M.: Constructing an Ideal Hash Function from Weak Ideal Compression Functions. In: Biham, E., Youssef, A.M. (eds.) SAC 2006. LNCS, vol. 4356, pp. 358–375. Springer, Heidelberg (2007) 18. Lothaire, M.: Combinatorics on Words. Addison-Wesley, Reading (1983) 19. Nandi, M., Stinson, D.: Multicollision attacks on some generalized sequential hash functions. IEEE Trans. Inform. Theory 53, 759–767 (2007) 20. Restivo, A.: Mots sans repetitions et languages rationnels bornes. RAIRO Inform. Theor. 11, 197–202 (1977) 21. Restivo, A., Reutenauer, C.: Some applications of a theorem of Shirshov to language theory. Inform. and Control 57, 205–213 (1983) 22. Restivo, A., Reutenauer, C.: Rational languages and the Burnside problem. Theoret. Comput. Sci. 40, 13–30 (1985) 23. Suzuki, K., Tonien, D., Kurosawa, K., Toyota, K.: Birthday paradox for multicollisions. IEICE Transactions 91-A(1), 39–45 (2008)
Summing Symbols in Mutual Recurrences Berkeley R. Churchill1 and Edmund A. Lamagna2 1
University of California, Santa Barbara, CA, USA Department of Mathematics 2 University of Rhode Island, Kingston, RI, USA Department of Computer Science and Statistics
Abstract. The problem of summing a set of mutual recurrence relations with constant coefficients is investigated. A method is presented for summing an order d system of the form A(n) = di=1 Mi A(n − i) + G(n), where A, G : N → K m and M1 , . . . , Md ∈ Mm (K) forsome field K and natural number m. The procedure expresses the sum n i=0 A(i) in terms of A(n), . . . , A(n − d), initial conditions and sums of the inhomogeneous term G(n).
1
Problem Statement
An important task in computer nalgebra systems is evaluating indefinite sums, that is computing values sn = k=0 ak where the ak are some sequence depending only on k. Today many functions can be summed, in part due to the pioneering work of many researchers [3], [5], [7]. Nonetheless, there are still countless instances where we lack algorithms to sum particular expressions, or the algorithms that exist are inefficient or produce undesirable outputs. One area of interest is summing recurrence relations. Summing any ak is a special case of computing the value of An where An = An−1 + ak and A0 = 0. Recurrence relations arise frequently in algorithm analysis and numerical analysis of differential equations. The classical example is the Fibonacci sequence, defined as a function f : N → N1 given by F (n) = F (n − 1) + F (n − 2) ∀n ≥ 2 with F (0)= 0, F (1) = 1. It is well known2 that this sequence satisfies the n property i=0 Fi = Fn+2 − 1. This identity is nice because it presents the sum in terms of the original Fibonacci symbol. An even trickier situation is a system of linear recurrences, often referred to as mutual recurrences in the literature. Consider the following example: A, B : N → Q satisfy A(n + 2) − A(n + 1) − A(n) − B(n) = 1 and −A(n)+B(n+2)−B(n+1)−B(n) = 1 with A(0) = B(0) = 0 and A(1) = B(1) = 1. How could one write an algorithm that computes an identical expression for 1 2
This work was supported in part by the National Science Foundation under a Research Experiences for Undergraduates (REU) grant, NSF Award No. 1004409. We use N = {n ∈ Z|n ≥ 0}. F (0) = F (2) − 1 holds true. The proof is by induction: suppose n i=0 Fi = Fn+2 − 1 and add Fn+1 to both sides of the equation to verify the formula.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 531–542, 2011. c Springer-Verlag Berlin Heidelberg 2011
532
B.R. Churchill and E.A. Lamagna
n
i=0 A(i) in terms of the symbols A and B themselves? How could this be generalized to deal with any such system? In this paper we present a procedure which can compute the sum in a closed form any time the inhomogeneous term can be summed repeatedly.
2
Related Work
The primary inspiration for this work is Ravenscroft and Lamagna’s work on summation of a single linear recurrence. They providean efficient algorithm to d express the sum of a homogeneous recurrence A(n) = i=1 mi A(n − i) in terms of A(n − d), . . . , A(n − 1) by using a “summing factor” to deal with recurrences that initially appear to be degenerate. They also provide a technique that handles some inhomogeneous terms [8]. Several authors study summing C-finite sequences (those determined by recurrence relations with constant coefficients). Greene and Wilf provide an algorithm to sum a general form of products of C-finite sequences [4]. Kauers and Zimmermann study determining whether summation relationships exist between different C-finite sequences [6]. Work on P -finite sequences (those determined by recurrence relations with polynomial coefficients) has also been done. Abramov and van Hoeij discuss summing P -finite sequences in terms of the original coefficients [1]. Chyzak generalizes the works of Gosper [3] and Zeilberger [10] to sum P -finite sequences that are not hypergeometric [2]. Schneider extends Karr’s approach [5] to P -finite sequences as well [9].
3
Systems of Mutual Recurrences
Definition 1 (Mutual Recurrence). Let K be a field, and m, d ∈ Z+ . A system of mutual linear recurrence relations with constant coefficients on K of order d in m variables is a set of m functions A1 (n), . . . , Am (n) mapping N into K satisfying ⎛ ⎛ ⎞ ⎞ ⎞ ⎛ ⎞ A1 (n − 1) A1 (n − d) A1 (n) g1 (n) ⎜ A2 (n − 1) ⎟ ⎜ A2 (n − d) ⎟ ⎜ g2 (n) ⎟ ⎜ A2 (n) ⎟ ⎜ ⎜ ⎜ ⎟ ⎟ ⎟ ⎜ ⎟ ⎜ .. ⎟ = M1 ⎜ ⎟ + · · · + Md ⎜ ⎟ + ⎜ .. ⎟ .. .. ⎝ ⎝ ⎝ . ⎠ ⎠ ⎠ ⎝ . ⎠ . . ⎛
Am (n)
Am (n − 1)
Am (n − d)
gm (n)
for some M1 , . . . , Md ∈ Mm (K) and g1 , . . . , gm mapping N → K. Typically we will refer to this as a “mutual recurrence”. We call the vector containing the gi (n) the inhomogeneous term. If this inhomogeneous term is zero, the mutual recurrence is homogeneous. We call the values {Ai (j) : 1 ≤ i ≤ m, 0 ≤ j < d} the initial conditions for the recurrence. The notation in this definition is used throughout the paper whenever a specific mutual recurrence is being considered.
Summing Symbols in Mutual Recurrences
533
Example 1. We will use the following example of a mutual recurrence to demonstrate computational procedures throughout the paper. For this example m = 2, so for convenience we use A(n) to denote A1 (n) and B(n) to denote A2 (n). A(n) = 2A(n − 1) + B(n − 1), B(n) = A(n − 1) + 2B(n − 2). This may be written in the form stated in the definition as
0 A(n − 2) 00 A(n − 1) 21 A(n) . + + = 0 B(n − 2) 02 B(n − 1) 10 B(n) Here the order is d = 2 and, coincidentally, m = 2 as well.
4
Homogeneous Case
The homogeneous case can be reduced to a set of C-finite sequences easily and then solved with any of the existing methods, such as [1], [2], [4], [8]. To do so we write the system as follows: (E − 2)A(n) − B(n) = 0, (E 2 − 2)B(n) − EA(n) = 0.
(1) (2)
Here E is the shift operator defined as Ef (n) = f (n+1). Regarding the above as a system of equations with coefficients in Q(E), we can find C-finite relations explicitly for A and B. In this case we could multiply (1) by (E 2 − 2) and add (2) leaving (E 3 − 2E 2 − 3E + 4)A(n) = 0. This demonstrates that A is C-finite and can be summed. B(n) can be handled similarly. This approach works in general for homogeneous systems. However, by combining an inhomogeneous term G, it is possible to construct a sequence that is not C-finite or P -finite. Yet so long as we can sum G using some algorithm, the method we present can still be used to sum the mutual recurrence.
5
Inhomogeneous Case
For the following discussion, fix a particular mutual recurrence n and use the notation provided in the definition. Our goal is to compute j=0 Ai (j) for each i ∈ {1, . . . , m} and express the answer in terms of Span{Ai (n − j) : 1 ≤ i ≤ m, 0 ≤ j ≤ d}, the initial conditions and possibly nan inhomogeneous term. For any function f : N → K, define S(f (n)) = i=d f (i). S will henceforth be known as the summation operator. Recursively define Sij (n) = S(Sij−1 (n)) and Si1 (n) = Si (n) = S(Ai (n)). This operator corresponds to the notion of summing that allowed Ravenscroft and Lamagna to symbolically sum linear recurrences [8]. It becomes convenient to write a mutual recurrence as follows. In the following equation, the leftmost matrix is a block matrix, while the others are not. Check that the dimensions of the matrices are, from left to right, m × m(d + 1), m(d + 1) × 1 and m × 1, and that the following equation is identical to the definition provided earlier.
534
B.R. Churchill and E.A. Lamagna
⎛
A1 (n) A2 (n) .. .
⎞
⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎛ ⎞ ⎜ ⎟ g1 (n) ⎜ Am (n) ⎟ ⎟ ⎜ g2 (n) ⎟ ⎜ ⎜ ⎟ ⎜ ⎟ .. I −M1 −M2 · · · −Md ⎜ ⎟ = ⎜ .. ⎟ . . ⎜ ⎟ ⎝ . ⎠ ⎜ A1 (n − d) ⎟ ⎜ ⎟ gm (n) ⎜ A2 (n − d) ⎟ ⎜ ⎟ ⎜ ⎟ .. ⎝ ⎠ . Am (n − d) This equation can be manipulated using the standard three row operations along with the S operator without changing its validity. This means we may perform the following operations: (i) multiply rows by scalars, (ii) add any row times a scalar to another row, (iii) swap rows and (iv) apply the S operator to any row. The S operator now deserves some attention. Let V be a vector space over K with basis β = {Ai (n − j) : 1 ≤ i ≤ m, 0 ≤ j ≤ d} ∪ {Sij (n) : 1 ≤ i ≤ m, j ∈ Z+ } ∪ {1}. Throughout our work S will only be applied to functions of the form v(n) + i(n) where v ∈ V and i(n) is an inhomogeneous term that depends only on n, and never on any function of the Ai . Therefore to understand S we need only understand how S acts on β; summing the inhomogeneous parts yields other inhomogeneous parts, and this may be accomplished via other methods [3], [5], [7]. From the definitions, we already know S(Sij (n)) = Sij+1 (n). The others are not hard to compute as S(Ai (n−j)) = Ai (d−j)+Ai (d−j +1)+· · ·+Ai (n−j) = d−1 n n n k=d−j Ai (k) + k=d Ai (k) − k=n−j+1 Ai (k) = Si (n) − k=n−j+1 Ai (k) + d−1 k=d−j Ai (k) and S(1) = 1 + 1 + · · ·+ 1 = (n − d + 1). Now consider applying S to a row of a matrix equation. By this we mean expanding the entire row of the equation, applying S to both the right and left hand sides, and then returning it to matrix form. Unless the row only contains an inhomogeneous term and nothing else (this does not occur in our procedure), applying S will create a new column including an Sij (n). Therefore, we need to expand our matrix equation by t blocks of size m × m. t will be assigned a definite value later. Here is the new matrix equation, now expanded: 0 · · · 0 I −M1 · · · −Md ∗
t S1t (n) · · · Sm (n) · · · S1 (n) · · · Sm (n) A1 (n) · · · Am (n) · · · A1 (n − d) · · · Am (n − d)
⎛
⎞ g1 (n) ⎜ g2 (n) ⎟ ⎜ ⎟ =⎜ . ⎟ ⎝ .. ⎠ gm (n)
t
Summing Symbols in Mutual Recurrences
535
For brevity we will notationally abbreviate equations of the above form as an augmented matrix like this, 0 0 · · · 0 I −M1 −M2 · · · −Md G . Here G denotes the column of inhomogeneous terms. In the following we will explicitly demonstrate the action of the summation operator on an augmented matrix. Suppose we start with the following augmented matrix,
0 0 · · · 0 Bj Bj−1 · · · B1 C1 C2 · · · Ck G
where B1 , . . . , Bj and C1 , . . . , Ck are m × m matrices. In the expanded matrix j equation, Bj is multiplied by the block matrix containing the S1j (n), . . . , Sm (n) j as rows. A row of their product is therefore a linear combination of Si (n). Applying the summation operator creates an identical linear combination of j+1 S1j+1 (n), . . . , Sm (n). The same logic applies to Bj−1 , . . . , B1 . In block matrix form, all the B1 , . . . , Bj appear to be shifted one block to the left after applying the summation operator. The result looks like
0 0 · · · 0 Bj Bj−1 · · · B1 ∗ ∗ ∗ · · · ∗ ∗ .
To determine the block matrix represented by the leftmost asterisk, consider when Si (n) appears in the image of the S operator; it appears once for every k occurrence of Ai (n − j) (for any j ∈ N) in the preimage. This implies i=1 Ci is the value of the leftmost asterisk. For the kth asterisk to the right of the separator, the number of Ai (n − k) in the image of S is given by the negation of the number of Ai (n − l) in the preimage, where l > k. This result is best stated as a lemma. Lemma 1. Given an augmented block matrix of the form
0 0 · · · 0 Bj Bj−1 · · · B1 C1 C2 · · · Ck G
applying S to each row yields a new block matrix
0 0 · · · 0 Bj Bj−1 · · · B1
k
i=1 Ci −
k
i=2 Ci −
k
i=3 Ci · · · −Ck 0 G
where G is some column matrix of inhomogeneous functions. Our goal is to solve for S1 (n), . . . , Sm (n) in terms of the Ai (n − j) and inhomogeneous terms. To accomplish this we attempt to use the four row operations to put the matrix into the form 0 0 · · · 0 I ∗ ∗ · · · ∗ ∗ where the matrices marked by ∗ need not satisfy any conditions. At this point, each of S1 (n), . . . , Sm (n) can be fully solved via back-substitution. The following example illustrates how this works in tandem with Lemma 1.
536
B.R. Churchill and E.A. Lamagna
Example 2. In the context of Example 1, we will demonstrate how this can be used to evaluate the sums we desire. Begin by writing the mutual recurrence as an augmented matrix,
0 0 1 0 −2 −1 0 0 0 0 I −M1 −M2 G = . 0 0 0 1 −1 0 0 −2 0 Apply the summation operator to both rows:
−1 −1 2 1 0 0 0 0 −2A(1) − B(1) −1 −1 1 2 0 2 0 0 −A(1) − 2B(1) − 2B(0) Negate row 1 and add it to row 2:
−1 −1 2 1 0 0 0 0 −2A(1) − B(1) 0 0 −1 1 0 2 0 0 A(1) − B(1) − 2B(0) Sum row 2 again:
−1 −1 2 1 0 0 0 0 −2A(1) − B(1) −1 3 0 −2 0 0 0 0 (A(1) − B(1) − 2B(0))(n − 1) + 2B(1) Negate row 1 and add it to row 2:
1 1 −2 −1 0 0 0 0 2A(1) + B(1) 0 4 −2 −3 0 0 0 0 (A(1) − B(1) − 2B(0))(n − 1) + 3B(1) + 2A(1)
Divide row two by 4 and subtract it from row 1:
1 0 − 23 − 14 0 0 0 0 − 41 (A(1) − B(1) − 2B(0))(n − 1) + 32 A(1) + 14 B(1) 0 1 − 21 − 34 0 0 0 0 14 (A(1) − B(1) − 2B(0))(n − 1) + 34 B(1) + 12 A(1) For completeness, observe that SB (n) + B(1) + B(0) and n
i=0
i=0
A(i) = SA (n)+A(1)+A(0) and
n
i=0
B(i) =
A(i) =
3 1 1 3 1 A(n) + B(n) + (A(1) − B(1) − 2B(0))n − A(1) + B(0) + A(0) 2 4 4 4 2
B(i) =
1 3 1 1 1 A(n) + B(n) − (A(1) − B(1) − 2B(0))n − A(1) + B(0). 2 4 4 4 2
i=0
n
n
Now we are ready to state the main procedure which is similar to the approach of this example.
6
The Summation Procedure
Procedure 1. Given a mutual recurrence and its corresponding augmented matrix, take its augmented matrix
Summing Symbols in Mutual Recurrences
537
U = 0 I −M1 −M2 · · · −Md G . For each t ≥ 0 do the following starting with U : (1) Augment the matrix with t + 1 blocks of m × m zero matrices on the left-hand side. (2) Duplicate each row of the matrix t times. The matrix has dimensions (t + 1)m × (t + d + 3)m and looks like: ⎛ ⎞ 0 · · · 0 I −M1 −M2 · · · −Md G ⎜ 0 · · · 0 I −M1 −M2 · · · −Md G ⎟ ⎜ ⎟ ⎜ .. . . .. .. .. .. . . .. .. ⎟ . ⎝. . . . . . . . .⎠ 0 · · · 0 I −M1 −M2 · · · −Md G Number the block rows from top to bottom starting at 1. (3) Apply S to the (t + 2 − i)th block row i times for 1 ≤ i ≤ t + 1. (4) If placing this matrix in row-reduced echelon form results in some submatrix of the form
0 0 ··· 0 I ∗ ∗ ··· ∗ ∗
then stop. Back-substitute to solve for each Si (n) when i ∈ {1, . . . , m}. Otherwise increment t by one and continue. In the following we prove that this procedure terminates when m = 1 or when d = 1. By construction, if it terminates we are guaranteed that the solution is correct. That the procedure always terminates is left as a conjecture.
7
Analysis
Given integers m, d and matrices M1 , . . . , Md ∈ Mm (K), define M0 = −Im and f (i) =
d d
d
···
k1 =i k2 =k1
Mki+1 .
ki+1 =ki
On some occasions it is useful to consider a more general function of two variables, f (i, j) =
d d k1 =j k2 =k1
···
d
αki +1 .
ki+1 =ki
For convenience when i ≥ 0 we also define f (−1, i) = Mi . Notice that f (i, i) = f (i) for all nonnegative integers i. We also have the identity f (i, j) =
d
f (i − 1, k)
(3)
k=j
which is easily checked from the definitions given. Typically m, d and M1 , . . . , Md correspond to a particular mutual recurrence that should be clear from the context.
538
B.R. Churchill and E.A. Lamagna
Lemma 2. Procedure 1 terminates if the following statement holds: Given positive integers m, d, a field K and M1 , . . . , Mn ∈ Mm (K), M0 = −Im , there exists some t ∈ N such that the matrix ⎛ ⎞ f (0) f (1) f (2) · · · f (t) ⎜ 0 f (0) f (1) · · · f (t − 1)⎟ ⎜ ⎟ ⎜ 0 0 f (0) · · · f (t − 2)⎟ ⎜ ⎟ ⎜ .. ⎟ .. .. . . .. ⎝ . ⎠ . . . . 0
0
0
···
f (0)
contains the vectors (0, 0, . . . , 0, 1, 0, . . . , 0), (0, 0, . . . , 0, 0, 1, . . . , 0), · · · , m
m
(0, 0, . . . , 0, 0, 0, . . . , 1) in its rowspace. Note that each entry in this tm × tm m
matrix is an m × m block. Proof. The matrix presented above is the matrix derived from performing the four steps listed in the procedure for a particular value of t. If for some t the rowspace of this matrix contains these m standard basis vectors, then the m × m identity matrix can be formed as a submatrix from a linear combination of the rows, and hence the procedure terminates. The only thing left to check is that performing the steps of the procedure results in a matrix in the above form. After completing step 2 in the procedure, the matrix has tm rows and is ⎛ ⎞ 0 0 · · · 0 I −f (−1, 1) −f (−1, 2) · · · −f (−1, d) G ⎜ 0 0 · · · 0 I −f (−1, 1) −f (−1, 2) · · · −f (−1, d) G ⎟ ⎜ ⎟ ⎜ .. .. . . .. .. .. .. .. .. ⎟ . .. ⎝. . . . . . . . . .⎠ 0 0 · · · 0 I −f (−1, 1) −f (−1, 2) · · · −f (−1, d) G We claim that applying the summation operator j + 1 times to any row will result in the row appearing as
0 · · · 0 f (0) f (1) · · · f (j) f (j, j + 1) f (j, j + 2) · · · f (j, d) 0 · · · 0 G .
Using Lemma 1 this is easy to verify inductively. Assuming that after j + 1 summations the row takes the above form, summing once more obtains the form
0 · · · 0 f (0) · · · f (j)
d k=1
f (j, j + k) −
d k=2
f (j, j + k) · · · −
d k=d
f (j, j + k) 0 · · · 0 G .
From the identity (3) it follows that this row equals 0 · · · 0 f (0) · · · f (j) f (j + 1) −f (j + 1, j + 2) · · · −f (j + 1, d) 0 · · · 0 G .
Summing Symbols in Mutual Recurrences
539
Therefore, after completing all of step 4, the matrix appears as ⎛ ⎞ f (0) f (1) f (2) · · · f (t) ∗ ∗ · · · ∗ ∗ ⎜ 0 f (0) f (1) · · · f (t − 1) ∗ ∗ · · · ∗ ∗ ⎟ ⎜ ⎟ ⎜ 0 0 f (0) · · · f (t − 2) ∗ ∗ · · · ∗ ∗ ⎟ ⎜ ⎟. ⎜ .. .. .. . . .. .. .. . . .. .. ⎟ ⎝ . . . . . . . . . .⎠ 0
0
0 ···
f (0)
∗ ∗ ··· ∗ ∗
For now we are only concerned with the left-hand portion of this matrix. If this matrix contains the necessary basis vectors in its rowspace, then the identity matrix must exist as a submatrix of the left-hand block. If no such t exists then the procedure never terminates. Corollary 1. If f (0) = M1 +M2 +· · ·+Md −I is nonsingular, then the procedure terminates when t = 1. Lemma 3. Let p(x) = αd xd + · · ·+ α1 x + α0 with α0 , . . . , αd ∈ K. Then (x − 1)t divides p(x) if and only if f (0) = f (1) = · · · = f (t − 1) = 0. Proof. We use the function f taking Mi = αi . By induction we show that d d t f (t−i) 1 i i−t + i=1 (x−1)i for t ≥ 0. When i=0 f (−1, i)x = i=t f (t − 1, i)x (x−1)t t = 0 this is just the polynomial we start with. The key to the inductive step is the observation that for a generic polynomial g(x) = bn xn + · · · + b1 x + b0 the quotient g(x)/(x − 1) can be computed by summing the coefficients, as is done in the process of “synthetic division”. Specifically, g(x)/(x − 1) = bn xn−1 + (bn + bn−1 )xn−2 +· · ·+(bn +· · ·+b1 )+(bn +· · ·+b1 +b0 )/(x−1). Using this technique, divide each side of the inductive goal by (x − 1). 1/(x − 1)t+1 di=0 f (−1, i)xi = d d t d f (t−i) i−(t+1) + j=t f (t − 1, j)/(x − 1) + i=1 (x−1) i+1 = i=t+1 j=i f (t − 1, j)x d t+1 f (t+1−i) d i−(t+1) i−(t+1) + f (t)/(x − 1) + i=2 (x−1)i = i=t+1 f (t, i)x + i=t+1 f (t, i)x t+1 f (t+1−i) t i=1 (x−1)i . This completes the induction. Notice that now (x − 1) divides p(x) evenly if and only if f (0) = f (1) = · · · = f (t − 1). Theorem 2. The procedure terminates when m = 1. Moreover, if (x−1)p ||Md xd + Md−1 xd−1 + · · · + M1 x + M0 , then the procedure terminates when t = p.3 Proof. For some nonnegative integer p we have that (x−1)p ||Md xd +Md−1 xd−1 + · · · + M1 x + M0 . By lemma 3 we know that f (0) = f (1) = · · · = f (p − 1) = 0, and that f (p) = 0. By lemma 2 we know this implies the procedure terminates since all the entries in the matrix are zero except the top-right entry. Theorem 3. Procedure 1 terminates with the correct answer when d = 1. Proof. The approach is to take the mutual recurrence of order 1 and explicitly show that the condition in lemma 2 is satisfied. Let A = M1 . The goal is to show that for some t ≥ 0 the following matrix of dimension (t + 1)m × (t + 1)m 3
When m = 1, each Mi ∈ K.
540
B.R. Churchill and E.A. Lamagna
⎛
A − I −A 0 ⎜ 0 A − I −A ⎜ ⎜ 0 A−I Z =⎜ 0 ⎜ .. .. .. ⎝ . . . 0 0 0
0 ··· 0 ··· −A · · · .. . . . .
0 0 0 .. .
⎞ ⎟ ⎟ ⎟ ⎟ ⎟ ⎠
0 ··· A − I
can be row-reduced into a matrix containing I as a submatrix. The easy case is when A is nilpotent. Here, |A − I| = 0, so row reducing the matrix with t = 0 yields the identity matrix. For the remainder of the cases we will first discuss some facts about A and polynomials involving A, and then proceed to the row-reduction. Let μA (x) be the minimal polynomial of A, that is the polynomial of least degree such that μA (A) = 0. We regard μA ∈ K[x] and can write μA (x) = μk xk +μk−1 xk−1 +· · · μ1 x+μ0 for some μi ∈ K, but define for any X ∈ Mm (K), μ(X) = μk X k + · · · + μ1 X + μ0 I. Let t be the greatest nonnegative integer such that (x − 1)t divides μ(x) and write μ(x) = (x − 1)t q(x) for some q(x) ∈ K[x]. We define q(X) for a matrix X the same way we did for μA . Notice that this allows us to perform the division algorithm with polynomials over matrices, in the sense that for any polynomial g ∈ K[x] there exist polynomials s, r ∈ K[x] such that q(X) = g(X)s(X) + r(X) where the degree of r is less than the degree of g. This works because sums and products of a single matrix X freely commute with each other. Label the block rows of the matrix from top to bottom starting at 1. For 1 ≤ i ≤ t multiply the row by (A − I)t−i Ai−1 q(A). In the first block row the leftmost block entry becomes μ(A) = (A − I)t q(A) = 0. For all subsequent rows i ≤ t, the leftmost non-zero block entry equals the entry above it; namely the leftmost non-zero block in row i is (A − I)t−i+1 Ai−1 q(A). In row t, the rightmost block entry is −At q(A) and the entry below it is still A − I. At this point row reducing the matrix only leaves all the entries of the matrix nonzero except for these two, so ⎛ ⎞ 0 ··· 0 0 ⎜ .. . . .. ⎟ .. ⎜. ⎟ . . . ⎜ ⎟ Z ∼ ⎜0 ··· 0 . 0 ⎟ ⎜ ⎟ ⎝ 0 · · · 0 At q(A) ⎠ 0 ··· 0 A − I Using the division algorithm, write q(A) = (A−I)s(A)+αAp for some α ∈ K, p ∈ N and s ∈ K[x]. Notice that α = 0, for if it were not then (x − 1)|q(x) which would contradict its definition. Multiply the bottom row by s(A)At and subtract from the row above. Divide the above row by α. This leaves the matrix ⎞ ⎛ 0 ··· 0 0 ⎜ .. . . .. .. ⎟ ⎜. . . . ⎟ ⎟ ⎜ Z ∼ ⎜0 ··· 0 ⎟. 0 ⎟ ⎜ ⎝ 0 · · · 0 Ap+t ⎠ 0 ··· 0 A − I
Summing Symbols in Mutual Recurrences
541
Finally multiply the bottom row of the matrix by (Ap+t−1 +Ap+t−2 +· · ·+A1 ) and subtract from the top row. This leaves the entry Ap+t − (Ap+t−1 + Ap+t−2 + · · · + A1 )(A − I) = A in that row. Negate the bottom row and add the other row to derive I in the bottom right corner of the matrix. Corollary 2. For m = 1 and d = 1 the runtime is bounded by O(m3 (t + d)3 ). For both cases, we can use the above theorems to provide an explicit value for t ≤ m. The two longest steps in the procedure are applying the summation operator and computing the row reduction. Via lemma 1 it takes O(m2 (t + d2 )) time to sum one block row of the matrix in addition to the time it takes to compute the sum of the inhomogeneous term. This must be performed only m times if the results from row i are used to compute row i + 1. Therefore step 2 takes time O(m3 (t + d2 )). A naive implementation of step 3 using Gauss-Jordan elimination will require O(m3 (t + d)3 ) time. Thus the third step dominates and the asymptotic run time of the entire procedure is O(m3 (t + d)3 ) in addition to the time required to sum inhomogeneous parts. Notice that for both the m = 1 case and the d = 1 case there exists a polynomial p(x) such that if q is the greatest integer where (x − 1)q |p(x) then t is bounded above by q. This is reminiscent of Ranvenscroft and Lamagna’s result in [8] where this power of t is used to derive a “summing factor” to sum linear recurrences. This suggests a more general phenomena of a minimal polynomial for a mutual recurrence that can be subject of further work. It also suggests that understanding this minimal polynomial will yield more results about the efficiency and termination of the procedure.
8
Conclusion
The procedure presented in this paper provides a way to compute symbolic sums for both homogeneous and inhomogeneous mutual recurrences. It is an improvement over Ravenscroft and Lamagna’s [8] because it generalizes to mutual d recurrences and provably works when m = 1, d = 1 or | i=1 Mi − I| = 0. It also extends the current work on P -finite and C-finite summation. Given a sequence an that is not P -finite but can be summed via other methods, procedure 1 will sum mutual recurrences where the ai appear as inhomogeneous terms. We believe that generalizing the proof of theorems 2 and 3 will be difficult for two reasons. First, there is not a well-known theory of a characteristic polynomial or minimal polynomial for a mutual recurrence that satisfies our needs, or a theorem like Cayley-Hamilton which extends to multiple matrices. Secondly, the ring generated by two m × m matrices is not necessarily commutative. When there is only one matrix this ring commutes, which allowed many of the steps in the proof of theorem 3.
542
B.R. Churchill and E.A. Lamagna
References 1. Abramov, S.A., van Hoeij, M.: Desingularization of linear difference operators with polynomial coefficients. In: Dooley, S. (ed.) International Symposium on Symbolic and Algebraic Computation, pp. 269–275. ACM, New York (1999) 2. Chyzak, F.: An extension of Zeilberger’s fast algorithm to general holonomic functions. Discrete Mathematics 217(1-3), 115–134 (2000) 3. Gosper Jr., R.W.: Decision procedure for indefinite hypergeometric summation. Proceedings of the National Aacademy of Sciences USA 75, 40–42 (1978) 4. Greene, C., Wilf, H.S.: Closed form summation of C-finite sequences. Transactions of the American Mathematical Society 359, 1161–1189 (2007) 5. Karr, M.: Summation in finite terms. Journal of the ACM 28(2), 305–350 (1981) 6. Kauers, M., Zimmermann, B.: Computing the algebraic relations of C-finite sequences and multisequences. Journal of Symbolic Computation 43(11), 787–803 (2008) 7. Moenck, R.: On computing closed forms for summation. In: Proceedings of the MACSYMA User’s Conference, pp. 225–236 (1997) 8. Ravenscroft Jr., R.A., Lamagna, E.A.: Summation of linear recurrence sequences. In: Milestones in Computer Algebra, pp. 125–132 (2008) 9. Schneider, C.: A new sigma approach to multi-summation. Advances in Applied Mathematics 34(4), 740–767 (2005) 10. Zeilberger, D.: A fast algorithm for proving terminating hypergeometric series identities. Discrete Mathematics 80(2), 207–211 (1990)
Flipping Triangles and Rectangles Minghui Jiang Department of Computer Science, Utah State University, Logan, UT 84322-4205, USA [email protected]
Abstract. We study the chromatic number of the flip graph of triangles determined by n points in convex position in the plane, and present new or improved bounds on several related parameters for this graph. We also find the chromatic numbers of two related graphs: the rectangle flip graph which generalizes the shift graph, and the rolling block graph from the popular puzzle “Rolling Block Maze.”
1 Introduction Let Sn be a set of n points in the plane in convex position, n ≥ 4. Define the where triangle flip graph n as the graph with vertices being the n3 triangles determined by Sn , and with an edge between two vertices if and only if the corresponding triangles are adjacent, that is, they share an edge and are interior-disjoint. We refer to Figure 1 for an illustration.
Fig. 1. The triangle flip graphs 4 , 5 , and 6
Supported in part by NSF grant DBI-0743670.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 543–554, 2011. c Springer-Verlag Berlin Heidelberg 2011
544
M. Jiang
Fabila-Monroy et al. [5] recently proved that the chromatic number of n is at least log2 (n−1) and at most 3log2 n−4. Their upper bound was obtained by a recursive algorithm. In the following theorem, we improve the upper bound by 1. Our upper bound is achieved by an alternative coloring method in which the color of each triangle depends only on its shape and hence can be specified by a simple formula. Theorem 1. For every integer n ≥ 4, χ(n ) ≤ 3log2 n − 5. The following proposition on the clique number of the triangle flip graph can be easily verified: Proposition 1. For every integer n ≥ 4, ω(n ) = 2. For any graph G, it is obvious that χ(G) ≥ ω(G), but whether χ(G) can be bounded from above by a function of ω(G) is not at all clear. Recall that the two numbers are equal for every induced subgraph of a perfect graph. Thus the ratio of the chromatic number to the clique number of a graph is often studied as a measure of its “imperfection”; see for example [3] for some related work on bounding this ratio for geometric intersection graphs and their complements. The bounds on the chromatic number of the triangle flip graph together with the exact value of its clique number lead to the following corollary: Corollary 1. 1/2 ≤ limn→∞ χ(n )/ω(n ) / log2 n ≤ 3/2. Denote by G the complement of a graph G. The clique-partition number ϑ(G) and the independence number α(G) of any graph G are respectively the chromatic number χ(G) and the clique number ω(G) of G. Our following two theorems give the first bounds on the clique-partition number and the independence number of the triangle flip graph: 1 Theorem 2. For every integer n ≥ 6, n3 /2 ≤ ϑ(n ) ≤ n3 (1 + 2n−6 )/2. Theorem 3. For every integer n ≥ 4, (n3 − n)/24 ≤ α(n ) ≤ n−3 (n3 − n)/16 when n−2 3 3 2 n is odd, and (n − 4n)/24 ≤ α(n ) ≤ (n − 2n )/16 when n is even. In contrast to Corollary 1, we have the following corollary: Corollary 2. 4/3 ≤ limn→∞ ϑ(n )/α(n ) ≤ 2. For a graph G = (V, E) and a weight function w : V → N, let Gw denote the graph obtained from G via replacing each vertex v by a clique of size w(v). Gerke and McDiarmid [8] introduced the imperfection ratio imp(G) of a graph G as χ(Gw ) imp(G) = lim rk , where rk = max : max{w(v) : v ∈ V } = k . k→∞ ω(Gw ) They showed that imp(G) = imp(G) for any graph G, and moreover imp(G) = 1 if and only if G is perfect. They also showed that imp(G) = χf (G)/2 if G is trianglefree, where χf (G) is the fractional chromatic number of G. We obtain the following theorem that connects Corollaries 1 and 2:
Flipping Triangles and Rectangles
545
Fig. 2. The rectangle [2, 4]×[1, 2] has three neighbors [1, 2]×[1, 2], [2, 4]×[2, 3], and [2, 4]×[2, 4] in the rectangle flip graph 24 (partially shown)
Theorem 4. For every integer n ≥ 6, 5/4 ≤ imp(n ) = χf (n )/2 < 4. Let [n] denote the set {1, . . . , n}. Let Tnd = [n]d be the set of nd lattice points in Rd , where d ≥ 1 and n ≥ 2. Define the rectangle flip graph
dn as the graph with vertices nd being the 2 hyperrectangles determined by Tn , and with an edge between two vertices if and only if the corresponding hyperrectangles are adjacent, that is, they share a facet and are interior-disjoint in their bodies. We refer to Figure 2 for an illustration. When d = 1, the “interval flip graph”
1n is better known as the “shift graph,” which was introduced by Erd˝os and Hajnal in 1968 [4]. The chromatic number of the shift graph is exactly log2 n; see for example [9]. We generalize this result to all d ≥ 1 in our next theorem: Theorem 5. For every integers d ≥ 1 and n ≥ 2, χ(
dn ) = log2 n. The rectangle flip graph
2n has connection to a popular puzzle called “Rolling Block Maze” in the recreational mathematics community [1,7]; see also [2] for a related puzzle. In the simplest setting of the rolling block puzzle, we are given a 1 × 1 × 2 block on an m × n board. The goal is to move the block from a start position to an end position on the board using the minimum number of rolls. (In more advanced settings, the block may have unusual dimensions x × y × z and may even be non-convex, and the board may have some squares marked as obstacles and may even be equipped with ramps to change levels.) We refer to Figure 3 for an example. Note that each roll of the block is a flip between two adjacent rectangles in the projected view.
Fig. 3. A cycle of 7 rolls of a 1 × 1 × 2 block on a 4 × 3 board
546
M. Jiang
For any three positive integers a, b, and c such that gcd(a, b, c) = 1, we define the rolling block graph Ra,b,c as the graph with vertices being the positions of an unlabeled a × b × c block on an infinite board, and with an edge between two vertices if and only if the block can be rolled between the corresponding positions in one step. What is the chromatic number of Ra,b,c ? Our following theorem gives a complete characterization of the colorability of the rolling block graph: Theorem 6. For any three positive integers a, b, and c such that gcd(a, b, c) = 1, we have χ(Ra,b,c ) = 2 if a, b, c are either all odd or all distinct, and χ(Ra,b,c ) = 3 otherwise. In particular, χ(R1,1,2 ) = 3.
2 Flipping Triangles In this section we prove Theorems 1, 2, 3, and 4. p2
p1
p12
p3
p11
p4
pi+n/2
p10
p5
p9 p6
p7
pi
p8
Fig. 4. Left: partition the triangles into three subsets. p3 p8 p12 ∈ A, p5 p7 p11 ∈ B, p1 p2 p6 ∈ C. Right: the subgraph of n induced by each subset Bi is bipartite.
Without loss of generality, we assume that Sn is the set of vertices of a regular n-gon Pn = p1 . . . pn (in counterclockwise orientation) inscribed in a unit-radius circle Ω centered at the origin o. Refer to Figure 4 left. Then the set of n3 triangles determined by Sn can be partitioned into three subsets A, B, and C such that – A includes the triangles with the origin in their interiors; – B includes the triangles with the origin on their boundaries; – C includes the triangles completely disjoint from the origin. Note that the subset B is empty when n is odd. 2.1 Chromatic Number We prove Theorem 1 in this subsection. To derive the improved upper bound, we will color the triangles in A ∪ B and the triangles in C separately. Clearly one color is enough for all triangles in A since they are not interior-disjoint. The triangles in B, when n is even, can be partitioned into n/2 subsets Bi , 1 ≤ i ≤ n/2, with the triangles in each subset Bi sharing the diagonal pi pi+n/2 of Pn as an edge.
Flipping Triangles and Rectangles
547
w T1
u
v T2
x
Fig. 5. Two adjacent triangles T1 = (u, w, v) and T2 = (u, v, x) in Ci
Refer to Figure 4 right. Observe that in each subset Bi , two triangles are adjacent if and only if they are on opposite sides of the diagonal. This implies that the subgraph of n induced by each subset Bi is bipartite. Since any two triangles from two different subsets in the partition A ∪ B1 ∪ . . . ∪ Bn/2 are not interior-disjoint, two colors are enough for all triangles in A ∪ B. It remains to color the triangles in C. Refer to Figure 5. For any two vertices u and v of Pn , let #[u, v] denote the number of vertices of Pn from u to v (inclusive) in the counterclockwise direction. Represent each triangle in C, say T , by an ordered triple (u, w, v) of its three vertices such that the arc of the circle Ω going counterclockwise from u to v has angle less than π and contains w.Clearly #[u, v] = #[u, w]+#[w, v]− 1. Now define ψ(T ) = #[u, v] and φ(T ) = min #[u, w], #[w, v] . Observe that each triangle T in C satisfies ψ(T ) ≤ n/2, and hence φ(T ) ≤ (n/2 + 1)/2 = n/4 (the last equality can be easily verified by a case analysis of the four possible values of n mod 4). Put k = log2 n/4. Partition C into k subsets Ci , 1 ≤ i ≤ k, such that the values of φ(T ) for the triangles T in Ci belong to the closed interval [ 2i−1 + 1, 2i ].
(1)
Partition each subset Ci further into subsets Ci,j such that the values of ψ(T ) for the triangles T in Ci,j belong to the closed interval [ j · 2i−1 + 1, (j + 1) · 2i−1 ].
(2)
Assign the color ci,j = i+(j mod 3)·k to the triangles in Ci,j . Note that 1 ≤ ci,j ≤ 3k. We claim that no two adjacent triangles in C have the same color. The claim is clearly true for two triangles from different subsets Ci1 and Ci2 . Now consider any two adjacent triangles T1 and T2 in Ci . Refer back to Figure 5. Assume without loss of generality that ψ(T1 ) < ψ(T2 ). Let T1 be (u, w, v). Then T2 must be either (u, v, x) or (x, u, v) for some other vertex x. Suppose that T2 = (u, v, x) (the other case is symmetric). Since #[u, v] = #[u, w] + #[w, v] − 1 ≥ 2 · φ(T1 ) − 1 ≥ 2 · (2i−1 + 1) − 1 = 2i + 1 and
min #[u, v], #[v, x] = φ(T2 ) ≤ 2i ,
548
M. Jiang
we must have #[v, x] = φ(T2 ). It follows that ψ(T2 ) − ψ(T1 ) = #[u, x] − #[u, v] = #[v, x] − 1 = φ(T2 ) − 1 ∈ [ 2i−1 , 2i − 1 ]. This implies that T1 and T2 are from two different subsets Ci,j1 and Ci,j2 with 1 ≤ j2 − j1 ≤ 2. Consequently, T1 and T2 have different colors. Recall that we set k = log2 n/4. It follows that k − 1 < log2 n/4 ≤ k and, in particular, n/4 > 2k−1 . Clearly log2 (n/4) ≤ log2 n/4. If log2 (n/4) < log2 n/4 were to hold, then we would have log2 (n/4) ≤ log2 (n/4) ≤ k − 1, hence n/4 ≤ 2k−1 , and hence n/4 ≤ 2k−1 , a contradiction. So we indeed have k = log2 n/4 = log2 (n/4) = log2 n − 2. The total number of colors is at most 3k for C plus either 1 for A when n is odd or 2 for A ∪ B when n is even. Note that when n is even, each triangle T in Ck has φ(T ) ∈ [ 2k−1 + 1, 2k ] and ψ(T ) ∈ [ 2k + 1, n/2 ]. Thus the number of subsets Ck,j in the partition of Ck is at most (n/2 − 2k )/2k−1 = n/2k − 2 ≤ 2. This saves one color. In summary, we have χ(n ) ≤ 3k + 1 = 3log2 n − 5. 2.2 Clique-Partition Number We prove Theorem 2 in this subsection. The number of vertices in the graph n is exactly n3 . Since ω(n ) = 2, we immediately have the lower bound ϑ(n ) ≥ n3 /2. To obtain an upper bound, observe that every triangle in n has exactly n−3 neighbors. Also observe that for n ≥ 6, the girth of n is exactly 4: the graph is obviously trianglefree; to find a 4-cycle, take any four triangles sharing one edge, with two triangles on each side of the edge. Flaxman and Hoory [6] showed that for d ≥ 3, a maximum matching in any d-regular graph of girth g includes all but a small fraction 1/n0 (d, g) of vertices. When d = n − 3 and g = 4, n0 (d, g) = 2(n − 3). It follows that for n ≥ 6, 1 ϑ(n ) ≤ n3 (1 + 2n−6 )/2. 2.3 Independence Number Weprove Theorem 3 in this subsection. Our proof will again make use of the partition of n3 triangles into three subsets A, B, and C. Observe that (i) the triangles in A form an independent set when n is odd, and (ii) the triangles in A plus exactly half of the triangles in B (the triangles on either side of each diagonal pi pi+n/2 , 1 ≤ i ≤ n/2) form an independent set when n is even. In the following, we show that the sizes of these two independent sets are at least constant fractions of the maximum in their respective cases. Refer to Figure 6. For each diagonal pi pj of the polygon Pn that does not go through the center o of the circumscribed circle Ω, where the triangle opi pj is in counterclockwise orientation, let Aij and Bij be the subsets of triangles in A and B, respectively, with pi pj as an edge, and let Cij be the subset of triangles in C with pi pj as the longest edge. Observe that |Bij | = 0 and |Aij | = |Cij | + 1 when n is odd, and that |Bij | = 2 and |Aij | = |Cij | when n is even. Thus for any n, we have |Aij | + |Bij |/2 = |Cij | + 1. Let I be an arbitrary independent set of triangles. Observe that if I includes at least one triangle in Cij , then it cannot include any triangles in Aij ∪ Bij . We first consider the case that n is odd. Refer to Figure 7 right. For each k, 1 ≤ k ≤ n, we consider the set Lk of diagonals pi pk such that Cik ∩ I are not empty, and the set
Flipping Triangles and Rectangles
pi
549
pj pi
pj
Fig. 6. The number of (solid) triangles in Cij is less than the number of (dashed and dotted) triangles in Aij and Bij . Left: n = 12. Right: n = 11. pj
pj
pj
pk
pi
pk pi
pk pi
Fig. 7. Left (n is even): the triangles pi pk pk and pj pk pk in B cannot be included in I. Right (n is odd): the triangles pk pi pi ∈ Cik and pk pj pj ∈ Ckj cannot be included in I.
Rk of diagonals pk pj such that Ckj ∩ I are not empty. Put lk = |Lk | and rk = |Rk |. For any two diagonals pi pk and pi pk in Lk , if pi pk is longer than pi pk , then the triangle pk pi pi ∈ Cik cannot be included in I. Similarly, for any two diagonals pk pj and pk pj in Rk , if pk pj is longer than pk pj , then the triangle pk pj pj ∈ Ckj cannot be included in I. Thus the number of triangles in I ∩ C with their longest edges incident to pk is at most ⎛ ⎞
lk rk ⎝ ⎠ mk = |Cik | + |Ckj | − − . (3) 2 2 i : I∩Cik =∅
j : I∩Ckj =∅
On the other hand, the number of triangles in A \ I with pk as a vertex is at least ⎛ ⎞
mk = ⎝ |Aik | + |Akj |⎠ − lk rk , i : I∩Cik =∅
(4)
j : I∩Ckj =∅
where the term lk rk accounts for the number of double-counted triangles pi pj pk ∈ Aik ∩ Akj . Recall that for odd n we have |Aik | = |Cik | + 1 and |Akj | = |Ckj | + 1. Thus
lk rk (lk − rk )2 lk + rk mk − mk = lk + rk + + − lk rk = + ≥ 0. 2 2 2 2
550
M. Jiang
n n It follows that k=1 mk ≤ k=1 mk . Observe that each triangle in I ∩ C is counted n exactly twice in k=1 mk : each triangle in I ∩ Cij is counted once when k = i and once when k = j. Also observe that each triangle in A \ I is counted at most three times in nk=1 mk . Therefore we have 2|I ∩ C| ≤
n
mk ≤
k=1
n
mk ≤ 3|A \ I|,
k=1
and hence 2|I| = 2|I ∩ C| + 2|I ∩ A| ≤ 3|A \ I| + 3|A ∩ I| = 3|A|. This upper bound can be slightly improved by a more careful analysis n that takes advan tage of the non-negative term (l + r )/2 in m − m . Put c = k k k k k=1 (lk + rk )/2. Then n n m − m ≥ c. Observe that each subset C with I ∩ Cij = ∅ contributes k ij k k=1 k=1 1 to lk when k = j, and 1 to rk when k = i. Thus c is exactly the number of subsets Cij with I ∩ Cij = ∅. Clearly |Cij | ≤ (n − 3)/2. It follows that c ≥ 2|I ∩ C|/(n − 3). Therefore we have
n n
1 2|I ∩ C| +1 ≤c+ mk ≤ mk ≤ 3|A \ I|, n−3 k=1
k=1
and hence for n ≥ 5 we have n−3 n−3 n−3 · 3|A \ I| + · 3|A ∩ I| = · 3|A|. n−2 n−2 n−2 We next consider the case that n is even. Refer to Figure 7 left. Define Lk , Rk , lk , and rk as before. Check that the same two bounds of mk and mk in (3) and (4) still hold. However we cannot obtain the same inequality mk − mk ≥ 0, because for even n we only have |Aik | = |Cik | and |Akj | = |Ckj |. To continue, we have to take B into consideration. Now fix a subset B ⊂ B of size |B|/2 by taking the triangles on only one side of each diagonal pi pi+n/2 , 1 ≤ i ≤ n/2, such that I ∩ B = I ∩ B . Let pk be the antipodal vertex of pk . For each diagonal pi pk in Lk , the triangle pi pk pk ∈ B cannot be included in I. Similarly, for each diagonal pk pj in Rk , the triangle pj pk pk ∈ B cannot be included in I. Thus the number of triangles in B \ I with their longest edges incident to pk is at least mk = min{lk , rk }. (5) 2|I| = 2|I ∩ C| + 2|I ∩ A| ≤
Thus we have
lk rk (lk − rk )2 |lk − rk | = min{lk , rk } + + − l k rk = − ≥ 0. 2 2 2 2 n n It follows that k=1 mk≤ k=1 (mk + mk ). Observe that each triangle in I ∩ C is n counted twice in k=1 mk , each triangle in A\I is counted at most three n exactly n times in k=1 mk , and each triangle in B \ I is counted at most two times in k=1 mk . Therefore we have n n
2|I ∩ C| ≤ mk ≤ (mk + mk ) ≤ 3|A \ I| + 2|B \ I|, mk + mk − mk
k=1
and hence
k=1
Flipping Triangles and Rectangles
551
2|I| = 2|I ∩ C| + (2|I ∩ A| + 2|I ∩ B |) ≤ (3|A \ I| + 2|B \ I|) + (3|A ∩ I| + 2|B ∩ I|) = 3|A| + 2|B |. It remains to calculate the sizes of A and B for different values of n. The size of B is obviously 0 when n is odd and is n(n − 2)/2 when n is even. As to the size of A, we note that for each triangle in A, when any one of its three vertices is fixed at any one of the n points in Sn , the number of choices for the other two vertices is
(n−1)/2
1 n−1 n−1 (n − 1)(n + 1) i= 1+ = 2 2 2 8 i=1 when n is odd, and is (n−2)/2
i=1
1 (i − 1) = 2
n−2 n−2 (n − 2)(n − 4) 0+ −1 = 2 2 8
when n is even. It follows that the size of A is n(n − 1)(n + 1)/24 when n is odd, and is n(n − 2)(n − 4)/24 when n is even. Consequently, α(n ) is at least |A| = n(n − 1)(n + 1)/24 = (n3 − n)/24 and at most n−3 · 3 |A| = n−3 (n3 − n)/16 when n n−2 2 n−2 is odd, and is at least |A| + 12 |B| = n(n − 2)(n − 4)/24 + n(n − 2)/4 = (n3 − 4n)/24 and at most 32 |A| + 12 |B| = n(n − 2)(n − 4)/16 + n(n − 2)/4 = (n3 − 2n2 )/16 when n is even. 2.4 Imperfection Ratio and Fractional Chromatic Number We prove Theorem 4 in this subsection. For any n ≥ 6, the triangle flip graph n has an induced 5-cycle p1 p3 p5 , p1 p2 p3 , p1 p3 p4 , p1 p4 p5 , p1 p5 p6 ; see Figure 1. Replace each vertex of a 5-cycle by a clique of size k, then the resulting graph has chromatic number 52 k and clique number 2k; see for example [3, Theorem 4]. By the definition of the imperfection ratio, this implies that imp(n ) ≥ 5/4. For the upper bound, we note that any combination of three vertices pi , pj , pk may form two triangles in different orientations (pi pj pk = pj pk pi = pk pi pj ) = (pk pj pi = pi pk pj = pj pi pk ). Now define the oriented triangle flip graph n as the graph with n vertices being the 2 3 oriented triangles, and with an edge between two vertices if and only if the corresponding triangles share an edge and the edge appear in different orientations in the two triangles. Then each oriented triangle pi pj pk is adjacent to exactly 3(n − 3) + 1 other oriented triangles: pj pi pl , pk pj pl , pi pk pl for each pl ∈ / {pi , pj , pk }, and pk pj pi . The graph n is clearly vertex-transitive since any permutation of the n vertices pi , 1 ≤ i ≤ n, gives an automorphism. It follows that χf (n ) = 2 n3 /α(n ); see forexample [10, Proposition 3.1.1]. Observe that n is a subgraph of n induced n by all 3 triangles of the same orientation (either all counterclockwise or all clockwise). Thus χf (n ) ≤ χf (n ) and α(n ) ≤ α(n ). From the lower bounds in Theorem 3, we have α(n ) > n3 /4. Finally,
n n χf (n )/2 ≤ χf (n )/2 = /α(n ) ≤ /α(n ) < 4, 3 3 as required.
552
M. Jiang
3 Flipping Rectangles In this section we prove Theorem 5. When d = 1, the result χ(
1n ) = log2 n is d folklore. We now show that χ(
n ) = log2 n holds for all d ≥ 1. Refer to Figure 8 upper-left. Project each hyperrectangle H in the graph
dn to d intervals Hi , 1 ≤ i ≤ d, along the d orthogonal directions; that is, H = H1 × · · · × Hd . These d intervals Hi are vertices in d distinct copies of the shift graph
1n . Fix an arbitrary optimal coloring of 1 the intervals in each
n using the log2 n colors 0, 1, . . . , log2 n − 1. Let hi be the d color of the interval Hi , 1 ≤ i ≤ d. We assign the color h = ( i=1 ci ) mod log2 n to H. To see that the coloring is proper, consider two hyperrectangles H = H1 × · · · × Hd and H = H1 × · · · × Hd in
dn . If they are adjacent, then they must be projected to two adjacent intervals along exactly one of the d orthogonal directions and to the same intervals along the other d − 1 directions. This implies that hj = hj for some j and hi = hi for all i = j. It follows that h = h . Thus we have obtained a coloring of
dn with log2 n colors. This bound is tight because
dn contains
1n as an induced subgraph.
4 Rolling Blocks In this section we prove Theorem 6. We consider three cases in the following. (i) a, b, c are all odd. Refer to Figure 8 upper-right. Consider a 2-coloring of the unit squares of the board following the pattern of a chessboard. Then each position of the block occupies a rectangle in which the (at most four) squares at the corners have the
H2
H
H1
c
c
b
a
b a
b a
c
a
a b
a
c
b
c
b
c
a b
c
c
a
b
Fig. 8. Upper-left: project H in R2 to two intervals H1 and H2 . Upper-right: corner squares of the rectangle occupied by each block position have the same color. Lower: the transition map of the six orientations of the a × b × c block is a 6-cycle.
Flipping Triangles and Rectangles
553
same color—assign this color to the block position. This yields a proper 2-coloring of all block positions. (ii) a, b, c are all distinct. Refer to Figure 8 lower. The block has six orientations, where each orientation corresponds to an ordering of the three dimensions a, b, c. We use the convention that the block in orientation abc occupies an a × b rectangle of dimension a along the x-axis and b along the y-axis of the board, and has height c above the board. Observe that each roll of the block changes its orientation. Consider all block positions of the same orientation as one family. Then we have six families. The transition map of these families is a cycle of length 6: abc, acb, bca, bac, cab, cba. An even cycle clearly admits a 2-coloring. (iii) a, b, c are not all odd and not all distinct. Since gcd(a, b, c) = 1, a, b, c are not all even either. We can assume without loss of generality that a = b = c and that a + c is odd. Following the convention in the previous case, now we have only three distinct orientations aac, aca, and caa. Observe that the block can be rolled from the orientation aac to either aca or caa and back, but it cannot be rolled between the two orientations aca and caa in one step. To obtain a 3-coloring, we reserve one color for all block positions in orientation aac, and use (the same) two colors for the block positions in orientations aca and caa. We now specify the coloring for aca (the coloring for caa can be obtained from the coloring for aca by a 90◦ rotation). Each block position in orientation aca occupies an a × c rectangle on the board. Depending on their offsets in planar coordinates, these positions can be partitioned into a · c layers of tilings of the board: the blocks in each layer admits a 2-coloring (e.g. following the chessboard pattern); the blocks in different layers cannot be adjacent so the two same colors can be reused. In summary, three colors suffice. To show that three a colors are necessary, we produce an odd cycle. Consider the cycle (aac) (caa)(aac) (aca)(aca)a+c , which starts in orientation aac, and consists of 2a rolls in the +x direction, 1 roll in the +y direction, a + c rolls in the −x direction, and finally 1 roll in the −y direction back to the start position. The length of the cycle is 2a + 1 + a + c + 1 = 2(a + 1) + (a + c), which is odd. We refer back to Figure 3 for an example.
5 Open Question A possibly n fruitful direction for extending this line of research is to consider flip graphs simplices determined by n points in general position (but not necessarily in of d+1 convex position) in Rd , where d ≥ 2 and n ≥ d + 2. For example, given a set of n ≥ 5 points in R3 such that no three points are collinear and no four points are coplanar, we can define a tetrahedron flip graph with vertices being the n4 tetrahedra determined by these points, and with an edge between two vertices if and only if the corresponding tetrahedra share a face and are interior-disjoint. What is the chromatic number of this graph? Acknowledgment. The author would like to thank an anonymous reviewer for pointing out an error in a previous version of Theorem 6.
554
M. Jiang
References 1. Abbott, R.: Rolling-block mazes, Website at http://www.logicmazes.com/rb/column.html 2. Buchin, K., Buchin, M., Demaine, E.D., Demaine, M.L., El-Khechen, D., Fekete, S.P., Knauer, C., Schulz, A., Taslakian, P.: On rolling cube puzzles. In: Proceedings of the 19th Canadian Conference on Computational Geometry (CCCG 2007), pp. 141–144 (2007) 3. Dumitrescu, A., Jiang, M.: Coloring translates and homothets of a convex body. Beitr¨age zur Algebra und Geometrie, doi:10.1007/s13366-011-0048-4 4. Erd˝os, P., Hajnal, A.: On chromatic number of infinite graphs. In: Proceedings of the Colloquium on Theory of Graphs held at Tihany, Hungary, September 1966, pp. 83–98. Academic Press, New York (1968) 5. Fabila-Monroy, R., Flores-Pe˜naloza, D., Huemer, C., Hurtado, F., Urrutia, J., Wood, D.R.: On the chromatic number of some flip graphs. Discrete Mathematics and Theoretical Computer Science 11, 47–56 (2009) 6. Flaxman, A.D., Hoory, S.: Maximum matchings in regular graphs of high girth. Electronic Journal of Combinatorics 14, #N1 (2007) 7. Friedman, E.: Rolling block mazes, Website at http://www2.stetson.edu/˜efriedma/rolling/ 8. Gerke, S., McDiarmid, C.: Graph imperfection. Journal of Combinatorial Theory, Series B 83, 58–78 (2011) 9. Harner, C.C., Entringer, R.C.: Arc colorings of digraphs. Journal of Combinatorial Theory, Series B 13, 219–225 (1972) 10. Scheinerman, E.R., Ullman, D.H.: Fractional Graph Theory: A Rational Approach to the Theory of Graphs. John Wiley & Sons, Chichester (1997)
Unconstrained and Constrained Fault-Tolerant Resource Allocation Kewen Liao and Hong Shen School of Computer Science The University of Adelaide, SA 5005, Australia {kewen,hong}@cs.adelaide.edu.au
Abstract. First, we study the Unconstrained Fault-Tolerant Resource Allocation (UFTRA) problem (a.k.a. FTFA problem in [19]). In the problem, we are given a set of sites equipped with an unconstrained number of facilities as resources, and a set of clients with set R as corresponding connection requirements, where every facility belonging to the same site has an identical opening (operating) cost and every client-facility pair has a connection cost. The objective is to allocate facilities from sites to satisfy R at a minimum total cost. Next, we introduce the Constrained FaultTolerant Resource Allocation (CFTRA) problem. It differs from UFTRA in that the number of resources available at each site i is limited by Ri . Both problems are practical extensions of the classical Fault-Tolerant Facility Location (FTFL) problem [10]. For instance, their solutions provide optimal resource allocation (w.r.t. enterprises) and leasing (w.r.t. clients) strategies for the contemporary cloud platforms. In this paper, we consider the metric version of the problems. For UFTRA with uniform R, we present a star-greedy algorithm. The algorithm achieves the approximation ratio of 1.5186 after combining with the cost scaling and greedy augmentation techniques similar to [3,14], which significantly improves the result of [19] using a phase-greedy algorithm. We also study the capacitated extension of UFTRA and give a factor of 2.89. For CFTRA with uniform R, we slightly modify the algorithm to achieve 1.5186-approximation. For a more general version of CFTRA, we show that it is reducible to FTFL using linear programming.
1
Introduction
Many facility location models are built around the classical Uncapacitated Facility Location (UFL) problem. Since late 1990s, UFL has been studied extensively from the perspective of approximation algorithms for its practical use in clustering applications and network optimization [11]. With the practical focus on the later, the Fault-Tolerant Facility Location (FTFL) model was proposed in [10], which adds tolerance to UFL against connection/communication failures between facilities and clients. As our computer world evolves, optimal resource
This work was partially supported by Australian Research Council Discovery Project grant #DP0985063.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 555–566, 2011. c Springer-Verlag Berlin Heidelberg 2011
556
K. Liao and H. Shen
allocation starts to become essential in many contemporary applications [2]. The typical example is today’s cloud computing platform. In particular, cloud providers own data centers equipped with physical machines as resources. Each physical machine runs a few virtual machines to serve remote clients’ leases for computing power. This new resource sharing paradigm inevitably brings up two optimization problems from different perspectives: 1) how do cloud providers cost-effectively share their resources among a larger number of closer clients? 2) how can clients optimally rent machines in clouds that incurs minimum cost? Through a careful look at these questions, it is interesting to see they may be interpreted as facility location problems where facility costs w.r.t. providers are physical machine costs, whereas to clients, they are administration overheads; Connection costs w.r.t. providers are distances and they are renting rates to clients. However, existing models like UFL and FTFL are insufficient to capture the resource allocation scenario. They both restrict at most one facility/resource to open at each site/data center, and connection requests/leases of a client must be served by facilities from different sites. This motivates us to study the Unconstrained Fault-Tolerant Resource Allocation (UFTRA) and the Constrained Fault-Tolerant Resource Allocation (CFTRA) models generalized from FTFL. Both of them allow multiple facilities to open at every site and a client’s connection requests to be served by facilities within the same site. This is more realistic since a client may access multiple machines on the same site in parallel. The difference is the former model does not limit the number of resources to use at each site (so provider can always add them) while the later constrains the amount of available resources to allocate. Related Work: For UFL, due to its combinatorial structure, best approximation algorithms are based on primal-dual and LP-rounding techniques. In the stream of primal-dual algorithms, JV [11], MMS [13] and JMS [9] algorithms are significant and well known. They achieved approximation ratios of 3, 1.861 and 1.61 respectively. Charikar and Guha [3] improved the result of JV algorithm to 1.853 and Mahdian et al. [15] improved JMS algorithm to 1.52-approximation. Both of these improvements were made using the cost scaling and greedy augmentation techniques. The first LP-rounding algorithm for UFL is proposed by Shmoys et al. [17]. It achieved a ratio of 3.16 based on the filtering and rounding technique of Lin and Vitter [12]. Over the past decade, this result has been improved progressively until very recently Charikar and Li [4] gave the current best ratio of 1.488. In contrast to UFL, primal-dual methods suffered from the bottleneck [10] for the general non-uniform FTFL. Constant results were only for the uniform case. In particular, Jain et al. [8] showed that their MMS and JMS algorithms can be adapted to FTFL with the same approximation factors of 1.861 and 1.61. Swamy and Shmoys [18] improved this to 1.52. On the other hand, based on LP-rounding Guha et al. [6,7] obtained the first constant factor algorithm for the non-uniform FTFL with ratio 2.408. Later, it was improved to 2.076 by Swamy and Shmoys [18]. Recently, Byrka et al. [1] achieved the current best ratio of 1.7245 using dependent rounding.
Unconstrained and Constrained Fault-Tolerant Resource Allocation
557
Guha and Khuller [16] proved a lower bound of 1.463 for UFL holds unless P = N P [5]. The ratio also bounds FTFL and the problems we study here. UFTRA is also known as the fault-tolerant facility allocation (FTFA) problem in the context of [19]. Xu and Shen used a phase-greedy algorithm to obtain approximation ratio of 1.861. Recently, Yan and Chrobak [20] gave a rounding algorithm that achieved 3.16-approximation. Our Results: We present a star-greedy algorithm for UFTRA with uniform R that first achieves approximation factor of 1.61. Our algorithm is motivated by JMS [8] and its adaptation for FTFL [18]. We also give an equivalent primaldual algorithm, and apply the dual fitting [8] and the inverse dual fitting [19] techniques for its ratio analysis. Together with the cost scaling and greedy augmentation techniques similar to [3,14], the overall algorithm arrives at the current best ratio of 1.5186 which significantly improves the 1.861-approximation in [19]. In addition, we study the capacitated version of UFTRA and provide a factor of 2.89. For CFTRA, we show that with a slight modification, our algorithm for UFTRA preserves the ratio of 1.5186 for its uniform case. Finally, we use linear programming to formally prove that CFTRA even with arbitrary facility costs existing on the same site is pseudo-polynomial time reducible to FTFL.
2
Unconstrained FTRA
In UFTRA, we are given a set of sites F and a set of clients C, where |F | = nf and |C| = nc . For convenience, let n = nf + nc . At each site i ∈ F , an unbounded number of facilities with fi as costs can be opened. There is also a connection cost cij between each client j ∈ C and all facilities at site i. The objective is to optimally allocate a certain number facilities from each i to serve every client j with rj ∈ R requests while minimizing the total cost incurred. UFTRA can be formulated by the following integer linear program (ILP). In the formulation, variable yi denotes in the solution the number of facilities to open at site i, and xij the number of connections between the (i, j) pair. Compared to the FTFL problem [10], domains of these variables are relaxed to be non-negative rather than 0-1 integers and therefore UFTRA forms a relaxation of FTFL. minimize i + i∈F fi y i∈F j∈C cij xij subject to ∀j ∈ C : i∈F xij ≥ rj ∀i ∈ F, j ∈ C : yi − xij ≥ 0 ∀i ∈ F, j ∈ C : xij ∈ Z+ ∀i ∈ F : yi ∈ Z+
2.1
(1)
The Algorithms
Xu and Shen’s algorithm [19] for UFTRA runs in phases. In each phase, clients that have not fulfilled requirements get connected to one more facility. In contrast to their phase-greedy approach, our algorithm iteratively picks the star with the least average cost (the most cost-effectiveness) and at the same time optimizes the overall connection cost. It terminates until all clients’ connection
558
K. Liao and H. Shen
requirements are satisfied. In Algorithm 1, we incrementally build the solution yi ’s and xij ’s which are initially set to 0. Their values will then increase according to the star being picked. We define set U includes all clients that have not fulfilled their connection requirements. In order to ensure the feasibility of the solution, two conditions need to be met while iteratively choosing stars: 1) the previously opened and used facility at a site will have zero opening cost in the next iteration; 2) validity of stars, i.e., a star to be chosen only consists of a facility and clients have not connected to it. For these conditions, we consider two types of facilities for every site: closed facilities with cost fi and already opened ones with no cost. Also, w.r.t. the closed facilities of site i, we construct the set of clients to be chosen by C1i = U. Similarly for the previously opened facilities of site i, the target clients are put into the set C2i = {j ∈ U | xij < yi }. Initially ∀i ∈ F : C1i = C, C2i = ∅. Therefore, at every i the star to be selected is either {(i, C ) | i ∈ F, C ⊆ C1i } with facility cost fi or {(i, C ) | i ∈ F, C ⊆ C2i } with facility cost 0. In addition, since each client j has at least rj demands, we can treat them as virtual ports in j with each of them to be assigned to a single facility. W.l.o.g., we number the ports of j from 1 to rj and connect them in ascending order. In every iteration of the algorithm, we use variable pj to keep track of the port of client j to be connected. Initially ∀j ∈ C : pj = 1, and obviously U = {j ∈ C | pj ≤ rj }. Moreover, the optimization of the overall connection cost actually happens when a closed facility is opened and some clients in C\U switch their most expensive connections to the facility. In order to capture this, we denote the port q of j as j (q) where 1 ≤ q ≤ rj , and φ j (q) as the site j (q) connects to. Therefore, the combined greedy objective for picking the most cost cij effective star in Algorithm 1 is defined as the minimum of mini∈F , C ⊆C2i j∈C |C | fi +
j∈C
cij −
j∈C\U
max 0, maxq c
−cij φ j (q) j
(
)
and mini∈F , C ⊆C1i . |C | We restate Algorithm 1 as an equivalent primal-dual algorithm (Algorithm 2) for the sake of ratio analysis. In addition to the previous definitions, each port j (q) of client j is associated with a dual variable αqj , representing the total price paid by port j (q) . We also denote a time t, which increases monotonically from 0. At any t, we define the contribution of j to site i as (2) and the event j connects to i happens in two cases: 1) j fully pays the connection cost of an open facility at i that it is not connected to; 2) total contribution to a closed facility at i fully pays its opening cost and j’s contribution is positive.
max (0, t − cij )
max 0, maxq cφ(j (q) )j − cij
if j ∈ U if j ∈ C\U
(2)
Lemma 1. Runtime complexity of the Primal-Dual Algorithm is O n3 maxj rj . Proof. Clients’ reconnections dominate the time complexity. Once they happen in Event 2, it takes time O (nc nf ) to update clients’ contributions to other facilities for computing anticipated time of events. There are maximum j rj 3 such events, therefore total time is O j rj nf nc , i.e. O n maxj rj .
Unconstrained and Constrained Fault-Tolerant Resource Allocation
559
Algorithm 1. Star-Greedy Algorithm Input: ∀i, j : fi , cij , rj . Output: ∀i, j : yi , xij . Initialization: Set U = C, ∀i, j : yi = 0, xij = 0, pj = 1. While U = ∅: 1. Choose the optimal star (i, C ) according to the combined greedy objective. 2. If ∃j ∈ C : xij = yi , then set yi = yi + 1. pj ) ( 3. ∀j ∈ C : set φ j = i and xij = xij +1; ∀j ∈ C\U s.t. maxq cφ(j (q) )j −cij > 0 : set xφ(j (q) )j = xφ(j(q) )j − 1, xij = xij + 1 and φ j (q) = i. 4. ∀j ∈ C s.t. pj = rj : set U = U\ {j}, otherwise set pj = pj + 1.
Algorithm 2. Primal-Dual Algorithm Input: ∀i, j : fi , cij , rj . Output: ∀i, j : yi , xij . Initialization: Set U = C, ∀i, j : yi = 0, xij = 0, pj = 1. While U = ∅, increase time t uniformly and execute the events below: – Event 1: ∃i ∈ F,j ∈ U: t = cij and xij < yi p Action 1: Set φ j (pj ) = i, xij = xij + 1 and αj j = t; If pj = rj , then set U = U\ {j}, otherwise set pj = pj + 1. – Event 2: ∃i ∈ F: j∈U max (0, t − cij ) + j∈C\U max 0, maxq cφ(j(q) )j − cij = fi Action 2: Set yi = yi + 1; ∀j ∈ C\U s.t. maxq cφ(j(q) )j − cij > 0 : set xφ(j(q) )j = xφ(j (q) )j − 1, xij = xij + 1 and φ j (q) = i; ∀j ∈ U s.t. t ≥ cij : do Action 1. Remark 1 If more than one event happen at time t, the algorithm processes all of them in an arbitrary order. Also, the events themselves may repeatedly happen at any t since unbounded facilities are allowed to open.
2.2
Analysis: Dual Fitting and Inverse Dual Fitting
Before proceeding our analysis, for simplicity we consider to decompose any solutions of ILP (1) into a collection of stars from set S = {(i, C ) | i ∈ F, C ⊆ C} and construct the equivalent ILP (3). Note that the star considered here consists of a site and a set of clients. It is different from the definition in the greedy algorithm where a star includes two types of facilities. However, this will not make any difference because C1i and C2i can eventually combine into a star belonging to S. Moreover, we are allowed to have duplicate stars in a solution. This directly implies multiple identical facilities can be opened at every site. The variable xs in (3) denotes the number of duplicate star s. Also, the cost of s
560
K. Liao and H. Shen
denoted by cs is equal to fs + j∈s∩C csj . Here we use s to index the site in star s, therefore fs is the facility cost of site s and csj is the connection cost between the site and client j.
minimize cs xs s∈S
subject to ∀j ∈ C :
xs ≥ rj
(3)
s:j∈s
∀s ∈ S : xs ∈ Z+ Its LP-relaxation and dual LP are the following: minimize
maximize
cs xs
s∈S
subject to ∀j ∈ C :
rj α j
j∈C
xs ≥ rj (4)
s:j∈s
subject to ∀s ∈ S :
αj ≤ cs (5)
j∈s∩C
∀s ∈ S : xs ≥ 0
∀j ∈ C : αj ≥ 0
Single Factor Analysis: We apply the dual fitting technique [8] for the primaldual algorithm’s single factor analysis. In order to utilize the weak duality relationship between LP (5) and LP (4), we need an algorithm that produces feasible primal (xs ’s) and dual (αj ’s) solutions. Denote the objective values of LPs (3), (4) and (5) by SOLILP , SOLLP and SOLD respectively, such an algorithm establishes the relationship SOLD ≤ SOLLP ≤ SOLILP . Note that SOLD ≤ SOLLP implies any feasible SOLD is upper bounded by all feasible SOLLP , then apparently after defining the optimal values of (4) and (3) as OP TLP and OP TILP respectively, we have SOLD ≤ OP TLP ≤ OP TILP . However, our algorithm produce a feasible primal solution but infeasible dual. This is because some stars may overpay cs and therefore violate the constraint of (5). α Nevertheless, if we shrink the dual by a factor ρ and prove the fitted dual ρj is D feasible, we get SOL ≤ SOLLP ≤ SOLILP . Therefore, if we denote SOLP as ρ the total cost of the primal solution produced by our algorithm, the key steps to obtain the approximation factor are: 1) establish a relationship between SOLP and SOLD from our primal-dual algorithm; 2) find a minimum ρ and prove the α fitted dual ρj is feasible. For step 1), we have the following lemmas: Lemma 2. The total cost of the primal solution SOLP produced by the PrimalDual Algorithm is j∈C 1≤q≤rj αqj . Proof. It is clear that in the algorithm, the sum of dual values of all ports fully pays all facility and connection costs even with reconnection of clients. Then the lemmas follows. r
Lemma 3. Let the dual solution αj j returned by the Primal-Dual Algorithm be r a solution to LP (5), i.e. αj = αj j , then the corresponding SOLD ≥ SOLP .
Unconstrained and Constrained Fault-Tolerant Resource Allocation
561
r
Proof. For a city j, αj j is the largest dual among its ports. Because we let r r αj = αj j in LP (5), SOLD = j∈C rj αj j ≥ j∈C 1≤q≤rj αqj = SOLP . α
r
For step 2), if we find a minimum ρ s.t. the fitted dual ρj (αj = αj j , from now on we use αj for simplicity) is feasible, we will then get SOLD ≤ ρ · OP TILP . Together with the previous lemma, our algorithm is ρ-approximation. The following lemma and corollary are immediate. α Lemma 4. Fitted dual ρj is feasible iff ∀s ∈ S : j∈s∩C αj ≤ ρ · cs . Corollary 1. W.l.o.g., assume a star s consists of a site with opening cost fs and k clients s.t. α1 ≤ α2 ≤ · · · ≤ αk . Denote the connection cost to the site of j k as csj , then the fitted dual is feasible iff ∀s ∈ S : j=1 αj ≤ ρ · fs + kj=1 csj , i.e. ρ ≥
k
j=1 αj . fs + k j=1 csj
In order to find such a ρ, we first prove a couple of properties that our algorithm holds and then use these properties to guide the construction of a series of factorrevealing programs. Note that although the following lemmas are analogous to the ones in [8,18] for UFL and FTFL, they essentially reveal UFTRA’s unique combinatorial structure which holds properties both from UFL and FTFL. Lemma 5. At time t = αj − , a moment before port j (rj ) first time gets conr nected (because αj = αj j ), ∀1 ≤ h < j < k, let rh,j = maxi cih if port h(rh ) is already connected to a facility of a site, otherwise let rh,j = αh (αh = αj ), then rh,j ≥ rh,j+1 . Proof. A client’s ports always reconnect to a facility of a site with less connection cost, so its maximum connection cost will never increase. The lemma follows. j−1 Lemma 6. For any star s with k clients, ∀1 ≤ j ≤ k : h=1 max (rh,j − csh , 0)+ k h=j max(αj − csh , 0)≤ fs . Proof. The lemma follows because at time t = αj − , in the primal-dual algorithm the contribution of all clients (either connected or unconnected) in star s will not exceed the facility’s opening cost at site s. Lemma 7. For clients h, j in any star s with k clients s.t. 1 ≤ h < j ≤ k : rh = rj = r, then αj ≤ rh,j + csh + csj . Proof. This is where we must enforce all clients have uniform R. At time t = αj − , if port h(rh ) is still not connected, by Lemma 5 αj = rh,j and this lemma holds. Otherwise, client h’s ports have already connected to r different facilities (not necessary on different sites) and rh,j = maxi cih . At time t, since j has at most r − 1 connections, there is at least a facility s.t. h connects to it but j does not. Denote this facility by i , by triangle inequality we have ci j ≤ csj + csh + ci h . Also because i is already open, then αj ≤ ci j . The lemma holds from rh,j = maxi cih ≥ ci h .
562
K. Liao and H. Shen
Theorem 1. Let ρ = supk≥1 {λk }, i.e. the least upper bound of λk among all k and k
λk = maximize
j=1
f+
k
αj
j=1
dj
subject to ∀1 ≤ j < k : αj ≤ αj+1 ∀1 ≤ h < j < k : rh,j ≥ rh,j+1 ∀1 ≤ h < j ≤ k : αj ≤ rh,j + dh + dj j−1
1≤j≤k:
max (rh,j − dh , 0) +
h=1
k
(6) max (αj − dh , 0) ≤ f
h=j
1 ≤ h ≤ j < k : αj , dj , f, rh,j ≥ 0
Then the fitted dual is feasible. Proof. Let f = fs , dj = csj together with αj , rh,j constitute a feasible solution k j=1 αj to the above program due to Lemma 5, 6 and 7. Hence ∀s ∈ S, k fs + j=1 csj ≤ λk ≤ ρ and then theorem follows from Corollary 1. Theorem 2. The Primal-Dual Algorithm and Star-Greedy Algorithm achieve 1.61-approximation for UFTRA with uniform R. Proof. The previous theorem and the weak duality theorem imply when ρ = supk≥1 {λk }, SOLD ≤ρ · OP TILP . Together with Lemma 3, it concludes our algorithms are ρ-approximation. Also the factor-revealing program (6) we obtained is equivalent to program (25) of [8], then we can directly use its result to get ∀k, λk ≤ 1.61 and hence ρ = 1.61. Bi-Factor Analysis: We apply the inverse dual fitting technique [19] to the primal-dual algorithm’s bi-factor analysis for its simplicity compared to dual fitting. Inverse dual fitting considers scaled instances of the problem, and shows the duals of original instances are feasible to the scaled instances. For UFTRA, we scale any original instance I’s facility cost by ρf and connection cost by ρc to get an instance I . In particular in the original problem, let SOLLP = FSOL + CSOL , where FSOL and CSOL represent the total facility cost and connection cost (they are possibly fractional) of any SOLLP respectively. In the scaled problem, if we define the corresponding primal and dual costs as SOLLP and SOLD (with dual variable αj ), then clearly SOLLP = ρf · FSOL + ρc · CSOL , and if αj = αj that is feasible to the scaled problem, by weak duality and Lemma 3 we have SOLP ≤ SOLD = SOLD ≤ SOLLP and the following lemma and corollary. Lemma 8. The Algorithm Primal-Dual is (ρf , ρc )-approximation iff ∀s ∈ S : α ≤ ρ · f + ρ c f s c j∈s∩C j j∈s∩C sj . Corollary 2. W.l.o.g., assume a star s consists of a site with opening cost fs and k clients s.t. α1 ≤ α2 ≤ · · · ≤ αk . Denote the connection cost of j to
Unconstrained and Constrained Fault-Tolerant Resource Allocation
563
the site as csj , then the Primal-Dual Algorithm is (ρf , ρc )-approximation iff k k k j=1 αj −ρf ·fs k ∀s ∈ S : α ≤ ρ · f + ρ c , i.e. ρ ≥ . j f s c sj c j=1 j=1 c j=1
sj
Similar to dual fitting, we wish to find the minimum value of ρc for any ρf ≥ 1. We can construct a new factor revealing program with objective function: k j=1 αj − ρf f λk = maximize and having same constraints as the program k j=1 dj k j=1 αj − ρf fs (6). Clearly, if ρc = supk≥1 {λk }, we have ∀s ∈ S, ≤ λk ≤ ρc , k c sj j=1 which implies a (ρf , ρc )-approximation from Corollary 2. Further, this program is equivalent to program (36) of [8]. Therefore from the result of [14], the StarGreedy Algorithm is (1.11, 1.78)-approximation. Finally, after the scaling of facility costs with factor 1.504 and the similar greedy augmentation that runs in time O n3 maxj rj by considering total nf maxj rj facilities, it is easy to see the overall algorithm achieves the ratio of 1.5186. Details are omitted. Theorem 3. Star-Greedy Algorithm with cost scaling and greedy augmentation is 1.5186-approximation in time O n3 maxj rj . 2.3
Capacitated UFTRA
We observe that there is a strong connection between the well studied Soft Capacitated Facility Location (SCFL) problem [17,11,14] and the Capacitated UFTRA (CUFTRA) problem we consider here. In SCFL, a facility i is allowed to open multiple times with identical cost fi . This is similar to CUFTRA where a site has unconstrained resources to allocate. We formulate the CUFTRA problem as ILP (7), in which the third constraint limits the total requests a site is able to serve (capacity of the site). Through investigating the work for SCFL in [14], we discover that the similar result also holds for CUFTRA. minimize i + i∈F fi y i∈F j∈C cij xij subject to ∀j ∈ C : x ≥ r j i∈F ij ∀i ∈ F, j ∈ C : yi − xij ≥ 0 ∀i ∈ F : j∈C xij ≤ ui yi ∀i ∈ F, j ∈ C : xij ∈ Z+ ∀i ∈ F : yi ∈ Z+
(7)
Theorem 4. Any (ρf , ρc )-approximation algorithm for UFTRA implies a (ρf + ρc )-algorithm for CUFTRA. Proof. With the generalized Lagrangian relaxation technique similar to [14], we can move the third constraint of CUFTRA into its objective function, thereby constructing a new UFTRA problem as a relaxation of CUFTRA. Afterwards, we scale the UFTRA instance’s facility costs by ρρfc and solve the instance using the Star-Greedy Algorithm with output Yi ’s and Xij ’s. Finally we can prove yi = j∈C Xij /ui and xij = Xij construct a feasible solution to ILP (7) and lead to (ρf + ρc )-approximation. Details are omitted.
564
K. Liao and H. Shen
The following theorem is then immediate from the bi-factor result of (1.11, 1.78) for UFTRA with uniform R. Theorem 5. CUFTRA with uniform R achieves an approximation factor of 2.89 in time O n3 maxj rj .
3
Constrained FTRA
In CFTRA, the only difference compared to UFTRA is the number of resources to allocate at site i is limited by Ri (Ri ≥ 1). However, this constraint introduces a harder problem to solve since FTFL is a special case of CFTRA when ∀i : Ri = 1. Also, from the practical point of view, the CFTRA model plays an important role in the resource constrained allocation. The problem’s LP-relaxation and dual are displayed below. minimize i + i∈F fi y i∈F j∈C cij xij subject to ∀j ∈ C : i∈F xij ≥ rj ∀i ∈ F, j ∈ C : yi − xij ≥ 0 ∀i ∈ F : yi ≤ Ri ∀i ∈ F, j ∈ C : xij ≥ 0 ∀i ∈ F : yi ≥ 0
maximize j∈C rj αj − i∈F zi zi subject to ∀i ∈ F : j∈C βij ≤ fi + Ri ∀i ∈ F, j ∈ C : αj − βij ≤ cij ∀i ∈ F, j ∈ C : βij ≥ 0 ∀j ∈ C : αj ≥ 0 ∀i ∈ F : zi ≥ 0
After adding an extra constraint yi < Ri to Event 2 of the Primal-dual Algorithm for UFTRA, it is clear that the slightly modified algorithm computes a feasible primal solution to CFTRA. The question left is whether the same approximation ratio preserves for CFTRA with uniform R. The first observation we make is that the Lemma 6 for UFTRA fails to hold for CFTRA since the number of facilities at a site is limited. Therefore, results of UFTRA do not directly lead to CFTRA’s approximation guarantee. In fact, CFTRA’s combinatorial structure generalizes FTFL’s. So now we try toextend the solution to the uniform FTFL in [18]. W.l.o.g., we set zi =
j
θij =
l j xij αj − αj j 0
primarily xij = Ri otherwise
where l denotes the last port of j that connects to i. Then we have SOLD = r α − to Lemma 3). Afterwards, using dual j∈C j j i∈F zi ≥ SOLP (similar θ fitting we can prove ∀i ∈ F : j∈C αj − Riji ≤ ρ fi + j cij which implies 1.5186-approximation for CFTRA using inverse dual fitting. Details are omitted. Theorem 6. CFTRA with uniform R can be approximated with a factor of 1.5186 in time O n3 maxj rj . Moreover, we study the generalized CFTRA (GCFTRA) problem where facility costs on each site are allowed to be different. This problem is more general in the case that costs of resources at each site are not necessary identical. For GCFTRA, we have a different problem formulation (8) that identifies individual facility fid at each site i.
Unconstrained and Constrained Fault-Tolerant Resource Allocation nf Ri d d nf nc yi + i=1 j=1 cij xij minimize i=1 d=1 fi nf subject to ∀1 ≤ j ≤ nc : rj i=1 xij ≥ Ri d ∀1 ≤ i ≤ nf , 1 ≤ j ≤ nc : d=1 yi − xij ≥ 0 d ∀1 ≤ i ≤ nf , 1 ≤ d ≤ Ri : yi ≤ 1 ∀1 ≤ i ≤ nf , 1 ≤ j ≤ nc : xij ∈ Z+ ∀1 ≤ i ≤ nf , 1 ≤ d ≤ Ri : yid ∈ {0, 1}
565
(8)
Now, we consider to reduce this problem to an FTFL problem [10]. Instead of clustering facilities within sites as GCFTRA does, we put all facilities (totally R ) of a GCFTRA instance together (without separating them by sites) and i i consider them as a whole. This transformation then brings in an FTFL problem shown in ILP (9). We prove that GCFTRA is pseudo-polynomial time reducible to FTFL, i.e. ILPs (9) and (8) are equivalent. i Ri i Ri nc minimize yk + k=1 k=1 fk j=1 ckj xkj subject to ∀1 ≤ k ≤ i Ri , 1 ≤ j ≤ nc : yk − xkj ≥ 0 i Ri xkj ≥ rj ∀1 ≤ j ≤ n c : k=1 ∀1 ≤ k ≤ i Ri : yk ≤ 1 ∀1 ≤ k ≤ i Ri , 1 ≤ j ≤ nc : xkj ∈ {0, 1} ∀1 ≤ k ≤ i Ri : yk ∈ {0, 1}
(9)
Theorem 7. GCFTRA is pseudo-polynomial time reducible to FTFL. Proof. Let (yk, xkj ) be any solution of ILP (9), and in ILP (8) let yid = yk if the facility i(d) = k and xij = k∈i xkj . Note that through our transformation, an FTFL instance includes all facilities of an GCFTRA instance. The condition i(d) = k denotes the case of a pair of identical facilities and k ∈ i denotes the case if the kth facility of an FTFL belongs to the ith site of the GCFTRA instance instance. We first substitute yk, k∈i xkj into ILP (8) and show it constitutes a feasible solution. Next, it is easy to see the objective values of ILPs (8) and (9) are equivalent after substitution. Details are omitted.
References 1. Byrka, J., Srinivasan, A., Swamy, C.: Fault-tolerant facility location: A randomized dependent lp-rounding algorithm. In: Eisenbrand, F., Shepherd, F.B. (eds.) IPCO 2010. LNCS, vol. 6080, pp. 244–257. Springer, Heidelberg (2010) 2. Chang, F., Ren, J., Viswanathan, R.: Optimal Resource Allocation in Clouds. In: 2010 IEEE 3rd International Conference on Cloud Computing (CLOUD), pp. 418– 425. IEEE, Los Alamitos (2010) 3. Charikar, M., Guha, S.: Improved combinatorial algorithms for facility location problems. SIAM J. Comput. 34(4), 803–824 (2005) 4. Charikar, M., Li, S.: An novel LP-rounding approximation algorithm for the kmedian problem and an improved approximation algorithm for the metric facility location problem (2011) 5. Chudak, F.A., Williamson, D.P.: Improved approximation algorithms for capacitated facility location problems. Mathematical Programming 102(2), 207–222 (2005)
566
K. Liao and H. Shen
6. Guha, S., Meyerson, A., Munagala, K.: Improved algorithms for fault tolerant facility location. In: SODA 2001: Proceedings of the Twelfth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 636–641. Society for Industrial and Applied Mathematics, Philadelphia (2001) 7. Guha, S., Meyerson, A., Munagala, K.: A constant factor approximation algorithm for the fault-tolerant facility location problem. J. Algorithms 48(2), 429–440 (2003) 8. Jain, K., Mahdian, M., Markakis, E., Saberi, A., Vazirani, V.V.: Greedy facility location algorithms analyzed using dual fitting with factor-revealing LP. Journal of the ACM 50(6), 795–824 (2003) 9. Jain, K., Mahdian, M., Saberi, A.: A new greedy approach for facility location problems. In: STOC 2002: Proceedings of the Thiry-fourth Annual ACM Symposium on Theory of Computing, pp. 731–740. ACM, New York (2002) 10. Jain, K., Vazirani, V.V.: An approximation algorithm for the fault tolerant metric facility location problem. In: Jansen, K., Khuller, S. (eds.) APPROX 2000. LNCS, vol. 1913, pp. 177–182. Springer, Heidelberg (2000) 11. Jain, K., Vazirani, V.V.: Approximation algorithms for metric facility location and k-median problems using the primal-dual schema and Lagrangian relaxation. Journal of the ACM 48(2), 274–296 (2001) 12. Lin, J.-H., Vitter, J.S.: e-approximations with minimum packing constraint violation. In: STOC 1992: Proceedings of the Twenty-fourth Annual ACM Symposium on Theory of Computing, pp. 771–782. ACM, New York (1992) 13. Mahdian, M., Markakis, E., Saberi, A., Vazirani, V.: A greedy facility location algorithm analyzed using dual fitting. In: Goemans, M.X., Jansen, K., Rolim, J.D.P., Trevisan, L. (eds.) RANDOM 2001 and APPROX 2001. LNCS, vol. 2129, pp. 127– 137. Springer, Heidelberg (2001) 14. Mahdian, M., Ye, Y., Zhang, J.: Improved approximation algorithms for metric facility location problems. In: Jansen, K., Leonardi, S., Vazirani, V.V. (eds.) APPROX 2002. LNCS, vol. 2462, pp. 229–242. Springer, Heidelberg (2002) 15. Mahdian, M., Ye, Y., Zhang, J.: Approximation algorithms for metric facility location problems. SIAM J. Comput. 36(2), 411–432 (2006) 16. Guha, S., Khuller, S.: Greedy strikes back: Improved facility location algorithms. Journal of Algorithms 31(21), 228–248 (1999) 17. Shmoys, D.B., Tardos, E., Aardal, K.: Approximation algorithms for facility location problems. In: Proceedings of the 29th Annual ACM Symposium on Theory of Computing, pp. 265–274 (1997) 18. Swamy, C., Shmoys, D.B.: Fault-tolerant facility location. ACM Trans. Algorithms 4(4), 1–27 (2008) 19. Xu, S., Shen, H.: The fault-tolerant facility allocation problem. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 689–698. Springer, Heidelberg (2009) 20. Yan, L., Chrobak, M.: Approximation algorithms for the Fault-Tolerant Facility Placement problem. Information Processing Letters (2011)
Finding Paths with Minimum Shared Edges Masoud T. Omran1 , J¨org-R¨ udiger Sack1 , and Hamid Zarrabi-Zadeh1,2 1
2
School of Computer Science, Carleton University, Ottawa, Ontario K1S 5B6, Canada {mtomran,sack,zarrabi}@scs.carleton.ca Department of Computer Engineering, Sharif University of Technology, Tehran, Iran [email protected]
Abstract. Motivated by a security problem in geographic information systems, we study the following graph theoretical problem: given a graph G, two special nodes s and t in G, and a number k, find k paths from s to t in G so as to minimize the number of edges shared among the paths. This is a generalization of the well-known disjoint paths problem. While disjoint paths can be computed efficiently, we show that finding paths with minimum shared edges is NP-hard. Moreover, we show that it is even hard to approximate the minimum number of shared edges to 1−ε n within a factor of 2log , for any constant ε > 0. On the positive side, we show that there exists a k-approximation algorithm for the problem, using an adaption of a network flow algorithm. We design some heuristics to improve the quality of the output, and provide empirical results.
1
Introduction
In this paper, we address a problem motivated by a security assurance demand in a geographic information system (GIS) setting. The problem set arose in the following context. Suppose that a security organization is hired to do planning for a VIP who wishes to travel safely between two locations. Given the security concerns, k paths are determined in pre-trip planning and then, just prior to actual travel, randomly one path among the k paths is chosen. The fewer edges that are shared among the pre-trip paths, the higher the level of perceived security. However, if it becomes unavoidable to share edges among the paths, guards are employed on those shared edges. Once a guard has been employed for a particular edge, he/she protects all paths that use this edge. Since guards are expensive, we want to reduce their total number. We refer to this problem as Minimum Shared Edges, or MSE for short. The problem is formally defined as follows: Problem 1 (Minimum Shared Edges (MSE)). Given a graph G = (V, E), two special nodes s, t ∈ V , and an integer k > 0, find a set P of k paths from s to t in G so as to minimize c(P ) = e∈E λ(e), where λ(e) = 0 if e is used in at
Research supported by NSERC, SUN Microsystems and HPCVL.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 567–578, 2011. c Springer-Verlag Berlin Heidelberg 2011
568
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh e4 e1 e3
s e2
e5
e8
e6
e10 e9
t e11
e7
π1 π2 π3 π4 π5 π6
= e1 , e4 , e10 = e2 , e7 , e11 = e2 , e6 , e8 , e10 = e2 , e3 , e4 , e10 = e2 , e7 , e9 , e10 = e2 , e6 , e5 , e4, e10
Fig. 1. A graph G with six possible (s, t)-paths, denoted by π1 to π6
most one path of P , and λ(e) = 1 otherwise. An edge e with λ(e) = 1 is called a shared edge. We assume, without loss of generality, that the input graph is directed. Figure 1 illustrates an instance of the MSE problem on a sample graph. For k = 2, the minimum possible number of shared edges is zero, attained by two paths π1 and π2 . For k = 3, the minimum number of shared edges is two, realized by the set {π1 , π2 , π3 }. Any other set of three paths leads to a higher number of shared edges. For the special case where the number of shared edges is required to be zero, the MSE problem is reduced to the “disjoint paths” problem which can be solved in polynomial time using standard maximum flow algorithms. In particular, one can use Goldberg and Rao’s binary blocking flow algorithm [7] to find k disjoint paths in a graph G = (V, E) in O(m min(n2/3 , m1/2 ) log(n2 /m) log k) time, where n = |V | and m = |E|. An improved algorithm is provided for the special case of k = 2 [12]. See also [8] for the related problem of finding “shortest” disjoint paths in a graph. A closely related problem studied in the context of communication networks is the so-called “k-best paths” problem [3,11]. In this problem, the objective is to find a set P of k paths with minimum edge sharability, which is defined analogously to Problem 1, with the only difference that here, for each edge e, λ(e) = 0 if e is used in at most one path of P , otherwise λ(e) is equal to the number of paths containing e minus 1. As shown in [10,13], the k-best paths problem is polynomially solvable using a minimum-cost flow algorithm. Despite its close similarity to the k-best paths problem, the minimum shared edges problem studied in this paper turns out to be substantially more challenging. In particular, we prove that the minimum shared edges problem is NP-hard. 1−ε Moreover, we show that the problem admits no 2log n -factor approximation, for any constant ε > 0, unless NP ⊆ DTIME(npolylog n ). On the other hand, we show that there exists a k-approximation algorithm for the problem, using a simple adaption of a network flow algorithm. We propose some heuristics for improving the quality of the algorithm. Our empirical results show that the resulting algorithm works reasonably well in practice.
2
NP-Hardness Proof
In this section, we prove that the MSE problem is NP-hard. The proof is by a reduction from the Set Cover problem. The decision version of Set Cover is
Finding Paths with Minimum Shared Edges
569
defined as follows: Given X, C, , where X is a finite set of elements, C is a collection of subsets of X, and is an integer, is there a subset C ⊆ C with |C | such that the member elements of C cover X? Theorem 2. The MSE problem is NP-hard. Proof. We prove that the following decision version of MSE is NP-complete: Given G, k, h, where G is a graph with two distinguished nodes s and t, and k, h ∈ N are two numbers, is there a set P of k paths from s to t such that the number of edges shared among paths in P is at most h? It is easy to see that MSE is in NP. A certificate for this problem composed of k paths from s to t, and a certifier can then, in polynomial time, verify whether the number of shared edges is less than h. We reduce Set Cover to MSE, by transforming each instance X, C, of Set Cover to an instance G, k, h of MSE. The transformation is as follows. We first add to G the set of nodes V = VX ∪ VC ∪ {t}, where VX = {vx | x ∈ X} and VC = {vCi | Ci ∈ C}. We connect every node vx ∈ VX to a node vCi ∈ VC by a directed edge if x ∈ Ci . Moreover, we connect every node vCi ∈ VC by a directed edge to t. Additionally, we add a node s to G and connect it to every other node v ∈ VX ∪ VC using a path of size + 1. We call each of these paths a chain. Figure 2 illustrates our construction on a sample instance of Set Cover. We complete the transformation by setting k = |X| + |C| and h = . Suppose that there is a set P of k (s, t)-paths in G with at most h shared edges. We show that there exists a collection C ⊆ C with |C | ≤ that covers X. It is easy to observe that each chain appears in at most one (s, t)-path, because otherwise more than h (= ) edges would be shared. Since the outdegree of s is equal to the number of paths, k, it follows that each chain is used exactly once, and thus, each vertex vx ∈ VX appears in exactly one (s, t)-path. Therefore, only one outgoing edge from each vx ∈ VX is used in P , and hence, shared edges are only among those incident to t. Now, let V = {v ∈ VC | (v, t) is a shared edge}. Consider a (s, t)-path that goes through a node vx ∈ VX and a node v ∈ VC . We claim that v ∈ V . Otherwise, node v is incident to two paths, one coming from vx and the other coming from s via a chain, causing the edge (v, t) to be used X C1
1
2
C2 s
4
(a)
C1
2
5 3
1
C3
3
C2
4
C3
t
5
(b)
Fig. 2. (a) An instance of the Set Cover problem, with a covering set {C2 , C3 }. (b) Reduction from Set Cover to MSE. Dashed lines represent chains of size + 1.
570
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh
in at least two paths; a contradiction. Therefore, in the induced subgraph G[P ], each node vx ∈ VX is connected to a node v ∈ V . The set C = {Ci | vCi ∈ V } is thus a covering of X with |C | = . Conversely, let C ⊆ C be a covering of X with |C | ≤ . We show that in the corresponding graph G, there is a set P of k paths with at most h shared edges. Let V = {vCi ∈ VC | Ci ∈ C }. For each x ∈ X, we define a (s, t)-path Px as follows. We start from s and follow the chain to vx . Since x is covered by a collection Ci ∈ C , there is an edge (vx , vCi ) such that vCi ∈ V . So, we use the edge (vx , vCi ) to reach from vx to vCi , and then proceed to t. The set PX = {Px | x ∈ X} consists of |X| (s, t)-paths. Now, we define a set PC of |C| (s, t)-paths by concatenating, for each Ci ∈ C, the chain from s to vCi and the edge (vCi , t). Let P = PX ∪ PC . It is easy to observe that only edges between VC and t can be used in more than one path of P . Since nodes in VC \ V are not touched by the paths in PX , each edge (v, t) for v ∈ VC \ V is used exactly once in P , and hence, the number of shared edges in P is at most |V | = h.
3
Approximation Algorithm
In this section, we provide an approximation algorithm for the minimum shared edges problem by transforming it to a network flow problem, called “Minimum Edge-Cost Flow”. The problem definition is as follows. Problem 3 (Minimum Edge-Cost Flow (MECF)). Given a graph G = (V, E) with a capacity u(e) ∈ Z+ and a cost c(e) ∈ Z+ 0 associated to each edge e ∈ E, find an integral flow f of value F from a source node s to a destination node t such that the total cost of edges sending non-zero flow, i.e., e∈E,f (e)>0 c(e), is minimized. It is known that the MECF problem is NP-hard [6]. Krumke et al. [9] have provided an F -approximation algorithm for the MECF problem. We use their result to obtain an approximation algorithm for MSE via a transformation. The following lemma provides the ingredient. Lemma 4. MSE can be reduced to MECF. c(e2 ) = 1 u(e2 ) = k − 1 e2
e
e1 c(e1 ) = 0 u(e1 ) = 1 G
G
Fig. 3. Transforming an edge in MSE to two edges in MECF
Finding Paths with Minimum Shared Edges
571
Proof. We transform each instance of MSE on a graph G = (V, E) to an instance of MECF on a graph G = (V , E ). The transformation is as follows. We set V = V , and for every edge e ∈ E, we add two edges e1 and e2 to E with u(e1 ) = 1, c(e1 ) = 0, u(e2 ) = k − 1 and c(e1 ) = 1 (see Figure 3). Any solution of cost for MECF on G corresponds to k = F paths in G with shared edges. To see this, consider the set of edges that have positive flow and cost 1 in a solution for MECF on G . The corresponding edges in G are exactly those who are shared in a solution for MSE. Conversely, any solution of size for MSE on G corresponds to a solution of cost for MECF on G . By Lemma 4, any α-approximation algorithm for MECF immediately gives an α-approximation for MSE. In [9], an approximation algorithm is given for the MECF problem which is based on a solution for a well-known related problem, called Minimum-Cost Flow, defined as follows: Problem 5 (Minimum-Cost Flow (MCF)). Given a graph G = (V, E) with a capacity u(e) ∈ Z+ and a cost c(e) ∈ Z+ 0 associated to each edge e ∈ E, find an integral flow f of value F from a source node s to a destination node t such that e∈E c(e)f (e) is minimized. Krumke et al. [9] showed that any solution of cost c to the MCF problem on a graph with modified edge costs c(e)/u(e) is a solution of cost at most cF to MECF on the original graph. Therefore, any algorithm for MCF yields an F approximation algorithm for MECF. There are a number of efficient algorithms for the MCF problem. The best one for our setting is an algorithm due to Ahuja et al. [1] that runs in O(nm log(nC) log log U ) time, where n, m, C, and U are the number of nodes, number of edges, maximum edge cost, and maximum edge capacity, respectively. Since in our transformation, F = k, C = 1, and U = k − 1, we get the following result. Theorem 6. There is a k-approximation algorithm for the MSE problem that runs in O(nm log n log log k) time. On series-parallel graphs, a fully polynomial time approximation scheme is given for the MECF problem in [9]. It leads to a (1 + ε)-approximation algorithm for the MSE problem on series-parallel graphs, with a running time of O(m3 (1 + 1/ε) log k). Remark. The MECF problem is listed in Garey and Johnson’s book ([6], Problem [ND32]) as an NP-complete problem, leaving the proof to an unpublished work by Even and Johnson. As a by-product, Theorem 2 and Lemma 4 together provide a simple proof for the NP-completeness of MECF.
4
Inapproximability Result
In the previous section, we provided a k-approximation algorithm for the MSE problem. It is natural to ask if this is the best approximation factor one can
572
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh
c(e) = 1 u(e) > 0
y
x
→
x
.
u(e) ..
x
y
G
G
Fig. 4. Conversion of an edge in MECF with uniform edge-costs to an edge component in MSE. Dashed lines represent chains of length |E| + 1.
achieve. In this section, we prove a lower bound on the approximability of the problem. The proof is based on the following theorem from [5] (here, n refers to the number of nodes in the input graph). Theorem 7 (Even et al. [5]). The MECF problem with uniform edge-costs 1−ε does not admit a 2log n -ratio approximation, for any constant ε > 0, unless polylog n NP ⊆ DTIME(n ). This hardness holds even if only two edge capacity values are allowed, namely, u(e) ∈ {1, poly(n)}, for every e. We establish an analogous hardness result for our problem, using an approximation preserving reduction from MECF with uniform edge-costs to MSE. The reduction is provided below. Theorem 8. The MSE problem admits no 2log ε > 0, unless NP ⊆ DTIME(npolylog n ).
1−ε
n
-ratio approximation, for any
Proof. Let P be the problem of finding a (s, t)-flow f of value F and cost C on a graph G = (V, E) (see Problem 3). Each edge e ∈ E is associated with an integer capacity u(e) ∈ {1, poly(n)} and a uniform cost c(e) = 1. We construct a graph G = (V , E ) from G = (V, E) as follows. For each node x ∈ V we insert a corresponding node x in V . For each edge e = (x, y) ∈ E, we add an “edge component” between x and y in G , as depicted in Figure 4. Each edge component is composed of u(e) parallel chains from x to a newly-added node x , and a directed edge from x to y. Each chain is composed of |E|+1 directed edges. We denote the edge component corresponding to an edge (x, y) by (x, x , y), and refer to chains connecting x to x as type-1 chains. Additionally, we add two nodes s and t , and connect s to s and t to t with F chains. We call these chains type-2 chains. Finally, we add for each edge component (x, x , y), a chain from s to x and a chain from y to t . We refer to these chains as type-3 chains. The resulting graph is illustrated in Figure 5. Let P be the problem of finding k = |E| + F (s , t )-paths in G = (V , E ) with S |E| shared edges. We show that solutions to P and P are in one-to-one correspondence. First, we show that every solution to P is a solution to P. A solution to P is a set P of k (s , t )-paths in G with S |E| shared edges. Observe that none of the chains in G can be on more than one path of P , otherwise, the number of shared edges exceeds |E|. Since the out-degree of s in
Finding Paths with Minimum Shared Edges
573 E ...
: chain of length |E| + 1
E ... u(e)
x
y
s
t
..
s G = (V, E)
. F ..
x
.
u(e)
x
y
t
. F ..
t
s G = (V , E )
Fig. 5. Reduction from MECF with uniform edge-costs to MSE
G is k = |E| + F , each chain incident to s must be on exactly one path of P . Similarly, each chain incident to t is on exactly one path of P . Therefore, each edge (x , y) of an edge component (x, x , y) of G is used in at least one path of P . Moreover, the only edges that can be shared among paths of P are these (x , y) edges. Now, view P as a flow f of value |E| + F from s to t . We convert f to a flow of value F in G as follows. First, for each path p of the form s x → y t , where represents a chain, we remove a flow of value 1 along p from f . After this step, f has value F , and each type-3 chain has flow zero. Thus, we can remove type-3 chains from the graph. For each edge component (x, x , y) corresponding to an edge e of E, the remaining flow on (x , y) is at most u(e). Since the whole flow of x now comes from x and continues to y, we can contract type-1 chains in between, and replace the edge component (x, x , y) by a single edge (x, y) of capacity u(e), carrying the same amount of flow previously carried by (x , y). Similarly, we can contract type-2 chains and merge s to s and t to t. The resulting graph is isomorphic to G, and the new flow f corresponds to a feasible (s, t)-flow of value F in G. Observe that edges having positive flow in the new f are exactly those edges having flow greater than 1 in the original f , and thus correspond to edges shared in P . As the cost of each corresponding edge in G is one, the total cost of flow f is equal to the number of shared edges, namely C = S. By reversing the above process, we can show that every solution to P is also a solution to P . Therefore, the one-to-once correspondence follows. The con structed graph G has size O(|V | + |E|(F + e∈E u(e))). Recall that u(e) ∈ {1, poly(n)}. Moreover, F |V |2 in the construction used in [5]. The reduction is thus polynomial, and the theorem statement follows. The lower bound proved in Theorem 8 is stated in terms of n. Since k is unbounded in the original definition of MSE, we cannot directly use the above theorem to get a lower bound in terms of k. The following lemma, however, enables us to bound the value of k, and get an analogous lower bound.
574
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh
Lemma 9. If k > |E|, then the minimum number of shared edges is equal to the size of the shortest (s, t)-path. Proof. It is easy to see that in any set of k paths, for k > |E|, there is a path whose all edges are shared. Because, otherwise, each path needs to have at least one edge different from other paths, requiring more than |E| edges, which is impossible. Lemma 9 implies that the MSE problem is polynomially solvable on instances with k > |E|. Therefore, we can simply assume that k |E| = O(n2 ). Theorem 8 1−ε thus implies a lower bound of 2log k on the approximability of MSE.
5
Heuristic Improvements
In this section, we discuss some heuristics for improving the quality of the kapproximation algorithm described in Section 3. Experimental results from implementing the heuristics are also presented and compared. 5.1
Successive Cost Update
The k-approximation algorithm described in Section 3 is based on running a minimum-cost flow (MCF) algorithm, and returning the obtained flow as a kapproximation for MECF, which in turn, gives a k-approximation for MSE. The MCF algorithm receives a transformed graph in which each edge has a cost in {0, 1/(k − 1)}. When it comes to using an edge of cost 1/(k − 1), the additive cost of selecting an edge that is not sending any flow is the same as that of an edge that is currently sending a positive flow. Given that a positive flow on an edge of cost 1/(k − 1) corresponds to a shared edge in the original graph G, it follows that in the k-approximation algorithm, there is no preference in reusing a previously shared edge rather than sharing a fresh edge. Our first heuristic attempts to force the approximation algorithm to reuse edges previously used in the solution. We implement this heuristic by an iterative cost update method. To encourage the MCF algorithm to reuse a previously shared edge, we select at each iteration an edge with maximum flow among edges that have positive cost, update the cost of that edge to zero, and re-run the MCF algorithm. It is easy to observe that this cost update operation does not affect the approximation factor of the algorithm. Details of the heuristic are provided in Algorithm 1. 5.2
Shortest Path Bound
The second heuristic is based on the fact that the minimum number of shared edges in the MSE problem is bounded from above by the number of edges in a shortest path from s to t. Let p be the size of a shortest (s, t)-path. If a feasible solution to MSE consisting of k (s, t)-paths uses more than p edges, we can reroute all k paths through a shortest path, and reduce the number of shared edges to p. We use this tweak on top of Algorithm 1 to obtain the second heuristic as shown in Algorithm 2.
Finding Paths with Minimum Shared Edges
575
Algorithm 1. mse-approx(G, k, s, t) 1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
construct G from G using Lemma 4 obtain G0 from G by updating the cost of each edge e to c(e)/u(e) compute a minimum-cost (s, t)-flow f of value k in G0 set i = 0 while cost of f = 0 do find an edge e with a maximum flow among positive-cost edges in Gi obtain Gi+1 from Gi by updating the cost of e to zero compute a minimum-cost (s, t)-flow f of value k in Gi+1 i ← i+1 return i
Algorithm 2. mse-approx2(G, k, s, t) 1: let r = mse-approx(G, k, s, t) 2: let p = size of a shortest (s, t)-path in G 3: return min(r, p)
5.3
Experimental Results
We implemented the k-approximation algorithm described in Section 3 as well as the two heuristics described in this section. We evaluated our code on two families of graphs: road networks for large cities, and networks produced by benchmark graph generators. Figures 6 and 7 summarize the results of running our code on the two sample graphs: a road network for the city of Rome1 , and a random directed graph from DARPA HPCS SSCA#2 graph theory benchmark [2]2 . A SSCA#2 graph is a representative of computations in the field of national security, scientific computing, and computational biology. Both test graphs have 3350 nodes and 8870 edges. The algorithms are run for k = 1 to 50, and the average number of shared edges are reported for 100 randomly-picked pairs of source and destination nodes. To force random pairs to be far enough, we discarded pairs of source and desti√ nation nodes that were less than n/4 edges apart, for n being the number of nodes. We used High Performance Computing Virtual Laboratory (HPCVL)’s Beowulf Cluster3 that has 64 nodes of 4×2.2 GHz Opteron Cores with 8 GB RAM for running the experiments in parallel. As can be seen in Figures 6 and 7, our heuristics perform significantly better compared to the original k-approximation algorithm. For large enough values of 1
2 3
The graph is available at: http://www.dis.uniroma1.it/~challenge9/data/rome/ rome99.gr The generator is available at: https://sdm.lbl.gov/~kamesh/software/GTgraph/ The information is available at: http://www.hpcvl.org/hpc-env-beowulf-cluster.html
576
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh
200 k-approx heuristic 1 heuristic 2
180
Number of Shared Edges
160 140 120 100 80 60 40 20 0 0
5
10
15
20
25
30
35
40
45
50
Number of Paths (k)
Fig. 6. Empirical results for the road network of Rome 120 k-approx heuristic 1 heuristic 2
Number of Shared Edges
100
80
60
40
20
0 0
5
10
15 Number of Paths (k)
20
25
30
Fig. 7. Empirical results for a SSCA benchmark graph
k, we get an improvement of 50% to 85% in the number of shared edges in these two graphs. The second heuristic performs better than the first one for some range of k. However, the two heuristics eventually converge for k sufficiently large. The reason for this convergence is that when the number of paths, k, is large, it is more likely for the edges on shortest paths to be shared in more paths, and thus, be selected by Algorithm 1 for cost update.
Finding Paths with Minimum Shared Edges
6
577
Conclusions
In this paper, we studied the complexity of the minimum shared edges problem, 1−ε and showed that the problem admits no 2log k -factor approximation, for any constant ε > 0. Moreover, we presented a k-approximation algorithm for the problem, and proposed some heuristics for improving it in practice. The first heuristic provided in Section 5 can be indeed used as a practical algorithm for the MECF problem. An interesting open problem is to see if an algorithm with an approximation ratio better than k exists for the minimum shared edges problem. Although our lower bound in Section 4 eliminates the possibility of having a poly-logarithmic approximation factor, we have not ruled out the possibility of having an approximation factor of O(nc ), for a constant c < 1. (For example, see [4] for two variants 1−ε of the Label Cover problem for which the same hardness of 2log n holds, yet they admit a O(n1/3 )-factor approximation.) Improving the lower bound on the approximability is another open problem. Acknowledgments. The authors would like to thank Anil Maheshwari and Peter Widmayer for helpful discussions.
References 1. Ahuja, R.K., Goldberg, A.V., Orlin, J.B., Tarjan, R.E.: Finding minimum-cost flows by double scaling. Mathematical Programming 53(1), 243–266 (1992) 2. Bader, D.A., Madduri, K.: Design and implementation of the HPCS graph analysis benchmark on symmetric multiprocessors. In: Bader, D.A., Parashar, M., Sridhar, V., Prasanna, V.K. (eds.) HIPC 2005. LNCS, vol. 3769, pp. 465–476. Springer, Heidelberg (2005) 3. Castanon, D.A.: Efficient algorithms for finding the k best paths through a trellis. IEEE Trans. Aerospace and Electronic Systems 26(2), 405–410 (1990) 4. Charikar, M., Hajiaghayi, M., Karloff, H.: Improved approximation algorithms for label cover problems. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 23–34. Springer, Heidelberg (2009) 5. Even, G., Kortsarz, G., Slany, W.: On network design problems: fixed cost flows and the covering steiner problem. ACM Trans. Algorithms 1(1), 74–101 (2005) 6. Garey, M., Johnson, D.S.: Computers and intractability: A guide to the theory of NP-completeness. W.H. Freeman, New York (1979) 7. Goldberg, A.V., Rao, S.: Beyond the flow decomposition barrier. J. ACM 45(5), 783–797 (1998) 8. Kobayashi, Y., Sommer, C.: On shortest disjoint paths in planar graphs. Discrete Optimization 7(4), 234–245 (2010) 9. Krumke, S.O., Noltemeier, H., Schwarz, S., Wirth, H.-C., Ravi, R.: Flow improvement and network flows with fixed costs. In: Proc. Internat. Conf. Oper. Res., OR 1998, pp. 158–167 (1998)
578
M.T. Omran, J.-R. Sack, and H. Zarrabi-Zadeh
10. Lee, S.-W., Wu, C.-S.: A k-best paths algorithm for highly reliable communication networks. IEICE Trans. Commun. E82-B(4), 586–590 (1999) 11. Nikolopoulos, S.D., Pitsillides, A., Tipper, D.: Addressing network survivability issues by finding the k-best paths through a trellis graph. In: Proc. 16th IEEE Internat. Conf. Comput. Commun., pp. 370–377 (1997) 12. Suurballe, J.W., Tarjan, R.E.: A quick method for finding shortest pairs of disjoint paths. Networks 14(2), 325–336 (1984) 13. Zheng, S.Q., Yang, B., Yang, M., Wang, J.: Finding minimum-cost paths with minimum sharability. In: Proc. 26th IEEE Internat. Conf. Comput. Commun., pp. 1532–1540 (2007)
Combinatorial Group Testing for Corruption Localizing Hashing Annalisa De Bonis1 and Giovanni Di Crescenzo2 1
Universit`a di Salerno, Fisciano, Salerno, Italy [email protected] 2 Telcordia Technologies, Piscataway, NJ, USA [email protected]
Abstract. Corruption-localizing hashing is a recently introduced cryptographic primitive that enhances the well-known primitive of collision-intractable hashing. In addition to allowing detection of changes in input data, they also provide a superset of the changes location, where the accuracy of this superset is formalized as a metric, called localization factor. In this paper we consider the problem of designing corruption-localizing hash schemes with reduced localization factor. We define a new and natural notion of localizing codes, and prove that any such code can be used in conjunction with collision-intractable hashing, to obtain corruption-localizing hashing, a general result of independent interest. Then we propose two localizing codes based on combinatorial group testing techniques (i.e., superimposed codes), resulting in the first corruption-localizing hash scheme with constant localization factor against an unbounded number of corruptions of distinct and unbounded lengths. Keywords: Algorithms, Cryptography, Group Testing, Superimposed Codes.
1 Introduction Efficient detection of errors or corruptions in data stored in or communicated through computers is crucial for the reliability of data itself and, more generally, of computation. In addition to detecting corruptions, it is often desirable to have the capability of obtaining information about the location of corrupted data blocks. As an example, when downloading data from the Internet or analyzing data on a local computer, localizing the corruptions would avoid to repeat the entire download or analysis procedures since only part of the data would need to be transmitted or analyzed again, respectively. Collisionintractable hash functions [1] are used to detect the mere existence of a corruption in these two application scenarios. Combinatorial group testing algorithms [6,8] can be used to (exactly) find multiple atomic-length data corruptions. In this paper we enhance collision-intractable hashing using combinatorial group testing algorithms to propose new solutions to the problem of localizing (i.e., obtaining additional information about their location) multiple data corruptions of arbitrary and distinct lengths. Related areas and previous work. With respect to errors or corruptions on data stored or in transit, the notion of localization (i.e., finding a small superset of corrupted entries) B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 579–591, 2011. c Springer-Verlag Berlin Heidelberg 2011
580
A. De Bonis and G. Di Crescenzo
is very related to the notions of detection (i.e., finding whether corrupted entries exist) and correction (i.e., finding all corrupted entries). Typically, localization targets better (resp., worse) properties and requires more (resp., less) resources than detection (resp., correction), where, according on specific application demands, any one notion may be preferable over the other two other ones. Related areas where these notions are of interest include coding theory, digital watermarking, software download, program checking, memory correctness checking, combinatorial group testing, authenticated data structures and data forensics. The closest previous work [3,4,5,11] includes detailed discussions of these areas. A scheme in [3] corrects up to a constant number of atomic-length data corruptions. In [11] collision-intractable hashing and combinatorial group testing are combined to correct multiple atomic-length corruptions. Corruption-localizing hashing is directly studied in a corruption model allowing a single arbitrary-length corruption [5] and in a model with multiple corruptions with distinct and arbitrary lengths [4]. In this paper we continue this research direction, by focusing on the relationship between corruption-localizing hashing and (non-cryptographic) localizing and superimposed codes, from combinatorial group testing. Summary of results and contributions. The analysis of corruption-localizing hashing is mainly based on two conflicting metrics: the localization factor (measuring closeness to finding the corrupted bits) and the number of hash tags (measuring storage complexity), as a function of the number n of data bits, the upper bound v on the number of corruptions and the upper bound β on the size of the corrupted data segments. Our goal is to design schemes that achieve the smallest possible localization factor and number of hash tags, while keeping an arbitrary β = O(n) and an unbounded v. Our first contribution is a slightly stronger definition of corruption-localizing hashing, where the adversary cannot find any arbitrary collision to the hashing algorithm and, when applying up to v corruptions, cannot prevent localization or force a higher localization factor. We then present a new and natural notion of localizing codes, and show the following general result: any localizing code can be used in conjunction with any arbitrary collision-intractable hash function to obtain a corruption-localizing hash scheme with related parameters for localization and number of hash tags. This unifies our other results with previous work; specifically, results in [4,5] could be restated as localizing codes with appropriate localization factor and number of hash tags. We then present two new constructions of localizing codes based on combinatorial group testing techniques (i.e., superimposed codes). By combining these two constructions with our general result, we obtain corruption localizing hash schemes that achieve a constant localization factor for unbounded β and v by only requiring a number of hash tags almost linear in v. (Conventional applications of combinatorial group testing techniques would give a number of hash tags quadratic in v and β.) Previously, constant localization factor was achieved under the following model restrictions: in the case β = 1 and v = O(1) [3], in the case β = 1 and v bounded by some polynomial in n [11], in the case v = 1 [5], and when v = O(1) [4]. Our constructions also achieve efficient running time and use superimposed codes with sublinear description size.
Combinatorial Group Testing for Corruption Localizing Hashing
581
2 Model and Preliminaries In this section we review known formal notions and definitions of interest in the rest of the paper; specifically: collision-intractable hashing, corruption-localizing hashing, superimposed codes and combinatorial group testing. Collision-intractable Hashing. Let H = {Hλ }λ∈N , where Hλ is a set of functions hλ : {0, 1}p(λ) → {0, 1}σ , where λ is a security parameter, p is a polynomial and σ is constant with respect to λ. A family of hash functions, denoted as H, is a family of polynomial-time (in λ) samplable and computable functions hλ that take a p(λ)bit message as input and return a σ-bit tag. We denote as tn (H) the running time of hash function Hλ on inputs of length n. As these functions compress an arbitrarily large input to a fixed-size output, each output has a very large set of preimages; yet, the collision-intractability property states that any efficient algorithm finds two preimages of the same output only with small probability. We now recall their formal definition. Definition 1. Let H = {Hλ }λ∈N be a family of hash functions. For any t, > 0, we say that H is (t, )-collision-intractable if for any algorithm A running in time t, Prob[ hλ ← Hλ ; (x1 , x2 ) ← A(1λ , hλ ) : x1 = x2 ∧ hλ (x1 ) = hλ (x2 ) ] ≤ , where the notation ← denotes a random process (e.g., randomly choosing from a fixed set, or from the set of outputs of an algorithm on a given input). Collision-intractable hashing is used in several real-life applications, to detect whether an input message was modified or not. Constructions in the literature are based on either the computational intractability of number-theoretic problems (see, e.g., [1]), or more general complexity-theoretic assumptions (see, e.g., [13]), or heuristic finite functions with very high efficiency but only conjectured collision intractability. Corruption-Localizing Hashing. A corruption-localizing hash scheme consists of a hashing algorithm that is used in synergy with a localization algorithm to determine a superset of the positions of corrupted data bits. Our formal definition of corruptionlocalizing hashing and related preliminary definitions build on the model from [5,4]. Data model. Let x denote an n-bit message (extending our results to messages with n blocks of multiple bits as atomic components is immediate). A sequence of consecutive bits of a message x will be referred to as a segment of x. The sequence of position indices within [0, n − 1] of a segment will be referred as an interval. Adversary model. Given two n-bit messages x and x , we measure their difference using v function Diffv [x, x ] = min r=1 |Sr |, where each Sr , for r = 1, . . . , v, is an interval v in [0, n − 1], and the minimum is taken over all S1 , . . . , Sv such that x[ r=1 Sr ] = v x [ r=1 Sr ]1 . Notice that Sr might be empty for some r ∈ {1, . . . , v}. If S1 , . . . , Sv v v are v intervals in [0, n − 1] such that Diffv [x, x ] = r=1 |Sr | and x[ r=1 Sr ] = x [ vr=1 Sr ] then we say that S1 , . . . , Sv achieve Diffv [x, x ]. Intuitively, Diffv [x, x ] represents the minimum total size of up to v segments that an adversary can modify 1
We note that our constructions do not require an efficient algorithm for computing Diffv [x, x ].
582
A. De Bonis and G. Di Crescenzo
in order to change x to x . We say that an n-bit vector e is a (β, v)-corruption vector if there exists |Si | ≤ β, for i = 1, . . . , v, where S1 , . . . , Sv achieve Diffv [0n, e]. Note that Diffv [x, x ] = Diffv [0n , e], where e = x ⊕ x , 0n denotes the n-bit zero vector and ⊕ denotes the logical XOR operation. We can then characterize the adversary’s attack as issuing two messages x, x such that e = x ⊕ x is a (β, v)-corruption vector and formally define corruption-localizing hash schemes as follows. Definition 2. A hash scheme is a pair of algorithms HS = (clH, Loc), with the following syntax. On input an n-bit string x, algorithm clH returns a string tag. On input a positive integer v, an n-bit string x and a string tag, algorithm Loc returns a set of indices T ⊆ {0, · · · , n − 1}. Both algorithms are deterministic and run in time polynomial in some security parameter λ. We say that the hash scheme HS is (t, , α, β, v)-corruptionlocalizing if for any algorithm A running in time t and returning distinct x, x , it holds that p(Succ1 (A; HS; α, 1 (A; HS; α, v)) is v)) ≤ , where probability p(Succ formally defined as Pr (x, x ) ← A(1λ ) : clH(x) = clH(x ) , and if whenever e = x⊕x is a (β, v)-corruption vector, then p(Succ2 (A; HS; α, v)) ≤ , where probability p(Succ2 (A; HS; α, v)) is formally defined as Pr (x, x ) ← A(1λ ); T ← Loc(v, x , clH(x)) : (x[T ] = x [T ]) ∨
|T | > α . Diffv [x, x ]
We note that the adversary is successful if it either finds a collision to the hashing algorithm clH or prevents effective localization (i.e., one of the modified bits is not included in T , and thus x[T ] = x [T ]), or forces the scheme to exceed the expected localization factor (i.e., |T | > α · Diffv [x, x ]). We use the following metrics to design and analyze corruption-localizing hash schemes: the hashing algorithm and localizer’s running times; the localization factor α, defined as |T |/Diffv [x, x ]; and the tag length, defined as the length of the output tag from algorithm clH. In [4] it was also noted that two trivial schemes exist that achieve (1) α = n/v, or (2) α = 1 and tag length O(n), thus moving the scheme design target to achieving α = o(n/v) and tag length o(n). As in our schemes, the output tag from algorithm clH can be split into messageindependent components (i.e., the description of a binary code and the description of a collision-intractable hash function) and message-dependent components (i.e., the hash tags), we define the length of these two quantities as the off-line tag length and the on-line tag length, respectively. Furthermore, we simplify the on-line tag length metric by using instead the number of hash tags, defined as the number of hash tags from a collision-intractable hash function contained in the message-dependent component of tag. In our constructions both the hashing algorithm and localizer’s running times are efficient, and the off-line tag length is sublinear in n; thus, the main metrics of interest will be the localization factor and the number of hash tags. Combinatorial Group Testing and Superimposed Codes. Combinatorial group testing [6] is the problem of searching the positive elements of a given set O of n elements by posing queries of the form “Does Q contain any positive element?”, with Q being a subset of O. The cost of non-adaptive querying strategies (i.e., where all queries are decided in advance), is well known to correspond to the length of a type of superimposed codes [9,12], whose definition we now recall. A binary code of size n and length N is
Combinatorial Group Testing for Corruption Localizing Hashing
583
an N × n matrix C = {C(i, j)}, where all C(i, j) ∈ {0, 1} and whose columns are called codewords. Given two equal-length binary strings x, y, we say that x is covered by y if x(i) = 1 implies y(i) = 1, for all indices i. Definition 3. [9] Let d, q, n be integers > 0 with d + q ≤ n and let M = {M (i, j)} be a binary code of size n. We say that M is a (d, q)-superimposed code if for any d + q codewords M (·, j1 ), . . . , M (·, jd+q ), there exists a row index i such that ∨dh=1 M (i, jh ) = 1 and ∨d+q k=d+1 M (i, jk ) = 0, where ∨ denotes boolean OR. For a (d, q)-superimposed code C, the boolean sum of any d columns is not covered by the boolean sum of any other q columns. Moreover, if C has size n and F is the family of subsets of {1, . . . , n} having the codewords of C as incidence vectors, then F has the property that the union of any d members is not contained in the union of any other q members. For d = 1, (d, q)-superimposed codes correspond to classical superimposed codes [12], or equivalently to cover free families [10]. The following asymptotic upper and lower bounds [2,9] on the minimum length, denoted as N (d, q, n), of a (d, q)superimposed code of size n hold: ⎧ 2 q 2 ⎨ Ω d log log nq if q ≥ 2d, q q n N (d, q, n) = O log ; N (d, q, n) = ⎩ d q Ω(q log nd ) if q < 2d. Our most interesting results are based on (d, q)-superimposed codes with d = 1 and d = O(q), and can be based on any codes in the literature that achieve the above upper bound in these cases. To additionally minimize the off-line tag length of our schemes, we also require that the codes have sublinear (in n) description size. We achieve this by using a result in [11] that provides a probabilistic construction that is not a (d, q)superimposed code only with small probability. (Although this result is only presented for the case d = 1, we can extend it to the case d = O(q).)
3 Using Localizing Codes for Corruption Localization In this section we present a new notion of localizing codes and show that any one of these codes can be used to construct a corruption-localizing hash scheme from a collision-intractable hash function. We then give preliminary observations towards constructing localizing codes. Localizing Codes. We formally define localizing codes as binary codes for which there exists an efficient algorithm that, given the output of a matrix product between the code matrix and a corruption vector, returns a superset of the corrupted bits, that is larger by a bounded factor. We use matrix product in the 2-value Boolean algebra; that is, the semiring ({0, 1}, ∨, ∧), where matrix product is then a sequence of ∨’s (i.e., boolean ORs) of ∧’s (i.e., boolean ANDs). The weight of a binary vector e, defined as the number of nonzero vector components, is denoted as w(e). Definition 4. Let M = {M (i, j)} be a binary code of size n and length N . We say that M is a (β, v, α)-localizing code if there exists an efficient algorithm LM such that for any (β, v)-corruption vector e, given as input the matrix product M · e, LM returns a vector u such that u covers e and w(u) = α Diffv [0n , e].
584
A. De Bonis and G. Di Crescenzo
Corruption Localization from Localizing Codes. We obtain the following Theorem 1. Let H = {Hλ }λ∈N be a family of hash functions, and let M = {M (i, j)} be a binary code of size n and length N . If H is (t, )-collision-intractable and M is a (β, v, α)-localizing code, then there exists a hash scheme HSM = (clHM , LocM ) that is (t , , β, v, α )-corruption-localizing, where = , t = t + O(tn (H) · N ). Moreover, HSM has localization factor α = α, number of hash tags O(N ), and runtime complexity O(tn (H) · N ). A sketch of the construction of the scheme HSM is as follows. The hashing algorithm clHM runs N times function Hλ , where, for i = 1, . . . , N , the i-th execution of Hλ takes as input the concatenation of all file entries x[j] such that M (i, j) = 1, for all j = 1, . . . , n, and returns the obtained hash tag. The localizing algorithm LocM starts by repeating the same computation by running Hλ on the corrupted file x , and generates an N -bit vector z such that z[i] = 1 if and only if the hash tag computed on the i-th execution of Hλ on x is equal to the one returned by clHM as the tag computed by the i-the execution of Hλ on x. Finally, LocM runs the algorithm LM on vector z to obtain vector u, and outputs this vector. The main observation in the proof of Theorem 1 is that, either collisions are found in Hλ or the vector z can be shown to be equal to the matrix product between matrix M of the localizing code M and the (β, v)-corruption vector e, and therefore the localization property of LM implies an analogue localization property for LocM . Theorem 1 unifies previous results (in particular, a result in [5] can be restated as a (β, 1, O(1))-localizing code, and a result in [4] can be re-stated as a (β, v, O(v3 ))localizing code) and simplifies the problem of constructing efficient corruption-localizing hash schemes to the problem of constructing efficient localizing codes. Using Superimposed Codes to Construct Localizing Codes. As already observed in [4], there is a high similarity between localization of corruptions in a string and combinatorial group testing. However, in that paper it was pointed out that group testing results cannot be directly used for corruption localization as in those results atomic elements are searched, whereas we are interested in searching corrupted segments that may have lengths that are potentially > 1 and different among each other. One approach to overcome this objection is to search for corrupted bits (rather than corrupted segments) given that they occur in at most v segments of length ≤ β (a more specific version of non-adaptive combinatorial group testing). However, even using the best known constructions for superimposed codes to determine the exact location of all corrupted bits by a nonadaptive group testing strategy, would cost O((vβ)2 log n) in terms of number of tags, which is not satisfactory as it is at least linear in n whenever vβ = Ω( n/ log n). (Note that in general β = O(n) and that our goal is to obtain a corruption-localizing hash scheme with number of tags o(n); e.g. polylogarithmic in n.) To improve on the latter bound on the tag length, we have to specifically target corruption localization (as opposed to search) and exploit the additional information that corrupted bits occur in segments of length at most β. In the next two sections we propose two non-trivial uses of superimposed codes to construct localizing codes with desirable combinations of efficiency and localization properties.
Combinatorial Group Testing for Corruption Localizing Hashing
585
4 A First Localizing Code In this section we present our first localizing code. When plugged into Theorem 1, one instantation of this code gives a corruption-localizing hash scheme with localization factor constant with respect to the maximum number v of corruptions and sublinear number of tags, whenever v = o( n/ log n). An informal discussion. Recall that our goal is to construct a localizing code that localizes up to v corruptions in an n-bit message, each of length no larger than β, up to a multiplicative localization factor α. Towards this goal, a first difficulty is that an upper bound on the length of each corruption, although known to be at most β, can actually vary widely between 1 and β. As variations in the length parameter seem to have a big impact on the efficiency and localization properties of any codes and hash schemes obtained, it is desirable to have a close estimate of this length parameter. We deal with this difficulty by adding a parameter b to the code, which intuitively denotes a close upper bound on the maximum length of all v corruptions. Accordingly, we start with a binary code C of size n/b and expand it into a binary code D of size n by replicating each bit b times, so that the resulting code essentially operates over b-bit blocks directly, thus potentially better detecting b-bit corruptions. The code D and its properties. Let C = {C(i, j)} be a binary code of size n/b and length N , for some 1 ≤ b ≤ β. We define the binary code D = {D(i, j)} of size n and length N , as the code returned by the following procedure. 1. For i = 1, . . . , N , for j = 1, . . . , n/b , let sbj denote the interval [b(j − 1), min{bj − 1, n − 1}]; for all j in interval sbj , set D(i, j ) = C(i, j) 2. Return: D = {D(i, j)}. We obtain that code D satisfies the following Theorem 2. Let b, n, β, v be given positive integers such that v ≤ n and 2 ≤ b ≤ β ≤ n, and let C be a binary code of size n/b . If C is a (d, 2v)-superimposed code, for an arbitrary positive integer d ≤ n − 2v, then D is a (b, v, α)-localizing binary code of size n, for α ≤ (d + 1)b. The length of D is the same as the length of C. Proof. To prove the theorem, we formally describe an algorithm LD that localizes the up to v corruptions as from the (β, v)-corruption vector e, and satisfies the stated bound on the parameter α. In fact, we prove the stronger bound α ≤ 2b + (d − 1)b/p, where p ≤ v is the number of non-empty corrupted segments; that is, the number of intervals Sr = ∅ among the v intervals S1 , . . . , Sv in [0, n − 1] that achieve Diffv [x, x ]. The algorithm LD . On input response vector z = D · e, algorithm LD goes as follows: 1. set u = 0n 2. for j = 1, . . . , n/b , let sbj denote the interval [b(j − 1), min{bj − 1, n − 1];
586
A. De Bonis and G. Di Crescenzo
if column C(·, j) is covered by z then set u[j ] = 1 for all j ∈ sbj 3. return: u We now prove that for any (b, v)-corruption vector e, it holds that w(u) ≤ α Diffv [0n , e] for α ≤ 2b+(d−1)b/p. We assume that n is a multiple of b (the more general case being proved similarly). Also, we say that an interval sbj ∈ {sb1 , . . . , sbn/b } is corrupted if it intersects one or more Sr ’s. First we show that u has nonzero elements in correspondence of ≤ 2p + d − 1 intervals from {sb1 , . . . , sbn/b } and consequently w(u) ≤ (2p + d − 1)b. To see this, observe that each Sr has size ≤ b and thus each Sr intersects at most two adjacent segments among sb1 , . . . , sbn/b . Since there are p intervals Sr ’s such that Sr = ∅, then there are at most 2p corrupted intervals in {sb1 , . . . , sbn/b }. Let sbj1 , . . . , sbjm , for some m ≤ 2p, be the corrupted intervals in {sb1 , . . . , sbn/b }. The response vector z is the bitwise OR of columns C(·, j1 ), . . . , C(·, jm ). By definition of (d, 2v)-superimposed code, one has that, for any d column indices 1 , . . . , d ∈ / {j1 , . . . , jm }, the bitwise OR of columns C(·, 1 ), . . . , C(·, d ) is not covered by z, and consequently, there might be at most d − 1 columns, in addition to C(·, j1 ), . . . , C(·, jm ), that are covered by z. Let C(·, r1 ), . . . , C(·, rh ), for some h < d, denote these columns. One has that u[j ] = 0 for all j ∈ sbj and j ∈ {j1 , . . . , jm , r1 , . . . , rh }, and u[j ] = 1 for all j ∈ sbj and j ∈ {j1 , . . . , jm , r1 , . . . , rh }. Observe that Diffv [0n , e] might be as small as p since each non-empty interval Sr might consist of a single bit. Hence, one has that α is w(u)/Diffv [0n , e] = (m + h)b/Diffv [x, x ] ≤ (2p + d − 1)b/p = 2b + (d − 1)b/p. The next corollary follows from Theorems 1 and 2. Corollary 1. Let b, n, β, v be given positive integers such that v ≤ n and 2 ≤ b ≤ β ≤ n, and let N = N (d, 2v, n/b ), for an arbitrary positive integer d ≤ n − 2v. If H = {Hλ }λ∈N is a (t, )-collision-intractable family of hash functions, then there exists a (t , , b, v)-corruption-localizing hash scheme with = , t = t + O(tn (H) · N ), localization factor α ≤ b(d + 1), and number of tags O(N ). We minimize the localization factor by setting d = 1, and apply the upper bound in Section 2 to N (1, 2v, n/b ) so to obtain a hash scheme with localization factor 2b (constant in v) and number of tags O(v 2 log(n/(bv))) (sublinear when v = o( n/ log n)).
5 A Localizing Code Achieving Constant Localization Factor In this section we present our second localizing code. When plugged into Theorem 1, this code results in a corruption-localizing hash scheme that achieves constant localization factor for any number of corruptions and any corruption length. The construction of this code uses and significantly extends ideas from the localizing code of Section 4. An informal description. The intuition behind the construction in this section is that we learn a good estimate of the length of the largest corrupted segment and to this aim we use a halving strategy on the length b of the intervals into which we partition [0, n − 1]. Indeed, if b is chosen too large then the 2b localization factor of the localizing
Combinatorial Group Testing for Corruption Localizing Hashing
587
code in Section 4 is too large. On the other hand, if the chosen value of b is too small then the number of corrupted intervals among sb1 , . . . , sbn/b is too large with respect to the parameter 2v of the superimposed code C, and the number of columns of C covered by the response vector might be much larger than v; potentially, n/b , in which case w(u) would be very large as well. The main component of our construction is a localizing code E and the related localizing algorithm LE , which are informally described as follows. For k = 0, . . . , log β , let Ck be a (d, 2v + v/c )-superimposed code of size n/βk and length Nk , where βk = β/2k , d ≤ n − 2v − v/c is an arbitrarily chosen positive integer, and c ≥ 1 is an arbitrary constant. For k = 0, . . . , log β , E expands Ck into a code Dk of size n as described in Section 4. Given codes Ck and Dk , we construct a localizing algorithm Lk as shown in the proof of Theorem 2, and use that theorem to conclude that Lk returns an n-bit vector uk with the following properties: (a) uk covers the (β, v)-corruption vector e, and (b) if all corrupted segments have length ≤ βk = β/2k then w(uk ) ≤ βk (2v + v/c + d − 1). The idea of our localizing algorithm LE is to run algorithms L0 , . . . , Lf , where f = min{k ∈ {1, . . . , log β } : w(uk ) > βf (2v + v/c + d − 1)}. A crucial difficulty is to prove that, by stopping at k = f , the algorithm LE achieves constant localization factor. (The solution to this difficulty is later detailed in the formal proof.) There is also a possibility that the localizing algorithm never finds such an f , in which case it is not possible to prove that the algorithm attains a constant localization factor by returning one of vectors uk ’s. Notice that in this case the vector ulog β has weight ≤ 2v + v/c + d − 1 and therefore this vector attains constant localization factor only when Diffv (0n , e) = Ω(v). In order to achieve the desired localization factor for any Diffv (0n , e), we exploit the fact that the total number of corrupted bits is ≤ w(ulog β ) ≤ 2v + v/c + d − 1, and consequently, it is convenient to localize all corruptions by a group testing strategy that directly searches for the single corrupted bits, rather than searching for corrupted segments of some maximum length. The algorithm achieves constant localization factor and has an O(v log v log n) overhead in terms of time and storage complexity. Notice that a trivial use of non-adaptive group testing would allow to exactly detect the corrupted bits but would incur a far larger overhead of O((v + d)2 log(n/(v + d))). Theorem 3. Let n, β, v be given positive integers such that β ≤ n and v ≤ n. For k = 0, . . . , log β , let βk = β/2k and Ck be a (d, 2v + v/c )-superimposed code of size n/βk , where d ≤ n − 2v − v/c is an arbitrary positive integer and c ≥ 1 is an arbitrary constant. Moreover, for r = 0, . . . , log(2v + v/c + d − 1), let vr = (2v + v/c + d − 1)/2r and Gr be a ( vr /c , vr )-superimposed code of size n, with c > 0 being an arbitrary constant. There exists a (β, v, α)-localizing binary code of size n, where α ≤ max{4c + 2 + 2c(d − 1)/v, 2 + 2/c }. This code has length equal to the sum of the lenghts of codes C0 , . . . , Clog β , G0 , . . . , Glog(2v+v/c+d−1) . Proof. For the sake of simplicity, we will assume that v/c is an integer (the more general case being proved similarly). For k = 0, . . . , log β , let Nk denote the length of ˆr denote the length of code Ck , and for r = 0, . . . , log(2v + v/c + d − 1), let N code Gr . For k = 0, . . . , log β , we expand Ck into a binary code Dk = {Dk (i, j)} of
588
A. De Bonis and G. Di Crescenzo
size n and length Nk . The code Dk is obtained from Ck exactly in the same way as the code D is obtained from code C in Section 4. The code E is obtained by concatenating the rows of codes D0 , . . . , Dlog β and those of G0 , . . . , Glog(2v+v/c+d−1) . The code E and its properties. The code E is formally defined as follows: 1. Set h = 0 2. For k = 0, . . . , log β , for i = 1, . . . , Nk , for j = 1, . . . , n/βk , let sβj k denote the interval [βk (j − 1), min{βk j − 1, n − 1}], for all j in interval sβj k , set Dk (i, j ) = Ck (i, j) and E(h + i, j ) = Dk (i, j ) set h = h + Nk 3. For r = log(2v + v/c + d − 1), . . . , 0, ˆr , for i = 1, . . . , N for j = 1, . . . , n, set E(h + i, j) = Gr (i, j) ˆr h=h+N 4. Return: E = {E(i, j)}. To show the localizing properties of code E, we formally describe an algorithm LE that localizes the v corruptions and satisfies the stated bound on the parameter α. We denote by e the (β, v)-corruption vector that transforms x into x . For k = 0, . . . , log β , we denote with Lk the algorithm obtained by replacing C with Ck and D with Dk in the algorithm LD described in Section 4. The algorithm LE . On input the response vector z = E · e, the algorithm LE does the following 1. Set uk = 0n , for k = 0, . . . , log β . 2. For k = 0, . . . , log β , set uk = the vector returned by Lk , if w(uk ) > βk (2v + v/c + d − 1), then return: u = uk−1 , set k = k + 1. 3. Set u ˆr = 0n , for r = 0, . . . , log(2v + v/c + d − 1). 4. For r = log(2v + v/c + d − 1), . . . , 0, for j = 1, . . . , n, if column Gr (·, j) is covered by z then then set u ˆr [j] = 1 if w(ur ) < vr + vr /c then return: u = u ˆr set r = r − 1 It is immediate to see that the vector u returned by LE covers the corruption vector e. To prove the theorem, we need to show that for any (β, v)-corruption vector e, it holds that w(u) ≤ α Diffv [0n , e], for α ≤ max{4c + 2 + 2c(d − 1)/v, 2 + 2/c}. First we consider the case when there exists a k ≤ log β such that w(uk ) > βk (2v + v/c + d − 1). In this case the above algorithm returns the vector uf −1 , where f = min{k ∈ {1, . . . , log β } : w(uk ) > βf (2v + v/c + d − 1)}. Theorem 2 implies
Combinatorial Group Testing for Corruption Localizing Hashing
589
that there exists an ∈ {0, . . . , n − 1} such that |S | > βf = β2−f . Indeed, any (d, 2v + v/c)-superimposed code is also a (d, 2v)-superimposed code and consequently Cf satisfies the hypothesis of Theorem 2. By that theorem, one has that, if |Sr | ≤ βf , for all r = 1, . . . , v, then w(uf ) ≤ βf (2v + d − 1). Since we have chosen f as the smallest integer such that w(uf ) > βf (2v + v/c+ d− 1) then at least one of S1 , . . . , Sv should have cardinality larger than βf . Now we show that Diffv [x, x ] > β2−f v/c. Let us assume by contradiction that Diffv [x, x ] ≤ β2−f v/c and let us consider the partition of {1, . . . , n} into the intervals β βf β s1 f , . . . , sn/β of length βf . For r = 1, . . . , v, we denote by Ir f the set of (consecf β
β
utive) corrupted intervals sj f ’s that intersect Sr . Notice that for some r < v, Ir f and β
β
f Ir+1 might intersect since the rightmost corrupted interval in Ir f might be the leftmost βf β β β β in Ir+1 . Let I1f , . . . , Igf , for some g ≤ v, denote those sets among I1 f , . . . , Iv f with cardinality larger than or equal to three. We have that g g v β Diffv [x, x ] = |Sr | ≥ |Sj | > (|Ijf | − 2)βf . (1)
r=1
j=1
j=1 β
Indeed, for j = 1, . . . , g, we have that Sj entirely contains all intervals in Ijf , with the eventual exception of the leftmost and rightmost segments that are not taken into account by the summation in the last term of (1). Inequality (1) and the contrag β diction hypothesis imply that j=1 (|Ijf | − 2)βf < βf v/c from which it follows that g βf βf j=1 |Ij | < v/c + 2g. On the other hand the number of corrupted intervals sj ’s v β β β g is at most r=1 |Ir f | ≤ j=1 |Ijf | + 2(v − g), in view of the fact that |Ir f | ≤ 2 for r ∈ / {1 , . . . , g }. The last two inequalities imply that the number of corrupted inβ tervals sj f ’s is at most 2v + v/c, and consequently, the response vector zf = Df · e is the boolean sum of up to 2v + v/c columns of Cf . Since Cf is a (d, 2v + v/c) superimposed code then the only columns covered by zf are those associated with the corrupted intervals plus an additional subset of at most d − 1 columns. It follows that w(uf ) ≤ βf (2v + v/c + d − 1), from which we have a contradiction. We are ready to show that w(uf −1 )/Diffv [x, x ] < 4c + 2 + 2c(d − 1)/v. To see this, observe that f is the smallest index such that w(uf ) > βf (2v + v/c + d) and consequently it must hold w(uf −1 ) ≤ βf −1 (2v + v/c + d − 1) = (2v + v/c + d − 1)β2−(f −1) . On the other hand, we proved that Diffv [x, x ] > β2−f v/c from which we have that w(uf −1 )/Diffv [x, x ] < 4c + 2 + 2c(d − 1)/v. Now we consider the case when w(uk ) ≤ βk (2v + v/c + d − 1), for all k = 0, . . . , log β . In this case the algorithm outputs the vector u ˆg , where g = max{r ∈ {0, . . . , log(2v + v/c + d − 1)} : w(ˆ uk ) ≤ vr + vr /c }. We will show that w(ˆ uk )/Diffv [x, x ] < 2(1 + 1/c ). Let p ≤ w(uk ) denote the unknown number of corrupted bits. Notice that βlog β = 1, and consequently, p ≤ w(uk ) ≤ 2v + v/c + d. We denote by a the integer in {0, . . . , log(2v +v/c+d−1)} such that (2v +v/c+d− 1)/2a+1 < p ≤ (2v + v/c + d − 1)/2a . Let Ga (·, j1 ), . . . , Ga (·, jp ) the p columns of Ga associated with the p corrupted bits. The response vector ˆ za = Ga · e is the bitwise OR of columns Ga (·, j1 ), . . . , Ga (·, jp ). By definition of ( va /c , va )-superimposed code, one has that the bitwise OR of any va /c columns is not covered by the union
590
A. De Bonis and G. Di Crescenzo
of up to va other columns. Therefore, for any va /c column indices 1 , . . . , va /c ∈ / {j1 , . . . , jp }, the bitwise OR of columns Ga (·, 1 ), . . . , Ga (·, va /c ) is not covered by ˆ z, and consequently, there might be at most va /c − 1 columns, in addition to Ga (·, j1 ), . . . , Ga (·, jp ), that are covered by z. This guarantees that algorithm LE will return a vector u ˆ=u ˆg (for some g ≥ a) such that w(ˆ ug ) < vg + vg /c ≤ va + va /c , and therefore the algorithm achieves localization factor α = w(u)/Diffv [0n , e] < (va + va /c )/p. Since p > (2v + v/c + d − 1)/2a+1 = va /2, it follows that α < (2p + 2p/c )/p = 2(1 + 1/c ). The following corollary is an immediate consequence of Theorems 1 and 3. log v log β N ( vr /c , vr , n), Corollary 2. Let N = k=0 N (d, 2v+ v/c , n/βk )+ r=0 k r where βk = β/2 , vr = (2v + v/c + d − 1)/2 and d ≤ n − 2v − v/c is an arbitrary positive integer. If H = {Hλ }λ∈N is a (t, )-collision-intractable family of hash functions then, for any two constants c ≥ 1 and c > 0, there exists a (t , , β, v)corruption-localizing hash scheme, with = , t = t + O(tn (H) · N ), localization factor α ≤ max{4c + 2 + 2c(d − 1)/v, 2(1 + 1/c )} and number of tags O(N ). The upper bound in Section 2 on the minimum length of (d, q)-superimposed codes implies that the minimum length of a (d, 2v+ v/c )-superimposed code of size n/βk is N (d, 2v + v/c , n/βk ) = O((v2 /d) log(n2k /(βv))) and the minimum length of a ( vr /c , vr )-superimposed code of size n is N ( vr /c , vr , n) = O(c vr log(n/vr ). log v ˆ log β These bounds imply that the length k=0 Nk + r=0 N r of code E is upper bounded by O(v(log v) log n + (v 2 /d)(log β) log(n/v))). We note that the localization factor of the scheme in Corollary 2 increases with d, whereas its storage complexity is a decreasing function of d. Finally, when setting d = O(v), the scheme achieves constant localization factor and number of tags O(v(log v) log n + v log β log(n/v)).
References 1. Damg˚ard, I.: Collision Free Hash Functions and Public Key Signature Schemes. In: Price, W.L., Chaum, D. (eds.) EUROCRYPT 1987. LNCS, vol. 304, pp. 203–216. Springer, Heidelberg (1988) 2. De Bonis, A., Gasieniec, L., Vaccaro, U.: Optimal Two-Stage Algorithms for Group Testing Problems. SIAM Journal on Computing 34(5), 1253–1270 (2005) 3. Di Crescenzo, G., Ge, R., Arce, G.: Design and Analysis of DBMAC: an Error-Localizing Message Authentication Code. In: Proceedings of IEEE GLOBECOM 2004 (2004) 4. Di Crescenzo, G., Jiang, S., Safavi-Naini, R.: Corruption-localizing hashing. In: Backes, M., Ning, P. (eds.) ESORICS 2009. LNCS, vol. 5789, pp. 489–504. Springer, Heidelberg (2009) 5. Di Crescenzo, G., Vakil, F.: Cryptographic hashing for virus localization. In: Proceedings of the 2006 ACM CCS Workshop on Rapid Malcode - WORM 2006, pp. 41–48 (2006) 6. Dorfman, R.: The detection of defective members of large populations. Ann. Math. Statist. 14, 436–440 (1943) 7. Du, D.Z., Hwang, F.K.: Pooling Designs and Nonadaptive Group Testing. World Scientific, Singapore (2006)
Combinatorial Group Testing for Corruption Localizing Hashing
591
8. Du, D.Z., Hwang, F.K.: Combinatorial Group Testing and its Applications. World Scientific, Singapore (2000) 9. Dyachkov, A.G., Rykov, V.V.: A survey of superimposed code theory. Problems Control & Inform. Theory 12(4), 1–13 (1983) 10. Erd¨os, P., Frankl, P., F¨uredi, Z.: Families of finite sets in which no set is covered by the union of r others. Israel J. of Math. 51, 75–89 (1985) 11. Goodrich, M., Atallah, M., Tamassia, R.: Indexing information for data forensics. In: Ioannidis, J., Keromytis, A.D., Yung, M. (eds.) ACNS 2005. LNCS, vol. 3531, pp. 206–221. Springer, Heidelberg (2005) 12. Kautz, W.H., Singleton, R.R.: Nonrandom binary superimposed codes. IEEE Trans. on Inform. Theory 10, 363–377 (1964) 13. Russell, A.: Necessary and Sufficient Conditions for Collision-Free Hashing. Journal of Cryptology 8(2), 87–99 (1995)
Task Ordering and Memory Management Problem for Degree of Parallelism Estimation Sergiu Carpov1,2 , Jacques Carlier2 , Dritan Nace2 , and Renaud Sirdey1 1
CEA, LIST, Embedded Real Time Systems Laboratory, Point Courrier 94, 91191 Gif-sur-Yvette Cedex, France 2 UMR CNRS 6599 Heudiasyc, Université de Technologie de Compiègne, Centre de recherches de Royallieu, BP 20529, 60205 Compiègne Cedex, France
Abstract. This paper is devoted to the problem of estimating the achievable degree of parallelism for a parallel algorithm with respect to a bandwidth constraint. In a compiler chain for embedded parallel microprocessors such an estimation can be used to fix an appropriate target for parallelism reduction “tools”. Informally, our problem consists in task ordering and memory management for an algorithm, so as to minimize the number of memory accesses. After a brief survey of the literature, we prove the N P-hardness of this problem and introduce a polynomial special case. We then present a branch and bound procedure for the general case along with computational results interpretation demonstrating its practical relevance. Keywords: task scheduling, memory management, parallel processor.
1
Introduction
In this paper, we investigate a series of problems related to efficient memory bandwidth management in embedded parallel processor architectures. In particular, we are interested in estimating the memory bandwidth required for the sequential execution of a parallel algorithm so as to estimate the number of tasks which may execute in parallel with respect to an external memory bandwidth constraint. In a compiler chain proceeding by parallelism reduction (via task fusion [9]), such an estimation can be used to fix an appropriate target for the degree of parallelism. This estimation can also be used within an AlgorithmArchitecture Adequation framework to perform an initial assessment. Let us consider an embedded parallel processor architecture which consists of many processing cores which share a common memory space. The system in which this processor is used, has an external memory for storing application data and instructions. External memory locations are accessed without direct core involvement, i.e. it only initiates and finishes the data transfers. In this B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 592–603, 2011. c Springer-Verlag Berlin Heidelberg 2011
Task Ordering and Memory Management Problem
593
context, a typical bottleneck for many algorithms1 is the external memory access bandwidth, which must be carefully managed in order to keep the processing cores busy enough. An algorithm is composed of a set of tasks that are using external memory data. Let Δ be the total amount of data (i.e. number of bytes) used by all algorithm tasks. The total sequential algorithm execution time Texec , Texec = T + TΔ , consists of a fixed part T and of a variable part TΔ . The fixed part T corresponds to the execution itself, that is the time the processing cores are busy. The variable part TΔ corresponds to the time needed to load all the external memory data Δ. The data loading time is variable because several data could be loaded two or more times in function of the caching strategy. In this study, we propose a method to estimate the achievable degree of parallelism for an algorithm constrained by the external memory bandwidth, that is the ratio Λ/λ between the external memory bandwidth Λ to the average bandwidth λ required by an optimal (in some sense defined later) sequential execution of the algorithm. We suppose that we are dealing with parallel algorithms, thus their intrinsic structure in terms of parallelism is not an issue, only the limitations of the chip (here, in terms of external memory bandwidth) influence the estimation. The average bandwidth λ is defined as the total amount of data divided by the total execution time, λ = Δ/T +TΔ . Let us reverse the bandwidth formula, we obtain λ−1 = T/Δ + k, where k is the duration of loading one unit of data (within a certain degree of accuracy we suppose TΔ = kΔ). It is straightforward to see that the average bandwidth is proportional to the amount of data loaded from the external memory, thus loading less data will reduce the bandwidth. Our goal is to find a task execution order which, combined with an appropriate data management (via data reuse), minimizes the average bandwidth and in turn maximizes the achievable degree of parallelism. A branch and bound procedure is introduced to deal with this problem. One practical utility of the exact resolution approach we propose is for finding optimal solutions which could be used for evaluating heuristic methods, as obtaining tight global lower bounds for a particular case of this problem is already a difficult task [1]. After a survey on the existing work, we give a formal definition of our problem and state on its complexity. We then present the issue of on-chip memory management for a fixed task calculation order, and finally, we introduce the branch and bound algorithm.
2
Related Work
Previous work related to our problem is quite rare. Although our study is on the limitations induced by the external memory bandwidth on algorithm parallelism, we have identified the following works which are indirectly related to our problem. The similarities mainly consist in the tools that are used to address related though different problems. 1
Especially signal and image processing algorithms.
594
S. Carpov et al.
It appears that [5] were the first to study a problem relatively close to ours. In their work they intend to reorder program instructions so as to improve program data access locality. The goal of locality minimization is to reduce the distance between instructions that are using the same data, thereby to augment data reuse. However, instead of using an optimal cache management policy for calculating the distances, a sufficient-only condition is used. The latter requires that the time distance, which is the number of instructions between two accesses, is bounded by a constant in order to ensure a cache hit. This problem is modeled as a bandwidth-minimization problem. In their paper, the authors describe a tool that reorders program instructions and provide experimental results for a set of benchmark programs. Some earlier works, [14,11], describe methodologies for optimizing data reuse in program loops. In a series of two papers [4,6] describe two program transformations: locality grouping, which reorders program data accesses in order to improve data temporal reuse, and dynamic data packing, which consists in reorganizing data layout so as to improve data spatial reuse. Other papers [12,13] describe similar approaches of data locality improvement and provide benchmark analysis.
3
Problem Formulation and Complexity
An algorithm is a set of tasks. Each task uses external memory data which needs to be fetched before the task execution can start. The smallest unit of data is called an input, hereafter we use the terms of external memory data and input equivalently. Let A = (S, E, δ) denote an algorithm where S are algorithm’s tasks, E represent the set of inputs used by the algorithm and δ : S → 2E is a function that associates to any task s, s ∈ S, a set of inputs δ (s) needed for its calculation. We suppose that there are no precedence relations between algorithm tasks2 . Although this model seems to be limited the methods described further can be easily modified to take into account the precedence constraints. Let γ : S → 2E be a function that associates a set of inputs γ (s) to any task s, s ∈ S. The set of inputs γ (s) gives the on-chip memory state at the beginning of task s calculation. It is evident that for any task s, γ (s) contains at least all the inputs used by this task, δ (s) ⊆ γ (s). Remaining inputs that do not belong to δ (s), come from data reuse. Data reuse is the process of reusing inputs already present in memory, originating from previously calculated tasks. Throughout this paper we suppose that available on-chip memory size is equal to C, thus condition |δ (s)| ≤ |γ (s)| ≤ C must be verified for any s ∈ S. Without loss of generality we suppose that the total number of inputs is larger than the on-chip memory size, i.e. |E| > C. The task ordering and memory management problem consists in finding a permutation π of tasks S such that the number of external memory accesses, given by cost function (1) is minimized. 2
This case can be interpreted as a coarse-grained view of algorithm task graphs where the set of tasks producing an outcome are grouped into a single task.
Task Ordering and Memory Management Problem
595
Fig. 1. Illustration of graph transformations used to obtain an instance of our problem n γ sπ(1) + γ sπ(i) \γ sπ(i−1)
(1)
i=2
Proposition 1. Task ordering and memory management problem is N P-hard. Proof. Let G = (V, A) be an arbitrary non-oriented graph. The problem of existence of a Hamiltonian path in graph G is N P-complete [7, p.199]. We show that Hamiltonian path existence problem can be reduced to a special case of our problem, by using the following transformations. Each vertex of graph G becomes a task in our problem S = V (see Figure 1 for an illustration). To each edge of graph G an input is associated. The on-chip memory size equals to the maximum degree of graph vertices, C = maxs∈V deg (s). For any task s ∈ S, δ (s) contains the set of input-edges that are adjacent to s in the graph, plus a set of C − deg (s) dummy inputs specific for each task. In this way γ (s) = δ (s) and |γ (s) ∩ γ (s )| = 1 for any pair of adjacent task s, s ∈ S. The problem obtained in such a way is a special case of our problem. It has a solution of cost n · C − n + 1 (n being the number of tasks) if and only if it exists a Hamiltonian path in graph G. As far as the question of existence of a Hamiltonian path in graph G is N P-complete, our problem is N P-hard.
4
Memory Management for a Fixed Sequence of Tasks
We start by investigating the on-chip memory data management separately from the task ordering as it is an important issue of our problem. Let A = (S, E, δ) be an algorithm. Suppose that a permutation of tasks s1 , . . . , sn is given. We recall that for any task s ∈ S, δ (s) are the inputs that must be loaded into the on-chip memory before s starts. It is obvious that the duration of loading inputs δ (s) depends on the position of task s in this sequence and on the content of the on-chip memory. Namely, on already loaded inputs originating from data reuse process. We are interested to find the on-chip memory states γ (s) for any s, s ∈ S, such that the number of external memory accesses (1) is minimal. For solving the memory management problem, we introduce an incremental3 algorithm, see Algorithm 1, which updates the optimal memory states for a 3
The incremental formulation is useful in the branch and bound procedure we introduce in the next section, where it is necessary to recalculate the data reuse induced only by the last task.
596
S. Carpov et al.
sequence of tasks s1 , . . . , sk−1 with the data reuse induced by a task sk added to the end of this sequence. The complexity of this algorithm is O (k · m), where m is the number of inputs. The algorithm is based on the principle used in optimal cache replacement algorithm proposed by [2]. In our context4 , it may be informally stated as follows: “when a memory location is needed for a given input and the on-chip memory is full, free space should be obtained by dropping out the input which is to be used in the farthest future”. In order to find the optimal memory management for a sequence of tasks s1 , . . . , sn the algorithm is executed n − 1 times, each time adding task si , i = 2 . . . n, to the end of computed sequence. The global complexity of previously this procedure is O n2 · m . The minimal number of external memory accesses can be found using expression (1) from the calculated memory states. Algorithm 1. Incremental on-chip memory management algorithm (for the sake of simplicity we consider γi = γ (si ) and δi = δ (si )) Input: s1 , . . . , sk−1 - task ordering with already computed memory states γ1 , . . . , γk−1 Input: sk - new task to be added to the end of the ordering Output: γ1 , . . . , γk - updated memory states 1: p = k − 1 2: while p > 1 and|γp | < C do {Find last task with full on-chip memory, if it exists} 3: p=p−1 4: end while 5: γi = γi for i = 1, . . . , p 6: for i = p + 1 tok − 1 do 7: L = (δk \ γi ) ∩ γi−1 {Potential inputs to reuse} 8: l = min (|L| , C − |γi |) 9: γi = γi ∪ {First l elements of L according to a linear order} 10: end for 11: γk = δk
The optimal on-chip memory data management based on the calculated memory states is easily found. For first task s1 all the inputs γ (s1 ) are loaded into the on-chip memory. For next tasks si , i ≥ 2, before the execution of task si starts, inputs γ (si ) \ γ (si−1 ) are loaded into the on-chip memory in place of inputs γ (si−1 ) \ γ (si ).
5
Task Ordering and Memory Management
The fact that the task ordering and memory management problem is N P-hard legitimates the use of a branch and bound procedure for solving it. In what follows we describe the proposed branch and bound algorithm as well as each of the used components. The branch and bound algorithm starts with an empty 4
We do not use the algorithm described in Belady’s paper, because in their model at each step only a single memory location is loaded. Contrary to our model, where at each step we can load more than one input.
Task Ordering and Memory Management Problem
597
sequence of tasks. At each branching decision it adds to the end of this sequence a new task from the set of not yet ordered ones. A leaf is obtained when all the tasks are ordered. Lower bounds as well as a dominance relation are used in algorithm in order to reduce the search space. Before describing the branch and bound procedure we introduce some useful definitions. Let us denote by (I, π) a permutation of tasks or task ordering, where I ⊆ S is a set of tasks and π : {1, . . . , |I|} → {1, . . . , |I|} is a permutation of tasks of I. In the case when I = S the task permutation is called a complete permutation, when it is not - a partial permutation. A triplet ω = (I, π, γ), where (I, π) is a task ordering and γ : I → 2E are optimal memory states at the beginning of each task calculation, is a solution. When the solution contains a partial ordering, we call it a partial solution, and when not a complete solution. Let Ω be the set of all possible partial and complete solutions. A task ordering (I , π ) begins with the partial task ordering (I, π) if the following relations are satisfied: I = I ∪ K for K ⊆ S \ I and π (i) = π (i) for any si ∈ I. Respectively, solution (I , π , γ ) begins with the partial solution (I, π, γ) when (I , π ) begins with (I, π). Let f : Ω → R+ 0 be a bijection that assigns to any solution ω ∈ Ω a nonnegative value f (ω), where f (ω) represents the minimum number of external memory accesses of solution ω, calculated using Algorithm 1. In what follows we describe each of the components used in the branch and bound algorithm. 5.1
Branching Rule
A partial or a complete task ordering (I, πI ) is respectively a node or a leaf of the search tree, here I denotes the set of already ordered tasks and πI is a permutation of tasks I. The root node of the search tree is (∅, π∅ ) and it corresponds to an empty task ordering. At a node (I, πI ) of the search tree, for each task s ∈ S \ I the nodes I ∪ {s} , πI∪{s} beginning with (I, π) are created. Thus, branching from node (I, πI ) creates a number of |S \ I| new nodes. 5.2
Lower Bounds
Let ω = (I, π, γ) be a partial solution associated to the node (I, π) of the search tree. Two lower bounds are proposed for computing an underestimated value of current partial solution. Because of limited space the proofs of the lower bounds are omitted (see [3] for complete proofs). Proposition 2 (Lower bound 1). Let ω = (I, π, γ) be a solution. Suppose that ω = (I , π , γ ) is a new solution that begins with ω, where I = I ∪ {sd } and sd isa dummy task containing all the inputs of not yet ordered tasks, i.e. δ (sd ) = s∈S\I δ (s). Then g1 (ω) = f (ω ) is a lower bound of solution ω. In the following proposition a computationally cheaper lower bound, but weaker than the previous one is described.
598
S. Carpov et al.
Proposition 3 (Lower bound 2). Let ω = (I, π, γ) be a solution. Then g2 (ω) is a lower bound of ω: δ (s) \ δ s|I| − B g2 (ω) = f (ω) + s∈S\I where
⎛ ⎞ ⎞ ⎜ ⎟ ⎜ ⎟ δ (s )⎠ \ δ s|I| ⎠ B = min ⎝C − δ s|I| , ⎝ δ (s) ∩ s∈S\I s ∈I\{s|I| }
5.3
⎛
Dominance Relation
A dominance relation, described in Proposition 4, is proposed. It is applied before the exploration starts, so as to divide the search space into several independent search spaces. Proposition 4. Suppose that the set of tasks S can be divided into p distinctive that are not using common inputs, thus verifying relasets of tasks S1 , . . . , Sp tions: Si ∩ Sj = ∅ and s∈Si δ (s) ∩ s ∈Sj δ (s ) = ∅ for any i = j. Then any complete solution ω = (S, π, γ) is dominated by solution ω = (S, π , γ ) that is built from p independent permutations of tasks (Sk , πk ), k = 1 . . . p, that is to say (S, π ) = [(S1 , π1 ) , (S2 , π2 ) , . . . , (Sp , πp )]. In order to divide the set of tasks S into p distinctive sets S1 , . . . , Sp , a graph theory algorithm for finding connected components is used [10]. This algorithm is applied on the input dependency graph GID = (V, A, t), defined as follows. An input dependency graph is an undirected graph GID = (V, A, t), where the set of nodes V represent algorithm tasks (i.e. V = S), the set of edges A represents dependencies on inputs between the tasks and t : A → N∗ is a weighting function assigning to each graph edge (si , sj ) ∈ A a positive number, t (si , sj ) = |δ (si ) ∩ δ (sj )|. For any pair of tasks si , sj ∈ V , edge (si , sj ) belongs to the graph GID if and only if δ (si ) ∩ δ (sj ) = ∅. The fact that the sets S1 , . . . , Sp are not using common inputs allows us to apply the branch and bound algorithm separately on each of these sets. p In this way, the number of solution search space is reduced from |S|! to i=1 |Si |!. After the application of the branch and bound procedure onto each set of task sets S1 , . . . , Sp , p partial solutions ω1 , . . . , ωp are obtained. Complete solution ω ¯ is obtained by joining p together these partial solutions. The cost of complete solution ω ¯ is f (¯ ω ) = i=1 f (ωi ). 5.4
Selection Rules
Before describing selection rules we introduce an useful definition. For a search tree node ω = (I, π), let K be a set that contains the tasks from the neighborhood of already ordered tasks I in the input dependency graph: K = {sk ∈ S \ I : (si , sk ) ∈ A, si ∈ I} .
Task Ordering and Memory Management Problem
599
The next node to be examined is selected in a greedy fashion, the immediate profit is privileged. The next three rules are applied successively on the set of feasible nodes. The first rule is applied until there are no nodes whose last two tasks are adjacent in the input dependency graph, the second rule is applied until the set K is empty, and afterwards the third one is applied to the remaining nodes. , such that 1. Select the node (I, π) with the largest edge cost t s , s π(|I|−1) π(|I|) sπ(|I|−1) , sπ(|I|) ∈ A, in the input dependency graph GID = (V,A, t). 2. Select the currently active node (I, π) with the largest edge cost t s, sπ(|I|) , such that sπ(|I|) ∈ K and s ∈ I, in the input dependency graph GID = (V, A, t). 3. Select the currently active node ω = (I, π) with the least lower-bound cost g (ω). 5.5
Computational Results
Random Generated Instances. In the first part of computational results section we investigate the performance of the proposed branch and bound method applied on randomly generated problem instances. A randomly generated problem instance is characterized by five parameters: the number of tasks n ∈ {10, 20, 30}, the number of algorithm inputs m ∈ {1/2, 1, 3/2, 2}·n, the average number of inputs per task (IpT) μ ∈ {1/2, 1/4, 1/8}·m, the standard deviation σ ∈ {1/2, 1/4, 1/8} · μ of IpT and the distribution used for generating IpT. Three distributions are used for IpT value generation: random U (μ − σ, μ + σ), N μ, σ 2 and Exponential μ−1 . An instance is generated as follows: – a number x of inputs per task is randomly generated using one of the distribution functions with parameters μ and σ, and x is rounded to the nearest integer (eventually x is floored or ceiled in order to verify 1 ≤ x ≤ m), – for each task s the set of inputs δ (s) is uniformly drawn from the set of all inputs e1 , . . . , em such that the length of δ (s) is x. For each random problem instance we define the minimal size of on-chip memory size as Cmin = mini |δ (si )|. In order to be feasible problem’s on-chip memory size C must be bigger than Cmin . In our experiments we use six values for C, C = r · Cmin where r ∈ {1.0, 1.1, 1.2, 1.3, 1.4, 1.5}. For each combination of parameters three instances are generated, in total 5832 problem instances are obtained. The branch and bound algorithm is executed on each randomly generated problem instance with a time limit of 20 minutes. We are considering as optimal solutions the solutions for which the branch and bound method explored the entire search tree. In reality the number of optimal solutions could be larger because in tree search methods much time is spent for optimality proof. Table 1 presents the number of found optimal solutions for each parameter. From the total of 5832 problem instances 3854 were solved to optimality, which
600
S. Carpov et al.
Table 1. Optimal number of solutions (in percents) for each parameter (a) On-chip memory size ratio r. 1.0 56%
1.1 60% 1/2n 75%
1.2 64% n 66%
1.3 68% 3/2n 64%
1.4 72%
1/4μ 65%
1/8μ 63%
(e) Standard deviation of IpT σ.
1.5 76%
2n 59%
(c) Number of inputs m. 1/2μ 71%
(b) Number of tasks n. 10 100%
20 63%
1/2m
1/4m
1/8m
70%
59%
70%
30 35%
(d) Average number of IpT μ.
Uniform 50%
Normal 61%
Exponential 87%
(f ) IpT distribution function.
corresponds to approximatively 67%. When the on-chip memory is larger the number of optimal solutions increases as well, we can see that augmenting C by 50% (r = 1.5) the number of optimal solutions increases from 56% to 76%. All the instances built of 10 tasks are solved to optimality, this percentage decreases for instances of 20 and 30 tasks to 63% and respectively 35%. Instances with larger input sets (number of inputs m) become more difficult, which is counterintuitive as one can think that with the increase of number of inputs the problem becomes more decoupled because the number of common inputs between tasks decreases. Another interesting fact is that for exponential number of inputs per task, 87% of instances are solved to optimality. Which is explained by relatively large onchip memory sizes when compared to the average number of inputs per task, thus the data reuse is privileged. Image Processing Algorithm. A good example of easily parallelizible algorithms are the image processing ones. Nowadays image processing algorithms work with considerable amount of data, e.g. one of the smallest image resolution being 640×480 pixels. Because of this fact as well as, of course, the N P-hardness of our problem, exact resolution of practical instances is out of reach of even the most sophisticated methods. Still, we can apply the branch and bound proposed earlier on small instances so as to probe the structures of an optimal solutions for real world image processing algorithms. Thereafter, we do so for a classical image processing primitive, the image convolution (see [8] for a detailed description). Image processing algorithm input and output parameters are images. An algorithm task uses several pixels from the input image to calculate a pixel for the output one. We search to order the execution of tasks so as to minimize the number of external memory accesses. Then, guided by the obtained results we try to find patterns in task execution order and to generalize them to higher resolution images.
Task Ordering and Memory Management Problem
601
Image convolution algorithm calculates the convolution product of an image I with a kernel K: I [p − i, q − j] · K [i, j] i
j
It computes the value of an output image pixel in function of its neighborhood pixels in the input image, in our experiments we use a 3 × 3 square neighborhood (kernel). Output image pixels belonging to image boundaries are not calculated. Figure 2a illustrates the calculation order of output image pixels found by the branch and bound procedure. The used image convolution problem instance has the minimum possible on-chip memory size, C = 9, being also the most constrained one, the number of input image pixels is 49 and of output image pixels 25. The optimal number of external memory accesses for this instance is 81 and it was solved in approximately 2 hours on a standard desktop PC. As often observed with branch and bound algorithms, the minimal solution is rapidly found and most of the calculation time is spent on optimality proof completion. It is easy to see that two consecutively calculated output image pixels are either horizontal or vertical neighbors. Thus, we conjecture that if the calculation order of output image pixels satisfies the last rule, then this order is an optimal one. It is straightforward to deduce output image pixels calculation order for higher resolution images based on this rule, e.g. a possible order is given in Figure 2b. We note that for each output image pixel, 3 input image pixels must be loaded, except the first output image pixel for which 9 pixels must be loaded. Thus, the number of external memory accesses is 3 · (M − 2) · (N − 2) + 6 for a N × M input image. Current processor technology admits bigger on-chip memory sizes than we have used for the above image convolution instance. Therefore, we carry out an experiment that aims to find the minimal on-chip memory size allowing to load only once each one of input image pixels. Several convolution instances with different image dimensions, varying from 5 × 5 to 8 × 8 pixels, were tested. The results are presented in Table 2. We can see that if the on-chip memory
(a)
(b)
Fig. 2. Image convolution task processing order
602
S. Carpov et al.
Table 2. On-chip memory sizes allowing to load input image pixels only once Image size 6×6 7×7 8×8 6×8 7×8 8×6 8×7 Memory size 15 17 19 15 17 15 17 Calculation order No matter which Vertical Horizontal
size equals to 2 · min (N, M ) + 3 for a N × M input image then the number of external memory accesses equals to N · M . E.g. for a 640 × 480 image, if the onchip memory size can store 963 (2·480+3) pixels then each input image pixel will be accessed exactly once, i.e. 307200 external memory accesses; contrary to a 9 pixel on-chip memory for which approximatively 3 times more external memory accesses are needed (914898). We shall note that two different calculation orders of output image pixels were found by the branch and bound algorithm. The first one is horizontal, here output image pixels are calculated line by line5 and the second one is vertical order, output pixels being calculated column by column.
6
Conclusion
In this paper, we have examined the task ordering and memory management problem. The aim of the last is to find a task execution order and an external memory data loading strategy so as to minimize the total number of external memory accesses for an algorithm. The main constraint is that the on-chip memory is limited in size, thus an optimal data management strategy is necessary. This problem is used to find the achievable degree of parallelism for a parallel algorithm, which in a compiler chain proceeding by parallelism reduction will help to fix an appropriate target. Initially we have supposed that we are given a task ordering, so as to study the issue of on-chip memory data management separately from the ordering problem. We have proposed a polynomial algorithm for its resolution. This algorithm relies on Belady’s principle for virtual memory management. We have proposed a branch and bound algorithm for the task ordering and memory management problem and described its building blocks (lower bound, dominance relation etc.). Firstly we have performed computational experiments with randomly generated problem instances. The branch and bound procedure found optimal solution for more than two thirds (67%) of the cases. Afterwards, several tests were done with an image processing algorithm: the image convolution. The branch and bound algorithm was not able to solve instances of image processing algorithms applied on real, high resolution images, because the size of the search space is unimaginably huge for an exact algorithm. However we solved instances with low resolution input images and generalized the results for high resolution images. 5
In Figure 2b a horizontal order is illustrated.
Task Ordering and Memory Management Problem
603
References 1. Allahverdi, A., Ng, C.T., Cheng, T.C.E., Kovalyov, M.Y.: A survey of scheduling problems with setup times or costs. European Journal of Operational Research 187(3), 985–1032 (2008) 2. Belady, L.A.: A study of replacement algorithms for a virtual-storage computer. IBM Systems Journal 5(2), 78–101 (1966) 3. Carpov, S.: Optimisation du préfetch et du parallélisme pour plateforme MPSoC. Master’s thesis, Université de Technologie de Compiègne (2008) 4. Ding, C., Kennedy, K.: Improving cache performance in dynamic applications through data and computation reorganization at run time. SIGPLAN Not. 34(5), 229–241 (1999) 5. Ding, C., Kennedy, K.: Improving effective bandwidth through compiler enhancement of global cache reuse. J. Parallel Distrib. Comput. 64(1), 108–134 (2004) 6. Ding, C., Orlovich, M.: The potential of computation regrouping for improving locality. In: SC 2004: Proceedings of the 2004 ACM/IEEE Conference on Supercomputing, p. 13. IEEE Computer Society, Washington, DC (2004) 7. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York (1979) 8. Gonzalez, R., Woods, R.: Digital Image Processing. Addison-Wesley Longman Publishing Co., Inc., Boston (2001) 9. Gordon, M.I., Thies, W., Amarasinghe, S.: Exploiting coarse-grained task, data, and pipeline parallelism in stream programs. In: Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS-XII, New York, NY, USA, pp. 151–162 (2006) 10. Korte, B., Vygen, J.: Combinatorial Optimization: Theory and Algorithms. Springer, Heidelberg (2002) 11. McKinley, K., Carr, S., Tseng, C.W.: Improving data locality with loop transformations. ACM Trans. Program. Lang. Syst. 18(4), 424–453 (1996) 12. Pingali, V., McKee, S., Hsieh, W.C., Carter, J.: Restructuring computations for temporal data cache locality. Int. J. Parallel Program. 31(4), 305–338 (2003) 13. Strout, M., Carter, L., Ferrante, J.: Compile-time composition of run-time data and iteration reorderings. In: PLDI 2003: Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation, pp. 91–102. ACM, New York (2003) 14. Wolf, M., Lam, M.: A data locality optimizing algorithm. In: PLDI 1991: Proceedings of the ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation (1991)
Computing Majority with Triple Queries Gianluca De Marco1 , Evangelos Kranakis2, , and G´ abor Wiener3, 1
2
Dipartimento di Informatica e Applicazioni, Universit` a di Salerno, 84084 Fisciano (SA), Italy [email protected] School of Computer Science, Carleton University, Ottawa, ON, K1S 5B6, Canada [email protected] 3 Department of Computer Science and Information Theory, Budapest University of Technology and Economics, H-1521, Budapest, Hungary [email protected]
Abstract. Consider a bin containing n balls colored with two colors. In a k-query, k balls are selected by a questioner and the oracle’s reply is related (depending on the computation model being considered) to the distribution of colors of the balls in this k-tuple; however, the oracle never reveals the colors of the individual balls. Following a number of queries the questioner is said to determine the majority color if it can output a ball of the majority color if it exists, and can prove that there is no majority if it does not exist. We investigate two computation models (depending on the type of replies being allowed). We give algorithms to compute the minimum number of 3-queries which are needed so that the questioner can determine the majority color and provide tight and almost tight upper and lower bounds on the number of queries needed in each case. Key Words and Phrases: Search, Balls, Colors, Computation Models, Queries, Pairing model, Y/N model.
1
Introduction
We are given a bin containing n balls colored with two colors, e.g., EK red and blue. At any stage, we can choose any k of the balls and ask the question “do these balls have the same color?”. The aim is to produce a ball of the majority color (meaning that the number of balls with that color is strictly greater than that of the other color), or to state that there is no majority (i.e. there is the same number of red and blue balls) using as few questions as possible. We are considering the worst case problem, that is our aim is to find the number of questions the fastest algorithm uses in the worst case.
Supported in part by NSERC and MITACS grants. Supported in part by the Hungarian National Research Fund and by the National Office for Research and Technology (Grant Number OTKA 67651).
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 604–615, 2011. c Springer-Verlag Berlin Heidelberg 2011
Computing Majority with Triple Queries
Query
Input x 0 x1 ..... xk−1
605
Questioner Q Oracle A
Answer
Fig. 1. A questioner (Q), an oracle (or adversary) (A) and a k-query input
1.1
Model of Computation
In computing the majority there are two participants: a questioner (denoted by Q) and an oracle (or adversary) denoted by A (see Figure 1). The questioner asks questions on the status of the color of the balls by providing the oracle with k balls and the oracle provides a reply which, depending on the type of the oracle, is related to the distribution of colors of the balls concerned. Although the answer of the oracle depends on the k-tuple provided by the questioner, it is otherwise permutation-independent, i.e., the answer is independent of the order of the balls. Moreover, the balls are endowed with distinct identities (say, integers 1, 2, . . . , n). Notice that in the course of querying the questioner is never allowed to see the color of any ball but merely relies on the answer provided by the oracle. Majority Problem. Given n balls of two colors, for a solution to the majority problem we are interested to determine 1. whether or not there is a color occurring in the majority (i.e., more than half) of the balls, and 2. if indeed there is majority, to output a ball having the majority color. In addition, we would like to minimize the number of queries required. Query Models. Next we define two query models which will be considered in the sequel. In each model the input to the oracle is a set {x0 , x1 , . . . , xk−1 } of k balls. 1. Y/N Model: The answer is either yes or no. yes means that all balls have the same color, no means that the balls in the k-tuple do not have the same color. 2. Pairing Model: The answer to a query is either yes or no. yes means that all balls have the same color. no means that not all the balls have the same color and to show this, (any) two balls of different color are also provided. 1.2
Notation qkp (n), qk (n)
Let denote the minimum number of queries which are sufficient to solve the majority problem for n balls colored with two colors using k-queries
606
G. De Marco, E. Kranakis, and G. Wiener
in the Y/N and Pairing models, respectively. It is obvious that qkp (n) ≤ qk (n) (assuming that these numbers exist). 1.3
Related Work
Our study is a natural generalization of the well-known majority problem [1] where at any stage two balls a and b are chosen and the question is “do a and b have the same color?”. It is obvious that q2 (n) = q2p (n) and Saks and Werman [15] showed that q2 (n) = n−ν(n), where ν(n) denotes the number of 1’s in the binary representation of n. Later Alonso, Reingold, and Schott [6] also gave the solution for the average case. Aigner [2,3] introduced several variants and generalizations of the majority problem. In particular, in the (n, k)-majority game one has to show a k-majority ball z (that is, there are at least k balls colored like z), or declare there is no k-majority. Other variations of the majority problem include the case where more than two colors are available. Fisher and Salzberg [11] studied the majority problem when the number of colors is any integer up to n. In this case the majority color is the color such that there are at least n/2+1 balls of that color. They solved the problem by showing that 3n/2 − 2 comparisons are necessary and sufficient. Another natural generalization is the plurality problem where the goal is to identify a ball of the dominant color (i.e., the one occurring more often than any other). In [4] linear upper and lower bounds were given for 3 colors. The currently best result for any number of colors was given in [8]. The authors of [8] studied also the oblivious versions both for the majority and the plurality problem. In oblivious strategies the questioner has to ask all questions in advance before getting any answer from the oracle. Finally, bounds for randomized algorithms can be found in [10,13]. 1.4
Outline and Results of the Paper
Section 2 discusses the problem of existence of a solution to the majority problem in the models proposed. In Section 3 we are considering the Y/N model for k = 3 and give lower and upper bounds for q3 (n) whose difference is between 1 and 3, depending on the residue of n modulo 4. Section 4 investigates the Pairing model. Here we give a general lower bound for qkp (n) and compute the precise value of q3p (n), namely n/2 + 1 if n is even, and q3p (n) = n/2 if n is odd.
2
Existence of Solutions
Before trying to compute qkp (n) and qk (n) we should discuss whether these numbers exist at all, since it may happen that asking all possible queries is not enough for Q to solve the problem. It is clear that n should be at least k and if n = k, then the only possible query is enough in both games for k = 2 and in the Y/N model for k = 3, but not in the other cases. For k ≥ 3 we prove that qk (n) and qkp (n) exist if and only if n ≥ 2k − 2 and n ≥ 2k − 3, respectively.
Computing Majority with Triple Queries
607
Theorem 1. Let k ≥ 3. 1. The number qk (n) exists if and only if n ≥ 2k − 2. 2. The number qkp (n) exists if and only if n ≥ 2k − 3.
3
Y/N Model
It might be worth observing that in the Y/N model while a no answer on a pair of balls tells us that these balls have different colors and consequently they can be discarded by the questioner, when the number of balls is greater than two then a no answer only tells us that there are (at least) two balls of different color. Therefore, if on the one hand it seems more advantageous comparing more balls at a time, on the other hand it is more challenging for the questioner to exploit a less informative no answer. First we give upper bounds and next we discuss lower bounds on the number of queries. We conclude with some examples. 3.1
The Upper Bound
In this section we give an algorithm for solving the majority problem. We start with a straightforward extension of a result of Saks and Werman. Lemma 1. For all n odd we have qk (n) ≤ qk (n − 1). The proof is basically the same as the proof of Saks and Werman for k = 2. Let us now describe our algorithm. Algorithm Majority3 . Let m = n/4. Consider an arbitrary partition of the n balls in m groups G1 , G2 , . . . , Gm of size 4 each and let R be the group of the r ≡ n mod 4 remaining balls. For i = 1, 2, . . . , m, we make all 43 = 4 possible triple queries on the four balls of Gi till we get a yes answer. There are two cases: – (a) for some j we get a yes answer on at least one of the 4 triple queries involving balls of Gj ; – (b) we get always no answers on all the 4m comparisons. In case (a), we can discard all balls contained in G1 , . . . , Gj−1 as they have no effect for determining the majority. Let a, b, and c the three balls in Gj that have the same color. Notice that we also know whether or not the color of the fourth ball d in Gj is the same as the color of the other three balls. The number of queries required up to this point is 4j. From now on, all the remaining n − 4j balls are compared, one at a time, with two balls of identical color, e.g. a and b. It is clear that this way we can count the number of balls colored like a and b and the number of balls colored like a different ball e, if it exists. This will allow us to solve the problem by using a total number of at most 4j + (n − 4j) = n queries.
608
G. De Marco, E. Kranakis, and G. Wiener
In case (b), we have found that there is an equal number of red and blue balls among the 4m balls in G1 ∪ G2 ∪ · · · ∪ Gm . Therefore, in this case, the majority is determined by the remaining r balls in set R. Hence, we have to determine, for every r ∈ {0, 1, 2, 3}, the number q3 (4m + r). We limit our analysis to q3 (4m) and q3 (4m + 2) as, in view of Lemma 1, we have q3 (4m + 1) ≤ q3 (4m) and q3 (4m+3) ≤ q3 (4m+2). If r = 0, the algorithm can already state that there is no majority. If r = 2, the problem reduces to ascertain whether these two remaining balls have the same color (in which case any of them is in the majority) or not (which implies that there is no majority). In order to do so, we compare the 2 remaining balls (call them x and y) with three arbitrary balls a, b, c (one at a time) from G1 . Namely, we perform the following queries: {x, y, a}, {x, y, b} and {x, y, c}. If x and y are identically colored, we obtain a yes (recall that, since we are in case (b), there must be two different balls among a, b, and c); otherwise we always obtain no answers. Therefore, in both cases we can solve the ptoblem using at most 3 additional queries. In conclusion, we have proved the following. Lemma 2. Let n = 4m + r for some r ∈ {0, 1, 2, 3} and m ≥ 1. q3 (4m) ≤ 4m = n; q3 (4m + 1) ≤ 4m = n − 1; q3 (4m + 2) ≤ 4m + 3 = n + 1; q3 (4m + 3) ≤ 4m + 3 = n. The next lemma will be useful in the proof of the lower bound. Lemma 3. With at most one additional comparison, algorithm Majority3 is able to output a number i such that there are i balls of one color and n − i of the other color. 3.2
The Lower Bound
In the sequel, a coloring is a partition (R, B) of the set of balls into two sets R and B, where R is the set of red balls and B the set of blue balls. In this section we will give a lower bound on the number of queries needed to determine the majority. Our aim will be to construct a worst case input coloring for any unknown correct algorithm that solves the majority problem. We use the usual adversary lower bound technique. We say that an adversary’s strategy admits a coloring if such a coloring is consistent with all the answers provided by the adversary. As long as the strategy devised by the adversary admits alternative possible colorings that are consistent with at least two different possible solutions for the majority problem, the algorithm cannot correctly give its output. The goal of the adversary is to maximize, with its strategy of answers, the number of rounds until the algorithm can correctly give its output. We will first consider the case of an even number n of balls. Given a sequence of queries S = (Q1 , . . . , Qt ) and a positive integer i ≤ t, let us define the following property:
Computing Majority with Triple Queries
609
P(i) : for all X ⊆ [n], with |X| = m, there exists j ≤ i such that one of the following conditions hold: (a) Qj ⊆ X; (b) Qj ∩ X = ∅. The adversary’s strategy. The strategy followed by the adversary is defined as follows. To every query Qj , the adversary replies no as far as P(j) does not hold. Let i be the first index for which P(i) holds, if it exists. Then there exists ¯ = [n] − X for a set X ⊆ [n], with |X| = m, such that Qj ⊆ X and Qj ⊆ X j = 1, 2, . . . , i − 1 (this is because i is the smallest index such that P(i) holds), ¯ (these are conditions (a) and (b) on P(i)). and either Qi ⊆ X or Qi ⊆ X From this point forth, the adversary replies yes to Qi and all subsequent queries ¯ and replies {a, b, c} if all three elements a, b, c belong to the same set X or X, no to all the other queries. Lemma 4. Let n = 2m for some m > 1. Any algorithm that solves the majority problem on n balls uses at least n − 1 queries. Proof. Assume that Q1 , . . . , Qt is the sequence of queries that the algorithm produces before giving its output. We distinguish two main cases: either P(t) does not hold or P(t) holds. Case 1: P(t) does not hold. In this case there exists X ⊆ [n], with |X| = m, such that for all queries Q1 , . . . , Qt neither (a), nor (b) holds. According to its strategy, the adversary replies always no in this case. If the algorithm states that there is a majority, the algorithm actually has to show a ball in X or in [n] \ X. The adversary’s strategy admits the following coloring: color red all the balls in X and blue all the remaining balls. Indeed, such a coloring is consistent with all the no answers provided by the adversary, as since property P(t) does not hold, there is no query entirely contained in X ¯ This means that there is no majority, which contradicts the algorithm. or in X. Let us assume the algorithm states that there is no majority. Suppose that ¯ ∪ {x} for every i = 1, 2, . . . , t. In this there exists a ball x in X such that Qi ⊆ X case, the adversary’s strategy allows us to produce the following coloring: color ¯ ∪{x} and blue the others. Indeed, it is easy to observe that, red all the balls in X ¯ ∪ {x} for every i = 1, 2, . . . , t, such a coloring is consistent with the since Qi ⊆ X no answers provided by the adversary to each Qi for i = 1, 2, . . . , t. This implies that there is a majority: once again the claim of the algorithm is contradicted. ¯ such that Qi ⊆ X ∪ {x} for every The case in which there exists a ball x in X i = 1, 2, . . . , t, is similar. It remains to analyze the case when both the following conditions hold: (1) for every x ∈ X there exists a query Qi for some i ∈ {1, 2, . . . , t}, such ¯ ∪ {x}; that Qi ⊆ X ¯ there exists a query Qi for some i ∈ {1, 2, . . . , t}, such (2) for every x ∈ X that Qi ⊆ X ∪ {x}. Condition (1) implies that the sequence of queries Q1 , Q2 , . . . , Qt must contain ¯ Analogously, a query {x, x1 , x2 } for every x ∈ X and for some x1 , x2 ∈ X. ¯ condition (2) implies that there must be a query {x , x1 , x2 } for every x ∈ X and for some x1 , x2 ∈ X. Since all these queries are clearly distinct, t ≥ 2m = n.
610
G. De Marco, E. Kranakis, and G. Wiener
Case 2: P(t) holds. In this case, the adversary replies no to all the queries Qj , as far as P(j) does not hold, and replies yes to the first query Qi for which P(i) holds. Since P(i) holds, while for j = 1, 2, . . . , i − 1 P(j) does not hold, ¯ and there exists X ⊆ [n], |X| = m, such that either Qi ⊆ X or Qi ⊆ X, ¯ for j = 1, 2, . . . , i − 1. Qj ⊆ X and Qj ⊆ X
(1)
In the following, we assume without loss of generality that Qi ⊆ X. Notice that this time the adversary’s strategy admits any coloring consistent with all the no answers given to Q1 , Q2 , . . . , Qi−1 and the yes answer to Qi . If the algorithm concludes that there is a majority, it can be easily contradicted by observing that the adversary’s strategy admits a coloring that colors red all the balls in X and blue all the others. Therefore, suppose the algorithm states that there is no majority. If there ¯ such that for every j = 1, 2, . . . , i, exists a ball x ∈ X \ Qi (resp. y ∈ X) ¯ ∪{x} (resp. Qj ⊆ X ∪{y}), the adversary’s strategy admits the following Qj ⊆ X ¯ \ {y}) and blue the balls in coloring. Color red all the balls in X \ {x} (resp. X ¯ ∪ {x} (resp. X ∪ {y}), so to have a majority in the latter set. This contradicts X the algorithm’s claim. It remains to analyze only the case when both the following conditions hold: (1*) for every x ∈ X \ Qi there is a query Qj for some j ∈ {1, 2, . . . , i − 1}, ¯ ∪ {x}; such that Qj ⊆ X ¯ there is a query Qj for some j ∈ {1, 2, . . . , i − 1}, such (2*) for every y ∈ X that Qj ⊆ X ∪ {y}. Let F1 and F2 be the set of queries necessary for (1*) and (2*) to be satisfied, respectively. Condition (1*) implies that the sequence of queries Q1 , Q2 , . . . , Qi−1 ¯ must contain at least a query {x, y, z} for every x ∈ X \Qi and for some y, z ∈ X. Condition (2*) implies that there must be also at least a query {x , y , z } for ¯ and for some y , z ∈ X. Therefore, every x ∈ X |F1 | + |F2 | ≥ 2m − 3.
(2)
In order to estimate the total number of queries, we need also to consider the set F3 of queries that involve balls in Qi = {a, b, c} and are not considered in F1 and F2 . The query Qi clearly belongs to F3 , so |F3 | ≥ 1.
(3)
Now we have to distinguish two cases. ¯ and y, z ∈ Qi . In Case (i): there is no query Q = {x, y, z}, such that x ∈ X this case, F3 must contain at least another query Q that contains some element ¯ otherwise the adversary’s strategy would from {a, b, c} and two elements from X, ¯ ∪ {a, b, c} are red, which would imply admit a coloring where all the balls in X the existence of a majority in this set. Hence, F3 ≥ 2 and by (2) the total number of queries is |F1 | + |F2 | + |F3 | ≥ 2m − 1. ¯ and y, z ∈ Qi . Case (ii): there exists a query Q = {x, y, z} such that x ∈ X ¯ Let s be the number of queries involving one ball from Qi and two balls from X.
Computing Majority with Triple Queries
611
We may assume that s < 2, otherwise |F3 | ≥ s + 1 ≥ 2 and the proof would be complete. If s < 2, we must have that (*) there exist two balls a and b in Qi such that there is no query involving a ¯ or b with two balls from X. ¯ and y, z ∈ Qi . By (*) we have Let us consider x, y, z ∈ Q and recall that x ∈ X that (**) there exists a ball v ∈ {y, z} ⊆ Qi such that there is no query {v, w1 , w2 } ¯ with w1 , w2 ∈ X. Moreover, since we are assuming that |F1 |+|F2 | = 2m−3, condition (2*) implies that ¯ there is exactly one query Qx = {x, yx , zx } that includes (***) for every x ∈ X x and some yx , zx ∈ X. Let Y = X \ {v} ∪{x}. We will show that there is no query among Q1 , Q2 , . . . , Qi that is entirely contained in Y or Y¯ , which contradicts the hypothesis that P(t) holds with i being the smallest index such that for all X ⊆ [n], with ¯ |X| = m, there exists j ≤ i such that either Qj ⊆ X or Qj ⊆ X. ¯ Since now x ∈ Y and v ∈ Y , we can easily verify that Qi ⊆ Y and Qi ⊆ Y¯ . It remains to show that no query among Q1 , Q2 , . . . , Qi−1 is entirely contained in Y or Y¯ . As a consequence of (**), there is no query involving v entirely contained in ¯ and two balls Y¯ . Moreover, by (***) Q must be the only query involving x ∈ X in X. Hence, there is no query involving x entirely contained in Y . Let Q be the set of remaining queries to analyze, i.e. the queries not involving v nor x. By the definition of Y and Q, it is straightforward to observe that for all Q ∈ Q, Q ⊆ Y ¯ Therefore, since i is the (resp. Q ⊆ Y¯ ) if and only if Q ⊆ X (resp. Q ⊆ X). smallest index such that P(i) holds, there is no query in Q entirely included in Y or in Y¯ . This is a contradiction and the proof is now complete. Lemma 5. For all n odd we have q3 (n) ≥ n − 3. The proof is based on Lemmas 3 and 4. Now we can state the main result in the following theorem. Theorem 2. Let n = 4m + r for some r ∈ {0, 1, 2, 3} and m ≥ 1. We have: n − 1 ≤ q3 (4m) ≤ n; n − 3 ≤ q3 (4m + 1) ≤ n − 1; n − 1 ≤ q3 (4m + 2) ≤ n + 1; n − 3 ≤ q3 (4m + 3) ≤ n. Proof. The proof follows immediately by combining Lemma 2 with Lemmas 4 and 5. Tightening the bounds of Theorem 2 so as to compute the exact value of q3 (n) does not seem to be easy, but we can show that q3 (4) = q3 (5) = 4 and q3 (6) = 7.
612
4
G. De Marco, E. Kranakis, and G. Wiener
Pairing Model
In this section we focus on the Pairing model. First we prove a lower bound on k-tuples that does not depend on k and then show that the bound is tight for k = 3. 4.1
A General Lower Bound
First we prove a lemma. Lemma 6. Let n ≥ 2k − 3, k ≥ 3. Then n/2 + 1 if n is even, and qkp (n) ≥ n/2 if n is odd. Proof. First we describe a strategy for the Adversary which guarantees that the number of queries the questioner should use is at least n/2 if n is odd. The strategy is quite simple, A always answers no whenever it is possible, that is, if it is not known before the query that all k balls asked have the same color (in which case the answer is yes, of course, but such a question will never be asked). A also has to show two balls of different color; these can be any pair of balls that may have different color before the query. To see that Q has to use at least n/2 queries even against this simple strategy, we use graphs to describe the knowledge of Q (this is the same graph we use in the proof of Theorem 1). In ths Pairing model to every negative answer of A there corresponds a pair of balls having different colors. Let these pairs be the edges of a graph G, whose vertices are the balls. By the strategy of A there exists a coloring of the balls (with colors blue and red) such that there is no edge between two balls of the same color; therefore the graph G is bipartite. Suppose now that Q can show a ball of majority color. This is possible if and only if there is a vertex x of G that always appears in the greater part in every bipartition of G. (Notice that now there is a majority color, since n is odd.) Now it is easy to see that G has at least n/2 edges thus the number of queries is also at least n/2. Now we slightly modify the above strategy to obtain the lower bound for n even. Q can declare that there is no majority if and only if in every bipartition of G the two parts have the same size, which is impossible if there is an isolated vertex in G. Suppose that A answers the first n/2 − 1 questions the same way as above. We consider two cases. Case 1. The edges of G after the n/2 − 1 queries are not independent. Now the answer to the next query is also answered the same way as above. Since there is an isolated vertex in G (we have n/2 edges that are not independent), Q cannot declare that there is no majority. Moreover, no vertex x can always appear in the greater part in every bipartition of G, because there are only n/2 edges in G (in the part where such an x would appear, there would be at least n/2 + 1 non-isolated vertices). This completes the proof in Case 1.
Computing Majority with Triple Queries
613
Case 2. The edges of G after the n/2 − 1 queries are independent. Now A has to be careful, since an edge between the two remaining isolated vertices would guarantee that there is no majority. So the edge is drawn somewhere else, which is possible, because k ≥ 3 and there is no cycle in G (that is, A may draw the edge between any two of the k vertices of the query). Now the situation is the same as in Case 1. This completes the proof. 4.2
Determining q3p (n)
Now we prove that the bound we have just proved in Lemma 6 is tight for k = 3. This is interesting because of several reasons. The strategy of A that gave the lower bound is quite simple and the lower bound is much smaller than the value of q2 (n) (as well as q3 (n)). However, the most surprising is that the function q3p is not increasing, since q3p (2n) = n+ 1 and q3p (2n + 1) = n. Actually, we have seen that qk is not strictly increasing and the same proof shows that the same is true for qkp : qkp (2n + 1) ≤ qkp (2n) and qk (2n + 1) ≤ qk (2n). Nevertheless, a complexity function that is not even increasing is quite unusual in search theory. The main theorem of this section is the following. Theorem 3. Let n ≥ 3. Then n/2 + 1 if n is even, and q3p (n) = n/2 if n is odd. Proof. We just have to show that the bounds in Lemma 6 are tight, that is, give an algorithm for the questioner Q that uses n/2 + 1 queries if n is even and n/2 queries if n is odd. The algorithm consists of two main parts of which the first is the formation of bins with balls and is similar to the one in [15]. Initially place all the n balls in n different bins and at each step do the following. 1. Select any 3 equal size bins and pick one representative from each of them and query these 3 balls. 2. If the answer is yes, then merge the bins into one new bin. 3. If the answer is no, then A specifies two balls of different colors. Remove the two corresponding bins. 4. Iterate the process until there are no 3 bins of equal size. It is obvious that all remaining bins have size a power of 3. The process stops because we can no longer find 3 bins of equal size, that is, each bin size occurs at most twice. It is easy to check that to build a bin of size 3c the questioner Q needs (3c − 1)/2 queries, while to remove two bins of size 3c each, the questioner Q needs exactly 3c queries. Thus if the total number of removed balls is 2t, then Q used t queries in order to get rid of them. This means that after the first main step of the algorithm, Q has n − 2t balls in bins whose sizes are powers of 3, bin sizes occur at most twice and Q used t queries to remove the 2t balls and (3c − 1)/2 queries to build a bin of size 3c .
614
G. De Marco, E. Kranakis, and G. Wiener
In other words, if the bin size 3i occurs ai times (i = 0, 1, 2) then the sequence as , as−1 , . . . , a0 is the ternary expansion of n − 2t (where s = log3 (n − 2t)) and s Q used t + i=0 ai (3i − 1)/2) queries altogether. It is obvious that if as = 0 (which occurs iff n − 2t = 0), then there is no majority, if as = 1, then the corresponding bin contains majority type balls, while if as = 2, then Q cannot show a majority type ball, neither can prove that there is no majority at the moment, so we may suppose that as = 2 (otherwise s i we are done, since 2t + i=0 ai (3 − 1) ≤ n, so for the number of queries we have s i that t + i=0 ai (3 − 1)/2) ≤ n/2). Now starts the second part of the algorithm, where Q tries to eliminate the remaining bins. If s > 0, then Q chooses one ball from both bins of size 3s and a third ball from one of these bins and queries this triple. Given the answer, Q learns if the two biggest bins have balls of the same color or not. If the answer is yes, then all balls in these two bins are clearly in majority, if the answer is no, then Q removes the two bins. Iterate this process if necessary (if the greatest bin size occurs twice), until it is possible, that is, while s > 0. To remove two bins of size 3c each, Q still needs exactly 3c queries, therefore it is clear that at the end of the second part Q can either solve the problem (that is, find a majority ball or show that there is no majority) using at most n/2 queries or Q has just two bins of size 1 and used exactly (n − 2)/2 queries to reach this position (which is possible only if n is even). Now to finish the algorithm and the whole proof let the two remaining balls be a and b and let c and c be two balls of different color (such balls exist and are known to Q , since n ≥ 3 and n is even). Now Q queries the balls a, b, c. If the answer is yesor the answer is noand the two differently colored balls shown by A is a and b, then Q can solve the problem using n/2 queries altogether. If the answer is noand the two different balls shown by A are not a and b, then Q queries the balls a, b, c , thus solving the problem using n/2 + 1 queries altogether. This completes the proof of Theorem 3.
5
Conclusion
In this paper we studied the minimum number of triple queries needed to determine the majority color in a set of n colored balls (colored with two colors) under two models a) Y/N, and b) Pairing, which depend on the type of queries being allowed. In addition to tightening the bounds for the majority problem in the Y/N model, several interesting questions remain open for further investigation, including computing majority on a) k-tuple queries, for some fixed k, b) bins with balls colored with more than two colors, as well as c) other natural computation models.
References 1. Aigner, M.: Combinatorial Search. Wiley, Chichester (1988) 2. Aigner, M.: Two colors and more. Entropy, Search, Complexity Bolyai Society Mathematical Studies 16, 9–26 (2007)
Computing Majority with Triple Queries
615
3. Aigner, M.: Variants of the majority problem. Discrete Applied Mathematics 137(1), 3–26 (2004) 4. Aigner, M., De Marco, G., Montangero, M.: The plurality problem with three colors. In: Diekert, V., Habib, M. (eds.) STACS 2004. LNCS, vol. 2996, pp. 513– 521. Springer, Heidelberg (2004) 5. Alonso, L., Reingold, E.M., Schott, R.: Determining the majority. Information Processing Letters 47, 253–255 (1993) 6. Alonso, L., Reingold, E.M., Schott, R.: The average-case complexity of determining the majority. SIAM Journal on Computing 26, 1–14 (1997) 7. Alonso, L., Chassaing, P., Reingold, E.M., Schott, R.: The chip problem (preprint), http://emr.cs.uiuc.edu/$\sim$reingold/chips.ps 8. Chung, F.R.K., Graham, R.L., Mao, J., Yao, A.C.: Oblivious and adaptive strategies for the Majority and Plurality problems. In: Wang, L. (ed.) COCOON 2005. LNCS, vol. 3595, pp. 329–338. Springer, Heidelberg (2005) 9. De Marco, G., Pelc, A.: Randomized algorithms for determining the majority on graphs. In: Rovan, B., Vojt´ aˇs, P. (eds.) MFCS 2003. LNCS, vol. 2747, pp. 368–377. Springer, Heidelberg (2003) 10. Dvoˇr´ ak, Z., Jel´ınek, V., Kr´ al, D., Kynˇcl, J., Saks, M.: Probabilistic strategies for the partition and plurality problems. Random Structures and Algorithms 30, 63–77 (2007) 11. Fisher, M., Salzberg, S.: Finding a majority among n votes. Journal of Algorithms 3, 375–379 (1982) 12. K˝ onig, D.: Graphen und Matrizen. Math. Fiz. Lapok 38, 116–119 (1931) 13. Kr´ al, D., Sgall, J., Tich` y, T.: Randomized Strategies for the plurality problem. Discrete Applied Mathematics 156, 3305–3311 (2008) 14. Preparata, F.P., Metze, G., Chien, R.T.: On the connection assignment problem of diagnosable systems. IEEE Trans. on Electronic Computers 16, 848–854 (1967) 15. Saks, M.E., Werman, M.: On computing majority by comparisons. Combinatorica 11, 383–387 (1991) 16. Wiener, G.: Search for a majority element. Journal of Statistical Planning and Inference 100, 313–318 (2002)
A New Variation of Hat Guessing Games Tengyu Ma1 , Xiaoming Sun2, , and Huacheng Yu1 1
Institute for Theoretical Computer Science, Tsinghua University 2 Institute for Advanced Study, Tsinghua University [email protected]
Abstract. Several variations of hat guessing games have been popularly discussed in recreational mathematics. In a typical hat guessing game, after initially coordinating a strategy, each of n players is assigned a hat from a given color set. Simultaneously, each player tries to guess the color of his/her own hat by looking at colors of hats worn by other players. In this paper, we consider a new variation of this game, in which we require at least k correct guesses and no wrong guess for the players to win the game, but they can choose to “pass”. A strategy is called perfect if it can achieve the simple upper bound n of the winning probability. We present sufficient and necessary conn+k dition on the parameters n and k for the existence of perfect strategy in the hat guessing games. In fact for any fixed parameter k, the existence of a perfect strategy for (n, k) is open for only a few values of n. In our construction we introduce a new notion: (d1 , d2 )-regular partition of the boolean hypercube, which is worth to study in its own right. For example, it is related to the k-dominating set of the hypercube. It also might be interesting in coding theory. The existence of (d1 , d2 )regular partition is explored in the paper and the existence of perfect k-dominating set follows as a corollary. Keywords: Hat guessing game; perfect strategy; hypercube; kdominating set; perfect code.
1
Introduction
Several different hat guessing games have been studied in recent years [1–6, 8–11]. In this paper we investigate a variation where players can either give a guess or pass. This model was first proposed by Ebert in [4]. In a standard setting there are n players sitting around a table, who are allowed to coordinate a strategy before the game starts. In the game each player is assigned a hat whose color is chosen randomly and independently with probability 1/2 from two possible colors, red and blue. Each player is allowed to see all the hats but his own.
This work was supported in part by the National Natural Science Foundation of China Grant 60603005, 61061130540, the National Basic Research Program of China Grant 2007CB807900, 2007CB807901, and Tsinghua University Initiative Scientific Research Program 2009THZ02120. Corresponding author.
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 616–626, 2011. c Springer-Verlag Berlin Heidelberg 2011
A New Variation of Hat Guessing Games
617
Simultaneously, each player guesses its own hat color or passes, according to their pre-coordinated strategy. If at least one player guesses correctly and no player guesses wrong, players win the game. Their goal is to design a strategy to maximize their winning probability. By a simple counting argument there is an upper bound on the maximum winning probability, n/(n + 1). It is known that this upper bound is achieved if and only if n has the form 2t − 1 [4]. It turns out that the existence of such perfect strategy that achieves the upper bound corresponds to the existence of a perfect 1-bit error-correcting code in {0, 1}n. In this paper, we present a natural generalization of Ebert’s hat guessing problem: The setting is the same as in the original problem, every player can see all other hats except his own, and is allowed to guess or pass. However, the requirement for them to win the game is generalized to be that at least k players from them should guess correctly, and no player guesses wrong (1 ≤ k ≤ n). Note that when k = 1, it is exactly the original problem. We denote by Pn,k the maximum winning probability for the problem with n players when at least k correct guesses are required. Similarly to the k = 1 n case, Pn,k has a simple upper bound Pn,k ≤ n+k . We call a pair (n, k) perfect if n this upper bound can be achieved, i.e. Pn,k = n+k . There is a simple necessary condition for a pair (n, k) to be perfect, and our main result states that this condition is almost sufficient: Theorem 1. For any d, k, s ∈ N with s ≥ k + log k − 1, (d(2s − k), dk) is perfect, in particular, (2s − k, k) is perfect. There exists pair (n, k) with the necessary condition but not perfect, see the Remark in Section 4. Here is the outline of the proof: first we give a general characterization of the winner probability Pn,k by using the size of the minimum k-dominating set of the hypercube. Then we convert the condition of (n, k) perfect to some kind of regular partition of the hypercube (see the definition in Section 2). Our main contribution is that we present a strong sufficient condition for the existence of such partition, which nearly matches the necessary condition. Then we can transform it into a perfect hat guessing strategy. As a corollary of Theorem 1, we also give asymptotic characterization of the value Pn,k . For example, we show that for any fixed k, the maximum winning probability approaches 1 as n tends to the infinity. Related work Feige [5] considered some variations including the discarded hat version and the everywhere balanced version. Lenstra and Seroussi [9] studied the case that n is not of form 2m − 1, they also considered the case with multiple colors. In [3], Butler, Hajiaghayi, Kleinberg and Leighton considered the worst case of hat placement with sight graph G, in which they need to minimize the maximum wrong guesses over all hat placements. In [6] Feige studied the case that each player can see only some of other players’ hats with respect to the sight graph G. In [10], Paterson and Stinson investigated the case that each player can see
618
T. Ma, X. Sun, and H. Yu
hats in front of him and they guess one by one. Very recently, Buhler, Butler, Graham and Tressler [2] studied the case that every player needs to guess and the players win the game if either exactly k1 or k2 players guess correctly, they showed that the simple necessary condition is also sufficient in this game. The rest of the paper is organized as follows: Section 2 describes the definitions, notations and models used in the paper. Then, Section 3 presents the result of the existence of (d1 , d2 )-regular partition of hypercube while Section 4 shows the main result of the hat guessing game. Finally, we conclude the paper in Section 5 with some open problems.
2
Preliminaries
We use Qn to denote the the n dimension boolean hypercube {0, 1}n. Two nodes are adjacent on Qn if they differ by only one bit. We encode the blue and red color by 0 and 1. Thus the placement of hats on the n players’ heads can be represented as a node of Qn . For any x ∈ Qn , x(i) is used to indicate the string obtained by flipping the ith bit of x. Throughout the paper, all the operations are over F2 . We will clarify explicitly if ambiguity appears. Here is the model of the hat guessing game we consider in this paper: The number of players is denoted by n and players are denoted by p1 , . . . , pn . The colors of players’ hats will be denoted to be h1 , . . . , hn , which are randomly and independently assigned from {0, 1} with equal probability. h = (h1 , . . . , hn ). Let h−i ∈ Qn−1 denote the tuple of colors (h1 , . . . , hi−1 , hi+1 , . . . , hn ) that player pi sees on the others’ heads. The strategy of player pi is a function si : Qn−1 → {0, 1, ⊥}, which maps the tuple of colors h−i to pi ’s answer, where ⊥ represents pi answers “pass” (if some player answers pass, his answer is neither correct nor wrong). A strategy S is a collection of n functions (s1 , . . . , sn ). The players win the game if at least k of them guess correctly and no one guesses wrong. We use Pn,k to denote the maximum winning probability of the players. The following two definitions are very useful in characterization Pn,k : Definition 1. A subset D ⊆ V is called a k-dominating set of graph G = (V, E) if for every vertex v ∈ V \ D, v has at least k neighbors in D. Definition 2. A partition (V1 , V2 ) of hypercube Qn is called a (d1 , d2 )-regular partition if each node in V1 has exactly d1 neighbors in V2 , and each node in V2 has exactly d2 neighbors in V1 . For example, consider the following partition (V1 , V2 ) of Q3 : V1 = {000, 111}, and V2 = Q3 \ V1 . For each vertex in V1 , there are 3 neighbors in V2 , and for each vertex in V2 , there is exactly one neighbor in V1 . Thus (V1 , V2 ) forms a (3, 1)-regular partition of Q3 .
3
(d1 , d2 )-Regular Partition of Qn
In this section we study the existence of (d1 , d2 )-regular partition of Qn .
A New Variation of Hat Guessing Games
619
Proposition 1. Suppose d1 , d2 ≤ n, if there exists a (d1 , d2 )-regular partition of hypercube Qn , then the parameters d1 , d2 , n should satisfy d1 +d2 = gcd(d1 , d2 )2s for some s ≤ n. Proof. Suppose the partition is (V1 , V2 ), we count the total number of vertices |V1 | + |V2 | = 2n , and the number of edges between two parts d1 |V1 | = d2 |V2 | . By solving the equations, we obtain |V1 | =
d2 d1 2n , |V2 | = 2n . d1 + d2 d1 + d2
Both |V1 | and |V2 | should be integers, therefore d1 + d2 = gcd(d1 , d2 )2s holds, since gcd(d1 , d1 + d2 ) = gcd(d2 , d1 + d2 ) = gcd(d1 , d2 ). Proposition 2. If there exists a (d1 , d2 )-regular partition of hypercube Qn , then there exists a (d1 , d2 )-regular partition of Qm for every m ≥ n. Proof. It suffices to show that the statement holds when m = n + 1, since the desired result follows by induction. Qn+1 can be treated as the union of two (1) copies of Qn (for example partition according to the last bit), i.e. Qn+1 = Qn ∪ (2) (1) Qn . Suppose (V1 , V2 ) is a (d1 , d2 )-regular partition of Qn . We can duplicate (2) the partition (V1 , V2 ) to get another partition (V1 , V2 ) of Qn . Then we can see that (V1 ∪ V1 , V2 ∪ V2 ) forms a partition of Qn+1 , in which each node has an edge to its duplicate through the last dimension. Observe that each node in V1 (V1 ) still has d1 neighbors in V2 (V2 ) and same for V2 (V2 ), and the new edges introduced by the new dimension are among V1 and V1 , or V2 and V2 , which does not contribute to the edges between two parts of the partition. Therefore we constructed a (d1 , d2 )-regular partition of Qn+1 . Proposition 3. If there exists a (d1 , d2 )-regular partition of Qn , then there exists (td1 , td2 )-regular partition of Qtn , for any positive integer t. Proof. Suppose (V1 , V2 ) is a (d1 , d2 )-regular partition of Qn . Let x = x1 x2 · · · xnt be a node in Qnt . We can divide x into n sections of length t, and denote the sum of ith section by wi , i.e. wi (x) =
ti
xj , (1 ≤ i ≤ n).
j=ti−t+1
Let R(x) = w1 (x)w2 (x) . . . wn (x) ∈ Qn . Define Vi = {x ∈ Qnt |R(x) ∈ Vi }, (i = 1, 2).
620
T. Ma, X. Sun, and H. Yu
We claim that (V1 , V2 ) is a (td1 , td2 )-regular partition of Qnt . This is because for any vertex x in V1 , R(x) is in V1 . So R(x) has d1 neighbors in V2 , and each of which corresponds t neighbors of x in V2 , thus in total td1 neighbors in V2 . It is the same for vertices in V2 . By Proposition 1-3 we only need to consider the existence of (d1 , d2 )-regular partition of Qn where gcd(d1 , d2 ) = 1 and d1 + d2 = 2s (where s ≤ n), or equivalently, the existence of (d, 2s − d)-regular partition of Qn , where s ≤ n and d is odd. The following Lemma from [2] showed that when n = 2s − 1 such regular partition always exists. Lemma 1. [2] There exists a (t, 2s − t)-regular partition of Q2s −1 , for any integer s, t with 0 < t < 2s . The following theorem shows how to construct the (t, 2s − t)-regular partition for n = 2s − r (where r ≤ t). Theorem 2. Suppose there exists a (t, 2s − t)-regular partition for Q2s −r and t > r, then there exists a (t, 2s+1 − t)-regular partition for Q2s+1 −r−1 . Proof. For convenience, let m = 2s − r. Suppose that (V1 , V2 ) is a (t, 2s − t)regular partition for Qm . Observer that 2s+1 − (r + 1) = 2m + r − 1. We want to construct a (t, 2s+1 − t)-regular partition for Q2m+r−1 . The basic idea of the construction is as follows: We start from set V2 . We construct a collection of linear equation systems, each of which corresponds to a node in V2 . The variables of the linear systems are the (2m + r − 1) bits of node x ∈ Q2m+r−1 . Let V2 be the union of solutions of these linear equation systems, and V1 be the complement of V2 . Then (V1 , V2 ) is the (t, 2s+1 − t)-regular partition as we desired. Here is the construction. Since (V1 , V2 ) is a (t, 2s − t) regular partition for Qm , the subgraph induced by V2 of Qm is a (t − r)-regular bipartite graph, i.e. for every node p ∈ V2 , there are (t − r) neighbors of p in V2 . By Hall’s theorem [7], we can find a perfect matching of nodes in V2 . For each p ∈ V2 , suppose q is the corresponding node of p in the matching. Let I(p) be the index of bit at which p and q are different. Note that in this case I(p) = I(q). Now for each node p = (p1 , . . . , pm ) ∈ V2 , we construct a linear equation system as follows: ⎧ ⎪ ⎪x1 + x2 = p1 , ⎪ ⎪ ⎪ ⎪x3 + x4 = p2 , ⎨ (1) ... ... ..., ⎪ ⎪ ⎪ x2m−1 + x2m = pm , ⎪ ⎪ ⎪ r−1 ⎩ m x j=1 2j−1 + x2I(p) + j=1 x2m+j = 0. Note that all variables xi and the addition operations are over F2 . Denote by S(p) ⊆ Q2m+r−1 the solutions of this linear system. For convenience, let f : Q2m+r−1 → Qm be the operator such that f (x1 , . . . , x2m+r−1 ) = (x1 + x2 , x3 + x4 , . . . , x2m−1 + x2m ).
A New Variation of Hat Guessing Games
621
Then in the linear system (1) the first m equations is nothing but f (x) = p. Let V2 = p∈V2 S(p), and V1 = Q2m+r−1 \ V2 be its complement. We claim that (V1 , V2 ) is a (t, 2s+1 − t)-regular partition of Q2m+r−1. To begin with, observe the following two facts. Observation 1. For every x ∈ V2 , we have f (x) ∈ V2 . It can be seen clearly from the first m equations in each equation system. Observation 2. If k ≤ 2m, then f (x(2k) ) = f (x(2k−1) ) = (f (x))(k) . If k > 2m, f (x(k) ) = f (x). Recall the x(i) is the node obtained by flipping the ith bit of x. The observation can be seen from the definition of f (x). For any node x ∈ V1 , we show that there are t different ways of flipping one bit of x so that we can get a node in V2 . There are two possible cases: Case 1: f (x) ∈ V2 . In this case if we flip the ith bit of x for some i > 2m, then from Observation 2, f (x(i) ) = f (x), so f (x(i) ) will remain not in V2 , and therefore x(i) will not be in V2 , by Observation 1. So we can only flip the bit in {x1 , . . . , x2m }. Suppose by flipping the ith bit of x we get x(i) ∈ V2 (i ∈ [2m]), from the definition of V2 we have : f (x(i) ) ∈ V2 , and x(i) satisfies the last equation in the equation systems corresponding to f (x(i) ): m
(i)
(i)
x2j−1 + x2I(f (x(i) )) +
j=1
r−1
(i)
x2m+j = 0.
(2)
j=1
Since f (x) ∈ / V2 and (V1 , V2 ) is a (t, 2s − t)-regular partition of Qm , so there are exactly t neighbors of f (x) in V2 , which implies there are t bits of f (x) we can flip to get a node in V2 . Let {j1 , . . . , jt } ⊆ [m] be these bits, i.e. f (x)(j1 ) , . . . , f (x)(jt ) ∈ V2 , by Observation 2, f (x(2jk −1) ) = f (x(2jk ) ) = f (x)(jk ) ∈ V2 , (k = 1, . . . , t). But exactly one of {x(2jk −1) , x(2jk ) } satisfies the equation (2) (here we use the fact f (x) ∈ / V2 , then jk = I(f (x)(jk ) )). Thus totally, there are t possible i’s such (i) that x ∈ V2 . Case 2: f (x) ∈ V2 . Since x ∈ / V2 , the last linear equation must be violated, i.e. m j=1
x2j−1 + x2I(f (x)) +
r−1
x2m+j = 1.
(3)
j=1
We further consider three cases here: flip a bit in {x1 , . . . , x2m } \ {x2I(f (x)) , x2I(f (x))−1 }; flip a bit in {x2I(f (x)) , x2I(f (x))−1 }; flip a bit in {x2m+1 , . . . , x2m+r−1 }: / V2 , both x(2i) and x(2i−1) will be in V1 a) if i ∈ [m] , i = I(f (x)). If f (x)(i) ∈ since first m equations cannot be satisfied. Otherwise, since (V1 , V2 ) is a (t, 2s −t)regular partition of Qm , there are m−(2s −t)−1 = (2s −r)−(2s −t)−1 = t−r−1 such index i. Note that for all such i’s, exactly one of x(2i−1) and x(2i) is in V2 ,
622
T. Ma, X. Sun, and H. Yu
depending on the value of Equation 3 for f (x)(i) . x(2i) ∈ V2 if it is originally 0, x(2i−1) ∈ V2 if it is originally 1. This is based on the fact that I(f (x)(i) ) = i. Thus in this case there are (t − r − 1) neighbors of x in V2 . b) if i = I(f (x)), then both of x(2i−1) , x(2i) are in V2 , since I(f (x)(i) ) = i in this case. There are 2 such neighbors. c) if i > 2m, then every x(i) is in V2 , there are r − 1 such neighbors. Hence, totally x has (t − r − 1) + 2 + r − 1 = t neighbors in V2 . The rest thing is to show that every node x ∈ V2 has (2s+1 − t) neighbors in The proof is similar to the proof of Case 2 above, we consider three cases: a) If i ∈ [m], i = I(f (x)), and f (x)(i) ∈ V2 . Then exactly one of x(2k−1) , x(2k) in V2 , thus there are m − (2s − t) − 1 = 2s − r − (2s − t) − 1 = t − r − 1 such neighbors of x in V2 . b) If i = I(f (x)) both x(2i−1) , x(2i) are not in V2 . c) If i > 2m, then every x(i) is not in V2 . Hence totally, x has (t − r − 1) neighbors in V2 , and therefore (2m + r − 1) − (t − r − 1) = 2s+1 − t neighbors in V1 . Hence we prove that (V1 , V2 ) is indeed a (t, 2s+1 − t)-regular partition of Q2s+1−r−1 . V1 .
Theorem 3. For any odd number t and any 0 < c ≤ t, when s ≥ log t + c − 1, there exists a (t, 2s − t)-regular partition of Q2s −c . Proof. Let s0 = s − c + 1. Note that we have 2s0 > t > 0, by Lemma 1, there exists a (t, 2s0 −t)-regular partition of Q2s0 −1 . By repeatedly using Theorem 2, we obtain that there exists (t, 2s0 +1 − t)-regular partition of Q2s0 +1 −2 , (t, 2s0 +2 − t)regular partition of Q2s0 +2 −3 . Finally we get a (t, 2s0 +c−1 − t)-regular partition of Q2s0 +c−1 −c , which is just a (t, 2s − t)-regular partition of Q2s −c . Combining Proposition 2, Proposition 3 and Theorem 3, we have the following corollary. Corollary 1. Suppose d1 = dt, d2 = d(2s − t), n = d(2s − c), where d, t, s are positive integers with 0 < t < 2s , c ≤ t and s ≥ log t + c − 1, then there exists a (d1 , d2 )-regular partition for Qn .
4
The Maximum Winning Probability Pn,k
The following lemma characterizes the relationship between the maximum winner probability Pn,k and the minimum k-dominating set of Qn . The same result was showed in [6] for k = 1. Lemma 2. Suppose D is a k-dominating set of Qn with minimum number of vertices. Then |D| Pn,k = 1 − n . 2
A New Variation of Hat Guessing Games
623
Proof. Given a k-dominating set D of Qn , the following strategy will have winning probability at least 1 − |D| 2n : For any certain placement of hats, each player can see all hats but his own, so player pi knows that current placement h is one of two adjacent nodes {x, x(i) } of Qn. If x ∈ D (or x(i) ∈ D), he guesses that the current placement is x(i) (or x), otherwise he passes. We claim that by using this strategy, players win the game when the placement is a node which is not in D. Observe that since D is a k-dominating set, for any node y ∈ / D, y has l neighbors y (i1 ) , y (i2 ) , . . . , y (il ) that are in D, where l ≥ k. According to the strategy desribed, players pi1 , . . . , pil would guess correctly and all other players |D| will pass. This shows the winning probability is at least 1 − 2n . Next we show that Pn,k ≤ 1 − |D| 2n . Suppose we have a strategy with winning probability Pn,k . We prove that there exists a k-dominating set D0 , such that |D0 | = 2n(1 − Pn,k ). The construction is straightforward: Let D0 = {h ∈ Qn : h is not a winning placement}. Thus |D0 | = 2n (1 − Pn,k ). For every winning placement h ∈ / D0 , suppose players pi1 , . . . , pil will guess correctly (l ≥ k), consider the placement h(i1 ) , which differs from h only at player pi1 ’s hat, so player pi1 will guess incorrectly in this case, thus h(i1 ) ∈ D0 . Similarly h(i2 ) , . . . , h(il ) ∈ D0 , therefore D0 is a k-dominating set. We have |D| ≤ |D0 | = 2n (1 − Pn,k ), which implies Pn,k ≤ 1 −
|D| . 2n
Combining these two results, we have Pn,k = 1 −
|D| 2n
as desired.
Proposition 4. The following properties hold: (a) If n1 < n2 then Pn1 ,k ≤ Pn2 ,k . (b) (n, k) is perfect iff there exists a (k, n)-regular partition of Qn . (c) For any t ∈ N, Pnt,kt ≥ Pn,k . As a consequence, if (n, k) is perfect, (nt, kt) is perfect. Proof. For part (a), suppose that D is a minimum k-dominating set of Qn1 . We make 2n2 −n1 copies of Qn1 , and by combining them we get a Qn2 , which has n2 −n1 dominating set of size 2n2 −n1 |D|. By Lemma 2, Pn2 ,k ≥ 1 − 2 2n2 |D| = Pn1 ,k . For part (b), suppose (U, V ) is a (k, n)-regular partition of Qn , note that V is a k k-dominating set of Qn and |V | = n+k · 2n , thus V is a minimum k-dominating
| n set of Qn . We have that Pn,k = 1 − |V = n+k , which implies that (n, k) is 2n perfect. On the other hand, if (n, k) is perfect, suppose D is the minimum k-dominating k set, we have |D| = n+k ·2n . It can be observed that (Qn \ D, D) is a (k, n)-regular partition of Qn. n nt For part (c), since n+k = nt+kt , once Pnt,kt ≥ Pn,k holds, it’s an immediate consequence that the perfectness of (n, k) implies the perfectness of (nk, nt).
624
T. Ma, X. Sun, and H. Yu
Suppose for n players, we have a strategy S with probability of winning Pn,k . For nt players, we divide them into n groups, each of which has t players. Each placement h = (h1 , h2 , . . . , hnt ) of nt players can be mapped to a placement P (h) of n players in the following way: for Group i, suppose the sum of colors in the group is wi , i.e. wi (h) =
ti
hj , (1 ≤ i ≤ n).
j=ti−t+1
Let P (h) = (w1 (h), w2 (h), . . . , wn (h)) be a placement of n players. Each player in Group i knows the color of all players in P (h) other than Player i, thus he uses Player i’s strategy si in S to guess the sum of colors in Group i or passes. Moreover once he knows the sum, his color can be uniquely determined. Note that the players in Group i would guess correctly or incorrectly or pass, if and only if Player i in the n-player-game would do. Since the hat placement is uniformly at random, the probability of winning using this strategy is at least Pn,k , thus Pnt,kt ≥ Pn,k . Now we can prove our main theorem: Theorem 1. For any d, k, s ∈ N with s ≥ log k + k − 1, (d(2s − k), dk) is perfect, in particular, (2s − k, k) is perfect. Proof. It is an immediate consequence of part (b) of Proposition 4 and Corollary 1. Remark: By Proposition 1 and Proposition 4(b) there is a simple necessary condition for (n, k) to be perfect, n + k = gcd(n, k)2t . Theorem 1 indicates that when n + k = gcd(n, k)2t and n is sufficiently large, (n, k) is perfect. The necessary condition and sufficient condition nearly match in the sense that for each k, there’s only a few n that we don’t know whether (n, k) is perfect. Moreover, the following proposition shows that the simple necessary condition can’t be sufficient. The first counterexample is (5, 3), it is not perfect while it satisfies the simple necessary condition. But (13, 3) is perfect by Theorem 1 and more generally for all s ≥ 4, (2s − 3, 3) is perfect. We verified by computer program that (24 − 5, 5) = (11, 5) is not perfect, while our main theorem implies that (27 − 5, 5) = (123, 5) is perfect. By applying Theorem 2 in a more delicate way, we could obtain (59, 5) is perfect1 as well. But we still don’t know whether the case between them, (25 − 5, 5) = (27, 5), is perfect. We list all the small values of (n, k) which are perfect in the Appendix. Proposition 5. (n, k) is not perfect unless 2k + 1 ≤ n when n ≥ 2 and k < n. 1
By Theorem 2, a (3, 1)-regular partition of Q3 implies a (3, 5)-regular partition of Q6 . By switching the two parts of which, we have a (5, 3)-regular partition of Q6 . Then by applying Theorem 2 three times, we could obtain a (5, 11)-regular partition of Q12 , and a (5, 27)-partition of Q28 , and a (5, 59)-partition of Q59 , which implies that (59, 5) is perfect by Proposition 4(b).
A New Variation of Hat Guessing Games
625
Proof. Suppose (n, k) is perfect. According to part (b) of Proposition 4, we can find (U, V ), a (k, n)-regular partition of Qn . Suppose x is some node in U , and y is some neighbor of x which is also in U , y has k neighbors in V . They all differ from x at exactly 2 bits and one of them is what y differs from x at, i.e. each of them “dominates” 2 neighbors of x, one of them is y. So x has totally k + 1 neighbors “dominated” by k of nodes in V . Since all nodes in V are pairwise nonadjacent, these k + 1 nodes must be in U . Now we have k + 1 neighbors of x are in U and k neighbors are in V , it has totally n neighbors. We must have 2k + 1 ≤ n. For each odd number k, let s(k) be the smallest number such that (2s(k) −k, k) is perfect. We know that s(k) ∈ [log k, log k + k − 1]. The following proposition indicates that all s ≥ s(k), (2s − k, k) is also perfect. Proposition 6. If (2s − k, k) is perfect, (2s+1 − k, k) is perfect. Proof. If (2s − k, k) is perfect, by Proposition 4(b) there is a (k, 2s − k)-regular partition of Q2s −k . Thus by Proposition 2, we have a (k, 2s − k)-regular partition of Q2s −k+1 . Combine this partition and Theorem 2, we get a (k, 2s+1 −k)-regular partition of Q2s+1 −k . Therefore (2s+1 − k, k) is perfect. Using Theorem 1 we can give a general lower bound for the winning probability k Pn,k . Recall that there’s upper bound Pn,k ≤ 1 − n+k . Lemma 3. Pn,k > 1 −
2k , n+k
when n ≥ 2log k+k−1 − k.
Proof. Let n be the largest integer of form 2t − k which is no more than n. By Theorem 1, (n , k) is perfect, i.e. Pn ,k = 1 − nk+k . By part (a) of Proposition 4, Pn,k ≥ Pn ,k . On the other hand we have n + k < 2t+1 , so we have Pn,k ≥ 1 −
k 2k 2k = 1 − t+1 > 1 − . n + k 2 n+k
Corollary 2. For any integer k > 0, limn→∞ Pn,k = 1.
5
Conclusion
In this paper we investigated the existence of regular partition for boolean hypercube, and its applications in finding perfect strategies of a new hat guessing games. We showed a sufficient condition for (n, k) to be perfect, which nearly matches the necessary condition. Several problems remain open: for example, determine the minimum value of s(k) such that (2s(k) − k, k) is perfect, and determine the exact value of Pn,k . It is also interesting to consider the case when there are more than two colors in the game.
626
T. Ma, X. Sun, and H. Yu
References 1. Aspnes, J., Beigel, R., Furst, M., Rudich, S.: The expressive power of voting polynomials. Combinatorica 14, 135–148 (1994) 2. Buhler, J., Butler, S., Graham, R., Tressler, E.: Hypercube orientations with only two in-degrees. Journal of Combinatorial Theory, Series A 118, 1695–1702 (2011) 3. Butler, S., Hajiaghayi, M., Kleinberg, R., Leighton, T.: Hat guessing games. SIAM J. Discrete Math. 22(2), 592–605 (2008) 4. Ebert, T.: Applications of recursive operators to randomness and complexity. PhD thesis, University of California at Santa Barbara (1998) 5. Feige, U.: You can leave your hat on (if you guess its color). Technical Report MCS04-03, Computer Science and Applied Mathematics, The Weizmann Institute of Science (2004) 6. Feige, U.: On optimal strategies for a hat game on graphs. SIAM Journal of Discrete Mathematics 24(3), 782–791 (2010) 7. Harris, J., Hirst, J., Mossinghoff, M.: Combinatorics and graph theory, 2nd edn. Springer, Heidelberg (2008) 8. Krzywkowski, M.: On the hat problem on the cycle c7 . Int. J. Contemp. Math. Sciences 5(43), 2137–2148 (2010) 9. Lenstra, H.W., Seroussi, G.: On hats and other covers. In: Proceedings of the IEEE International Symposium on Information Theory, p. 342 (2002) 10. Paterson, M., Stinson, D.: Yet another hat game. The Electronic Journal of Combinatorics 17(1), #R86 (2010) 11. Winkler, P.: Games people don’t play. Puzzlers’ Tribute: A Feast for the Mind, 301–313 (2002)
Appendix Here we list all the small values of (n,k) satisfying √ the necessary condition and being coprime, where n = 2s − k for some s. “ ” means we know that it is perfect, “×” means we know that it is not perfect, and “?” means it is unknown. @ s1 k@ @√ 1 3 5 7 9 11 -
2 √
3 √
-
× -
4 √ √
5 √ √
× × -
? ? ? ×
6 √ √ √
7 √ √ √
8 √ √ √
? ? ?
? ? ?
? ? ?
9 √ √ √ √ ? ?
Oblivious Transfer and n-Variate Linear Function Evaluation Yeow Meng Chee, Huaxiong Wang, and Liang Feng Zhang School of Physical and Mathematical Sciences Nanyang Technological University 21 Nanyang Link, Singapore 637371 {ymchee,hxwang}@ntu.edu.sg [email protected]
Abstract. We define a new cryptographic primitive which is called Oblivious n-variate Linear Function Evaluation with choice space C and denoted by C-OLFEn . The primitive captures a variety of well-known cryptographic primitives and is an interesting stepstone in secure protocol design. We present a statistically secure reduction from n1 -OT to kn invocations of C-OLFEn , where k is the security parameter and C contains all unit vectors of length n. The reduction allows us to reverse n -OT for any integer n ≥ 2. 1
1
Introduction
This paper describes a new cryptographic primitive, Oblivious n-Variate Linear Function Evaluation with choice space C (C-OLFEn ) which captures a variety of well-known cryptographic primitives. The primitive is always associated with a finite field F and involves a sender Alice who has an n-variate linear function n s(x) = i=1 si xi ∈ F[x] and a receiver Bob who has a choice c ∈ C ⊆ Fn . It allows the receiver Bob to evaluate s(c) in such a way that Alice cannot learn c and Bob learns no more information on s(x) except s(c). The C-OLFEn is an interesting stepstone in secure OT protocol design. Oblivious Transfer (OT) [14,10,4] is an important cryptographic primitive and has numerous applications in cryptographic study and protocol design [15,11,12]. Rabin’s OT [14] allows a sender Alice to send a bit b to a receiver Bob such that with probability 1/2 Bob obtains the bit, and with the same probability he does not, while Alice does not know which event has occurred. The n1 -OT [10,4] involves a sender Alice who has n secrets s1 , . . . , sn and a receiver Bob who has a choice c ∈ [n]. It allows Bob to obtain sc and no more information while c is not revealed to Alice. A number of other variants of OT have been defined and extensively studied [6,5,2,1,3] as well. For example, one of them is the XOT, where the sender Alice has two bits b0 , b1 and the receiver Bob is allowed to obtain bc for a choice c ∈ {0, 1, ⊕}, where b⊕ = b0 ⊕ b1 . Almost all variants of OT, including Rabin’s OT, n1 -OT and the XOT, have been shown information-theoretically equivalent to each other [8,3]. The C-OLFEn is also related to Oblivious Polynomial Evaluation (OPE) [13], which is a primitive B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 627–637, 2011. c Springer-Verlag Berlin Heidelberg 2011
628
Y.M. Chee, H. Wang, and L.F. Zhang
n−1
between a sender Alice who has a polynomial s(x) = i=0 si xi ∈ F[x] and a receiver Bob who wants to evaluate s(α) for an α ∈ F. It requires that Alice cannot learn α and Bob learns no more information on s(x) except s(α). C-OLFEn capturesa number of well-known cryptographic primitives. For any integer n ≥ 2, the n1 -OT with s = (s1 , . . . , sn ) as Alice’s input is a C-OLFEn n with s(x) = i=1 si xi and C be the set of all unit vectors. The XOT with (b0 , b1 ) as Alice’s input is a C-OLFEn with s(x) = b0 x0 ⊕ b1 x1 and C = {0, 1}2 \ {(0, 0)}. n−1 i The OPE with s(x) = n with C = i=0 si x as Alice’s input is a C-OLFE n−1 {(1, α, . . . , α ) : α ∈ F}. We show that C-OLFEn and n1 -OT are equivalent primitives, in the sense that there are statistically secure reductions between them. In particular, we present a statistically secure reduction from n1 -OT to C-OLFEn in the real/ideal model simulation paradigm.
Theorem I. The n1 -OT can be statistically securely reduced to kn invocations of a C-OLFEn , where k is the security parameter and C contains all unit vectors of length n. Cr´epeau et al. [9] raised the question of whether it is possible to implement OT in one direction using several invocations of OT in the other. The question arises in a scenario where one party is much more powerful in terms of computational power or technology than the other party. In such a setting, one can make a computational assumption epeau on the weaker party but not on the other. Cr´ et al. [9] proved that a 21 -OT in one direction can be reduced to 4k invocations of a 21 -OT in the other. Our reduction in Theorem I can be applied to reverse n -OT for any n ≥ 2. More precisely, we have that 1
Theorem II. The n1 -OT from Alice to Bob can be statistically securely reduced to kn(n − 1) invocations of the n1 -OT from Bob to Alice, where k is the security parameter.
2
Preliminaries
For a positive integer n, we denote by Sn the set of all permutations of integers in [n] = {1, 2, . . . , n}. The complement of a set P is denoted by P¯ . Let M be a k ×n matrix. For P ⊆ [k] and Q ⊆ [n], the submatrix of M with rows indexed by P and columns indexed by Q is denoted by M [[P, Q]] . We also denote M [[P, ∗]] = M [[P, [n]]]. The support of a vector v is defined to be N (v) = {t : vt = 0}. 1 and 0 denote the all-one and all-zero vectors, respectively. A function δ : N → [0, 1] is negligible if δ(k) < k −d for any integer d > 0 and sufficiently large k ∈ N. We denote by w ← W the experiment of choosing a random element from W. Let U and V be random variables. The statistical distance between U and V is defined to be SD(U, V ) = 12 w | Pr[U = w] − Pr[V = w]|. We denote by Pr[U = u|V = v] the conditional probability that U = u given V = v. A distribution ensemble X = {X(k, a)}k∈N,a∈D is an infinite sequence of probability distributions X(k, a), where k ∈ N and a ∈ D. Definition 1. Two distribution ensembles X and Y are equally distributed (and write X ≡ Y ) if X(k, a) and Y (k, a) are identical for all k and all a.
Oblivious Transfer and n-Variate Linear Function Evaluation
629
Definition 2. Two distribution ensembles X and Y are statistically indistinguishable (and write X ≈ Y ) if SD(X(k, a), Y (k, a)) < δ(k), for all sufficiently large k and all a, where δ : N → [0, 1] is a negligible function. The functionalities of
n 1 -OT
and C-OLFEn are defined as follows.
Definition 3. Let F be a finite field. n1 -OT is a primitive between a sender Alice who has as input n secrets s = (s1 , . . . , sn ) ∈ Fn and no output, and a receiver Bob who has as input a choice c ∈ [n] and outputs sc . Definition 4. Let F be a finite field and C ⊆ Fn . C-OLFEn is a primitive ben tween a sender Alice who has as input s(x) = i=1 si xi ∈ F[x] and no output, and a receiver Bob who has as input a choice c ∈ C and outputs s(c). We define their security in terms of general secure two-party function evaluation. Our definition follows the vein of [7]. Let f be a two-party function which maps any tuple (k, x1 , x2 ) of security parameter k, inputs x1 and x2 to a pair of outputs. A two-party protocol for f is a pair (P1 , P2 ) of interactive Turing machines, where each machine Pi starts with (k, xi ). The definition is given by comparing the ideal model and hybrid model. In the ideal model, the two parties do not interact with each other and evaluate f (k, x1 , x2 ) with the help of a trusted third party T f (which implements the functionality of f ) and in the presence of an ideal model adversary S. Let g be a two-party function as well. In the g-hybrid model, the two parties interact with each other and evaluate f (k, x1 , x2 ) with the help of a trusted third party T g (which implements the functionality of g) and in the presence of a g-hybrid model adversary H. Ideal Model. Let Pi be the party corrupted by S and z be the auxiliary input of S. The entities P1 , P2 , T f and S start with (k, x1 ), (k, x2 ), k and (k, xi , z), respectively. 1. Substitution: S instructs Pi to substitute its input xi with xi . 2. Computation: The parties send x3−i and xi to T f ; then T f computes (f1 , f2 ) = f (k, x1 , x2 ) if i = 1 and (f1 , f2 ) = f (k, x1 , x2 ) if i = 2, and sends f1 , f2 to P1 , P2 , respectively. 3. Output: P3−i outputs f3−i , Pi outputs ⊥ and S outputs an arbitrary function of its view of the computation. The global output IDEALf,S (k, x, z) of the ideal model is defined to be the concatenation of the outputs of S and P1 , P2 , where x = x1 x2 . We denote IDEALf,S = {IDEALf,S (k, x, z)}k∈N,x,z∈{0,1}∗ . Hybrid Model. Let Pi be the party corrupted by H and z be an auxiliary input of H. The entities P1 , P2 , T g and H start with (k, x1 ), (k, x2 ), k and (k, xi , z), respectively. 1. Computation: The computation consists of a number of interactive rounds and g-rounds.
630
Y.M. Chee, H. Wang, and L.F. Zhang
– In each interactive round, only one party is active. If P3−i is active, then it generates and sends a message m3−i to Pi according to the protocol specification. If Pi is active, then the adversary H generates a message mi and instructs Pi to send mi to P3−i . – In each g-round, both parties are active. P3−i sends an input y3−i to T g which is specified by the protocol; H decides an input yi and instructs Pi to send yi to T g . At last, T g evaluates (g1 , g2 ) = g(k, y1 , y2 ) and sends g1 , g2 to P1 , P2 , respectively. 2. Output: P3−i outputs whatever specified by the protocol; Pi outputs ⊥ and H outputs an arbitrary function of its view of the computation. The global output EXECπg ,H (k, x, z) of the hybrid model is defined to be the concatenation of the outputs of H and P1 , P2 , where x = x1 x2 . We denote EXECπg ,H = {EXECπg ,H (k, x, z)}k∈N,x,z∈{0,1}∗ . Definition 5. Let f and g be two-party functions. A two-party protocol π g for f in the g-hybrid model evaluates f statistically securely if for every g-hybrid model adversary H, there is an ideal model adversary S whose running time is polynomial in that of H such that IDEALf,S ≈ EXECπ g ,H . In particular, if IDEALf,S ≡ EXECπg ,H , then we say that π g evaluates f perfectly securely. A reduction from f to g is a two-party protocol π g for f in the g-hybrid model. We say that π g implements f statistically (resp. perfectly) securely if π g evaluates f statistically (resp. perfectly) securely in the g-hybrid model.
3
Statistically Secure Reduction from
n 1
-OT to C-OLFEn
Let f = n1 -OT and g = C-OLFEn , where C contains all unit vectors in Fn . We present a statistically secure reduction from f to g in this section. As a basic step, we suppose that C = Fn . The reduction is depicted by Fig. 1. The correctness of π g is easy and shown by the following lemma. Lemma 1. If Alice and Bob are honest, then IDEALf,S = EXECπg ,H , where S is the ideal model adversary corrupting no party and H is the g-hybrid model adversary corrupting no party. – input: Alice has n secrets s ∈ Fn and Bob has a choice c ∈ [n]; – subroutine: the trusted third party T g ; k 1. Alice: choose φj ← Sn , Xj ← Fn×n for every j ∈ [k] s.t. Xj [ φj (i), i]] = si j=1 for every i ∈ [n]; 2. T g : for (j, i) ∈ [k] × [n], Alice and Bob proceeds as follows – Alice: send (Xj [ i, 1]], . . . , Xj [ i, n]]) to T g ; – Bob: send the c-th unit vector in Fn to T g and receive Yji from T g ; 3. Alice: send the kpermutations φ1 , . . . , φk to Bob; 4. Bob: output Y . j=1 jφj (c) Fig. 1. A reduction from
n 1
-OT to C-OLFEn (π g )
Oblivious Transfer and n-Variate Linear Function Evaluation
631
input: (k, s, z), where s ∈ Fn is Alice’s input and z is an auxiliary input; subroutine: the g-hybrid model adversary H and the trusted third party T f ; feed H with (k, s, z); receive the k matrices X = (X1 , . . . , Xk ) which are decided by H and then sent to T g by Alice. 3. receive the k permutations φ = (φ1 , . . . , φk ) which are decided by H and then sent to Bob by Alice. k 4. for every i ∈ [n], set si = j=1 Xj [ φj (i), i]] and send s = (s1 , . . . , sn ) to T f . 5. output whatever H outputs, say H(k, s, z, φ , X ).
– – 1. 2.
Fig. 2. Ideal model adversary corrupting Alice for π g
Proof. Given (k, s, c, z), we have that IDEALf,S (k, s, c, z) = (⊥, ⊥, sc ) ≡ (⊥ k k , ⊥, j=1 Xj [[φj (c), c]]) = (⊥, ⊥, j=1 Yjφj (c) ) = EXECπ g ,H (k, s, c, z), where all random variables only depend on the uniform and independent coin tosses of Alice and Bob. Next lemma shows that the receiver’s privacy is achieved. Lemma 2. For any g-hybrid model adversary H corrupting Alice, there is an ideal model adversary S corrupting Alice whose running time is polynomial in that of H such that IDEALf,S ≡ EXECπ g ,H . Proof. The ideal model adversary S is depicted by Fig. 2. Given (k, s, c, z), we have that IDEALf,S (k, s, c, z) = (H(k, s, z, φ , X ), ⊥, sc ) = (H(k, s, z, φ , X ), ⊥ k k , j=1 Xj [[φj (c), c]]) ≡ (H(k, s, z, φ, X), ⊥, j=1 Xj [[φj (c), c]]) = (H(k, s, z, φ, X), k
⊥, j=1 Yjφj (c) ) = EXECπ g ,H (k, s, c, z), where the random variables only depend on the uniform and independent coin tosses of H. It remains to show the sender’s privacy. Given (k, c), let cji ∈ Fn be the choice vector sent by Bob in the (j, i)-th invocation of T g for every (j, i) ∈ [k] × [n]. Given (k, s), the honest sender Alice always choose the matrices X1 , . . . , Xk according to π g . For every (j, i) ∈ [k] × [n], a message Yji is sent to Bob by T g . Clearly, we have the following equation system:
cji · Xj [[i, ∗]] = Yji j=1 Xj [[φj (i), i]] = si
k
for every (j, i) ∈ [k] × [n], for every i ∈ [n],
(1)
where the vector of unknowns is X = (X1 [[1, 1]], . . . , X1 [[n, n]], . . . , Xk [[n, n]]) and the vector of constant terms is Y = (Y11 , . . . , Y1n , . . . , Ykn , s1 , . . . , sn ). Let C be the coefficient matrix of (1). Let Vque and Vsec be the vector spaces spanned by the first kn rows and the last n rows of C, respectively. For integers i ∈ [n] and j ∈ [k], we define the following sets of indices Pi = {(j − 1)n + φj (i) : j ∈ [k]} ⊆ [kn],
(2)
Qi = {(j − 1)n + (φj (i) − 1)n + i : j ∈ [k]} ⊆ [kn ], Sji = {h : (j − 1)n2 + (i − 1)n + 1 ≤ h ≤ (j − 1)n2 + in} ⊆ [kn2 ]. 2
2
(3) (4)
632
Y.M. Chee, H. Wang, and L.F. Zhang
Lemma 3. Let j be taken over [k] and i, h be taken over [n]. Then 1. 2. 3. 4.
Both {Qi} and {Sji } are composed of pairwise disjoint sets; |Qh ∩ Sji | ≤ 1 and it is equal to 1 only if (j − 1)n + i ∈ Ph ; C[[(j − 1)n + i, Sji ]] = cji and C[[(j − 1)n + i, S¯ji ]] = 0; ¯ i ]] = 0. C[[kn + i, Qi ]] = 1 and C[[kn + i, Q
Lemma 4. Let w =
n
i=1
αi · C[[kn + i, ∗]] ∈ Vsec . Then N (w) = ∪i∈N (α) Qi .
Proof. By Lemma 3, the support of C[[kn + i, ∗]] is Qi for every i ∈ [n] and all Qi are pairwise disjoint. Hence, N (w) = ∪i∈N(α) Qi . Lemma 5. Let Vint = Vque ∩ Vsec . If dim(Vint ) = m, then there is a subset I of [n] of cardinality m such that Vint is equal to the row space of C[[kn + I, ∗]]. n
Proof. For every w ∈ Vint , there exists α ∈ Fn such that w = i=1 αi · C[[kn + i, ∗]]. Let Iw = N (α) and I = ∪w∈Vint Iw . Then w is in the row space ofC[[kn + n I, ∗]]. For every h ∈ I, let w ∈ Vint be such that h ∈ Iw . Let w = i=1 αi · n C[[kn + i, ∗]] for some α ∈ F . Due to Lemma 4, N (α) = Iw and the support of w is the disjoint union of the supports of C[[kn + i, ∗]] (i.e. Qi ), where i is taken over Iw . Due to Lemma 3, Qi intersects the support of C[[(λ − 1)n + τ, ∗]] only if (λ − 1)n + τ ∈ Pi . Since w ∈ Vque , C[[kn + i, ∗]] must be a linear combination of the C[[(λ − 1)n + τ, ∗]]’s, where (λ − 1)n + τ ∈ Pi . Hence, C[[kn + i, ∗]] ∈ Vque . In particular, C[[kn + h, ∗]] ∈ Vque . It follows that C[[kn + h, ∗]] ∈ Vint . Hence, Vint is equal to the row space of C[[kn + I, ∗]] and |I| = dim(Vint ) = m. The following lemma shows that a dishonest receiver Bob can obtain more than one secret only with probability ≤ 2−k , which is negligible. Lemma 6. If k ≥ 2, then Pr[2 ≤ dim(Vint ) ≤ n] ≤ 2−k , where the probability is taken over the random permutations φ1 , . . . , φk ← Sn . Proof. Due to Lemma 5, for every 2 ≤ m ≤ n, dim(Vint ) = m if and only if there is a subset I ⊆ [n] of cardinality m such that Vint is equal to the row space of C[[kn + I, ∗]]. However, Vint is equal to the row space of C[[kn + I, ∗]] only if the support of C[[(j −1)n +φj (i), ∗]] is equal to {(j − 1)n2 + (φj (i)−1)n +i} for every (j, i) ∈ [k] × I. The later event occurs only if Bob can correctly guess φj (i) for every (j, i) ∈ [k] × I. Since φ1 , . . . , φk are totally random, the last event happens with probability at most n
(n−m)! k . It follows that Pr[2 ≤ dim(Vint ) ≤ n] = n! n n (n−m)! k ≤ m=2 m ≤ 2−k , where the probabilities n!
m=2 Pr[dim(Vint ) = m] are taken over the random permutations φ1 , . . . , φk ← Sn .
Let H = {t ∈ [kn] : C[[t, ∗]] = 0} and Vint be equal to the row space of C[[kn + I, ∗]], where I ⊆ [n]. The proofs of Lemma 7, 8 and 9 only involve simple linear algebra and omitted. Lemma 7. Let R = H ∩ [(k − 1)n]. Then for every α ∈ F|R| and β ∈ Fn , Pr[Y [[R]] = α|s = β] = (1/|F|)|R| , where the probability is taken over the random matrices X1 , . . . , Xk in (1).
Oblivious Transfer and n-Variate Linear Function Evaluation – – 1. 2. 3. 4. 5. 6.
633
input: (k, c, z), where c ∈ [n] is Bob’s input and z is an auxiliary input; subroutine: the g-hybrid model adversary H and the trusted third party T f . choose k random permutations φ1 , . . . , φk ← Sn and set φ = (φ1 , . . . , φk ); for every i ∈ [n], define the following sets of indices – Pi = {(j − 1)n + φj (i) : j ∈ [k]}, Qi = {(j − 1)n2 + (φj (i) − 1)n + i : j ∈ [k]}; initialize a (kn + n) × kn2 matrix C s.t. for every j ∈ [k] and i ∈ [n] ¯ i ] = 0; – C [ (j − 1)n + i, ∗]] = 0, C [ kn + i, Qi ] = 1, C [ kn + i, Q initialize k all-zero square matrices X1 , . . . , Xk of order n; let T = [kn] ⊆ [kn + n]. initialize the following subspaces of the row space of C – Vque = span{C [ T, ∗]]}, Vsec = span{C [ T¯ , ∗]]}, Vint = Vque ∩ Vsec ; initialize counter = 0. For (j, i) = (1, 1), . . . , (1, n), . . . , (k, n), – if (j, i) = (1, 1), set Cji = {(cλτ , Yλτ ) : (λ, τ ) ∈ [k] × [n], λn + τ < jn + i}; – if (j, i) = (1, 1), feed H with (k, c, z) and receive cji = H1 (k, c, z) from H; – if (j, i) = (1, 1), feed H with (k, c, z, Cji ) and receive cji = H1 (k, c, z, Cji ); – update the (j − 1)n + i-th row of C s.t. C [ (j − 1)n + i, Sji ] = cji ; – update the vector spaces Vque , Vsec , Vint and check the value of counter, • if dim(Vint ) = 0 or dim(Vint ) = 1 and counter = 1 ∗ choose xji ← Fn , update Xj s.t. Xj [ i, ∗]] = xji and set Yji = cji ·xji ; • if dim(Vint ) ≥ 2, output a failure message and halt; • if dim(Vint ) = 1 and counter = 0 ∗ find c ∈ [n] s.t. Vint = span{C [ kn + c , ∗]]}; k k ∗ find ρ ∈ F s.t. C [ kn + c , ∗]] = j=1 ρj · C [ (j − 1)n + φj (c ), ∗]]; ∗ feed T f with c and receive sc from T f ; ∗ choose xki ← Fn subject to the following identity: k−1 sc = j=1 ρj · Yj φ (c ) + ρk · C [ (k − 1)n + φk (c ), ∗]] · xki j
∗ update Xk s.t. Xk [ i, ∗]] = xki and set Yki = cki · xki ; ∗ counter = counter + 1. 7. feed H with (k, c, z, V , φ )(where V = {(cji , Yji ) : (j, i) ∈ [k] × [n]}), output whatever H outputs , say H2 (k, c, z, V , φ ), and then halt.
Fig. 3. Ideal model adversary corrupting Bob for π g
Lemma 7 shows that, among the first (k − 1)n answers Bob receives from T g , those indexed by R are totally random. On the other hand, it is clear that the remaining ones are 0. Lemma 8. For every i ∈ I, there is a vector ρ ∈ Fk such that Y(k−1)n+φk (i) = k−1 ρ−1 k · (si − j=1 ρj · Y(j−1)n+φj (i) ). Lemma 8 shows that if a secret si can be obtained by Bob, then the last answer (i.e., Y(k−1)n+φk (i) ) regarding to si is always uniquely determined by the first k − 1 answers (i.e., Y(j−1)n+φk (i) , where 1 ≤ j ≤ k − 1) regarding to si . Lemma 9. Let i ∈ I¯ be such that C[[(k − 1)n + φk (i), ∗]] = 0. Then for every α ∈ F|Ri | , β ∈ Fn and γ ∈ F, Pr[Y(k−1)n+φk (i) = γ|Y [[Ri ]] = α, s = β] = 1/|F|, where Ri = H ∩[(k −1)n+φk (i)−1] and the probability is taken over the random matrices X1 , . . . , Xk in (1).
634
Y.M. Chee, H. Wang, and L.F. Zhang
Lemma 9 shows that the receiver Bob learns essentially no information on si ¯ whenever i ∈ I. Lemma 10. For any g-hybrid model adversary H corrupting Bob, there is an ideal model adversary S corrupting Bob whose running time is polynomial in that of H such that IDEALf,S ≈ EXECπ g ,H . Proof. The ideal model adversary S is depicted by Fig. 3. The proof is deferred to the full version of this paper. Lemma 10 shows that a malicious receiver Bob cannot learn more information on the secrets of the sender Alice except with a negligible probability (In fact, the probability is ≤ 2−k by Lemma 6). Due to Lemma 1, 2 and 10, we have
Theorem 1. The n1 -OT can be statistically securely reduced to kn invocations of the Fn -OLFEn over a finite field F, where k is the security parameter.
Let C ⊆ Fn contain all unit vectors and g = C-OLFEn . Let π g be obtained by substituting g with g in Fig. 1. By the proof of Lemma 6, any hybrid model adversary H corrupting Bob in π g cannot do better than it does in π g .
Theorem 2. The n1 -OT can be statistically securely reduced to kn invocations of a C-OLFEn over a finite field F, where k is the security parameter and C contains all unit vectors of length n
C-OLFEn and Reversing
4
n 1
-OT
In this section, we present a C-OLFEn which can be applied to reverse any n1 OT, where C = {(c1 , . . . , cn ) : c1 ⊕ · · · ⊕ cn = 1} ⊆ Fn2 . More precisely, we present a C-OLFEn from Alice(as a sender) to Bob(as a receiver) by reducing it, in a perfectly secure way, to n − 1 invocations of a given n1 -OT from Bob(as a sender) to Alice (as a receiver). Let g be the C-OLFEn and h be the n1 -OT from Bob to Alice. Fig. 4 is a two-party protocol for g in the h-hybrid model. The correctness of σ h is shown by the following lemma. input: Alice has n bits b ∈ {0, 1}n and Bob has a choice vector c ∈ C; subroutine: the trusted third party T h ; Bob: choose ri ← {0, 1} and set aij = ri ⊕ (j − 1) · ci for 2 ≤ i ≤ n and j ∈ [n]; T h : for i = 2 . . . n, Bob and Alice proceed as follows: – Bob: send (ai1 , · · · , ain ) to T h ; – Alice: send di = b1 ⊕ bi to T h and receive xi from T h ; 3. Alice: send y = b1 ⊕ x2 ⊕ · · · ⊕ xn to R; 4. Bob: output y ⊕ r2 ⊕ · · · ⊕ rn .
– – 1. 2.
Fig. 4. A construction of C-OLFEn out of
n 1
-OT (σ h )
Oblivious Transfer and n-Variate Linear Function Evaluation – – 1. 2.
3. 4. 5. 6.
635
input: (k, b, z), where b ∈ {0, 1}n is Alice’s input and z is an auxiliary input; subroutine: the h-hybrid model adversary H and the trusted third party T g . feed H with (k, b, z); for i = 2, . . . , n execute – receive di from H; – choose xi ← {0, 1} and feed H with xi ; receive y from H; set b1 = y ⊕ x2 ⊕ . . . ⊕ xn and bi = b1 ⊕ di for 2 ≤ i ≤ n; feed T g with b1 , . . . , bn ; output whatever H outputs, say H(k, b, z, d , x , y ), where d = (d2 , . . . , dn ) and x = (x2 , . . . , xn ). Fig. 5. Ideal model adversary corrupting Alice for σ h
Lemma 11. If Alice and Bob are honest, then IDEALf,S ≡ EXECσh ,H , where S is the ideal model adversary corrupting no party and H is the h-hybrid model adversary corrupting no party. Proof. Given (k, b, c, z), we have IDEALf,S (k, b, c, z) =
⊥, ⊥, b1 · (1 ⊕
n
n
i=2 ci )
⊕
n
i=2 (bi
· ci ) =
n
⊥, ⊥, b1 ⊕
⊥, ⊥,
n
n
i=1 (bi
· ci ) =
⊕ bi ) · ci =
i=2 (b1
n
⊥, ⊥, b1 ⊕ i=2 (ri ⊕ (b1 ⊕ bi ) · ci ) ⊕ i=2 ri = ⊥, ⊥, y ⊕ i=2 ri = EXECσh ,H (k, b, c, z) where the random variables only depend on the uniform and independent coin tosses of Bob. Lemma 12. For any h-hybrid model adversary H corrupting Alice, there is an ideal model adversary S corrupting Alice whose running time is polynomial in that of H such that IDEALf,S ≡ EXECσh ,H . Proof. The ideal model adversary is depicted by Fig. 5. Given (k, b, c, z), we have that IDEALf,S (k, b, c, z) = H(k, b, z, d , x , y ), ⊥, b ·c = H(k, b, z, d , x , y ), ⊥ , b1 · (1 ⊕
n
n
i=2 ci ) ⊕
i=2 bi · ci
ci = H(k, b, z, d , x , y ), ⊥, y ⊕ ,y ⊕ n
n
xi i=2
⊕
n
i=2
di · ci
=
= H(k, b, z, d , x , y ), ⊥, b1 ⊕
n
i=2
xi ⊕
n
i=2
i=2 (b1
⊕ bi ) ·
di · ci ≡ H(k, b, z, d, x, y), ⊥
H(k, b, z, d, x, y), ⊥, y ⊕ n
n
n
i=2 (ri
⊕ di · ci ) ⊕
i=2 di · ci = H(k, b, z, d, x, y), ⊥, y ⊕ i=2 ri = EXECσh ,H (k, b, c, z), where b = (b1 , . . . , bn ), d = (d2 , . . . , dn ) and x = (x2 , . . . , xn ).
Lemma 12 shows that a malicious sender learns essentially no information on the choice vector of the receiver. Lemma 13. For any h-hybrid model adversary H corrupting Bob, there is an ideal model adversary S corrupting Bob whose running time is polynomial in that of H such that IDEALf,S ≡ EXECσh ,H . Proof. The ideal model adversary is depicted by Fig. 6. Given (k, b, c, z), we have that IDEALf,S (k, b, c, z) = (H(k, c, z, a , y ), ⊥, ⊥) and EXECσh ,H (k, b, c, z)
636
– – 1. 2. 3. 4.
Y.M. Chee, H. Wang, and L.F. Zhang input: (k, c, z), where c ∈ C is Bob’s input and z is an auxiliary input; subroutine: the h-hybrid model adversary H and the trusted third party T g . feed H with (k, c, z) and receive {aij : 2 ≤ i ≤ n and j ∈ [n]} from H; set ci = ai1 ⊕ ai2 for 2 ≤ i ≤ n and c1 = 1 ⊕ c2 ⊕ . . . ⊕ cn ; n g feed T with c = (c1 , . . . , cn ) and receive b · ci ; i=1 i n n feed H with y = a ⊕ i=1 bi · ci and output whatever H outputs, say i=2 i1 H(k, c, z, a , y ), where a = {aij : 2 ≤ i ≤ n and j ∈ [n]}. Fig. 6. Ideal model adversary corrupting Bob for σ h
= (H(k, c, z, a, y), ⊥, ⊥), where a = {aij : 2 ≤ i ≤ n and ∈ [n]}. It suffices to j n n show that (a , y ) ≡ (a, y). In fact, we have (a , y ) = a , i=2 ai1 ⊕ i=1 bi ·
n
n n ⊕ ai2 ) = a , i=2 ai1 ⊕ b1 · (1 ⊕ i=2 ai1 ⊕ (b1 · c1 ) ⊕ i=2 bi· (ai1 n n n n i · (ai1 ⊕ ai2 ) ≡ a, i=2 (ai1 ⊕ ai2 )) ⊕ i=2 b i=2 ai1 ⊕ (b1 · (1 ⊕ i=2 (ai1 ⊕ n n ai2 )))⊕ i=2 bi · (ai1 ⊕ ai2 ) = a, b1 ⊕ i=2 (ai1 ⊕(b1 ⊕bi )·(ai1 ⊕ ai2 )) = (a, y).
ci = a ,
Lemma 13 shows that a malicious receiver cannot learn more information on the sender’s function except one evaluation at his choice vector. Theorem 3. The C-OLFE n over F2 can be perfectly securely reduced to n − 1 invocations of the n1 -OT, where C = {(c1 , . . . , cn ) : c1 ⊕ . . . ⊕ cn = 1}. The choice space C in Theorem 3 contains all unit vectors in Fn2 . Therefore, due to Corollary 2, the resulting C-OLFEn can be transformed to an n1 -OT except for a negligible failure probability. By the composition theorem of secure two-party protocols [7], we have that
Theorem 4. The n1 -OT from Alice to Bob can be statistically securely reduced to kn(n − 1) invocations of the n1 -OT from Bob to Alice, where k is the security parameter. Theorem 4 shows that
5
n 1 -OT
can be efficiently reversed to for any n ≥ 2.
Conclusion
In this paper, we define a new cryptographic primitive called C-OLFEn and show that n1 -OT can be efficiently reduced to this primitive in a statistically secure way, where C contains all unit vectors of length n. Using the reduction, we show that the n1 -OT from Alice to Bob can be reduced to kn(n − 1) invocations of a given n1 -OT from Bob to Alice except for a negligible probability ≤ 2−k . Acknowledgements. The research is supported in part by the Singapore National Research Foundation under Research Grant NRF-CRP2-2007-03.
Oblivious Transfer and n-Variate Linear Function Evaluation
637
References 1. Beaver, D.: Precomputing oblivious transfer. In: Coppersmith, D. (ed.) CRYPTO 1995. LNCS, vol. 963, pp. 97–109. Springer, Heidelberg (1995) 2. Bennett, C.H., Brassard, G., Cr´epeau, C., Skubiszewska, H.: Practical quantum oblivious transfer. In: Feigenbaum, J. (ed.) CRYPTO 1991. LNCS, vol. 576, pp. 351–366. Springer, Heidelberg (1992) 3. Brassard, G., Cr´epeau, C., Robert, J.M.: Information theoretic reductions among disclosure problems. In: FOCS 1986, pp. 168–173. IEEE, Los Alamitos (1986) 4. Brassard, G., Cr´epeau, C., Robert, J.M.: All-or-nothing disclosure of secrets. In: Odlyzko, A.M. (ed.) CRYPTO 1986. LNCS, vol. 263, pp. 234–238. Springer, Heidelberg (1987) 5. Brassard, G., Cr´epeau, C., Wolf, S.: Oblivious transfers and privacy amplification. Journal of Cryptology 16(4), 219–237 (2003) 6. Cachin, C.: On the foundations of oblivious transfer. In: Nyberg, K. (ed.) EUROCRYPT 1998. LNCS, vol. 1403, pp. 361–374. Springer, Heidelberg (1998) 7. Canetti, R.: Security and composition of multiparty cryptographic protocols. Journal of Cryptology 13(1), 143–202 (2000) 8. Cr´epeau, C.: Equivalence between two flavors of oblivious transfers. In: Pomerance, C. (ed.) CRYPTO 1987. LNCS, vol. 293, pp. 350–354. Springer, Heidelberg (1988) 9. Cr´epeau, C., S´ antha, M.: On the reversibility of oblivious transfer. In: Davies, D.W. (ed.) EUROCRYPT 1991. LNCS, vol. 547, pp. 106–113. Springer, Heidelberg (1991) 10. Even, S., Goldreich, O., Lempel, A.: A randomized protocol for signing contracts. Communications of the ACM 28(6), 637–647 (1985) 11. Goldreich, O., Micali, S., Wigderson, A.: How to play any mental game or a completeness theorem for protocols with honest majority. In: STOC 1987, pp. 218–229. ACM, New York (1987) 12. Kilian, J.: Founding cryptography on oblivious transfer. In: STOC 1988, pp. 20–31. ACM, New York (1988) 13. Naor, M., Pinkas, B.: Oblivious transfer and polynomial evaluation. In: STOC 1999, pp. 245–354. ACM, New York (1999) 14. Rabin, M.O.: How to exchange secrets by oblivious transfer. Technical Report TR81, Aiken Computation Laboratory, Harvard University (1981) 15. Yao, A.C.C.: How to generate and exchange secrets. In: FOCS 1986, pp. 162–167. IEEE, Los Alamitos (1986)
Optimal Online Algorithms on Two Hierarchical Machines with Resource Augmentation Yiwei Jiang1, , An Zhang2, , and Jueliang Hu1 1 2
Faculty of Science, Zhejiang Sci-Tech University, Hangzhou 310018, China [email protected] Department of Mathematics, Zhejiang University, Hangzhou 310027, China [email protected]
Abstract. This paper investigates an online hierarchical scheduling problem with resource augmentation, i.e., the resources of the online algorithms are different from those of the offline algorithms. The machines are provided with different capacity according to their hierarchies. One with the hierarchy 1 has a speed of s (q) in the online (offline) algorithms and can process all the jobs. The other with hierarchy 2 has a speed of 1 in the online/offline algorithms and can only process partial jobs. The objective is to minimize makespan. For any 0 < q, s < ∞, we present optimal online algorithms with parametric competitive ratios.
1
Introduction
We study an online hierarchical scheduling on two uniformly related machines with resource augmentation. This problem can be described as follows. We are given a sequence J = {J1 , J2 , . . . , Jn } of independent jobs, which arrive one by one and each must be nonpreemptively scheduled on one of two uniform machines M1 and M2 before the next job arrives. Job Jj has a positive size pj and a hierarchy gj = 1 or 2, j = 1, · · · , n. We identify jobs with their sizes. Machine Mi , i = 1, 2 has a hierarchy g(Mi ) = i associated with it. Mi can process pj only when g(Mi ) ≤ gj . The machine might has different speeds in online and offline cases. Namely, the ratio of the machine speeds between M1 and M2 is s : 1 in the online algorithms and q : 1 in the offline algorithms. W.l.o.g., we assume the speeds of M1 are s and q in the online and offline algorithms, p respectively. Therefore, if pj is scheduled on M1 , its load will be sj in the online pj algorithms and q in the offline algorithms. Our objective is to minimize the makespan, i.e., the maximum load of the machines, where the load of a machine is defined as the completion time of the machine. The performance of an online algorithm A is measured by its competitive ratio, which is defined as the smallest number t such that C A (I) ≤ tC ∗ (I) for any job
Corresponding author. Supported by the National Natural Science Foundation of China (11001242, 11071220) and Zhejiang Province Natural Science Foundation of China (Y6090175, Y6090554). Supported by the China Postdoctoral Science Foundation (207100-X91002).
B. Fu and D.-Z. Du (Eds.): COCOON 2011, LNCS 6842, pp. 638–648, 2011. c Springer-Verlag Berlin Heidelberg 2011
Optimal Online Algorithms on Two Hierarchical Machines
639
sequence I, where C A (I) (or in short C A ) denotes the objective value produced by A, and C ∗ (I) (or in short C ∗ ) denotes the optimal objective value. An online scheduling problem has a lower bound ρ if no online algorithm has a competitive ratio smaller than ρ. An online algorithm is said to be optimal if its competitive ratio matches the lower bound. Related works: Resource augmentation was introduced by Kalyanasundaram and Pruhs [11]. As we know that some online scheduling problems are shown to have unbounded competitive ratio. However, they found that it becomes possible to obtain competitive algorithms even if the machines of the on-line algorithm are slightly faster than those of the off-line algorithm. Resource augmentation has now been widely applied. It was already used in the paper where the competitive ratio was introduced [15]. Other papers studying the effect of adding more or faster machines can be seen in [2,1,12,13]. A related problem is the online scheduling to minimize makespan on two uniform machines with resource augmentation by Epstein and Ganot [7]. For the non-preemptive variant, it is shown that the well known LS algorithm [8] is optimal with a competitive ratio of 1 1 + q, 0 < s ≤ 1+q , 2+q 1 , < s ≤ 1. 1+s 1+q for 0 < q, s ≤ 1 or equivalently,
1+2q 1+s , 1+q , s
1 < s < 1+q q , s ≥ 1+q . q
for q, s > 1. Note that it is exactly the case of our problem with no hierarchy constraint. For the online hierarchical scheduling to minimize makespan on two uniform machines, Tan and Zhang [16] proposed optimal algorithms for any 0 < s < ∞. The competitive ratio is ⎧ 1 + s, 0 < s ≤ s1 , ⎪ ⎪ ⎪ ⎨ 1 + 1+s 2 , s1 < s ≤ 1, 1+s+s √ 1+ 5 2s 1 + 1+s+s , ⎪ 2, 1 < s < 2 ⎪ √ ⎪ ⎩ 1 1+ 5 1 + s, s≥ 2 , where s1 is the real root to equation s3 + s2 − 1 = 0. Note that it is exactly the case of our problem without resource augmentation constraint. For this problem, Chassid and Epstein [4] considered fractional model where each job can be arbitrarily split between the machines and parts of the same job can run on different machines in parallel, and a semi-online model with known the total job size in advance. For both two models, optimal algorithms were proposed. The preemptive version of this problem was further studied by Dosa and Epstein [6]. They presented optimal algorithms which use idle time. The competitive ratio is
640
Y. Jiang, A. Zhang, and J. Hu
(1+s)2 1+s+s2 s(1+s)2 1+s2 +s3
0 < s ≤ 1, s > 1.
Moreover, it is proved that any deterministic algorithm which does not use idle time cannot achieve the same competitive ratio. Specially, for two identical-machines-case, i.e., s = 1, Jiang et al. [9] and Park et al. [14] independently proposed an optimal online algorithm with a competitive ratio of 5/3. Jiang [10] further generalized the problem to m identical machines and presented an 2.522-competitive algorithm, which is improved to 7/3 by Zhang et al. [17]. The more general problem on m identical machines with at most m hierarchies, has been studied in [3,5]. Online algorithms with a competitive ratio of e + 1 ≈ 3.718 were given. Our results: In this paper, we study the online scheduling problem on two uniform machines with both hierarchy and resource augmentation constraint (see Tab. 1). Note that q, s > 1 and 0 < q, s < 1 are not equivalent for hierarchical model and in fact, the two do have different motivation in the real life [4,16]. The former implies that M1 is a ”stronger” machine that can process all jobs and is faster. The latter implies that M2 is a ”specialized” machine which can process special jobs more quickly. We present two optimal algorithms for both cases. The competitive ratios are ⎧q q , 0 < s ≤ 1+q , ⎪ ⎨s q 1+q+q 2 1 + q, 1+q < s ≤ (1+q)2 , ⎪ ⎩ 2+2q+q2 1+q+q2 1+s+qs , (1+q)2 < s ≤ 1. and
1+3q+q2 1+s+qs , 1+q s ,
1 < s < 1+q q , s ≥ 1+q . q
respectively. Compared to Epstein and Ganot’s result [7], it can be seen that the optimal algorithms have larger competitive ratios than that of the corresponding scheduling problem without hierarchy. Also we note that when q = s, the problem reduces to two uniform hierarchical machines scheduling [16]. Especially, when q = s = 1, the competitive ratio of our algorithm is 53 which coincides with the previous works [9,14]. The following two sections study the algorithms of the case 0 < q, s ≤ 1 and q, s > 1, respectively. Some concluding remarks are given in the last section. Table 1. Hierarchy and resource augmentation on uniform machines speed speed machine hierarchy (online) (offline) M1 1 s q M2 2 1 1
Optimal Online Algorithms on Two Hierarchical Machines
2
641
Optimal Algorithm for 0 < q, s ≤ 1
In this section, we give an optimal algorithm for any 0 < q, s ≤ 1. For convenience, we define time j, j = 1, 2, · · · , n as the moment when pj has just been processed in an algorithm. Let Tj and Tj1 be the total size of all completed jobs and the completed jobs with hierarchy 1 at time j, respectively. Denote by LBj = max{pj ,
Tj1 Tj , }, q 1+q
(1)
then LBj is clearly nondecreasing. Since the offline machines have speeds q(≤ 1) and 1, we can get the following lemma accordingly. Lemma 1. At any time j, j = 1, 2, · · · , n, the current optimal makespan is no less than LBj . Hence, C ∗ ≥ LBn . The main idea of our algorithm for this case is to schedule jobs with hierarchy 2 on machine 2 as much as possible, unless the assignment might lead to a greater competitive ratio. See below the detailed description. Algorithm A1 (for 0 < q, s ≤ 1) 2
1. If 0 < s ≤ 1+q+q , schedule all the jobs with hierarchy i on Mi , i = 1, 2, (1+q)2 stop. 2 2. If 1+q+q < s ≤ 1, let the current arrived job be pj and the current loads of (1+q)2 machines be Lij−1 , i = 1, 2. If gj = 2 and pj + L2j−1 ≤ pj on M2 . Otherwise, schedule it on M1 .
2+2q+q 2 1+s+qs LBj ,
schedule
Theorem 1. For any 0 < q, s < 1, algorithm A1 has a competitive ratio of ⎧q q , 0 < s ≤ 1+q , ⎪ ⎨s q 1+q+q 2 1 + q, < s ≤ , 1+q (1+q)2 ⎪ ⎩ 2+2q+q2 1+q+q2 1+s+qs , (1+q)2 < s ≤ 1. 2
Proof. If 0 < s ≤ 1+q+q (1+q)2 , the algorithm assigns jobs according to step 1. Since all the jobs with hierarchy i are totally scheduled on Mi , i = 1, 2, we have C A1 = Tsn1 if the makespan is determined by M1 and C A1 = Tn − Tn1 otherwise. Tn By Lemma 1 and (1), we know that C ∗ ≥ LBn ≥ max{ Tqn1 , 1+q }. Hence, q q 0 < s ≤ 1+q , C A1 q s, ≤ max{ , 1 + q} = q 1+q+q2 ∗ C s 1 + q, 1+q < s ≤ (1+q)2 . 2
In the following we focus on the case when 1+q+q < s ≤ 1. W.l.o.g., suppose (1+q)2 the last job pn determines the makespan. If pn is scheduled on M2 by the algorithm, then from Lemma 1, we have C A1 = L2n−1 + pn ≤
2 + 2q + q 2 2 + 2q + q 2 ∗ LBn ≤ C . 1 + s + qs 1 + s + qs
642
Y. Jiang, A. Zhang, and J. Hu
Otherwise, pn is scheduled on M1 . Note that if there are no jobs with hierarchy q ∗ 2+2q+q2 ∗ Tn1 ∗ 2 scheduled on M1 , then C A1 = Tn1 s ≤ s C ≤ 1+s+qs C by C ≥ q from Lemma 1. Thus, we suppose there must be some jobs with hierarchy 2 scheduled on M1 by the algorithm. And we let pj be the one among them that arrives latest in the sequence. In other words, after time j, all jobs assigned to M1 are associated with hierarchy 1. This leads to Tn1 ≥ (sL1n−1 + pn ) − (sL1j−1 + pj ) accordingly. Denoted by x = (sL1n−1 +pn )−(sL1j−1 +pj ) ≥ 0 and y = sL1j−1 +pj , we have Tn1 ≥ x and C A1 =
sL1n−1 + pn x+y = . s s
(2)
2+2q+q2 LBj from the 1+s+qs (1+q)(1+q−s) 2 algorithm, combining it with (1), we can obtain Lj−1 > LBj . It 1+s+qs (1+q)(1+q−s) 1 2 yields that y = sLj−1 + pj = Tj − Lj−1 ≤ (1 + q)LBj − LBj = 1+s+qs (1+q)(2s+qs−q) 1+q−s 2 LBj , which follows Lj−1 > 2s+qs−q y. Therefore, Tn = sL1n−1 + 1+s+qs 1+q−s 1+s+qs pn + L2n−1 ≥ x + y + L2j−1 ≥ x + y + 2s+qs−q y = x + 2s+qs−q y. By Lemma 1, we
Since pj is not scheduled on M2 , we have L2j−1 + pj >
can conclude that C ∗ ≥ LBn ≥ max{
Tn1 Tn x x 1 + s + qs , } ≥ max{ , + y}. (3) q 1+q q 1+q (1 + q)(2s + qs − q)
From (2) and (3), it is easy to obtain that
C A1 C∗
≤
2+2q+q2 . 1+s+qs
To show the optimality of A1, we construct several sequences of jobs such that any algorithm cannot handle all of them without violating the competitive ratio of A1. 2
Lemma 2. For 0 < q ≤ 1 and 0 < s ≤ 1+q+q (1+q)2 , any online algorithm A must have a competitive ratio no smaller than q q 0 < s ≤ 1+q , s, 1 + q,
q 1+q
<s≤
1+q+q 2 . (1+q)2
Proof. Firstly, we construct the following sequences to establish that any algo2 rithm (denoted by A) must be at least min{1 + q, 1+q+q }-competitive. The first s(1+q) job has a size of p1 = 1 and a hierarchy g1 = 2. If it is assigned to M1 by A, then the last job with a size of q and a hierarchy 1 arrives. Note it has to be 1+q CA scheduled on M1 , we have C A = 1+q s . Consequently, C ∗ = s ≥ 1 + q, where ∗ C = 1 obtained by moving p1 to M2 . On the other hand, p1 is assigned to M2 initially. Then let the next job be p2 = 1q and g2 = 2. If the algorithm still schedule it on M2 , we end the sequence, obtaining C A = 1 + 1q . However, by assigning pi to Mi , i = 1, 2, the optimal schedule is found, therefore, C ∗ = 1q A
and C = 1 + q. Suppose A schedules p2 on M1 , then we let the last job with C∗ size p3 = 1 + q and hierarchy g3 = 1 arrives. It has to be schedued on M1 , thus
Optimal Online Algorithms on Two Hierarchical Machines
C A = max{ 1/q+1+q , 1} = s
1+q+q 2 . qs
643
In an offline algorithm, we assign jobs with
hierarchy i on Mi , i = 1, 2, which follows C ∗ ≤
1+q q
and hence A
CA C∗
1+q+q2 . s(1+q) 1+q+q2 s(1+q) }.
≥
Therefore, for any online algorithm A, we can conclude CC ∗ ≥ min{1+q, Secondly, if we let each arriving job be of hierarchy 1, then it has to be scheduled on M1 both for online and offline algorithms. So qs is a natrual lower bound for any online algorithm. Combining it with the above lower bounds, we finally get ⎧q q , 0 < s ≤ 1+q , ⎪ s ⎨ A 2 C q 1+q+q q 1+q+q2 ≥ max{ , min{1 + q, }} = 1 + q, 1+q < s ≤ (1+q)2 , ⎪ C∗ s s(1 + q) ⎩ 1+q+q2 1+q+q2 s(1+q) , (1+q)2 < s ≤ 1. By Lemma 2 and Theorem 1, we know that A1 is optimal for any 0 < s ≤ 2 For 1+q+q (1+q)2 < s ≤ 1, we construct different sequences of jobs to estalbish the lower bound. 1+q+q2 (1+q)2 .
Lemma 3. For any 0 < q ≤ 1 and
1+q+q2 (1+q)2
< s ≤ 1, any online algorithm A
must have a competitive ratio no smaller than
2+2q+q2 . 1+s+qs
Proof. Before to construct new sequences, we note the same argument as Lemma 2 A 2 still holds. Thus to avoid C ≥ 1 + q > 2+2q+q , any online algorithm has C∗ 1+s+qs to schedule the first job with p1 = 1, g1 = 2 on M2 and the second job with p2 = 1q , g2 = 2 on M1 . Now let the third job be p3 =
(1+q)(1+q−s) q[(1+q)2 s−(1+q+q 2 )] −1
and g3 = 2. If it is assigned
to M1 , then we end the sequence with a job of size 1 + q + p3q = and hierarchy 1. Hence, C A = max{
q(1+s+qs) (1+q)2 s−(1+q+q 2 )
p2 + p3 1 + q + p3 q 1 + q + p3 q 1 + p3 q + , p1 } = + , s s s qs
while by scheduling jobs with hierarchy i on Mi , i = 1, 2, we obtain an optimal 3q 3q schedule, which follows C ∗ = max{ 1+q+p , p1 + p2 + p3 } = 1+q+p . Therefore, q q CA q 1 + p3 q q 1 + (1 + q + p3 q)/q 2 + q + q2 = + ≥ + = , C∗ s s(1 + q + p3 q) s s[1 + q + p3 q + (1 + q + p3 q)/q] 1 + s + qs where the inequality holds due to p3 ≥ 1q . 3q If p3 is assigned to M2 by A, then the forth job with p4 = 1+q+p and g4 = 2 q2 arrives. If the algorithm schedules this job on M2 again, then the sequence ends. Consequently, we have C A = max{
p2 1 + q + p3 q 2 + 2q + q 2 , p1 +p3 +p4 } = 1+p3 + = . s q2 q[(1 + q)2 s − (1 + q + q 2 )]
In an offline algorithmn, we assign p4 to M2 and the other jobs to M1 , which follows
644
Y. Jiang, A. Zhang, and J. Hu
C ∗ ≤ max{ A
p1 + p2 + p3 1 + q + p3 q 1 + s + qs , p4 } = = . q q2 q[(1 + q)2 s − (1 + q + q 2 )] 2
2+q+q Thus C C ∗ ≥ 1+s+qs holds. Now suppose A schedules p4 on M1 , then the last job arrives, which has a (1+q)(1+s+qs) size p5 = 1+q (1 + q + p3 q) = (1+q) 2 s−(1+q+q2 ) and a hierarchy g5 = 1. The genq
erated makespan by A can be calculated accordingly, C A = max{ p2 +ps4 +p5 , p1 + 3 q)/q p3 } = 1+q (1 + q + p3 q) + 1+(1+q+p . Similarly, by assigning jobs with hiqs qs erarchy i on machine Mi , i = 1, 2, an optimal schedule is obtained, where C ∗ = max{ pq5 , p1 + p2 + p3 + p4 } = 1+q q 2 (1 + q + p3 q). Hence, we can conclude CA C∗
≥
q s
+
1+(1+q+p3 q)/q s[1+q+p3 q+(1+q+p3 q)/q]
=
2+q+q2 1+s+qs
as well.
From Theorem 1, Lemma 2 and Lemma 3, we have Theorem 2. Algorithm A1 is optimal for any 0 < q, s ≤ 1.
3
Optimal Algorithm for q, s > 1
In this section, we focus on the case of q, s > 1. Using the same definitions of Tj , Tj1 and time j, we let lbj = max{
pj Tj1 Tj , , }, q q 1+q
(4)
then lbj is also a nondecreasing function of time j. Since q > 1, we get a similar result as Lemma 1. Lemma 4. At any time j, j = 1, 2, · · · , n, the current optimal makespan is no less than lbj and especially, C ∗ ≥ lbn . The algorithm for q, s > 1 has a simlilar structure as that of q, s ≤ 1. The idea of scheduling as many jobs of hierarchy 2 as possible on the second machine is still valid. Besides, we note it is no need to use the second machine if the speed ratio becomes large enough (s ≥ 1+q ). Below is the detailed algorithm. q Algorithm A2 (for q, s > 1) 1. If s ≥ 1+q q , schedule all the jobs on M1 , stop. 2. If 1 < s ≤ 1+q , let the current arrived job be pj and the current loads of q machines be Lij−1 , i = 1, 2. If gj = 2 and pj + L2j−1 ≤ schedule pj on M2 . Otherwise, schedule it on M1 .
1+3q+q 2 1+s+qs lbj ,
Theorem 3. For any q, s > 1, algorithm A2 has a competitive ratio of 1+3q+q 2 , 1 < s < 1+q ; 1+s+qs q 1+q 1+q s≥ q . s ,
then we
Optimal Online Algorithms on Two Hierarchical Machines
645
Proof. The analysis is similar as that in Theorem 1. First, if s ≥ 1+q q , the Tn algorithm schedules all jobs on M1 , thus we have C A2 = Tsn and C ∗ ≥ 1+q from Lemma 4. The desired result follows. Because of this, we will always suppose 1 < s < 1+q q and suppose that the last job pn determines the makespan in the following proof. If pn is scheduled on M2 by the algorithm, then by the rule of step 2, we have 2 2 A2 C = pn + L2n−1 ≤ 1+3q+q lbn ≤ 1+3q+q C ∗ , where the last inequality is from 1+s+qs 1+s+qs Lemma 4. Otherwise, pn must be scheduled on M1 . Moreover, if there are no jobs with hierarchy 2 assigned to M1 by the algorithm, then we have C A2 = Tsn1 , 2
A2
which follows CC ∗ ≤ qs < 1+3q+q with C ∗ ≥ Tqn1 from Lemma 4. Hence, suppose 1+s+qs some jobs with hierarchy 2 have been scheduled on M1 by A2. Let pj be the one among them that arrives latest, i.e., after time j, all jobs scheduled on M1 must be of hierarchy 1. This implies that Tn1 ≥ (sL1n−1 + pn ) − (sL1j−1 + pj ). Denoted by x = (sL1n−1 + pn ) − (sL1j−1 + pj ) ≥ 0 and y = sL1j−1 + pj , we have Tn1 ≥ x and sL1n−1 + pn x+y C A2 = = . (5) s s Since pj has a hierarchy 2 and is assigned to M1 , it must be true that L2j−1 +pj > 1+3q+q 2 1+s+qs lbj .
Combining it with with (4), we can obtain L2j−1 > (1+q)(1+q−qs) lbj , 1+s+qs which, together with (4), leads to y = sL1j−1 + pj = Tj − L2j−1 ≤ (1 + q)lbj − (1+q)(1+q−qs) lbj 1+s+qs
1+q−qs = (1+q)(s−q+2qs) lbj . Then we obtain that L2j−1 > s−q+2qs y. 1+s+qs Thus the total job size is Tn = sL1n−1 + pn + L2n−1 ≥ sL1n−1 + pn + L2j−1 > 1+q−qs 1+s+qs x + y + s−q+2qs y = x + s−q+2qs y, together with Tn1 ≥ x and Lemma 4, we further have
C ∗ ≥ max{
Tn1 Tn x x 1 + s + qs , } ≥ max{ , + y}. q 1+q q 1 + q (1 + q)(s − q + 2qs)
By (5), (6) and a simple calculation, the desired result
C A2 C∗
≤
1+3q+q2 1+s+qs
(6)
follows.
Next, we will show the online algorithm A2 is actually best possible. Firstly, we point out that the lower bound given by Epstein and Ganot for the problem of scheduling jobs on two uniform machines with resource augmentation [7] is still valid for ours. This is because their problem can be seen as a hierarchical scheduling where all jobs have the same hierarchy of 2, which is a special case of our problem. Thus, when q > 1 and s ≥ 1+q q , our problem must have a lower 1+q bound of s , which matches the competitive ratio of A2. Lemma 5. [7] For q > 1 and s ≥ 1+q q , any online algorithm must have a competitive ratio no smaller than 1+q . s Now we only need to consider the case when 1 < s < q, it’s easy to see that q+
1+q q .
Let x0 =
q q x0 − q + qx0 1 + 3q + q 2 = + = . x0 s sx0 (1 + q) 1 + s + qs
q(1+s+qs) (1+q)(1+q−qs)
>
(7)
646
Y. Jiang, A. Zhang, and J. Hu
qx0 Consider the geometric series {xn }∞ n=1 with x1 = x0 −q − 1 > 0 and the common n x0 x0 ratio x0 −q > 1, i.e., xi+1 = x0 −q xi , i = 1, 2, · · · , we let X0 = 0, Xn = i=1 xi (Xn → ∞(n → ∞)). Then by a simple calculation, we get
and
1 + xn q = 1 + x0 + X n x0
(8)
x0 + Xn−1 + q(1 + x0 + Xn ) x0 − q + qx0 = . s(1 + q)(1 + x0 + Xn ) sx0 (1 + q)
(9)
Using the above series, we construct a sequence of jobs with hierarchy 2 and size of 1, x0 , x1 , x2 , · · · , respectively. Lemma 6. If an online algorithm has assigned the first job to M1 , or both 2 the first and any other job in the sequence to M2 , then it is at least 1+3q+q 1+s+qs competitive. Proof. If A assigns the first job to M1 , then the sequence terminates with the A 1+q 1+3q+q2 second job, which has a size of q and a hierarchy 1. We have C C ∗ = s > 1+s+qs , where the optimal makespan is C ∗ = 1 obtained by assgining 1 to M2 and q to M1 . Thus we can always suppose the algorithm has assigned the first job to M2 . If the algorithm schedules the second job in the sequence on M2 as well, then the sequence terminates immediately, C A = 1 + x0 . Note the optimal schedule is obtained by asssigning 1 to M2 and x0 to M1 , i.e., C ∗ = xq0 . By (7), it follows 2
CA C∗
0 = 1+x = q + xq0 = 1+3q+q . x0 /q 1+s+qs Suppose x0 , x1 , · · · , xn−1 on M1 , n = 1, 2, · · · have been assigned to M1 , but xn is assigned to M2 by the algorithm. Then we let the next job to be u = q(1 + x0 + Xn ) with a hierarchy 2. If it is assigned to M2 , then the sequence ends. We have
C A = max{
x0 + Xn−1 , 1 + xn + u} = q(1 + x0 + Xn ) + 1 + xn . s
On the other hand, by assigning u to M1 and all the other jobs to M2 , we can get an optimal schedule with makespan C ∗ = uq = 1+x0 +Xn . Therefore, by (7) and 2
A
1+xn (8), we obtain C = q + 1+x = q + xq0 = 1+3q+q . If u is assigned to M1 by C∗ 1+s+qs 0 +Xn the algorithm. Then we let the last job of sequence be v = q(1 + q)(1 + x0 + Xn ) with hierarchy 1, thus it follows
C A = max{
x0 + Xn−1 + u + v x0 + Xn−1 + u + v , 1 + xn } = s s
v x0 + Xn−1 + q(1 + x0 + Xn ) + . s s However, it’s easy to get that C ∗ = vq by scheduling the last job v independently on M1 and all the other jobs on M2 . By (7) and (9), we can conclude =
Optimal Online Algorithms on Two Hierarchical Machines
647
CA q x0 + Xn−1 + q(1 + x0 + Xn ) q x0 + Xn−1 + q(1 + x0 + Xn ) = + = + C∗ s sv/q s s(1 + q)(1 + x0 + Xn ) 2 q x0 − q + qx0 1 + 3q + q = + = . s sx0 (1 + q) 1 + s + qs In other words, to be better than to assign xn to M1 as well.
1+3q+q 2 1+s+qs -competitive,
Lemma 7. For any q > 1 and 1 < s < competitive ratio no smaller than
1+q q ,
2
1+3q+q 1+s+qs
any online algorithm has
any online algorithm must have a
.
Proof. From Lemma 6, any algorithm with a better competitive ratio than 1+3q+q 2 1+s+qs has to schedule the first job 1 on M2 and all the subsequent jobs x0 , x1 , · · · , xn , n = 1, 2, · · · on M1 . Now we terminate the sequence by a last job 0 +Xn ) with a size of q(1 + x0 + Xn ) and a hierarchy 1. Clearly C A = x0 +Xn +q(1+x s ∗ and C = 1 + x0 + Xn obtained by scheduling the last job on M1 and the others on M2 . Thus, we have CA q x0 + Xn q+1 1 + 3q + q 2 = + −→ > (n −→ ∞). C∗ s s(1 + x0 + Xn ) s 1 + s + qs From Theorem 3, Lemma 5, 6 and 7, we have Theorem 4. Algorithm A2 is optimal for all q, s > 1.
4
Conclusions
This paper studied online hierarchical scheduling on two uniform machines with resource augmentation. The two machines, M1 and M2 , have a speed of s and 1 in online algorithms, while in offline algorithms, they have a speed of q and 1 respectively. Each job, as well as each machine, is labelled with a hierarchy. A job can be scheduled on a machine only when its hierarchy is no less than that of the machine. We considered the objective of minimizing makespan. Optimal online algorithms for any 0 < q, s < ∞ are given in the paper. The results in this paper suggest some problems deserving further study. An important and natural question is to extend the result to m(m > 2) machines. In fact, it is still open to design optimal algorithms for general m uniform machines in hierarchy setting. In addition, it is also worth studying the preemptive version of our problem.
References 1. Berman, P., Coulston, C.: Speed is more powerful than clairvoyance. Nordic Journal of Computing 6(2), 181–193 (1999) 2. Bansal, N., Dhamdhere, K., K¨ onemann, J., Sinha, A.: Non-clairvoyant scheduling for minimizing mean slowdown. In: Alt, H., Habib, M. (eds.) STACS 2003. LNCS, vol. 2607, pp. 260–270. Springer, Heidelberg (2003)
648
Y. Jiang, A. Zhang, and J. Hu
3. Bar-Noy, A., Freund, A., Naor, J.: On-line load balancing in a hierarchical server topology. SIAM Journal on Computing 31, 527–549 (2001) 4. Chassid, O., Epstein, L.: The hierarchical model for load balancing on two machines. Journal of Combinatorial Optimization 15(4), 305–314 (2008) 5. Crescenzi, P., Gambosi, G., Penna, P.: On-line algorithms for the channel assignment problem in cellular networks. Discrete Applied Mathematics 137, 237–266 (2004) 6. Dosa, G., Epstein, L.: Preemptive scheduling on a small number of hierarchical machines. Information and Computation 206(5), 602–619 (2008) 7. Epstein, L., Ganot, A.: Optimal on-line algorithms to minimize makespan on two machines with resource augmentation. Theory of Computing Systems 42(4), 431– 449 (2008) 8. Graham, R.L.: Bounds for certain multiprocessing anomalies. Bell System Technical Journal 45, 1563–1581 (1966) 9. Jiang, Y.W., He, Y., Tang, C.M.: Optimal online algorithms for scheduling on two identical machines under a grade of service. Journal of Zhejiang University Science 7A, 309–314 (2006) 10. Jiang, Y.W.: Online scheduling on parallel machines with two GoS levels. Journal of Combinatorial Optimization 16, 28–38 (2008) 11. Kalyanasundaram, B., Pruhs, K.: Speed is as powerful as clairvoyance. Journal of the ACM 47(4), 214–221 (2000) 12. Kalyanasundaram, B., Pruhs, K.: Maximizing job completions online. In: Bilardi, G., Pietracaprina, A., Italiano, G.F., Pucci, G. (eds.) ESA 1998. LNCS, vol. 1461, pp. 235–246. Springer, Heidelberg (1998) 13. Lam, T.W., To, K.K.: Trade-offs between speed and processor in hard-deadline scheduling. In: Proceedings of the Tenth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 1999), pp. 623–632 (1999) 14. Park, J., Chang, S.Y., Lee, K.: Online and semi-online scheduling of two machines under a grade of service provision. Operations Research Letters 34, 692–696 (2006) 15. Sleator, D., Tarjan, R.E.: Amortized efficiency of list update and paging rules. Communications of the ACM 28, 202–208 (1985) 16. Tan, Z.Y., Zhang, A.: A note on hierarchical scheduling on two uniform machines. Journal of Combinatorial Optimization 20, 85–95 (2010) 17. Zhang, A., Jiang, Y.W., Tan, Z.Y.: Online parallel machines scheduling with two hierarchies. Theoretical Computer Science 410, 3597–3605 (2009)
Author Index
Ahlroth, Lauri 297 Aoki, Takanori 86 Arvind, V. 444 Asahiro, Yuichi 259 Asinowski, Andrei 180
Heggernes, Pinar 331 Hitchcock, John M. 240 Hoang, Do Huy 503 Hu, Jueliang 638 Hua, Qiang-Sheng 74
Banik, Aritra 213 Barequet, Gill 180 Barequet, Ronnie 180 Bhattacharya, Bhaswar B. 213 B¨ ocker, Sebastian 37 Bougeret, Marin 271 Brinkmeyer, Malte 37 Bui-Xuan, Binh-Minh 331
Iliopoulos, Costas S. Imai, Keiko 354 Ito, Takehiro 86
Cai, Jin-Yi 146 Carlier, Jacques 592 Carpov, Sergiu 592 Chang, Hsien-Chih 225 Chaudhary, Amitabh 366 Chee, Yeow Meng 627 Chen, Danny Z. 366 Chen, Jianer 110, 343 Chin, Francis Y.L. 391 Christou, Michalis 492 Churchill, Berkeley R. 531 Crochemore, Maxime 492 Daescu, Ovidiu 192 Das, Sandip 213 De Bonis, Annalisa 579 De Marco, Gianluca 604 Di Crescenzo, Giovanni 579 Duan, Zhenhua 402 Dutot, Pierre Francois 271 Feng, Qilong
343
Garvin, Brady 252 Gavinsky, Dmitry 158 Glaßer, Christian 240 Griebel, Thasso 37 Guo, Jiong 110 Guth, Ondrej 492
492
Jansen, Klaus 271 Jiang, Minghui 62, 543 Jiang, Shaoquan 479 Jiang, Yiwei 638 Ju, Wenqi 192 Kamiyama, Naoyuki 354 Kanmera, Kenta 259 Kao, Mong-Jen 25 Karagiorgos, Gregory 456 Katz, Bastian 25 Kautz, Steven M. 284 Kijima, Shuji 13 Kin, Sung Wing 503 K¨ obler, Johannes 444 Kortelainen, Juha 519 Kortelainen, Tuomas 519 Kowalczyk, Michael 146 Kranakis, Evangelos 604 Krug, Marcus 25 Lamagna, Edmund A. 531 Lau, Francis C.M. 74 Lee, D.T. 25 Le Gall, Fran¸cois 432 Li, Angsheng 467 Liao, Kewen 555 Liu, Yunlong 110 Lu, Hsueh-I. 225 Luo, Jun 192 Ma, Shaohan 49 Ma, Tengyu 616 Makino, Kazuhisa 1 Matsumoto, Yusuke 354
650
Author Index
Meister, Daniel 331 Messner, Jochen 168 Misra, Neeldhara 98 Miyano, Eiji 259 Moosa, Tanaeem M. 204
Tamaki, Suguru 1 Tan, Guozhen 414 Tayu, Satoshi 307 Tewari, Raghunath 252 Thai, My T. 379 Thierauf, Thomas 168 Tian, Cong 402 Ting, Hing-Fung 391 Travers, Stephen 240 Trystram, Denis 271
Nace, Dritan 592 Nguyen, Nam P. 379 Okamoto, Yoshio 13 Omran, Masoud T. 567 O’Neil, Shawn T. 366
Uchizawa, Kei Ueno, Shuichi Uno, Takeaki
Pan, Yicheng 467 Pavan, A. 240 Philip, Geevarghese 98 Pissis, Solon P. 492 Pottonen, Olli 297 Poulakis, Dimitrios 456 Proskurowski, Andrzej 331 Qin, Zhiguang
Vesanen, Ari 519 Vikas, Narayan 319 Vinodchandran, N.V.
252
Wagner, Dorothea 25 Wang, Haitao 366 Wang, Huaxiong 627 Wang, Jianxin 110, 343 Wang, Yuexuan 74 Wiener, G´ abor 604 Williams, Ryan 237
479
Raman, Venkatesh 98 Ranjan, Desh 134 Robenek, Christina 271 Roetteler, Martin 158 Roland, J´er´emie 158 Rote, G¨ unter 180 Rutter, Ignaz 25 Sack, J¨ org-R¨ udiger 567 Saurabh, Saket 98 Savage, John 134 Schumacher, Andr´e 297 Shen, Hong 555 Shen, Yilin 379 Shrestha, Anish Man Singh Shutters, Brad 284 Sirdey, Renaud 592 Sohel Rahman, M. 204 Stolee, Derrick 252 Sun, Jinghao 414 Sun, Xiaoming 616 Suzuki, Akira 86
86 307 13
Yamakami, Tomoyuki 122 Yamamoto, Masaki 1 Yoshida, Yuichi 432 Yu, Dongxiao 74 Yu, Huacheng 616
307
Zarrabi-Zadeh, Hamid 567 Zeng, Shengke 479 Zhang, An 638 Zhang, Liang Feng 627 Zhang, Pingping 49 Zhang, Yong 62, 391 Zhou, Xiao 86 Zhu, Binhai 192 Zhu, Daming 49 Zubair, Mohammad 134