fun with algorithms ferro, luccio widmayer 2014 05 16 Cấu trúc dữ liệu và giải thuật

388 42 0
fun with algorithms ferro, luccio   widmayer 2014 05 16 Cấu trúc dữ liệu và giải thuật

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

LNCS 8496 Alfredo Ferro Fabrizio Luccio Peter Widmayer (Eds.) Fun with Algorithms 7th International Conference, FUN 2014 Lipari Island, Sicily, Italy, July 1–3, 2014 Proceedings 123 CuuDuongThanCong.com 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 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 CuuDuongThanCong.com 8496 Alfredo Ferro Fabrizio Luccio Peter Widmayer (Eds.) Fun with Algorithms 7th International Conference, FUN 2014 Lipari Island, Sicily, Italy, July 1-3, 2014 Proceedings 13 CuuDuongThanCong.com Volume Editors Alfredo Ferro Università degli Studi di Catania Dipartimento di Matematica e Informatica, Viale A Doria 6, 95125 Catania, Italy E-mail: ferro@dmi.unict.it Fabrizio Luccio Università di Pisa, Dipartimento di Informatica Largo B Pontecorvo 3, 56127 Pisa, Italy E-mail: luccio@di.unipi.it Peter Widmayer ETH Zürich, Institute of Theoretical Computer Science Universitätsstrasse 6, 8092 Zürich, Switzerland E-mail: widmayer@inf.ethz.ch ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-319-07889-2 e-ISBN 978-3-319-07890-8 DOI 10.1007/978-3-319-07890-8 Springer Cham Heidelberg New York Dordrecht London Library of Congress Control Number: 2014940050 LNCS Sublibrary: SL – Theoretical Computer Science and General Issues © Springer International Publishing Switzerland 2014 This work is subject to copyright All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in ist current version, and permission for use must always be obtained from Springer Permissions for use may be obtained through RightsLink at the Copyright Clearance Center Violations are liable to prosecution under the respective Copyright Law The use of general descriptive names, registered names, trademarks, service marks, 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 While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made The publisher makes no warranty, express or implied, with respect to the material contained herein 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) CuuDuongThanCong.com Preface FUN with Algorithms is dedicated to the use, design, and analysis of algorithms and data structures, focusing on results that provide amusing, witty but nonetheless original and scientifically profound contributions to the area Donald Knuth’s famous quote captures this spirit nicely: pleasure has probably been the main goal all along But I hesitate to admit it, because computer scientists want to maintain their image as hard-working individuals who deserve high salaries Sooner or later society will realise that certain kinds of hard work are in fact admirable even though they are more fun than just about anything else.” The previous FUNs were held in Elba Island, Italy; in Castiglioncello, Tuscany, Italy; in Ischia Island, Italy; and in San Servolo Island, Venice, Italy Special issues of Theoretical Computer Science, Discrete Applied Mathematics, and Theory of Computing Systems were dedicated to them This volume contains the papers presented at the 7th International Conference on Fun with Algorithms 2014 that was held during July 1–3, 2014, on Lipari Island, Italy The call for papers attracted 49 submissions from all over the world, addressing a wide variety of topics, including algorithmic questions rooted in biology, cryptography, game theory, graphs, the Internet, robotics and mobility, combinatorics, geometry, stringology, as well as space-conscious, randomized, parallel, distributed algorithms, and their visualization Each submission was reviewed by three Program Committee members After a careful reviewing process and a thorough discussion, the committee decided to accept 29 papers In addition, the program featured two invited talks by Paolo Boldi and Erik Demaine Extended versions of selected papers will appear in a special issue of the journal Theoretical Computer Science We thank all authors who submitted their work to FUN 2014, all Program Committee members for their expert assessments and the ensuing discussions, all external reviewers for their kind help, and Alfredo Ferro, Rosalba Giugno, Alfredo Pulvirenti as well as Giuseppe Prencipe for the organization of the conference and everything around it We used EasyChair (http://www.easychair.org/) throughout the entire preparation of the conference, for handling submissions, reviews, the selection of papers, and the production of this volume It greatly facilitated the whole process We want to warmly thank the people who designed it and those who maintain it Warm thanks also go to Alfred Hofmann and Ingrid Haas at CuuDuongThanCong.com VI Preface Springer with whom collaborating was a pleasure We gratefully acknowledge financial support by the Department of Computer Science of ETH Zurich, and the patronage of the European Association for Theoretical Computer Science (EATCS) April 2014 CuuDuongThanCong.com Alfredo Ferro Fabrizio Luccio Peter Widmayer Organization Program Committee J´er´emie Chalopin Pierluigi Crescenzi Shantanu Das Josep Diaz Yann Disser Paolo Ferragina Fedor Fomin Pierre Fraigniaud Leszek Gasieniec Fabrizio Grandoni Evangelos Kranakis Danny Krizanc Flaminia Luccio Matus Mihalak Linda Pagli David Peleg Paolo Penna Giuseppe Persiano Giuseppe Prencipe Jose Rolim Piotr Sankowski Ryuhei Uehara Jorge Urrutia Peter Widmayer Christos Zaroliagis LIF, CNRS, Aix Marseille Universit´e, France Florence University, Italy Aix-Marseille Universit´e, France UPC Barcelona, Spain TU Berlin, Germany University of Pisa, Italy University of Bergen, Norway Universit´e Paris Diderot, France University of Liverpool, UK IDSIA, University of Lugano, Switzerland Carleton University, Canada Wesleyan University, USA Ca’ Foscari University of Venice, Italy ETH Zurich, Switzerland University of Pisa, Italy The Weizmann Institute, Israel Universit` a di Salerno, Italy Universit`a di Salerno, Italy University of Pisa, Italy University of Geneva, Switzerland University of Warsaw, Poland Japan Advanced Institute of Science and Technology Universidad Nacional Aut´onoma de M´exico ETH Zurich, Switzerland Computer Technology Institute, University of Patras, Greece Additional Reviewers Bernasconi, Anna Bonnet, Edouard Borassi, Michele Cicalese, Ferdinando Couăetoux, Basile De Prisco, Roberto Di Luna, Giuseppe Antonio CuuDuongThanCong.com Donati, Beatrice Drange, Paal Groenaas Ferraioli, Diodato Focardi, Riccardo Fotakis, Dimitris Gallopoulos, Efstratios Giotis, Ioannis VIII Organization Kontogiannis, Spyros Labourel, Arnaud Luccio, Fabrizio Mamageishvili, Akaki Marino, Andrea Naves, Guyslain Pallottino, Lucia Pisanti, Nadia CuuDuongThanCong.com Poupet, Victor Rossi, Gianluca Ruj, Sushmita Sacomoto, Gustavo Serna, Maria Squarcina, Marco Uznanski, Przemyslaw Venturini, Rossano Table of Contents Algorithmic Gems in the Data Miner’s Cave Paolo Boldi Fun with Fonts: Algorithmic Typography Erik D Demaine and Martin L Demaine 16 Happy Edges: Threshold-Coloring of Regular Lattices Muhammad Jawaherul Alam, Stephen G Kobourov, Sergey Pupyrev, and Jackson Toeniskoetter 28 Classic Nintendo Games Are (Computationally) Hard Greg Aloupis, Erik D Demaine, Alan Guo, and Giovanni Viglietta 40 On the Solvability of the Six Degrees of Kevin Bacon Game - A Faster Graph Diameter and Radius Computation Method Michele Borassi, Pierluigi Crescenzi, Michel Habib, Walter Kosters, Andrea Marino, and Frank Takes 52 No Easy Puzzles: A Hardness Result for Jigsaw Puzzles Michael Brand 64 Normal, Abby Normal, Prefix Normal P´eter Burcsi, Gabriele Fici, Zsuzsanna Lipt´ ak, Frank Ruskey, and Joe Sawada 74 Nonconvex Cases for Carpenter’s Rulers Ke Chen and Adrian Dumitrescu 89 How to Go Viral: Cheaply and Quickly Ferdinando Cicalese, Gennaro Cordasco, Luisa Gargano, Martin Milaniˇc, Joseph G Peters, and Ugo Vaccaro 100 Synchronized Dancing of Oblivious Chameleons Shantanu Das, Paola Flocchini, Giuseppe Prencipe, and Nicola Santoro 113 Another Look at the Shoelace TSP: The Case of Very Old Shoes Vladimir G Deineko and Gerhard J Woeginger 125 Playing Dominoes Is Hard, Except by Yourself Erik D Demaine, Fermi Ma, and Erik Waingarten 137 CuuDuongThanCong.com X Table of Contents UNO Gets Easier for a Single Player Palash Dey, Prachi Goyal, and Neeldhara Misra 147 Secure Auctions without Cryptography Jannik Dreier, Hugo Jonker, and Pascal Lafourcade 158 Towards an Algorithmic Guide to Spiral Galaxies Guillaume Fertin, Shahrad Jamshidi, and Christian Komusiewicz 171 Competitive Analysis of the Windfall Game Rudolf Fleischer and Tao Zhang 185 Excuse Me! or The Courteous Theatregoers’ Problem (Extended Abstract) Konstantinos Georgiou, Evangelos Kranakis, and Danny Krizanc 194 Zombie Swarms: An Investigation on the Behaviour of Your Undead Relatives Vincenzo Gervasi, Giuseppe Prencipe, and Valerio Volpi 206 Approximability of Latin Square Completion-Type Puzzles Kazuya Haraguchi and Hirotaka Ono Sankaku-Tori: An Old Western-Japanese Game Played on a Point Set Takashi Horiyama, Masashi Kiyomi, Yoshio Okamoto, Ryuhei Uehara, Takeaki Uno, Yushi Uno, and Yukiko Yamauchi 218 230 Quell Minghui Jiang, Pedro J Tejada, and Haitao Wang 240 How Even Tiny Influence Can Have a Big Impact! Barbara Keller, David Peleg, and Roger Wattenhofer 252 Optimizing Airspace Closure with Respect to Politicians’ Egos Irina Kostitsyna, Maarten Lă oer, and Valentin Polishchuk 264 Being Negative Makes Life NP-hard (for Product Sellers) Sven O Krumke, Florian D Schwahn, and Clemens Thielen 277 Clearing Connections by Few Agents Christos Levcopoulos, Andrzej Lingas, Bengt J Nilsson, and ˙ nski Pawel Zyli´ 289 Counting Houses of Pareto Optimal Matchings in the House Allocation Problem Andrei Asinowski, Bal´ azs Keszegh, and Tillmann Miltzow Practical Card-Based Cryptography Takaaki Mizuki and Hiroki Shizuya CuuDuongThanCong.com 301 313 Centers and Medians of a Tree 363 Chang, C.L.: Deterministic sublinear-time approximations for metric 1-median selection Inf Process Lett 113, 288–292 (2013) Chen, G., Yu, X.: A note on fragile graphs Discrete Mathematics 249, 41–43 (2002) Chepoi, V., Dragan, F., Estellon, B., Habib, M., Vax`es, Y.: Diameters, centers, and approximating trees of δ-hyperbolic geodesic spaces and graphs In: Proceedings of the Twenty-fourth Annual Symposium on Computational Geometry, pp 59–68 ACM (2008) Cormen, T., Leiserson, C., Rivest, R., Stein, C.: Introduction to Algorithms MIT Press and McGraw-Hill (2001) 10 Crescenzi, P., Grossi, R., Habib, M., Lanzi, L., Marino, A.: On computing the diameter of real-world undirected graphs Theor Comput Sci 514, 84–95 (2013) 11 Culberson, J., Rudnicki, P.: A fast algorithm for constructing trees from distance matrices Inf Process Lett 30, 215–220 (1989) 12 Fischer, M.J., Salzberg, S.L.: Solution to problem 81-5 J Algorithms 3, 376–379 (1982) 13 Goldman, A.J.: Optimal center location in simple networks Transp Sci 5, 212–221 (1979) 14 Guha, S., Meyerson, A., Mishra, N., Motwani, R., O’Callaghan, L.: Clustering data streams: Theory and practice IEEE Trans Knowl Data Eng 15(3), 515–528 (2003) 15 Gusfield, D.: Algorithms on Strings, Trees, and Sequences – Computer Science and Computational Biology Cambridge University Press (1997) 16 Hein, J.: An optimal algorithm to reconstruct trees from additive distance data Bull Math Biol 51, 597–603 (1989) 17 Indyk, P.: Sublinear time algorithms for metric space problems In: Proceedings of the 31st Annual ACM Symposium on Theory of Computing, pp 428–434 (1999) 18 Kannan, S., Lawler, E., Warnow, T.: Determining the evolutionary tree In: Proceedings of 1st Annual ACM-SIAM Symposium on Discrete Algorithms, pp 475–484 (1990) 19 King, V., Zhang, L., Zhou, Y.: On the complexity of distance-based evolutionary tree reconstruction In: Proceedings of 14th Annual ACM-SIAM Symposium on Discrete Algorithms, pp 444–453 (2003) 20 Magnien, C., Latapy, M., Habib, M.: Fast computation of empirically tight bounds for the diameter of massive graphs J Exp Algorithmics 13, 10 (2009) 21 Wasserman, S., Faust, K.: Social Network Analysis: Methods and Applications Cambridge University Press (1994) 22 Waterman, M., Smith, T., Singh, M., Beyer, W.: Additive evolutionary trees J Theor Biol 64, 199–213 (1977) 23 Wu, B.Y., Chao, K.M.: Spanning Trees and Optimization Problems Chapman & Hall (2004) 24 Wu, B.Y., Lancia, G., Bafna, V., Chao, K.M., Ravi, R., Tang, C.Y.: A polynomial time approximation scheme for minimum routing cost spanning trees SIAM J Comput 29, 761–778 (2000) 25 Wu, B.Y.: On approximating metric 1-median in sublinear time Inf Process Lett 114(4), 163–166 (2014) CuuDuongThanCong.com Swapping Labeled Tokens on Graphs Katsuhisa Yamanaka1 , Erik D Demaine2 , Takehiro Ito3 , Jun Kawahara4, Masashi Kiyomi5 , Yoshio Okamoto6 , Toshiki Saitoh7 , Akira Suzuki3 , Kei Uchizawa8 , and Takeaki Uno9 Iwate University, Japan yamanaka@cis.iwate-u.ac.jp Massachusetts Institute of Technology, USA edemaine@mit.edu Tohoku University, Japan {takehiro,a.suzuki}@ecei.tohoku.ac.jp Nara Institute of Science and Technology, Japan jkawahara@is.naist.jp Yokohama City University, Japan masashi@yokohama-cu.ac.jp University of Electro-Communications, Japan okamotoy@uec.ac.jp Kobe University, Japan saitoh@eedept.kobe-u.ac.jp Yamagata University, Japan uchizawa@yz.yamagata-u.ac.jp National Institute of Informatics, Japan uno@nii.ac.jp Abstract Consider a puzzle consisting of n tokens on an n-vertex graph, where each token has a distinct starting vertex and a distinct target vertex it wants to reach, and the only allowed transformation is to swap the tokens on adjacent vertices We prove that every such puzzle is solvable in O(n2 ) token swaps, and thus focus on the problem of minimizing the number of token swaps to reach the target token placement We give a polynomial-time 2-approximation algorithm for trees, and using this, obtain a polynomial-time 2α-approximation algorithm for graphs whose tree α-spanners can be computed in polynomial time Finally, we show that the problem can be solved exactly in polynomial time on complete bipartite graphs Introduction A ladder lottery, known as “Amidakuji” in Japan, is one of the most popular lotteries It is often used to assign roles to children in a group, as in the following example Imagine a teacher of an elementary school wants to assign cleaning duties to two students among four students A, B, C and D Then, the teacher draws four vertical lines and several horizontal lines between two consecutive vertical lines (See Fig 1(a).) The teacher randomly chooses two vertical lines, A Ferro, F Luccio, and P Widmayer (Eds.): FUN 2014, LNCS 8496, pp 364–375, 2014 c Springer International Publishing Switzerland 2014 CuuDuongThanCong.com Swapping Labeled Tokens on Graphs D (a) B A C D B (b) A 365 C (c) Fig How to use ladder lottery (Amidakuji) in Japan v1 v2 v3 v4 f0 ? (a) v1 v2 v3 (b) ft v4 v1 v2 v3 v4 f0 4 3 v1 v2 v3 ft v4 (c) Fig (a) Ladder lottery of the permutation (4, 2, 1, 3) with the minimum number of bars, (b) its corresponding instance of token swapping for a path, and (c) a transformation from f0 to ft with the minimum number of token swaps and draws check marks at their bottom ends The ladder lottery is hidden, and each student chooses one of the top ends of the vertical lines, as illustrated in Fig 1(b) Then, the ladder lottery assigns two students to cleaning duties (check marks) by the top-to-bottom route from each student which always turns right or left at each junction of vertical and horizontal lines (In Fig 1(c), such a route is drawn as a dotted line.) Therefore, in this example, cleaning duties are assigned to students B and C More formally, a ladder lottery can be seen as a model of sorting a particular permutation Let π = (p1 , p2 , , pn ) be a permutation of integers 1, 2, , n Then, a ladder lottery of π is a network with n vertical lines (lines for short) and zero or more horizontal lines (bars for short) each of which connects two consecutive vertical lines and has a different height from the others (See Fig 2(a) as an example.) The top ends of the lines correspond to π, and the bottom ends of the lines correspond to the target permutation (1, 2, , n) Then, each bar connecting two consecutive lines corresponds to a modification of the current permutation by swapping the two numbers on the lines The sequence of such modifications in a ladder lottery must result in the target permutation (1, 2, , n) There are many ladder lotteries that transform the same permutation π = (p1 , p2 , , pn ) into the target one Thus, one interesting research topic is CuuDuongThanCong.com 366 K Yamanaka et al v1 v2 v3 v1 v2 v3 v1 v2 v3 v1 v2 v3 v4 v5 v6 v4 v5 v6 v4 v5 v6 v4 v5 v6 (a) f0 (b) (c) (d) ft Fig A sequence of token placements of the same graph minimizing the number of bars in a ladder lottery for a given permutation π This minimization problem on ladder lottery can be solved by counting the number of “inversions” in π [8,10], where a pair (pi , pj ) in π is called an inversion in π if pi > pj and i < j; for example, there are four inversions in the permutation (4, 2, 1, 3), that is, (4, 2), (4, 1), (4, 3) and (2, 1), and hence the ladder lottery in Fig 2(a) has the minimum number of bars The bubble sort algorithm sorts π using a number of adjacent swaps equal to the number of inversions in π, and hence gives an optimal ladder lottery of π In this paper, we study a generalization of this minimization problem from one dimension to general graphs 1.1 Our Problem Suppose that we are given a connected graph G = (V, E) with n = |V | vertices, with n tokens 1, 2, , n already placed on distinct vertices of G (Refer to Fig 3, where the number i written inside each vertex represents the token i.) We wish to transform this initial token placement f0 into another given target token placement ft The transformation must consist of a sequence of token swaps, each defined by an edge of the graph and consisting of swapping the two tokens on the two adjacent vertices of the edge (See Fig as an example.) Notice that we need the graph to be connected for there to be a solution We will show that such a transformation exists for any two token placements f0 and ft Therefore, we consider the token swapping problem of minimizing the number of token swaps to transform a given token placement f0 into another given token placement ft Figure illustrates an optimal solution for transforming the token placement f0 in Fig 3(a) into the token placement ft in Fig 3(d) using a sequence of three token swaps As illustrated in Fig 2, token swapping on a path is identical to minimizing the number of bars in a ladder lottery The permutation π = (p1 , p2 , , pn ) in the ladder lottery corresponds to the initial token placement f0 , and the target identity permutation (1, 2, , n) corresponds to the target token placement ft where each token i, ≤ i ≤ n, is placed on the vertex vi Then, the number of bars is identical to the number of token swaps CuuDuongThanCong.com Swapping Labeled Tokens on Graphs 1.2 367 Related Work and Known Results A ladder lottery appears in a variety of areas in different forms First, it is strongly related to primitive sorting networks, which are deeply investigated by Knuth [9] (More precise discussion will be given in Section 2.3.) Second, in algebraic combinatorics, a “reduced decomposition” of a permutation π [11] corresponds to a ladder lottery of π with the minimum number of bars Third, a ladder lottery of the reverse permutation (n, n − 1, , 1) corresponds to a pseudoline arrangement in discrete geometry [13] The computational hardness of token swapping is unknown even for general graphs However, the problem of minimizing the number of bars in a ladder lottery, and hence token swapping for paths, can be solved in time O(n2 ) by counting the number of inversions in a given permutation [8,10], or by the application of the bubble sort algorithm Furthermore, token swapping can be solved in time O(n2 ) for cycles [8] and for complete graphs [3,8] Heath and Vergara [7] proposed a polynomial-time 2-approximation algorithm for the square of a path P , where the square of P is the graph obtained from P by adding a new edge between two vertices with distance exactly two in P Therefore, token swapping has been studied for very limited classes of graphs 1.3 Our Contribution In this paper, we study the token swapping problem for some larger classes of graphs, and mainly design three algorithms We first give a polynomial-time 2-approximation algorithm for trees Based on the algorithm for trees, we then present a 2α-approximation algorithm for graphs having tree α-spanners (The definition of tree α-spanners will be given in Section 3.2.) We finally show that the problem is exactly solvable in polynomial time for complete bipartite graphs In addition, we give several results and observations which are related to the three main results above In Section 2.2, we prove that any token placement for a (general) graph G can be transformed into any target token placement by O(n2 ) token swaps, where n is the number of vertices in G We also show that there are instances on paths which require Ω(n2 ) token swaps In Section 2.3, we discuss the relationship between our problem and sorting networks We finally note that our lower bound (in Lemma 1) on the minimum number of token swaps holds not only for trees but also for general graphs Due to the page limitation, several proofs are omitted Preliminaries In this paper, we assume that all graphs are simple and connected Let G = (V, E) be an undirected and unweighted graph with vertex set V and edge set E We sometimes denote by V (G) and E(G) the vertex set and edge set of G, respectively We always denote n = |V | CuuDuongThanCong.com 368 2.1 K Yamanaka et al Definitions for token swapping Suppose that the vertices in a graph G = (V, E) are assigned distinct labels v1 , v2 , , Let L = {1, 2, , n} be a set of n labeled tokens Then, a token placement f of G is a mapping f : V → L such that f (vi ) = f (vj ) holds for every two distinct vertices vi , vj ∈ V ; imagine that tokens are placed on the vertices of G Since f is a one-to-one correspondence, we can obtain its inverse mapping f −1 : L → V Two token placements f and f of a graph G = (V, E) are said to be adjacent if the following two conditions (a) and (b) hold: (a) there exists exactly one edge (vi , vj ) ∈ E such that f (vi ) = f (vj ) and f (vj ) = f (vi ); and (b) f (vk ) = f (vk ) for all vertices vk ∈ V \ {vi , vj } In other words, the token placement f is obtained from f by swapping the tokens on two vertices vi and vj such that (vi , vj ) ∈ E For two token placements f and f of G, a sequence S = f1 , f2 , , fh of token placements is called a swapping sequence between f and f if the following three conditions (1)–(3) hold: (1) f1 = f and fh = f ; (2) fk is a token placement of G for each k = 2, 3, , h − 1; and (3) fk−1 and fk are adjacent for every k = 2, 3, , h The length len(S) of a swapping sequence S is defined to be the number of token placements in S minus one, that is, len(S) indicates the number of token swaps in S For example, len(S) = for the swapping sequence S in Fig Without loss of generality, we always denote by ft the target token placement of a graph G such that ft (vi ) = i for all vertices vi ∈ V (G) For a token placement f0 of G, let OPT(f0 ) be the minimum length of a swapping sequence between f0 and ft , that is, OPT(f0 ) = min{len(S) : S is a swapping sequence between f0 and ft } As we will prove in Theorem 1, there always exists a swapping sequence from any token placement f0 to the target one ft , and hence OPT(f0 ) is well-defined Given a token placement f0 of a graph G, the token swapping problem is to compute OPT(f0 ) We denote always by f0 the initial token placement of G 2.2 Polynomial Upper Bound on the Minimum Length We show the following upper bound for any graph Theorem For any token placement f0 of a graph G, OPT(f0 ) = O(n2 ) It is remarkable that there exists an infinite family of instances on paths such that OPT(f0 ) = Ω(n2 ) Recall that token swapping for paths is equivalent to minimizing the number of bars in a ladder lottery of a given permutation π = (p1 , p2 , , pn ) As we have mentioned in Introduction, the minimum number of bars is equal to the number of inversions in π [8,10] Consider the reverse permutation πr = (n, n − 1, , 1) The number of inversions in πr is Ω(n2 ), and hence OPT(f0 ) = Ω(n2 ) for the corresponding instance of token swapping CuuDuongThanCong.com Swapping Labeled Tokens on Graphs 2.3 369 Relations to Sorting Networks In this subsection, we explain that token swapping has a relationship to sorting networks in the sense that we can obtain an upper bound on OPT(f0 ) for a given token placement f0 from a sorting network which sorts f0 We first explain that a primitive sorting network [9] gives an upper bound on OPT(f0 ) for token swapping on paths (i.e., ladder lotteries) A primitive sorting network transforms any given permutation into the permutation (1, 2, , n) by comparators each of which replaces two consecutive elements pi and pi+1 with (pi , pi+1 ) and max (pi , pi+1 ), respectively Therefore, in token swapping for paths, we can obtain a swapping sequence for a given token placement f0 by swapping two tokens whose corresponding elements are swapped in the primitive sorting network when f0 is input as a particular permutation We generalize this argument to parallel sorting algorithms on an SIMD machine consisting of several processors with local memory which are connected by a network [1] For our purpose, an interconnection network is modeled as an undirected graph G with n labeled vertices v1 , v2 , , Then, a (serial) sorting on G can be seen as a problem to transform a given token placement f0 of G into the target one ft by swapping two tokens on the adjacent vertices In a parallel sorting algorithm for G, we can swap more than one pair of tokens at the same time along a matching M of G; note that each pair of two adjacent tokens in M can be swapped independently More formally, a parallel sorting algorithm for G with r rounds consists of r prescribed matchings M1 , M2 , , Mr of G and r prescribed swapping rules R1 , R2 , , Rr ; each swapping rule Ri , ≤ i ≤ r, determines whether each pair of two adjacent tokens in Mi is swapped or not by the outcome of comparison of adjacent tokens in Mi It should be noted that the parallel sorting algorithm must sort any given token placement f0 of G by the prescribed r matchings and their swapping rules Then, since each matching contains at most n/2 edges, the argument similar to primitive sorting networks establishes the following theorem Theorem Suppose that there is a parallel sorting algorithm with r rounds for an interconnection network G Then, in token swapping, OPT(f0 ) = O(rn) for any token placement f0 of the graph G √ For example, with O( n) √ it is√known that there is a parallel sorting algorithm 3/2 rounds for a n × n mesh [12] Thus, we have OPT(f0 ) = O(n ) for token swapping on such meshes Similarly, from an O(log n(log log n)2 )-round algorithm on hypercubes [4], we obtain OPT(f0 ) = O(n log n(log log n)2 ) for token swapping on hypercubes Approximation In this section, we give approximation results We first give a lower bound on OPT(f0 ) which holds for any graph For a graph G and two vertices v, w ∈ V (G), we denote by spG (v, w) the number of CuuDuongThanCong.com 370 K Yamanaka et al v1 v2 v3 v1 v4 v5 v6 v4 v3 v5 v6 (b) D (a) f Fig (a) token placement f of a graph, and (b) its conflict graph D edges in a shortest path on G between v and w For a token placement f of G, we introduce a potential function pG (f ), as follows: spG (f −1 (i), vi ), pG (f ) = 1≤i≤n that is, the sum of shortest path lengths of all tokens from their current positions to the target positions Notice that ft−1 (i) = vi for all tokens i, ≤ i ≤ n, and hence pG (ft ) = Then, we have the following lemma Lemma OPT(f0 ) ≥ 21 pG (f0 ) for any token placement f0 of a graph G 3.1 Trees The main result of this subsection is the following theorem Theorem There is a polynomial-time 2-approximation algorithm for token swapping on trees As a proof of Theorem 3, we give a polynomial-time algorithm which actually finds a swapping sequence S between two token placements f0 and ft of a tree T such that spT (f0−1 (i), vi ) = pT (f0 ) (1) len(S) ≤ 1≤i≤n Then, Lemma implies that len(S) ≤ · OPT(f0 ), as required Conflict graph To give our algorithm, we introduce a digraph D = (VD , ED ) for a token placement f of a graph G (which is not necessarily a tree), called the conflict graph for f , as follows: • VD = {vi ∈ V (G) : f (vi ) = ft (vi )}; and • there is an arc (vi , vj ) from vi to vj if and only if f (vi ) = ft (vj ) = j Therefore, each token f (vi ) on a vertex vi ∈ VD needs to be moved to the vertex vj ∈ VD such that (vi , vj ) ∈ ED (See Fig as an example.) Lemma Let D be the conflict graph for a token placement f of a graph G Then, every component in D is a directed cycle CuuDuongThanCong.com Swapping Labeled Tokens on Graphs w1 w4 w1 w1 10 w4 w1 10 w3 w3 w4 10 w2 w1 w3 10 w4 w2 w1 w4 10 (e) f4,0 w2 w2 w2 (b) ft (c) f2,0 (a) f0 = f1,0 w4 10 w3 w2 371 w3 (d) f3,0 w3 (f ) ft Fig (a) Initial token placement f0 of a tree and (b) target one ft , where a directed cycle C = (w1 , w2 , w3 , w4 , w1 ) in the conflict graph D for f0 is depicted by dotted arrows (c), (d) and (e) indicate the applications of Step (1) to the tokens = 7, = and = 10, respectively (f) indicates the application of Step (2) to the token = Algorithm for Trees We now give our algorithm for trees For two vertices u and v of a tree T , we denote by P (u, v) a unique path in T between u and v Let D be the conflict graph for an initial token placement f0 of T , and let C = (w1 , w2 , , wq ) be an arbitrary directed cycle in D where wq = w1 Let k = f0 (wk ) for each k, ≤ k ≤ q−1; then ft (wk+1 ) = k Our algorithm moves the tokens , , , q−1 on the vertices in C to their target positions along the unique paths More formally, we construct a swapping sub-sequence SC for C, as follows; let f1,0 = f0 as the initialization (See also Fig as an example.) (1) At the k-th step of the algorithm, ≤ k ≤ q − 2, we focus on the token k −1 (= f0 (wk )) which is currently placed on the vertex fk,0 ( k ), and move it −1 −1 ( k ), fk,0 ( k+1 )) which is adjacent to the to the vertex in the path P (fk,0 −1 vertex fk,0 ( k+1 ) Let fk+1,0 be the resulting token placement of T (2) At the (q − 1)-st step of the algorithm, we move the token q−1 (= −1 ( q−1 ) to the vertex wq (= w1 ) f0 (wq−1 )) from the vertex fq−1,0 Then, we have the following lemma Lemma For the swapping sub-sequence SC , the following (a) and (b) hold: (a) len(SC ) ≤ 1≤k≤q−1 spT (wk , wk+1 ); and CuuDuongThanCong.com 372 K Yamanaka et al (b) the token placement f of T obtained by SC satisfies f (vi ) = ft (vi ) f0 (vi ) if vi in C; otherwise, for each vertex vi ∈ V (T ) It should be noted that Lemma 3(b) ensures that we can choose directed cycles in D in an arbitrary order Therefore, by repeatedly constructing swapping subsequences for all directed cycles in D (in an arbitrary order), we eventually obtain the target token placement ft of T Furthermore, notice that f0−1 ( k ) = wk for each k, ≤ k ≤ q − 1, and hence Lemma 3(a) implies that Eq (1) holds This completes the proof of Theorem 3.2 General Graphs We now give an approximation algorithm for general graphs by combining our algorithm in Section 3.1 with the notion of “tree spanner” of a graph A tree α-spanner T of an unweighted graph G = (V, E) is a spanning tree of G such that spT (v, w) ≤ α · spG (v, w) for every pair of vertices v, w ∈ V [2] Then, we have the following theorem Theorem Suppose that a graph G has a tree α-spanner, and it can be computed in polynomial time Then, there is a polynomial-time 2α-approximation algorithm for token swapping on G Theorem requires to find a tree α-spanner of a graph G in polynomial time However, Cai and Corneil [2] proved that deciding whether an unweighted graph G has a tree α-spanner is NP-complete for any fixed α ≥ 4, while it can be solved in polynomial time for α ≤ Therefore, several approximation and FPT algorithms have been studied extensively For example, Emek and Peleg [6] proposed a polynomial-time O(log n)-approximation algorithm on any unweighted graph for the problem of nding the minimum value of Dragan and Kă ohler [5] gave approximation results for some graph classes (For details, see their papers and the references therein.) Complete Bipartite Graphs The main result of this section is the following theorem Theorem Token swapping can be solved exactly in polynomial time for complete bipartite graphs Let G be a complete bipartite graph, and let X and Y be the bipartition of the vertex set V (G) We again construct the conflict graph D = (VD , ED ) for a token placement f of G Then, we call a directed cycle in D an XY -cycle if it contains at least one vertex in X and at least one vertex in Y Similarly, a directed cycle in D is called an X-cycle (or a Y -cycle) if it consists only of CuuDuongThanCong.com Swapping Labeled Tokens on Graphs 373 vertices in X (resp., only of vertices in Y ) Let cXY (f ), cX (f ) and cY (f ) be the numbers of XY -cycles, X-cycles and Y -cycles in D, respectively Let c0 (f ) be the number of vertices in V (G) that are not in D, that is, c0 (f ) = |V (G) \ VD | Then, we introduce the following value s(f ) for f : s(f ) = cXY (f ) + cX (f ) + cY (f ) + c0 (f ) − · max cX (f ), cY (f ) (2) For a token placement f of a complete bipartite graph G, let q(f ) = n − s(f ) Then, we have the following formula for OPT(f0 ) Lemma OPT(f0 ) = q(f0 ) Lemma implies that OPT(f0 ) can be computed in polynomial time for a complete bipartite graph G Therefore, in the remainder of this section, we prove Lemma as a proof of Theorem 4.1 Upper Bound We first prove OPT(f0 ) ≤ q(f0 ) by induction on q(f0 ) Our proof yields an actual swapping sequence S between two token placements f0 and ft of a complete bipartite graph G such that len(S) = q(f0 ) Base Case Let f0 be an initial token placement of G such that q(f0 ) = Then, we claim that f0 = ft Recall that cXY (f0 ), cX (f0 ) and cY (f0 ) denote the numbers of directed cycles in D, while c0 (f0 ) denotes the number of vertices in G that are not contained in D Since each directed cycle in D contains at least two vertices of G, we have c0 (f0 ) = |V (G) \ VD | ≤ n − · cXY (f0 ) + cX (f0 ) + cY (f0 ) Therefore, by Eq (2) we have s(f0 ) ≤ n − cXY (f0 ) + cX (f0 ) + cY (f0 ) − · max cX (f0 ), cY (f0 ) Since cXY (f0 ), cX (f0 ) and cY (f0 ) are all non-negative integers, we thus have s(f0 ) ≤ n Furthermore, s(f0 ) = n holds if and only if cXY (f0 ) = cX (f0 ) = cY (f0 ) = 0, that is, the conflict graph D has no vertex Therefore, if q(f0 ) = n − s(f0 ) = and hence s(f0 ) = n holds, then we have f0 = ft as claimed We thus have OPT(f0 ) = = q(f0 ) Inductive Step Suppose that OPT(f0 ) ≤ q(f0 ) holds for any token placement f0 of G such that q(f0 ) = k Let f0 be an initial token placement of G such that q(f0 ) = k + Then, we prove that OPT(f0 ) ≤ q(f0 ) = k + holds We may assume without loss of generality that cX (f0 ) ≥ cY (f0 ) We first choose one directed cycle C from the conflict graph D for f0 in the following manner: (A) if cXY (f0 ) ≥ 1, then choose any XY -cycle C in D; (B) if cXY (f0 ) = and cY (f0 ) ≥ 1, then choose any Y -cycle C in D; and (C) otherwise choose any X-cycle C in D CuuDuongThanCong.com 374 K Yamanaka et al X v1 v2 v3 v4 X v1 v2 v3 v4 v5 v6 v7 v8 CX C Y v5 v6 v7 v8 Y (b) f0’ (a) f0 Fig Example of Case (B) It should be noted that at least one of cXY (f0 ), cX (f0 ) and cY (f0 ) is non-zero because q(f0 ) = n − s(f0 ) = Therefore, we can always choose one directed cycle C from D according to the three cases (A)–(C) above We then swap some particular pair of tokens according to the chosen directed cycle C We will show that the resulting token placement f0 of G satisfies q(f0 ) = k Then, by applying the induction hypothesis to f0 , we have OPT(f0 ) ≤ + OPT(f0 ) ≤ + q(f0 ) = + k = q(f0 ) Due to the page limitation, we here prove only Case (b), that is, C is a Y -cycle; the remaining cases can be proved similarly In this case, by the choice of directed cycles from D, we have cXY (f0 ) = Furthermore, since cX (f0 ) ≥ cY (f0 ), we have cX (f0 ) ≥ and hence the conflict graph D for f0 contains at least one X-cycle CX Figure 6(a) illustrates an example; in the figure, for the sake of simplicity, we omit all the edges in E(G) and depict the arcs in the conflict graph by dotted arrows We arbitrarily pick one vertex in C and one vertex in CX , and swap the two tokens on them (See Fig 6(b).) Then, the resulting token placement f0 of G satisfies cXY (f0 ) = cXY (f0 ) + (= 1); cX (f0 ) = cX (f0 ) − (≥ 0); cY (f0 ) = cY (f0 ) − (≥ 0); and c0 (f0 ) = c0 (f0 ) Therefore, by Eq (2) we have s(f0 ) = cXY (f0 ) + + cX (f0 ) − + cY (f0 ) − +c0 (f0 ) − · max cX (f0 ) − 1, cY (f0 ) − = s(f0 ) + We thus have q(f0 ) = n − s(f0 ) = n − s(f0 ) + = q(f0 ) − = k for Case (b) In this way, we can verify that OPT(f0 ) ≤ q(f0 ) holds 4.2 Lower Bound We then prove OPT(f0 ) ≥ q(f0 ) Since q(ft ) = 0, it suffices to show that one token swap can decrease the value q(f0 ) by at most one More formally, we have the following lemma, which completes the proof of Lemma Lemma q(f ) − q(f ) ≤ holds for any two adjacent token placements f and f of a complete bipartite graph G CuuDuongThanCong.com Swapping Labeled Tokens on Graphs 375 Concluding Remark In this paper, we investigated algorithms for the token swapping problem on some non-trivial graph classes We note that the algorithm for trees runs in O(n2 ) time, because each step moves the token k along the unique path of O(n) length in the tree A swapping sequence S can be represented by outputting the edges used for the token swaps in S Therefore, the algorithm can return an actual swapping sequence for a given token placement f0 in O(n2 ) time, while there are instances on paths such that OPT(f0 ) = Ω(n2 ) as we have discussed in Section 2.2 Therefore, it seems difficult to improve the time complexity O(n2 ) of the algorithm if we wish to output an actual swapping sequence explicitly Acknowledgment We are grateful to Takashi Horiyama, Shin-ichi Nakano and Ryuhei Uehara for their comments on related work and fruitful discussions with them This work is partially supported by MEXT/JSPS KAKENHI, including the ELC project (Grant Numbers 24.3660, 24106010, 24700130, 25106502, 25106504, 25330003.) References Bitton, D., DeWitt, D.J., Hsaio, D.K., Menon, J.: A taxonomy of parallel sorting ACM Computing Surveys 16, 287–318 (1984) Cai, L., Corneil, D.G.: Tree spanners SIAM J Discrete Mathematics 8, 359–387 (1995) Cayley, A.: Note on the theory of permutations Philosophical Magazine 34, 527–529 (1849) Cypher, R., Plaxton, C.G.: Deterministic sorting in nearly logarithmic time on the hypercube and related computers J Computer and System Sciences 47, 501–548 (1993) Dragan, F.F., Kă ohler, E.: An approximation algorithm for the tree t-spanner problem on unweighted graphs via generalized chordal graphs In: Goldberg, L.A., Jansen, K., Ravi, R., Rolim, J.D.P (eds.)APPROX/RANDOM 2011 LNCS, vol 6845, pp 171–183 Springer, Heidelberg (2011) Emek, Y., Peleg, D.: Approximating minimum max-stretch spanning trees on unweighted graphs SIAM J Computing 38, 1761–1781 (2008) Heath, L.S., Vergara, J.P.C.: Sorting by short swaps J Computational Biology 10, 775–789 (2003) Jerrum, M.R.: The complexity of finding minimum-length generator sequence Theoretical Computer Science 36, 265–289 (1985) Knuth, D.E (ed.): Axioms and Hulls LNCS, vol 606 Springer, Heidelberg (1992) 10 Knuth, D.E.: The Art of Computer Programming, 2nd edn., vol Addison-Wesley (1998) 11 Manivel, L.: Symmetric Functions, Schubert Polynomials and Degeneracy Loci American Mathematical Society (2001) 12 Thompson, C.D., Kung, H.T.: Sorting on a mesh-connected parallel computer Communications ACM 20, 263–271 (1977) 13 Yamanaka, K., Nakano, S., Matsui, Y., Uehara, R., Nakada, K.: Efficient enumeration of all ladder lotteries and its application Theoretical Computer Science 411, 1714–1722 (2010) CuuDuongThanCong.com Author Index Alam, Muhammad Jawaherul Aloupis, Greg 40 Asinowski, Andrei 301 28 Boldi, Paolo Borassi, Michele 52 Brand, Michael 64 Burcsi, P´eter 74 Chen, Ke 89 Cicalese, Ferdinando 100 Cordasco, Gennaro 100 Crescenzi, Pierluigi 52 Das, Shantanu 113 Deineko, Vladimir G 125 Demaine, Erik D 16, 40, 137, 364 Demaine, Martin L 16 Dey, Palash 147 Dreier, Jannik 158 Dumitrescu, Adrian 89 Essed, Harrah 325 Fertin, Guillaume 171 Fici, Gabriele 74 Fleischer, Rudolf 185 Flocchini, Paola 113 Gargano, Luisa 100 Georgiou, Konstantinos Gervasi, Vincenzo 206 Goyal, Prachi 147 Guo, Alan 40 Habib, Michel 52 Haraguchi, Kazuya Horiyama, Takashi 218 230 Keszegh, Bal´ azs 301 Kiyomi, Masashi 230, 364 Kobourov, Stephen G 28 Komusiewicz, Christian 171 Kosters, Walter 52 Kostitsyna, Irina 264 Kranakis, Evangelos 194 Krizanc, Danny 194 Krumke, Sven O 277 Lafourcade, Pascal 158 Levcopoulos, Christos 289 Lingas, Andrzej 289 Lipt´ ak, Zsuzsanna 74 Lă oer, Maarten 264 Ma, Fermi 137 Marino, Andrea 52 Milaniˇc, Martin 100 Miltzow, Tillmann 301 Misra, Neeldhara 147 Mizuki, Takaaki 313 Nilsson, Bengt J 289 Okamoto, Yoshio 230, 364 Ono, Hirotaka 218 194 Peleg, David 252 Peters, Joseph G 100 Polishchuk, Valentin 264 Prencipe, Giuseppe 113, 206 Pupyrev, Sergey 28 Ruskey, Frank 74 Jamshidi, Shahrad 171 Jiang, Minghui 240 Jonker, Hugo 158 Saitoh, Toshiki 364 Santoro, Nicola 113 Sawada, Joe 74 Schwahn, Florian D 277 Shizuya, Hiroki 313 Suzuki, Akira 364 Kawahara, Jun Keller, Barbara Takes, Frank 52 Tejada, Pedro J 240 Ito, Takehiro CuuDuongThanCong.com 364 364 252 378 Author Index Therese, Wei 325 Thielen, Clemens 277 Toeniskoetter, Jackson 28 Uchizawa, Kei 364 Uehara, Ryuhei 230 Uno, Takeaki 230, 364 Uno, Yushi 230 Vaccaro, Ugo 100 Viglietta, Giovanni 40, 340 Volpi, Valerio 206 CuuDuongThanCong.com Waingarten, Erik 137 Wang, Haitao 240 Wattenhofer, Roger 252 Woeginger, Gerhard J 125 Wu, Bang Ye 352 Yamanaka, Katsuhisa 364 Yamauchi, Yukiko 230 Zhang, Tao 185 ˙ nski, Pawel 289 Zyli´ ... http://erikdemaine.org/fonts/ A Ferro, F Luccio, and P Widmayer (Eds.): FUN 2014, LNCS 8496, pp 16? ??27, 2014 c Springer International Publishing Switzerland 2014 CuuDuongThanCong.com Fun with Fonts: Algorithmic... CuuDuongThanCong.com 8496 Alfredo Ferro Fabrizio Luccio Peter Widmayer (Eds.) Fun with Algorithms 7th International Conference, FUN 2014 Lipari Island, Sicily, Italy, July 1-3, 2014 Proceedings 13 CuuDuongThanCong.com... NSF grants CCF-1115971 and DEB 1053 573 A Ferro, F Luccio, and P Widmayer (Eds.): FUN 2014, LNCS 8496, pp 28–39, 2014 c Springer International Publishing Switzerland 2014 CuuDuongThanCong.com Threshold-Coloring

Ngày đăng: 29/08/2020, 23:57

Mục lục

    Algorithmic Gems in the Data Miner’s Cave

    1 Welcome to the Dungeon

    2 Please, Crawl as you Enter the Cave

    3 Data Miners Eat Perfect Hash

    4 Fortunes and Misfortunes of Graph Compression

    5 Crunching Graphs in the Data Miner’s Grinder

    6 What a Miner Should Not Know

    Fun with Fonts: Algorithmic Typography

    Happy Edges: Threshold-Coloring of Regular Lattices

    2.3 The D(32, 4, 3, 4) andD(34, 6) Lattices

Tài liệu cùng người dùng

Tài liệu liên quan