311 66 5MB
English Pages 566 [572] Year 2003
Lecture Notes in Computer Science Edited by G. Goos, J. Hartmanis, and J. van Leeuwen
2697
3
Berlin Heidelberg New York Hong Kong London Milan Paris Tokyo
Tandy Warnow Binhai Zhu (Eds.)
Computing and Combinatorics 9th Annual International Conference, COCOON 2003 Big Sky, MT, USA, July 25-28, 2003 Proceedings
13
Series Editors Gerhard Goos, Karlsruhe University, Germany Juris Hartmanis, Cornell University, NY, USA Jan van Leeuwen, Utrecht University, The Netherlands Volume Editors Tandy Warnow University of Texas at Austin Department of Computer Science One University Station, C0500 Austin, TX 78712, USA E-mail: [email protected] Binhai Zhu Montana State University Department of Computer Science EPS 357 Bozeman, MT 59717, USA E-mail: [email protected] Cataloging-in-Publication Data applied for A catalog record for this book is available from the Library of Congress. Bibliographic information published by Die Deutsche Bibliothek Die Deutsche Bibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data is available in the Internet at .
CR Subject Classification (1998): F.2, G.2.1-2, I.3.5, C.2.3-4, E.1, E.5, E.4 ISSN 0302-9743 ISBN 3-540-40534-8 Springer-Verlag Berlin Heidelberg New York 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-Verlag. Violations are liable for prosecution under the German Copyright Law. Springer-Verlag Berlin Heidelberg New York a member of BertelsmannSpringer Science+Business Media GmbH http://www.springer.de © Springer-Verlag Berlin Heidelberg 2003 Printed in Germany Typesetting: Camera-ready by author, data conversion by PTP-Berlin GmbH Printed on acid-free paper SPIN: 10927991 06/3142 543210
P r e f a ce
T he papers in t his volume were present ed at t he 9t h Annual Int ernat ional Comput ing and Combinat orics Conference (COCOON 2003), held J uly 25–28, 2003, in Big Sky, MT , USA. T he t opics cover most aspect s of t heoret ical comput er science and combinat orics relat ed t o comput ing. Submissions t o t he conference t his year were conduct ed elect ronically. A t ot al of 114 papers were submit t ed, of which 52 were accept ed. T he papers were evaluat ed by an int ernat ional program commit t ee consist ing of Nina Ament a, Tet suo Asano, Bernard Chazelle, Zhixiang Chen, Francis Chin, Kyung-Yong Chwa, Robert Cimikowski, Anne Condon, Michael Fellows, Anna Gal, Michael Hallet t , Daniel Huson, Naoki Kat oh, D.T . Lee, Bernard Moret , Brendan Mumey, Gene Myers, Hung Quang Ngo, Takao Nishizeki, Cindy P hillips, David Sankoff , Denbigh St arkey, J ie Wang, Lusheng Wang, Tandy Warnow and Binhai Zhu. It is expect ed t hat most of t he accept ed papers will appear in a more complet e form in scient ific journals. T he submit t ed papers were from Canada (6), China (7), Est onia (1), Finland (1), France (1), Germany (8), Israel (4), It aly (1), J apan (11), Korea (22), Kuwait (1), New Zealand (1), Singapore (2), Spain (1), Sweden (2), Swit zerland (3), Taiwan (7), t he UK (1) and t he USA (34). Each paper was evaluat ed by at least t hree P rogram Commit t ee members, assist ed in some cases by subreferees. In addit ion t o select ed papers, t he conference also included t hree invit ed present at ions by J on Bent ley, Dan Gusfield and J oel Spencer. We t hank all t he people who made t his meet ing possible: t he aut hors for submit t ing papers, t he program commit t ee members and ext ernal referees (list ed in t he proceedings) for t heir excellent work, and t he t hree invit ed speakers. Finally, we t hank t he Comput er Science Depart ment of Mont ana St at e University for t he support and t he local organizers and colleagues for t heir assist ance.
J uly 2003
Tandy Warnow, Binhai Zhu
V I
O r gan izat ion
P r ogr a m C om m it t ee C h a ir s
Tandy Warnow, University of Texas at Aust in, USA Binhai Zhu, Mont ana St at e University, USA P r ogr a m C om m it t ee M em b er s
Nina Ament a, UC Davis, USA Tet suo Asano, J AIST , J apan Bernard Chazelle, P rincet on University, USA Zhixiang Chen, University of Texas at Pan American, USA Francis Chin, University of Hong Kong, China Kyung-Yong Chwa, KAIST , Korea Robert Cimikowski, Mont ana St at e University, USA Anne Condon, UBC, Canada Michael Fellows, University of Newcast le, Aust ralia Anna Gal, University of Texas at Aust in, USA Michael Hallet t , McGill University, Canada Daniel Huson, Tuebingen University, Germany Naoki Kat oh, Kyot o, J apan D.T . Lee, Academia Sinica, Taiwan Bernard Moret , University of New Mexico, USA Brendan Mumey, Mont ana St at e University, USA Gene Myers, UC Berkeley, USA Hung Quang Ngo, SUNY at Buff alo, USA Takao Nishizeki, Tohoku, J apan Cindy P hillips, Sandia Nat ional Labs, USA David Sankoff , University of Mont real, Canada Denbigh St arkey, Mont ana St at e University, USA J ie Wang, University of Massachuset t s at Lowell, USA Lusheng Wang, City University of Hong Kong, China O r ga n iz in g C om m it t ee
Gary Harkin, Mont ana St at e University, USA Michael Oudshoorn, Mont ana St at e University, USA J ohn Paxt on, Mont ana St at e University, USA J eannet t e Radcliff e, Mont ana St at e University, USA Rocky Ross, Mont ana St at e University, USA Denbigh St arkey (Chair), Mont ana St at e University, USA Year-Back Yoo, Mont ana St at e University, USA
O r gan izat ion
V II
R efer ees
Eric Bach David Bryant P rosenjit Bose David Bunde J in-Yi Cai Bob Carr To Yat Cheung Zhe Dang Olaf Delgado-Friedrichs Allyn Dimock Nadia El-Mabrouk St anley P.Y. Fung Frederic Green Minghui J iang Tao J iang
Anna J ohnst on Mikio Kano Neal Koblit z Francis C.M. Lau Hendrik Lenst ra Chi Ming Leung Xiang-Yang Li Kazuyuki Miura Cris Moore Subhas C. Nandy William D. Neumann Kay Nieselt -St ruwe Ojas Parekh Krzyszt of P iet rzak Chung Keung Poon
Md. Saidur Rahman Romeo Rizzi Yaoyun Shi Shang-Hua Teng Cao An Wang Guohua Wu Xiaodong Wu Hongwei Xi J inhui Xu Siu-Ming Yiu Xizhong Zheng Xiao Zhou Dengping Zhu David Zuckerman
T able of C ont ent s
I nvit ed L ect ur e LIAR! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Joel Spencer
1
Experiment s for Algorit hm Engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jon Bentley
3
Empirical Explorat ion of Perfect P hylogeny Haplotyping and Haplotypers Ren Hua Chung, Dan Gusfield
5
C om put at ional G eom et r y I Cylindrical Hierarchy for Deforming Necklaces . . . . . . . . . . . . . . . . . . . . . . . . Sergei Bespamyatnikh
20
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering . . . . . . . . Danny Z. Chen, Bin X u
30
Traveling Salesman P roblem of Segment s . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jinhui X u, Y ang Y ang, Zhiyong Lin
40
Subexponent ial-T ime Algorit hms for Maximum Independent Set and Relat ed P roblems on Box Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A ndrzej Lingas, Martin W ahlen
50
C om put at ional B iology I A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions . . . . Y ong Gao, Junfeng W u, Robert Niewiadomski, Y ang W ang, Zhi-Zhong Chen, Guohui Lin On t he Similarity of Set s of Permut at ions and It s Applicat ions t o Genome Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A nne Bergeron, Jens Stoye On All-Subst rings Alignment P roblems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W ei Fu, W ing-K ai Hon, W ing-K in Sung
57
68 80
C om put at ional/ C om plexit y T heor y I T he Specker-Blat t er T heorem Revisit ed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E. Fischer, J.A . Makowsky
90
X
Table of Cont ent s
On t he Divergence Bounded Comput able Real Numbers . . . . . . . . . . . . . . . 102 X izhong Zheng Sparse Parity-Check Mat rices over Finit e Fields . . . . . . . . . . . . . . . . . . . . . . . 112 Hanno Lefmann
G r aph T heor y/ A lgor it hm s I On t he Full and Bot t leneck Full St einer Tree P roblems . . . . . . . . . . . . . . . . 122 Y en Hung Chen, Chin Lung Lu, Chuan Y i Tang T he St ruct ure and Number of Global Roundings of a Graph . . . . . . . . . . . . 130 Tetsuo A sano, Naoki K atoh, Hisao Tamaki, Takeshi Tokuyama On Even Triangulat ions of 2-Connect ed Embedded Graphs . . . . . . . . . . . . . 139 Huaming Zhang, X in He
A ut om at a/ P et r i N et T heor y Pet ri Net s wit h Simple Circuit s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Hsu-Chun Y en, Lien-Po Y u Aut omat ic Verificat ion of Mult i-queue Discret e T imed Aut omat a . . . . . . . 159 Pierluigi San Pietro, Zhe Dang
G r aph T heor y/ A lgor it hm s I I List Tot al Colorings of Series-Parallel Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 172 X iao Zhou, Y uki Matsuo, Takao Nishizeki Finding Hidden Independent Set s in Int erval Graphs . . . . . . . . . . . . . . . . . . 182 T herese Biedl, Broˇn a Brejov´a, Erik D. Demaine, A ng`ele M. Hamel, A lejandro L´opez-Ortiz, Tom´aˇs V inaˇr Mat roid Represent at ion of Clique Complexes . . . . . . . . . . . . . . . . . . . . . . . . . 192 K enji K ashiwabara, Y oshio Okamoto, Takeaki Uno
C om plexit y T heor y I I On P roving Circuit Lower Bounds against t he Polynomial-T ime Hierarchy: Posit ive and Negat ive Result s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Jin-Y i Cai, Osamu W atanabe T he Complexity of Boolean Mat rix Root Comput at ion . . . . . . . . . . . . . . . . 212 Martin K utz A Fast Bit -Parallel Algorit hm for Mat ching Ext ended Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Hiroaki Y amamoto, Takashi Miyazaki
Table of Cont ent s
XI
D ist r ibut ed C om put ing Group Mut ual Exclusion Algorit hms Based on T icket Orders . . . . . . . . . . . 232 Masataka Takamura, Y oshihide Igarashi Dist ribut ed Algorit hm for Bet t er Approximat ion of t he Maximum Mat ching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 A . Czygrinow, M. Ha´n ´ckowiak Effi cient Mappings for Parity-Declust ered Dat a Layout s . . . . . . . . . . . . . . . . 252 Eric J. Schwabe, Ian M. Sutherland
W eb-B ased C om put ing Approximat e Rank Aggregat ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 X iaotie Deng, Qizhi Fang, Shanfeng Zhu Pert urbat ion of t he Hyper-Linked Environment . . . . . . . . . . . . . . . . . . . . . . . 272 Hyun Chul Lee, A llan Borodin Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Zhixiang Chen, Richard Fowler, Ada W ai-Chee Fu, Chunyue W ang
C om plexit y T heor y I I I Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions . . . . . . . . 294 Eike K iltz, Hans Ulrich Simon Quant um Sampling for Balanced Allocat ions . . . . . . . . . . . . . . . . . . . . . . . . . 304 K azuo Iwama, A kinori K awachi, Shigeru Y amashita
G r aph T heor y/ A lgor it hm s I I I Fault -Hamilt onicity of P roduct Graph of Pat h and Cycle . . . . . . . . . . . . . . . 319 Jung-Heum Park, Hee-Chul K im How t o Obt ain t he Complet e List of Cat erpillars . . . . . . . . . . . . . . . . . . . . . . 329 Y osuke K ikuchi, Hiroyuki Tanaka, Shin-ichi Nakano, Y ukio Shibata Randomized Approximat ion of t he St able Marriage P roblem . . . . . . . . . . . 339 Magn´u s Halld´orsson, K azuo Iwama, Shuichi Miyazaki, Hiroki Y anagisawa
C om put at ional G eom et r y I I Tet ris is Hard, Even t o Approximat e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 Erik D. Demaine, Susan Hohenberger, David Liben-Nowell
XII
Table of Cont ent s
Approximat e MST for UDG Locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 X iang-Y ang Li Effi cient Const ruct ion of Low Weight Bounded Degree P lanar Spanner . . . 374 X iang-Y ang Li, Y u W ang
G r aph T heor y/ A lgor it hm s I V Isoperimet ric Inequalit ies and t he Widt h Paramet ers of Graphs . . . . . . . . . 385 L. Sunil Chandran, T . K avitha, C.R . Subramanian Graph Coloring and t he Immersion Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 Faisal N. A bu-K hzam, Michael A . Langston Opt imal MST Maint enance for Transient Delet ion of Every Node in P lanar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Carlo Gaibisso, Guido Proietti, Richard B. Tan
Scheduling Scheduling Broadcast s wit h Deadlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Jae-Hoon K im, K yung-Y ong Chwa Improved Compet it ive Algorit hms for Online Scheduling wit h Part ial J ob Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 Francis Y .L. Chin, Stanley P.Y . Fung Ma jority Equilibrium for P ublic Facility Allocat ion . . . . . . . . . . . . . . . . . . . . 435 Lihua Chen, X iaotie Deng, Qizhi Fang, Feng T ian
C om put at ional G eom et r y I I I On Const rained Minimum P seudot riangulat ions . . . . . . . . . . . . . . . . . . . . . . 445 G¨u nter Rote, Cao A n W ang, Lusheng W ang, Y infeng X u Pairwise Dat a Clust ering and Applicat ions . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 X iaodong W u, Danny Z. Chen, James J. Mason, Steven R . Schmid Covering a Set of Point s wit h a Minimum Number of Turns . . . . . . . . . . . . 467 Michael J. Collins
G r aph D r aw ing Area-Effi cient Order-P reserving P lanar St raight -Line Drawings of Ordered Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 A shim Garg, Adrian Rusu Bounds for Convex Crossing Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Farhad Shahrokhi, Ondrej S´y kora, Laszlo A . Sz´ekely, Imrich Vrt’ o
Table of Cont ent s
XIII
On Spect ral Graph Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 Y ehuda K oren
C om put at ional B iology I I On a Conject ure on Wiener Indices in Combinat orial Chemist ry . . . . . . . . 509 Y ih-En A ndrew Ban, Sergei Bespamyatnikh, Nabil H. Mustafa Double Digest Revisit ed: Complexity and Approximability in t he P resence of Noisy Dat a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 Mark Cieliebak, Stephan Eidenbenz, Gerhard J. W oeginger Fast and Space-Effi cient Locat ion of Heavy or Dense Segment s in Run-Lengt h Encoded Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Ronald I. Greenberg Genomic Dist ances under Delet ions and Insert ions . . . . . . . . . . . . . . . . . . . . 537 Mark Marron, K rister M. Swenson, Bernard M. E. Moret
F ixed-P ar am et er C om plexit y T heor y Minimal Unsat isfiable Formulas wit h Bounded Clause-Variable Diff erence are Fixed-Paramet er Tract able . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 Stefan Szeider
A ut hor I ndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
L IA R !
J oel Spencer C o u r a n t I n st i t u t e N ew Y o r k U n i v er si t y
[email protected]
P aul is t rying t o ascert ain an unknown x , out of n possibilit ies, from an adversary Carole by asking a series of q queries. In t he st andard “T wenty Quest ions” P aul wins if and only if n ≤ 2q . In Liar Games, Carole is allowed, under cert ain rest rict ions, t o give an incorrect response. T hroughout t his st udy Carole will be rest rict ed t o give at most k incorrect responses, or lies. Asympt ot ic analysis here will be for k arbit rary but fixed, k = 1 being a nat ural and int erest ing case. T he game wit h t en queries, one hundred possibilit ies, and (at most ) one lie is amusing t o play. T he basic liar game, in which P aul can make arbit rary binary queries, has been well st udied. T he basic bound is t hat if q q q q n + + ...+ > 2 0 1 k t hen Carole (who is allowed an adversary st rat egy) will win. We shall indicat e a two proofs of t his basic bound and argument s for why t he converse almost (but not quit e!) holds. T here is a nat ural connect ion between Liar Games and Coding T heory. T he prot ocol must allow P aul t o det ermine x despit e (at most ) k “errors” in t he “t ransmission.” T he ma jor dist inct ion is t hat P aul’ s queries are sequent ial and can depend on previous responses. Some have described Liar Games as Coding T heory wit h Feedback. In t he Half-Lie Game Carole has a furt her rest rict ion. If t he correct answer is yes t hen Carole m ust say yes. In medical t erminology, t here can be false posit ives (t hough at most k of t hem) but no false negat ives. F ixing k we define A k ( q ) t o be t he largest n for which P aul wins t he Half-Lie Game wit h q queries. At COCOON 2000 Cicalese and Mundici found t he asympt ot ics when only one lie is permit t ed: 2q A 1 (q ) ∼ 2q We shall give a diff erent proof of t his result and a generalizat ion t o any fixed number k of lies. T he Half-Lie Game has two useful int erpret at ions. I t ake k = 1 for simplicity. One is as a vect or game. In t he middle of t he game t he st at e is a posit ion vect or p = ( a , b ) where a is t he number of x for which Carole has not yet lied and b is t he number of x for which Carole has lied once. Now P aul’ s query can also be given in vect or form and t he two pot ent ial new st at es have simple descript ions. T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 1–2, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
2
J . S p en c er
T he second, more combinat orial, view is in t erms of 1-t rees. A 1-t ree is a subset of { Y , N } q consist ing of one designat ed root r = ( r 1 , . . . , r q ) and, for each i wit h ′ ′ ′ r i = N , a “child” r = ( r 1 , . . . , r q ) t hat agrees wit h r in t he first i − 1 coordinat es and has r i′ = Y . T hese 1-t rees represent possible set s of response sequences of Carole wit h a part icular x . We argue t hat P aul wins if and only if it is possible t o pack n of t hese 1-t rees (more generally, k -t rees) int o { Y , N } q . T his leads t o some int riguing combinat orial quest ions. At a meet ing in Dagst uhl in Combinat orial Games last year Elwyn Berlekamp not ed t hat t he Half-Lie games corresponds t o Coding T heory over t he Z-channel. We have found t hat t he analysis readily ext ends, indeed is more nat ural, over arbit rary channels. By a channel we here mean a finit e set of possible lie types. For example: let P aul ask t ernary queries wit h answers A , B , C . We allow Carole t o “lie” wit h B when t he answer is A and wit h C when t he answer is B , but ot herwise she cannot lie. F ixing t he channel C h and t he number of lies k let A k , C h ( q ) be t he largest n for which P aul wins. T he met hods developed for t he Half-Lie problem allow us t o find t he asympt ot ics of A k , C h ( q ). To our surprise, t he asympt ot ics depend only on t he number E of lie types. When t he queries are t -ary we show A
k ,C h
(q )
t ∼
E
k
t
k
q
q k
T his is joint work wit h Ioana Dumit riu (M.I.T .) and Cat herine Yan (Texas A&M).
E x p e r im e n t s fo r A lg o r it h m E n g in e e r in g J on Bent ley Avaya Labs Research Basking Ridge, New J ersey, USA [email protected]
Hoare int roduced and analyzed t he Q uicksort algorit hm in t he early 1960s [6]. By t he early 1970s, a highly t uned version of t hat algorit hm was im plem ent ed in t he Unix syst em ’ s m ain m em ory sort funct ion, qsort. For t wo decades, t hat code p erform ed adm irably. In t he early 1990s, Alan W ilks and R ick Becker once again used t hat old, reliable program , and were st unned by t he result s. A run t hat should have t aken a few m inut es was cancelled aft er hours. T hey st udied t heir input dat a and event ually produced an eight -line program t hat showed t hat t heir run would have t aken weeks. T hey enclosed t hat program in a sup erb bug rep ort t hat t hey e-m ailed t o m e (det ails are describ ed by Bent ley [1]). T hey had st umbled across a problem t hat Hoare had foreseen: select ion of t he part it ioning elem ent . An im plem ent at ion cleverness t hat had st ood t he t est of t wo decades wort h of t im e had finally failed cat ast rophically. Doug McIlroy and I set out t o solve t heir problem . E xp erim ent s showed t hat t he venerable im plem ent at ion of Q uicksort failed on a dist urbing variet y of input s. We looked at ot her product ion-qualit y im plem ent at ions and found t hat t hey all exhibit ed such b ehavior. We t hus faced t he t ask of building our own im plem ent at ion of t he Q uicksort algorit hm t o m eet t he int erface sp ecificat ions of t he qsort ut ilit y. Bent ley and McIlroy describ e t he result ing algorit hm and sket ch it s hist ory [4]. T his t alk describ es m any of t he exp erim ent s t hat t ook place b ehind t he scenes in t hat process, and t he t ools used t o p erform t hem . In addit ion t o using profilers t o t im e part icular im plem ent at ions, we also used a program t o generat e a cost m odel t hat would give us insight int o t he relat ive cost s of crit ical op erat ions (det ails are given by Bent ley [2]). Sim ple exp erim ent s allowed us t o m easure t he eff ect iveness of a large fam ily of sam pling schem es for select ing t he part it ioning elem ent . C aching was not crit ical in t he early 1990s but now plays a key role in t he p erform ance of sort ing im plem ent at ions; sim ple exp erim ent s accurat ely predict t he p erform ance of various sort ing algorit hm s under caching. Many of t hese issues are addressed by Bent ley [3]. We set out t o build a product ion-qualit y sort ing algorit hm , and we were successful at t he t ask. T he algorit hm has b een widely used since it was int roduced, and we have yet t o hear of it cat ast rophically failing. T he eff ort also led t o som e pleasant t heory, including t he t ernary search t rees describ ed by Bent ley and Sedgewick [5] and McIlroys [7] killer adversary for any im plem ent at ion of Q uicksort . I will describ e som e of my exp eriences in exp erim ent s leading t o new t heory. T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 3–4, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
4
J . Bent ley
R e fe r e n c e s
1. J . L. Bent ley. Software Explorat orium: T he Trouble W it h Qsort , U N I X Revi ew , Vol. 10, 2, pp. 85–93, February 1992. 2. J . L. Bent ley. Software Explorat ions: Cost Models for Sort ing, U N I X Revi ew , Vol. 15, 4, pp. 65–72, April 1997. 3. J . L. Bent ley. P r ogr am m i n g P ear ls, Second Edit ion, Addison-Wesley, Reading, MA, 2000. 4. J . L. Bent ley and M. D. McIlroy. Engineering a sort funct ion, Soft war e–P r act i ce an d E xper i en ce, Vol. 23, 1, pp. 1249–1265, 1993. 5. J . L. Bent ley and R. Sedgewick. Fast Algorit hms for Sort ing and Searching St rings, P r oceedi n gs of t he 8t h A n n ual A C M -SI A M Sym posi um on D i scr et e A lgor i t hm s, pp. 360–369, J anuary 1997. 6. C. A. R. Hoare. Quicksort , C om put er J our n al , Vol. 5, 1, 1962. 7. M. D. McIlroy. A killer adversary for quicksort , Soft war e–P r act i ce an d E xper i en ce, Vol. 29, pp. 341–344, 1999.
E m p irical E x p lo rat io n o f P e rfe ct P hy lo g e ny H ap lo t y p in g an d H ap lo t y p e rs Ren Hua Chung and Dan Gusfield ⋆ Comput er Science Depart ment , University of California, Davis, Davis CA 95616, USA [email protected]
T he next high-priority phase of human genomics will involve t he development of a full H aplotype M ap of t he human genome [15]. It will be used in large-scale screens of populat ions t o associat e specific haplotypes wit h specific complex genet ic-influenced diseases. A key, perhaps bot t leneck, problem is t o comput at ionally det ermine haplotype pairs from genotype dat a. An approach t o t his problem based on viewing it in t he cont ext of perfect phylogeny was int roduced in [14] along wit h an effi cient solut ion. A slower (in worst case) variat ion of t hat met hod was implement ed [3]. T wo simpler met hods for t he perfect phylogeny approach t hat are also slower (in worst case) t han t he first algorit hm were lat er developed [1,7]. We have implement ed and t est ed all t hree of t hese approachs in order t o compare and explain t he pract ical effi ciencies of t he t hree met hods. We discuss two ot her empirical observat ions: a st rong phase-t ransit ion in t he frequency of obt aining a unique solut ion as a funct ion of t he number of individuals in t he input ; and result s of using t he met hod t o find non-overlapping int ervals where t he haplotyping solut ion is highly reliable, as a funct ion of t he level of recombinat ion in t he dat a. F inally, we discuss t he biological basis for t he size of t hese t est s. A b st r a c t .
1
Int ro d u ct io n t o S N P ’ s, G e n o t y p e s, an d H ap lo t y p e s
In diploid organisms (such as humans) t here are two (not complet ely ident ical) “copies” of each chromosome, and hence of each region of int erest . A descript ion of t he dat a from a single copy is called a h a p lo t y pe , while a descript ion of t he conflat ed (mixed) dat a on t he two copies is called a ge n o t y pe . In complex diseases (t hose aff ect ed by more t han a single gene) it is oft en much more informat ive t o have haplotype dat a (ident ifying a set of gene alleles inherit ed t oget her) t han t o have only genotype dat a. T he underlying dat a t hat forms a haplotype is eit her t he full DNA sequence in t he region, or more commonly t he values of s i n gle n u c leo t i d e po ly m o r p h i s m s ( S N P ’ s ) in t hat region. A SNP is a single nucleot ide sit e where exact ly two (of four) diff erent nucleot ides occur in a large percent age of t he populat ion. T he
⋆
Research Support ed by NSF grant s DBI-9723346 and EIA-0220154
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 5–19, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
6
R.H. Chung and D. Gusfield
SNP -based approach is t he dominant one, and high density SNP maps have been const ruct ed across t he human genome wit h a density of about one SNP per t housand nucleot ides.
1 .1
T h e B io lo g ic al P ro b le m
In general, it is not feasible t o examine t he two copies of a chromosome separat ely, and ge n o t y pe dat a rat her t han haplotype dat a will be obt ained, even t hough it is t he haplotype dat a t hat will be of great est use. Dat a from m sit es (SNP ’ s) in n individuals is collect ed, where each sit e can have one of two st at es (alleles), which we denot e by 0 and 1. For each individual, we would ideally like t o describe t he st at es of t he m sit es on each of t he two chromosome copies separat ely, i.e., t he haplotype. However, experiment ally det ermining t he haplotype pair is t echnically diffi cult or expensive. Inst ead, t he screen will learn t he 2m st at es (t he genotype) possessed by t he individual, wit hout learning t he two desired haplotypes for t hat individual. One t hen uses comput at ion t o ext ract haplotype informat ion from t he given genotype informat ion. Several met hods have been explored and some are int ensively used for t his t ask [4,5,8,23,13,22,20,21]. None of t hese met hods are present ly fully sat isfact ory, alt hough many give impressively accurat e result s.
1 .2
T h e C o m p u t at io n al P ro b le m
Abst ract ly, input t o t he haplotyping problem consist s of n ge n o t y pe vect ors, each of lengt h m , where each value in t he vect or is eit her 0,1, or 2. Each posit ion in a vect or is associat ed wit h a sit e of int erest on t he chromosome. T he posit ion in t he genotype vect or has a value of 0 or 1 if t he associat ed chromosome sit e has t hat st at e on bot h copies (it is a h o m o z y go u s sit e), and has a value of 2 ot herwise (t he chromosome sit e is h e t e ro z y go u s ). Given an input set of n genotype vect ors, a s o lu t i o n t o t he H a p lo t y pe I n f e re n ce ( H I ) P ro ble m is a set of n pairs of binary vect ors, one pair for each genotype vect or. For any genotype vect or g , t he associat ed binary vect ors v 1 , v 2 must bot h have value 0 (or 1) at any posit ion where g has value 0 (or 1); but for any posit ion where g has value 2, exact ly one of v 1 , v 2 must have value 0, while t he ot her has value 1. T hat is, v 1 , v 2 must be a feasible “explanat ion” for t he t rue (but unknown) haplotype pair t hat gave rise t o t he observed genotype g . Hence, for an individual wit h h het erozygous sit es t here are 2h 1 haplotype pairs t hat could appear in a solut ion t o t he HI problem. For example, if t he observed genotype g is 0212, t hen t he pair of vect ors 0110, 0011 is one feasible explanat ion, out of two feasible explanat ions. Of course, we want t o find t he explanat ion t hat act ually gave rise t o g , and a solut ion for t he HI problem for t he genotype dat a of all t he n individuals. However, wit hout addit ional biological insight , one cannot know which of t he exponent ial number of solut ions is t he “correct one”. −
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
2
7
P e rfe ct P hy lo g e ny
Algorit hm-based haplotype inference would be impossible wit hout t he implicit or explicit use of some genet ic model, eit her t o asses t he biological fidelity of any proposed solut ion, or t o guide t he algorit hm in const ruct ing a solut ion. Most of t he models use st at ist ical or probabilist ic aspect s of populat ion genet ics. We will t ake a more det erminist ic or combinat orial approach. T he most powerful such genet ic model is t he populat ion-genet ic concept of a coa le s ce n t , i.e., a root ed t ree t hat describes t he evolut ionary hist ory of a set of sequences (or haplotypes) in sampled individuals [24,16]. T he key observat ion is t hat “In t he absence of recombinat ion, each sequence has a single ancest or in t he previous generat ion.” [16]. T here is one addit ional element of t he basic coalescent model: t he i n fi n i t e s i t e s assumpt ion. T hat is, t he m sit es in t he sequence (SNP sit es in our case) are so sparse relat ive t o t he mut at ion rat e, t hat in t he t ime frame of int erest at most one mut at ion (change of st at e) will have occurred at any sit e. T his assumpt ion is usually made wit hout cont ent ion in SNP dat a. Hence t he coalescent model of haplotype evolut ion says t hat wit hout recombinat ion, t he t rue evolut ionary hist ory of 2n haplotypes, one from each of 2n individuals, can be displayed as a t ree wit h 2n leaves, and where each of t he m sit es labels exact ly one edge of t he t ree, i.e., at a point in hist ory where a mut at ion occurred at t hat sit e. T his is t he underlying genet ic model t hat we assume from here on. See [24] for anot her explanat ion of t he relat ionship between sequence evolut ion and coalescent s. In more comput er science t erminology, t he no-recombinat ion and infinit esit es model says t hat t he 2n haplotype (binary) sequences can be explained by an (unroot ed) pe r f ec t p h y loge n y [11,12]: D e fi n it io n . Let B be an 2n by m 0-1 (binary) mat rix, and V be an m -lengt h binary st ring. A roo t ed pe r f ec t p h y loge n y f o r B is a root ed t ree T wit h exact ly 2n leaves t hat obeys t he following propert ies: 1) Each of t he 2n rows labels exact ly one leaf of T . 2) Each of t he m columns labels e x a c t ly o n e edge of T . 3) Every int erior edge (one not t ouching a leaf) of T is labeled by a t lea s t one column. 4) For any row i , t he columns t hat label t he edges along t he unique pat h from t he root t o leaf i specify t he columns of B where row i has a value t hat is diff erent from t he value of V in t hat column. In ot her words, knowing V , t hat pat h is a compact represent at ion of row i . If we don’ t know V at input , t he u n roo t ed pe r f ec t p h y loge n y problem is t o det ermine a V so t hat B has perfect phylogeny root ed at V . T he classic T heorem of Perfect P hylogeny is t hat a binary mat rix B has a perfect phylogeny if and only if for each pair of columns, t here are no four rows in t hose columns wit h values (0,0), (0,1), (1,0) and (1,1). Moreover, if t he columns of B are dist inct , t hen t here is only one perfect phylogeny for B . Not e t hat an edge t o a leaf need not have a column label.
8
R.H. Chung and D. Gusfield
T he above condit ion is known as t he “Four-Gamet es Test ” in t he populat ion genet ics lit erat ure, and is known as t he “Compat ibility Test ” in t he phylogenet ic lit erat ure. 2 .1
T h e P e rfe c t P hy lo g e ny H ap lo t y p e ( P P H ) P ro b le m
Under t he coalescent model of haplotype evolut ion, t he HI problem now has precisely t he following combinat orial int erpret at ion: Given a set of n genotypes G , find an HI solut ion consist ing of at most 2n dist inct haplotype vect ors B , such t hat t he vect ors in B fit a perfect phylogeny. T his is t he unroot ed version of t he P P H problem. See Figure 1 for a t rivial example. If a root sequence V is specified, t hen t he perfect phylogeny is required t o have t he root sequence of V . T he two versions of t he problem are act ually equivalent in t he sense t hat an inst ance of one variat ion can be reduced t o t he ot her variat ion, so t hat an algorit hm for one variat ion can be used for bot h variat ions.
M
1 a 2 b 0 c 1
2 2 2 0
==> Q
12 a 22 a’ 2 2 b 02 b’ 0 2 c 10 c’ 1 0
==>
B
1 2 a 1 0 a’ 0 1 b 0 1 b’ 0 0 c 1 0 c’ 1 0
2
1
==> T b’
c c’
a
a’
b
A simple example where t here are two solut ions t o t he HI problem, but only t he one shown solves t he P P H problem. Mat rix Q is creat ed from mat rix M , doubling t he rows t o prepare for t he P P H solut ion B .
F ig. 1 .
3
T h re e A lg o rit h m s an d P ro g ram s fo r t h e P P H P ro b le m
In t his sect ion we briefly describe t hree algorit hms and t hree programs (GP P H, HP P H and DP P H) for t he P P H problem. T he first algorit hm for t he P P H problem was developed in [14]. Aft er t hat publicat ion, two addit ional met hods were
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
9
developed and present ed [1] and [7]. P rogram GP P H follows t he basic approach present ed in [14], wit h some modificat ions as det ailed below. P rograms DP P H and HP P H follow t he algorit hms developed in [1] and [7], respect ively. T he t hree programs are available at : cs.ucdavis.edu/ ˜gusfield 3 .1
S o lu t io n by G rap h R e aliz at io n : P ro g ram G P P H
T he first algorit hm for t he P P H problem, given in [14], is based on reducing t he problem t o a well-st udied problem in graph t heory. Let E r a set of r dist inct int egers. A “pat h set ” is an u n o rd e red subset P of E . A pat h set is “realized” in a undirect ed, edge-labeled t ree T consist ing of r edges, if each edge of T is labeled by a dist inct int eger from E r , and t here is a cont iguous pat h in T whose labels consist of t he int egers in P . For simplicity, we refer t o each int eger in E r as an “edge”, since in t he t ree T t hat we seek, each edge will be uniquely labeled wit h an int eger in E r . Not e t hat since P is unordered, it s present at ion does not specify or const rain t he order t hat t hose edges appear in T . In quit e diff erent t erms, from t he 1930’ s t o t he 1960’ s Whit ney and Tut t e and ot hers st udied and solved t he following problems: T h e G rap h R e aliz at io n P ro b le m . Given E r and a family Π = P 1 , P 2 , ..., P k of pat h set s, find an undirect ed t ree T in which each pat h set is realized, or det ermine t hat no such t ree exist s. Furt her, det ermine if t here is only one such T , and if t here is more t han one, charact erize t he relat ionship between t he realizing t rees. In [14] we reduce t he P P H problem t o t he graph realizat ion problem, and have implement ed t his approach in a program called here GP P H1 . P rogram GP P H implement s a slight ly diff erent reduct ion t han is described in [14]. T he act ual reduct ion is det ailed at : wwwcsif.cs.ucdavis.edu/ ˜gusfield/ recomberrat a.pdf. Aft er reducing a problem inst ance, program GP P H solves t he graph realizat ion inst ance, using a variat ion [10] of Tut t e’ s classic algorit hm for graph realizat ion [25]. In GP P H, we implement t he reduct ion and t he graph realizat ion solut ion separat ely. T he reduct ion t akes O ( n m ) t ime t o creat e an inst ance of t he graph realizat ion problem, and t he graph realizat ion module runs in O ( n m 2 ) t ime, and is complet ely general, not incorporat ing any part icular feat ures of t he P P H problem. Having a general solut ion t o t he graph realizat ion problem gives us a program t hat can be used for ot her applicat ions of graph realizat ion besides t he P P H problem. It is of int erest t o see how t his general approach performs relat ive t o met hods t hat incorporat e part icular insight s about t he P P H problem. Tut t e’ s graph realizat ion algorit hm is a met hod t hat recursively solves graph realizat ion problems for a subset E of E r , and a family of pat h set s Π ( E ), formed from t he family Π by rest rict ing each pat h set in Π t o E . Given E and Π ( E ), and knowledge of what decisions have already been made, t he algorit hm chooses an edge e (called here t he “pivot ” edge) from E and det ermines, by examining 1
T his program was previously called P P H, but now t hat mult iple programs exist for t he P P H problem , each is given a dist inct name.
10
R.H. Chung and D. Gusfield
t he pat h set s in Π ( E ) and using general insight s about pat hs in t rees, whet her t here are edges in E t hat must be on one part icular side of e or t he ot her side of e . It also det ermines whet her t here are pairs of edges in E t hat must be separat ed by e , and if so, whet her t hese pairs form a bipart it ion. To do t hat , it const ruct s a graph G ( E ) cont aining one node for each edge in E , and one undirect ed arc between every pair of edges ( e , e ) in E t hat must be separat ed by e . If G ( E ) is bipart it e, Tut t e’ s algorit hm arbit rarily put s t he edges from one side ofG ( E ) on one side of e , and t he edges from t he ot her side of G ( E ) on t he ot her side of e . It t hen recursively solves t he graph realizat ion problem for t he two set s of edges on eit her side of e , and when t hose two subproblems have been solved (ret urning two subt ress), t he algorit hm det ermines how t o at t ach t hose two subt rees t o e . Hence, t he recursion is cent ral t o t he met hod. If G ( E ) were det ermined not t o be bipart it e, t hen t he algorit hm correct ly det ermines t hat t here is no t ree realizing all t he pat h set s in E r . T here are ot her solut ions t o t he graph realizat ion problem not based on Tut t e’ s algorit hm. T he met hod in [2] is based on a general algorit hm due t o Lofgren, and runs in O ( n m α ( n m )) t ime, where α is t he inverse-Ackerman funct ion. T hat algorit hm is t he basis for t he worst -case t ime bound est ablished in [14], but we found it t o be t oo complex t o implement . In [14] it was explained t hat aft er one P P H solut ion is obt ained, by what ever met hod, one can get an implicit represent at ion of t he set of all P P H solut ions in O ( m ) t ime. In program GP P H, about 1000 lines of C code were writ t en t o implement t he reduct ion part of t he met hod and about 4000 lines of C code were writ t en t o implement t he graph realizat ion part of t he met hod. ′
3 .2
′ ′
A lg o rit h m an d P ro g ram H P P H
Alt hough obt ained independent ly of Tut t e’ s met hod, t he met hod of Eskin, Halperin and Karp [7] can be viewed as a specializat ion, t o t he P P H problem, of Tut t e’ s general graph realizat ion met hod. T he met hod is developed under t he assumpt ion t hat t he root V is known, and it exploit s t he root ed nat ure of t he P P H problem (even when V is not given, a solut ion t o t he P HH problem is a root ed t ree) t o find simpler, specific rules t o use when picking a pivot edge e , and t o det ermine t he placement of t he ot her edges t o e . In part icular, it builds a t ree t op-down from t he root , by choosing for a pivot edge e , a “maximal” edge, i.e., one t hat is guarant eed not t o be below any of t he edges t hat are not yet in t he t ree. Finding such a maximal pivot edge is a simple mat t er in t he cont ext of t he P P H problem using t he “leaf-count ” idea in [14]. Because of t he maximality, t he general operat ion in Tut t e’ s algorit hm of det ermining which edges are on which side of e becomes simpler. One det ermines for each ot her edge e , whet her e must be placed below e (on t he same pat h from t he root as e ), or must not be placed below e , or whet her bot h placement s are permit t ed. As in Tut t e’ s met hod, edges in t he last cat egory are considered pairwise t o find pairs of edges where exact ly one of t he pair must be placed below e , but eit her one of t he pair can be t he edge chosen t o be below e . T hese pairs are represent ed by a graph, and t he algorit hm checks t hat t he graph is bipart it e. If so, one set of ′
′
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
11
t he bipart it ion is arbit rarily chosen t o be placed below e and t he ot her chosen t o not be placed below e . Aft er t he algorit hm makes t hat decision, it recurses unt il a t ree is built or no furt her progress can be made. T he algorit hm can also implicit ly represent t he set of all P P H solut ions by not ing where it could have made alt ernat ive choices. We call t he program implement ing t his met hod t he HP P H program. Because t he HP P H program is a specializat ion of Tut t e’ s general met hod using simpler rules t o det ermine and implement t he pivot , it is expect ed t o run fast er in pract ice t han t he GP P H program. Moreover, t he t op-down st ruct ure of t he met hod has t he consequence t hat t he recursion used t o describe t he algorit hm in [7] is act ually t ail-recursion, so t hat t he met hod can be implement ed it erat ively wit hout any explicit recursion. T his can speed up t he program, part icularly for large dat a set s, and we have implement ed HP P H wit hout recursion. Viewed as a specializat ion of Tut t e’ s general met hod, it is of int erest t o see how much of a speed-up t he simpler pivot rules provide. About 1500 lines of C code were writ t en t o implement HP P H. S e g u e t o D P P H . One of t he cent ral det ails in HP P H (and also in t he DP P H met hod t o be discussed) is t hat for cert ain pairs of columns ( c, c ) in M , we can det ermine from looking at t hose columns alone (wit hout a n y ot her informat ion from M ) whet her t he edge labeled wit h c must be placed below t he edge labeled wit h c , or t he c edge must be placed below t he c edge, or neit her edge can be placed below t he ot her. T his is called a “forced relat ionship”. T he HP P H program spends O ( n m 2 ) t ime at t he st art t o examine t he columns in pairs t o find any forced relat ionships (act ually it det ermines anot her weaker relat ionship as well). Aft er t his first st age, t he algorit hm does operat ions whose best t ime-bound is O ( n m 2 ). ′
′
3 .3
′
A lg o rit h m an d P ro g ram D P P H
T he met hod in DP P H [1] is not based (explicit ly or implicit ly) on a graph realizat ion algorit hm, but is based on deeper insight s int o t he combinat orial st ruct ure of t he P P H problem and it s solut ion. T hese insight s are exploit ed t o avoid any recursion or it erat ion, in cont rast t o t he GP P H and HP P H programs. Rat her, aft er t he init ial O ( n m 2 )-t ime st age, where all t he forced relat ionships are found, t he algorit hm finds a P P H solut ion in O ( q 2 ) t ime, where q is t he minimum of n and m , by a simple dept h-first search in a graph t hat encodes t he forced relat ionships and t he addit ional decisions t hat remain t o be made. Moreover, t he graph represent s t he set of all solut ions in a simple way. We will not fully det ail t hat here, but we can explain how t he graph det ermines t he number of solut ions, assuming t here is a solut ion. We use t he column indices in M for vert ex labels, and let G F be a graph wit h a node c for each column c in M , and an edge between two nodes c and c if t here is a row in M wit h a 2 in bot h columns c and c . Let k be t he number of connect ed component s of G F . Now mark any edge ( c, c ) where c and c are in a forced-relat ionship, and let z be t he number of connect ed component s of t he ′
′
′
′
12
R.H. Chung and D. Gusfield
subgraph of G F induced by t he marked edges. T hen t he number of solut ions t o t he P P H problem, assuming t here is one, is exact ly 2( z k ) . Hence it is act ually easier t o count t he number of solut ions t han t o find one. Because of t he deeper insight s encoded in DP P H, we expect it will be t he fast est met hod in pract ice. About 1500 lines of C code were writ t en t o implement DP P H. −
4
G e n e rat in g t h e Te st D at a
We used t he program creat ed by Richard Hudson [17] t o generat e t he haplotypes. T hat program is t he widely-used st andard for generat ing sequences t hat reflect t he coalescent model of SNP sequence evolut ion. T he program allows one t o cont rol t he level of recombinat ion t hrough a paramet er r . When r is set t o zero, t here is no recombinat ion, and hence t he haplotypes produced are guarant eed t o fit a perfect phylogeny. Aft er obt aining 2n haplotypes from Hudson’ s program, t he haplotypes are randomly paired t o creat e t he n genotype vect ors given t o t he t hree programs. T he t hree P P H programs were t est ed wit h t housands of dat aset s and all of t he out put s were verified t o see t hat perfect phylogenet ic t rees were creat ed and t hat t he out put haplotypes explain t he input genotypes. In t he out put file, t he input genotypes and t heir corresponding haplotypes are report ed. T he out put file also report s t he perfect phylogenet ic t ree and whet her t he t ree is unique or not . If it is not , t he number of diff erent t rees which fit t he input dat a is report ed. P rogram DP P H also produces t he implicit represent at ion of t he set of all solut ions in a simple format .
5
P e rfo rm an ce C o m p ariso n
For genotype dat a wit h 50 individuals and 50 sit es, t he t hree P P H programs typically solve t he problem in less t han one second on a comput er equipped wit h AMD K6 1.33GHz CP U and 256 MB RAM. However, GP P H spends not ably longer t han t he ot hers when t he dat a is large. T he relat ive speed of program DP P H compared t o t he ot her two met hods, increases as t he dat a size increases. It typically spends under two minut es t o handle genotype dat a wit h 500 individuals and 1000 sit es. T his makes it possible t o handle long sequences wit h large samples. Our basic expect at ion t hat DP P H would be t he fast est , followed by HP P H and GP P H in t hat order, was confirmed, as is shown in Figure 2. We should not e t hat our implement at ion of HP P H included a number of minor ideas not made explicit in t he original paper [7], t hat considerably sped up t he execut ion. Also, Shibu Yooseph [27] has implement ed DP P H and report s running t imes t hat are two t o t hree t imes fast er t han our implement at ion. We implement ed t he graph realizat ion program used in GP P H lit erally as described in [10] and did not at t empt any opt imizat ions, alt hough many are clearly possible.
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
13
Average Running T imes (seconds) sit es individuals GP P H DP P H HP P H 30 50 0.6574 0.0206 0.0215 100 100 1.5697 0.3216 0.37345 300 150 9.31835 3.041 4.497 500 250 36.12485 11.5275 21.5901 1000 500 256.1847 75.5935 189.4267 2000 1000 2331.167 639.93 1866.569 T he comparison of t he running t imes of t hree met hods. Each number is t he average of 20 dat aset s.
F ig. 2 .
6 6 .1
R e lat e d To p ics U n iqu e n e ss o f t h e S o lu t io n : A S t ro n g P h ase Tran sit io n
For any given input of genotypes, it is possible t hat t here will be more t han one P P H solut ion. When designing a populat ion screen and int erpret ing t he result s, a unique P P H solut ion is very import ant . So t he quest ion arises: for a given number of sit es, how many individuals should be in t he sample (screen) so t hat t he solut ion is very likely t o be unique? T he general issue of t he number of individuals needed in a st udy was raised in [14]. T heoret ical and empirical result s on t his quest ion, addressing t he number of individuals needed in a st udy as a funct ion of t he number of dist inct haplotypes in t he populat ion, appear in [9]. Here, we report on several experiment s which det ermine t he frequency of a unique P P H solut ion when t he number of sit es and genotypes changes. Int uit ively, as t he rat io of genotypes t o sit es increases, t he probability of uniqueness increases. T he input dat aset s are generat ed by Hudson’ s program [17] discussed earlier. While generat ing t he dat a, we added an essent ial, biologically relevant rest rict ion t hat every mut at ion in t he t ree generat ing t he haplotypes must be on an edge t hat has at least 5 percent of t ot al leaves beneat h it . T hat is, at t hat sit e, t he least frequent allele must appear in at least 5 percent of individuals in t he sample. Wit hout adding t his rest rict ion, t he dat a are not biologically realist ic, and t he frequency of a unique P P H solut ion remains low even when t he rat io of genotypes t o sit es is high. T he t able in Figure 3 shows t he frequency, for dat aset s wit h 50 and 100 sit es respect ively, t hat a unique P P H solut ion is observed in 5000 dat aset s, as t he number of individuals in t he sample varies. Not e t hat t he number of individuals is t he number of input genotype vect ors, so t hat t he underlying t ree generat ing t he haplotypes has twice t hat many leaves. T he t able shown in Figure 3 shows a phase t ransit ion between 19 and 20 individuals. T his is almost cert ainly relat ed t o t he 5% rule. When t he number of individuals (genotypes) reaches 20, t he number of leaves in t he underlying t ree is 40, where t he 5% rule requires t hat each mut at ion (sit e) be placed on an edge wit h at least two leaves below it . Hence a mut at ion on an edge at t ached t o a leaf is prohibit ed. Before t hen, a mut at ion could be placed on such an edge, and when t hat happens, t he solut ion is very unlikely be unique. A more
14
R.H. Chung and D. Gusfield sit es individuals frequency sit es individuals frequency 50 10 0.0000 100 10 0.0000 50 19 0.0002 100 19 0.0000 50 20 0.7030 100 20 0.7260 50 28 0.7050 100 28 0.7236 50 30 0.9520 100 30 0.9774 50 40 0.9926 100 40 0.9966 50 50 0.9974 100 50 0.9994 50 60 0.9990 100 60 0.9996 50 70 0.9994 100 70 0.9998 50 80 0.9998 100 80 1.0000 50 90 0.9998 50 100 1
T he frequency of a unique P P H solut ion increases when t he number of individuals increases. 5000 dat aset s were simulat ed for each ent ry.
F ig. 3 .
int erest ing phase t ransit ion occurs between 20 and 30 individuals. Not ice t hat t he frequency of uniqueness is close t o one before t he number of individuals reaches t he number of sit es. T his may seem unexpect ed, and is explained by t he fact t hat t here are edges in t he t ree t hat receive more t han one mut at ion (sit e) in Hudson’ s program. Hence t he rat io of t he number of individuals t o t he number of edges in t he t ree t hat receive one or more mut at ions, is higher t han suggest ed by t he result s shown here. However, t he biologically relevant comparison is of t he number of individuals t o t he number of sit es of int erest , and so t he good news is t hat t he number of individuals needed in a sample, in order t o have a high probability of a unique P P H solut ion, is relat ively low compared t o t he number of sit es. 6 .2
H an d lin g H ap lo t y p e s G e n e rat e d w it h R e c o m b in at io n s
T he P P H problem is mot ivat ed by t he coalescent model wit hout recombinat ion. However, t he programs can be useful for solving t he HI problem when t he underlying haplotypes were generat ed by a hist ory involving some amount of recombinat ion. In t hat case, it is not expect ed t hat t he ent ire dat a will have a P P H solut ion, but some int ervals in t he dat a might have one. We can use one of t he P P H programs t o find maximal int ervals in t he input genotype sequences which have unique P P H solut ions. We first find t he longest int erval in t he genotype dat a, st art ing from posit ion 1, which has a unique P P H solut ion. We do t his using binary search, running a P P H program on each int erval specified by t he binary search. Let us say t hat t he first maximal int erval ext ends from posit ion 1 t o posit ion i . We out put t hat int erval, and t hen move t o posit ion 2 t o det ermine if t here is an int erval t hat ext ends past i cont aining a unique P P H solut ion. If so, we find t he maximal int erval st art ing at posit ion 2, and out put it . Ot herwise, we move t o posit ion 3, et c. We cont inue in t his way t o out put a set of maximal int ervals, each of which cont ains a unique P P H solut ion. T his
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
15
also implicit ly finds, for each st art ing posit ion, t he longest int erval st art ing at t hat posit ion t hat cont ains a unique P P H solut ion. In principle, t he int ervals t hat are out put could overlap in irregular, messy ways. However, we have observed t hat t his is rarely t he case. Generally, t he out put int ervals do not overlap, or two int ervals overlap at one sit e, i.e., t he right end of one int erval may overlap in one posit ion wit h t he left end of t he next int erval. T his provides a clean decomposit ion of t he dat a int o a few int ervals where in each, t he dat a has a unique P P H solut ion. A program called P P HS, which is available at t he websit e ment ioned earlier, was implement ed t o find t he maximal int ervals. We performed several experiment s for t he genotype dat a wit h diff erent recombinat ion rat es, using 100 genotypes and 100 sit es. T he input dat a for t he experiment s was again generat ed by Hudson’ s program [17]. T herefore, we were able t o check if t he out put haplotypes diff ered from t he original haplotypes, in any int erval. T he result s are shown in Figure 4. T he most st riking result is t hat when t he recombinat ion rat e is moderat e, t he accuracy of t he P P H solut ions inside each int erval, compared t o t he original haplotypes, is very high. In fact , when r = 4, in each of t he fift een runs described in Figure 4, t he unique P P H solut ion found by t he algorit hm precisely recreat ed t he input haplotypes in each int erval. T hat is, t he P P H program found t he correct haplotype pairs perfect ly in each int erval. One might t hink t hat t his must always be t rue, since t he P P H solut ion is unique in each int erval, but genotypes t hat can be explained wit h haplotypes t hat fit a perfect phylogeny need not have been generat ed t hat way. T here are many ways t hat such a decomposit ion can be used. T he most obvious is t o reduce t he amount of laborat ory work t hat is needed t o fully det ermine t he correct haplotypes. For example, in a problem wit h 100 sit es and 10 int ervals, we can form new short er genotype vect ors wit h one sit e per int erval, hence 10 sit es. If t he correct haplotype pairs for t hese short er genotype sequences are det ermined, we can combine t hat informat ion wit h t he (assumed correct ) haplotype pairs det ermined in each int erval by a P P H program. T he laborat ory eff ort is reduced t o one t ent h of what it would be t o det ermine t he haplotypes from 100 sit es. Anot her approach is t o input t he short er genotype sequences t o one of t he st at ist ical-based met hods for haplotype inference. T hese met hods can handle a moderat e level of recombinat ion and are generally quit e accurat e, but t heir running t imes increase great ly wit h an increasing number of sit es.
7
H ow Larg e S h o u ld t h e Te st D at a B e ?
In t his paper we t est ed programs and dat a wit h up t o 2000 sit es. T his is a larger number of SNP s t han has so far been observed t o fit t he perfect phylogeny model. Here we discuss t he quest ion of how many SNP sit es should be included in t est s of P P H programs. We define a set of binary sequences as “t ree-compat ible” if t he sequences pass t he four-gamet es t est . T hat is, t he dat a do not have two posit ions (sit es) where four sequences in t he set cont ain all four combinat ions 0,0; 0,1; 1,0, and 1,1. We
16
R.H. Chung and D. Gusfield r = 4 r = 16 r = 40 Experiment s Errors Int ervals Errors Int ervals Errors Int ervals No. 1 0 7 0 17 9 18 No. 2 0 7 1 17 26 17 No. 3 0 5 3 20 0 20 No. 4 0 5 1 16 0 22 No. 5 0 4 2 14 5 24 No. 6 0 3 1 12 1 22 No. 7 0 7 0 18 7 20 No. 8 0 4 0 14 0 25 No. 9 0 7 0 18 12 20 No. 10 0 10 0 15 1 24 No. 11 0 9 1 12 5 19 No. 12 0 5 0 18 1 18 No. 13 0 7 0 16 27 22 No. 14 0 8 0 14 1 25 No. 15 0 10 0 19 0 24 Average 0 6.5 0.6 16 6.3 21.3
F ift een experiment s wit h 100 individuals and 100 sit es, performed wit h t hree diff erent recombinat ion rat es. r is t he recombinat ion rat e used in Hudson’ s program [17]. W hen r is high, t he probability of recombinat ion is high. T he Int erval count is t he number of int ervals out put by program P P HS. T he error count is t he t ot al number of int ervals where t he given unique P P H solut ion is not correct for t hat int erval. Hence t he number of errors report ed can be larger t han t he number of int ervals. F ig. 4 .
define a “t ree-compat ible int erval” as an int erval where t he subsequences are t ree-compat ible. Sequences t hat are t ree-compat ible can be derived on a perfect phylogeny. T herefore, in considering t he size of relevant input t o P P H programs, t he key quest ion is: What is t he longest t ree-compat ible int erval t hat one could reasonably expect t o find in a set M of binary-encoded biological sequences (SNP s, or ot her binary sequences) of current or fut ure int erest ? We define t hat lengt h as m . T he correct value of m is cert ainly unknown at present , and t he exist ing lit erat ure relat ed t o t his issue (mainly from st udies of haplotype st ruct ure in humans, and st udies of linkage disequilibrium in a few ot her organisms) represent s a minuscule fract ion of t he molecular diversity st udies t hat are desired and t hat are expect ed t o be conduct ed in t he fut ure. However, t here is already good evidence est ablishing t hat m is much larger t han 30 (a number suggest ed by some of t he st udies in humans, for example [6]). Relevant dat a can come from two sources: act ual sequence and SNP dat a t hat can be direct ly examined for t ree-compat ible int ervals, and less direct st udies of linkage disequilibrium (LD). LD causes (or is defined by) a high correlat ion between t he occurrences of alleles at two sit es. If f A is t he frequency of allele A at one sit e, and f B is t he frequency of allele B at a second sit e, and f A B is t he joint frequency of t hose alleles at t he two sit es, LD at t he two sit es can be measured by t he deviat ion of f A B from f A × f B . Assuming infinit e sit es, ∗
∗
∗
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
17
long int ervals of high LD suggest long t ree-compat ible int ervals, since high LD is generally caused by lit t le recombinat ion between t he two sit es. LD can be measured wit hout direct ly det ermining whet her t he int erval is t ree-compat ible, and so LD is a more indirect , but much more available, indicat or of m t han is provided by t he full SNP sequences in t he sample. P resent ly, very few st udies have det ermined full SNP sequences in large populat ions, so dat a on LD is very cent ral in est imat ing m . In published dat a on humans, t here is considerable variance in t he level of LD observed. For example, surveys of LD suggest t hat among Nigerians, high levels of linkage disequilibrium ext end t o int ervals of only 5 Kb, but in Nort hern Europeans, high levels ext end t o int ervals of 60 t o 80 Kb. Depending on t he number of individuals in t he survey, t hat could t ranslat e t o t ree-compat ible int ervals of between 5 and 80 SNP s. In even more homogeneous populat ions, for example in Finland or Iceland or Pennsylvania Dut ch, even longer t ree-compat ible int ervals of SNP s are expect ed. Generally, st ruct ured subpopulat ions which are t he result of recent migrat ion, hist orical bot t lenecks (reduct ion of t he populat ion size), or admixt ure (t he recent mixing of two dist inct populat ions) are expect ed t o have even longer t ree-compat ible int ervals, and t he exact lengt hs are not yet known. Smaller, more local populat ions should have even longer t ree-compat ible int ervals. Moreover, st ruct ured, local, subpopulat ions, are very import ant in human genet ics research, so t hat even if 30 were t he human-average number of t reecompat ible SNP sit es in an int erval, t here are import ant st udies where one expect s, and will search for, longer t ree-compat ible int ervals. Domest icat ed plant s and animals are expect ed t o have longer t ree-compat ible int ervals t han humans, and t he few st udies t hat have been done are consist ent wit h t his expect at ion [19]. It is also import ant t o underst and how t he dat a report ed in [6] were obt ained. T hose st udies were looking for long int ervals in humans of high LD cont aining a small number of haplotypes in t he given sample. SNP sit es were sampled in t he genome at a density t hat was suffi cient t o ident ify t hese long int ervals, but once found, t he researchers were not int erest ed in det ermining t he t ot al number of SNP sit es in t he int ervals. T herefore, typically under 30 SNP s were found in int ervals up t o 200,000 nucleot ides long. But a human int erval of t hat lengt h is expect ed t o have between 200 and 400 SNP s, and so it is incorrect t o int erpret t he number of SNP s in an int erval report ed in [6] as an est imat e of m . Moreover, t he number of SNP s found will also be a funct ion of t he size of t he sample. Fine scale linkage and associat ion mapping aimed at ident ificat ion of specific genes and variant s will oft en lead t o t he det erminat ion of many more SNP s in candidat e regions. And large scale resequencing on a genomic scale will also produce high densit ies of SNP s t hroughout t he genome [18]. Moreover, t here is variat ion in t he density of SNP s, independent of t he amount of recombinat ion in a region. For example, recent invest igat ion of t he laborat ory mouse genome [26] found long regions of t he genome t hat cont ained 45 SNP s per 10Kb, and ot her long regions t hat cont ained only 1 SNP per 10Kb. Hence, it is expect ed t hat in t he mouse genome we could encount er t ree∗
∗
∗
18
R.H. Chung and D. Gusfield
compat ible regions wit h t he same number of nucleot ides, where one region has many more SNP s t han t he ot her. In general, t he value of m depends bot h on t he diversity of biological sequences (from diff erent organisms, regions of t he genome, populat ions and subpopulat ions) t hat are of import ance and t hat will be, or have been, st udied, and t he number of sequences in t hose st udies. More fundament ally, for any given sample, t he lengt h of t he longest t ree-compat ible int erval is a funct ion of t he rat io of t he (sit e) mut at ion rat e, and t he recombinat ion rat e in t hat sample. Among all t he organisms, genomic regions, populat ions and subpopulat ions t hat are of int erest , t hat rat io is expect ed, and has already been seen, t o vary over a large range [18]. Hence it is not correct t o conclude t hat m has been est ablished from t he limit ed, specific st udies recent ly conduct ed in humans. In short , t he correct value of m is unknown, and t here is very lit t le t hat is known, empirically or t heoret ically, t hat est ablishes good bounds for m . T here is enormous diversity in biology, wit h a vast number of unexplored organisms, populat ions, subpopulat ions and genomic regions of int erest . Any suggest ion t hat m is already known ignores t his. More specifically, t he suggest ion t hat m is bounded by 30 does not reflect t he lit t le dat a t hat is already known, and t he underst anding t hat compared t o t he human st udies recent ly done, much longer t ree-compat ible regions should exist in sequences from subpopulat ions and organisms whose diversity has not yet been st udied. ∗
∗
∗
∗
∗
∗
A ckn ow le d g e m e nt s. T hanks t o populat ion genet icist s Chuck Langley, Pet er
Morrell and St even Orzack for advice on t he discussion in Sect ion 7.
R e fe re n ce s 1. V. Bafna, D. Gusfield, G. Lancia, and S. Yooseph. Haplotyping as perfect phylogeny: A direct approach. Technical report , UC Davis, Depart ment of Comput er Science. J uly 17, 2002. 2. R. E. Bixby and D. K. Wagner. An almost linear-t ime algorit hm for graph realizat ion. M athemati cs of Operati ons Research, 13:99–123, 1988. 3. R.H. Chung and D. Gusfield. P erfect phylogeny haplotyper: Haplotype inferral using a t ree model. B i oi nfor mati cs, 19(6):780–781, 2003. 4. A. Clark. Inference of haplotypes from P CR-amplified samples of diploid populat ions. M ol. B i ol. E vol , 7:111–122, 1990. 5. A. Clark, K. Weiss, and D. Nickerson et . al. Haplotype st ruct ure and populat ion genet ic inferences from nucleot ide-sequence variat ion in human lipoprot ein lipase. A m. J. H uman G eneti cs, 63:595–612, 1998. 6. M. Daly, J . Rioux, S. Schaff ner, T . Hudson, and E. Lander. High-resolut ion haplotype st ruct ure in t he human genome. N ature G eneti cs, 29:229–232, 2001. 7. E. Eskin, E. Halperin, and R. Karp. Effi cient reconst ruct ion of haplotype st ruct ure via perfect phylogeny. Technical report , UC Berkeley, Comput er Science Division (EECS), August , 2002. 8. M. Fullert on, A. Clark, Charles Sing, and et . al. Apolipoprot ein E variat ion at t he sequence haplotype level: implicat ions for t he origin and maint enance of a ma jor human polymorphism. A m. J. of H uman G eneti cs, pages 881–900, 2000.
Empirical Explorat ion of P erfect P hylogeny Haplotyping and Haplotypers
19
9. S. Cleary and K. St . J ohn. Analysis of Haplotype Inference Dat a Requirement s. P reprint , 2003. 10. F . Gavril and R. Tamari. An algorit hm for const ruct ing edge-t rees from hypergraphs. N etwor ks, 13:377–388, 1983. 11. D. Gusfield. Effi cient algorit hms for inferring evolut ionary hist ory. N etwor ks, 21:19–28, 1991. 12. D. Gusfield. A lgor i thms on Str i ngs, T rees and Sequences: Computer Sci ence and Computati onal B i ology . Cambridge University P ress, 1997. 13. D. Gusfield. Inference of haplotypes from samples of diploid populat ions: complexity and algorit hms. Jour nal of computati onal bi ology , 8(3), 2001. 14. D. Gusfield. Haplotyping as P erfect P hylogeny: Concept ual Framework and Effi cient Solut ions (Ext ended Abst ract ). In P roceedi ngs of R E COM B 2002: T he Si xth A nnual I nter nati onal Conference on Computati onal B i ology , pages 166–175, 2002. 15. L. Helmut h. Genome research: Map of t he human genome 3.0. Sci ence, 293(5530):583–585, 2001. 16. R. Hudson. Gene genealogies and t he coalescent process. Oxford Sur vey of E voluti onar y B i ology , 7:1–44, 1990. 17. R. Hudson. Generat ing samples under t he W right -F isher neut ral model of genet ic variat ion. B i oi nfor mati cs, 18(2):337–338, 2002. 18. C. Langley. U.C. Davis Dept . of Evolut ion and Ecology. P ersonal Communicat ion, 2003. 19. J .Z. Lin, A. Brown, and M. T . Clegg. Het erogeneous geographic pat t erns of nucleot ide sequence diversity between two alcohol dehydrogenase genes in wild barley (Hordeum vulgare subspecies spont aneum). P N A S, 98:531–536, 2001. 20. S. Lin, D. Cut ler, M. Zwick, and A. Cahkravart i. Haplotype inference in random populat ion samples. A m. J. of H um. G enet. , 71:1129–1137, 2003. 21. T . Niu, Z. Qin, X. Xu, and J .S. Liu. Bayesian haplotype inference for mult iple linked single-nucleot ide polymorphisms. A m. J. H um. G enet , 70:157–169, 2002. 22. S. Orzack, D. Gusfield, and V. St ant on. T he absolut e and relat ive accuracy of haplotype inferral met hods and a consensus approach t o haplotype inferral. Abst ract Nr 115 in Am. Society of Human Genet ics, Supplement 2001. 23. M. St ephens, N. Smit h, and P. Donnelly. A new st at ist ical met hod for haplotype reconst ruct ion from populat ion dat a. A m. J. H uman G eneti cs, 68:978–989, 2001. 24. S. Tavare. Calibrat ing t he clock: Using st ochast ic processes t o measure t he rat e of evolut ion. In E. Lander and M. Wat erman, edit ors, Calculati ng the Secretes of L i fe. Nat ional Academy P ress, 1995. 25. W .T . Tut t e. An algorit hm for det ermining whet her a given binary mat roid is graphic. P roc. of A mer . M ath. Soc, 11:905–917, 1960. 26. C. Wade and M. Daly et al. T he mosaic st ruct ure of variat ion in t he laborat ory mouse genome. N ature, 420:574–578, 2002. 27. Shibu Yooseph. P ersonal Communicat ion, 2003.
C y lin d r ic a l H ie r a r c h y fo r D e fo r m in g N e c k la c e s Sergei Bespamyat nikh Depart ment of Comput er Science, University of Texas at Dallas, Box 830688, Richardson, T X 75083, USA [email protected]
Recent ly, Guibas et al. [7] st udied deformable necklaces – flexible chains of balls, called beads, in which only adjacent balls can int ersect . In t his paper, we invest igat e a problem of covering a necklace by cylinders. We consider several problems under diff erent opt imizat ion crit eria. We show t hat opt imal cylindrical cover of a necklace wit h n beads in R3 by k cylinders can be comput ed in polynomial t ime. We also st udy a bounding volume hierarchy based on cylinders.
A b st r a c t .
1
I n t r o d u c t io n
Our st udy is mot ivat ed by t he represent at ion and manipulat ion of molecular configurat ions, modeled by a collect ion of spheres. T he represent at ion of t hreedimensional geomet ric st ruct ure of a molecule wit h spheres where each at om is viewed as rigid sphere is a common approach. T he sizes of spheres depend on t he at om types. T here are recommended values for t he radius of each at om sphere called van der Waals radius. T he dist ance between t he cent ers of every pair of spheres is also known. In t his model, t he spheres of at oms in a chemical bond int erpenet rat e. T he fused spheres have been st udied in comput at ional geomet ry. Halperin and Overmars [8] proved useful propert ies of t he sphere model. For example, t he combinat orial complexity of t he boundary of a molecule is linear. Recent ly Guibas et al. [7] st udied t he sphere model under mot ion. T hey call t he sphere model a n ecklace and t he spheres beads and we borrow t his t erminology. Deforming necklaces and effi cient algorit hms for t his problem are needed in many comput at ional fields including comput er graphics, comput er vision, robot ics, geographic informat ion syst ems, spat ial dat abases, molecular biology, and scient ific comput ing. T here is a lit erat ure on using spheres in engineering modeling [4]. Comput at ional problems involving mot ion can be st at ed in t he K in et ic D at a S t ru ct u re Fram ework (KDS for short ) [6,5]. A mot ion of necklaces models (i) t he Brownian mot ion of molecules where necklaces move as rigid bodies, and (ii) molecular dynamics where necklaces undergo local changes only. Applied t o deforming necklaces an effi cient KDS can be design using bounding volume hierarchies. Guibas et al. [7] focused on a simple variant of hierarchy t hat uses spheres. T hey analyzed two ways of defining t he spheres in hierarchy. A sphere hierarchy of a necklace is defined t o be a balanced t ree whose leaves correspond t o t he beads. To each int ernal node is assigned a cage t hat is a bounding sphere. A wrapped hierarchy is a sphere hierarchy of a necklace where
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 20–29, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Cylindrical Hierarchy for Deforming Necklaces
21
t he cage corresponding t o each int ernal node is t he minimum enclosing sphere of t he beads in t he canonical sub-necklace associat ed wit h t hat node. Anot her hierarchy called a lay ered hierarchy is defined by making t he cage of an int ernal node t o be t he minimum enclosing sphere of t he cages of it s two children [12].
S1
Sl
S2
Sw
w is t he wrapped sphere of 7 point s and for t he spheres S 1 and S 2 .
F ig. 1 . S
Sl
is t he layered sphere const ruct ed
T he wrapped hierarchy is slight ly more diffi cult t o comput e t han t he layered hierarchy alt hough it is t ight er fit t ing, see Fig. 1 for an example and [4] for det ailed comparison of two hierarchies. T he idea of using cylinders comes from t his example. T he spheres S 1 and S 2 can be covered by a cylinder of volume smaller t han t he volume of S l . T he use of cylinders for molecular represent at ion is not a new idea. T he cylinders are widely used in software packages visualizing prot eins. St ruct ural component s of prot eins – helixes – are depict ed by cylinders. For example, t he human deoxyhaemoglobin 4HHB is a prot ein wit h high concent rat ion of helices; it cont ains 32 helices. T he helix st ruct ure is shown on Fig. 2. Packing helices int o cylinders and relat ed problems can be found in [13]. We want t o represent a molecule using cylinders. P roblems of covering spheres in R3 by cylinders are comput at ionally diffi cult . Recent ly, Zhu [15] considered t he problem of covering point s by cylinders. T he problem is NP -hard even for point s (spheres of radius 0). In t his paper we address t he following problem. N e ck la c e p a ck in g in t o c y lin d e rs . Let
N
be a necklace consist ing of
n beads B 1 , B 2 , . . . , B n in R3 . Let k be an int eger 1 ≤ k ≤ n . Find k cylinders C 1 , C 2 , . . . , C k and a part it ion of t he necklace int o k subnecklaces N 1 , N 2 , . . . , N k such t hat , for each 1 ≤ i ≤ k , t he cylinder C i cont ains t he beads of t he necklace N i and a funct ion F ( C 1 , C 2 , . . . , C k ) is minimized. Examples of funct ion F () can be (i) t he sum of volumes
of t he cylinders, or (ii) t he maximum radius of a cylinder, or (iii) t he maximum volume of a cylinder, et c. We show t hat , for reasonable funct ions F , t he problem of necklace packing can be solved in polynomial t ime. T he algorit hm exploit s t he sequence property of necklaces and is in cont rast t o NP -hardness result of packing a dist ribut ed point s [15].
22
S. Bespamyat nikh
F ig. 2 .
T he helices of human deoxyhaemoglobin 4HHB.
We use t he necklace packing t o generat e a cylinder hierarchy. As in t he sphere hierarchy [7], t here are two opt ions here: wrapped and layered hierarchy. We define a cylinder cage t o be t he sm allest en closin g cy lin der of underlying cylinders where a cylinder is measured using t he funct ion F (). We also ment ion t hat t he smallest radius cylinders find applicat ions in project ive clust ering [2,9].
2
S m a lle s t E n c lo s in g C y lin d e r
Given a necklace N , we want t o find t he smallest cylinder cont aining all t he spheres of N . Unfort unat ely, it seems t hat t he property of spheres of being in a necklace does not help in comput ing t he smallest enclosing cylinder. T here are several result s on comput ing a cylinder wit h t he smallest radius [1,3,14]. Agarwal et al. [1] gave a O ( n 3+ δ ) algorit hm for any δ > 0. Sch¨omer et al. [14] found a O ( n ε 2 log ε 1 ) t ime algorit hm t hat comput es (1 + ε )-approximat ion of t he smallest radius for any ε > 0. Chan [3] improved t he running t ime t o O ( n / ε ) using convex programming. Zhu [15] obt ained a pract ical algorit hm wit h running t ime O ( n log n + n / ε 4 ). We give a pract ical algorit hm t hat comput es (1 + ε )-approximat ion of t he smallest cylinder under various ob ject ive funct ions F (). We denot e i -t h bead in t he necklace by B i ( oi , r i ) where oi is t he cent er of B i and r i is it s radius. T he coordinat es of a point p ∈ R3 are denot ed as ( x ( p ) , y ( p ) , z ( p )) or ( p x , p y , p z ). −
−
Cylindrical Hierarchy for Deforming Necklaces
23
A lg o rit h m 1 S t ep 1. Comput e
Box = [cx
−
a x , cx + a x ] × [cy
−
a y , cy + a y ] × [cz
t he bounding box of t he spheres in t he necklace cx
−
ax =
N
−
a z , cz + a z ],
. For example,
min { x ( oi ) − r i } .
1≤
i ≤ n
S t ep 2. Let r = 2 max( a x , a y , a z ) and let D = [cx
−
r , cx + r ] × [cy
−
r , cy + r ] × [cz
−
r , cz + r ].
S t ep 3. Generat e a grid of size 2/ ε
× 2/ ε on each face of t he cube D . Let G be t he set of all grid point s. S t ep 4. For each line p 1 p 2 defined by two grid point s p 1 , p 2 ∈ G , find t he smallest cylinder C wit h cent er line p 1 p 2 t hat cont ains all t he beads of t he necklace. Comput e F ( C ). S t ep 5. Comput e t he smallest value of F ( C ) obt ained in St ep 4.
T h e o re m 1 . L et F ( C ) be on e of t he followin g fu n ct ion s: ( 1) t he radiu s of t he cy lin der C , or ( 2) t he volu m e of t he cy lin der C . A lgorit hm 1 com pu t es (1 + ε ) approxim at ion of t he sm allest en closin g cy lin der in O ( n / ε 4 ) t im e.
T he exact algorit hm by Agarwal et al. [1] can be applied t o t he minimizat ion of t he radius. What if one want t o minimize t he volume of a cylinder? T h e o re m 2 . T he sm allest volu m e cy lin der en closin g a n ecklace of n beads can be com pu t ed in O ( n 6 ) t im e. P roof. First , we show O ( n 6 ) bound. T he volume of a cylinder C of radius r and height h is vol( C ) = π r 2 h . Let C ∗ be t he smallest volume cylinder enclosing a
necklace N . We assume t hat t he beads of N are in general posit ion, i.e. t here is no unbounded cylinder whose surface t ouches t o more t han four beads. T he surface of C has t hree component s: two disks D 1 and D 2 and t he cylindrical surface S t hat can be unwrapped t o a rect angle. Not e t hat each disk D 1 and D 2 t ouches a bead since C has t he smallest volume. T he cylinder C has a property t hat eit her (i) t he surface S t ouches four beads, or (ii) t he surface S t ouches only t hree beads. In t he first case t he cent er line of C is det ermined by four t ouching beads and two disks D 1 and D 2 are t angent t o two ext reme beads in t he direct ion of t he cent er line. T here are O ( n 4 ) possible ways t o choose t hese beads. Each combinat ion of beads generat e O (1) cent er lines of a cylinder t ouching t hem simult aneously. We comput e each of t hese lines and find two corresponding disks D 1 and D 2 . T his gives us t he volume of t he cylinder. We check in linear t ime if ∗
∗
∗
∗
24
S. Bespamyat nikh
t he cylinder cont ains all t he beads of N . T hus, t he first case can be processed in O ( n 5 ) t ime. In t he second case t he locat ion of t he cylinder in t he space is det ermined by five beads: t hree beads B 1 , B 2 , B 3 t ouching S and two beads B 4 , B 5 t ouching t he disks D 1 and D 2 . Not e t hat beads B 1 , B 2 and B 3 are dist inct but two set s 5 { B 1 , B 2 , B 3 } and { B 4 , B 5 } can int ersect . T here are O ( n ) choices t o select t he beads. Each t uple generat es O (1) cylinders minimizing t he volume. Each cylinder can be checked if it cont ains all t he beads of N . T he running t ime in t he second case is O ( n 6 ). Next , we describe a more complicat ed algorit hm wit h bet t er asympt ot ic runt ime. T h e o re m 3 . U sin g advan ced t echn iqu es t he sm allest volu m e cy lin der en closin g a n ecklace of n beads can be com pu t ed in O ( n 5+ δ ) t im e where δ > 0 is arbit rary sm all con st an t . P roof. We apply t he paramet ric search t echnique of Megiddo [11]. We consider
t he following decision problem. D e c is io n P ro b le m . Given a necklace
N and a paramet er V , decide if t here is a cylinder of volume V t hat cont ains all t he beads of N .
Let L be a line in R3 and let C be t he smallest cylinder wit h cent erline L cont aining t he necklace. Let ( ξ 1 , ξ 2 , 1) be t he direct ion of L , i.e. t he line L is parallel t o t he line L ( ξ 1 , ξ 2 ) passing t hrough t he origin O (0, 0, 0) and t he point ( ξ 1 , ξ 2 , 1). Consider i -t h bead B i . To simplify not at ion, let oi = ( x i , y i , z i ). T here are two planes, denot ed by π i and π i+ , ort hogonal t o t he direct ion ( ξ 1 , ξ 2 , 1) and t angent t he bead B i . T heir equat ions can be writ t en as ξ 1 x + ξ 2 y + z = h i ( ξ 1 , ξ 2 ) and ξ 1 x + ξ 2 y + z = h +i ( ξ 1 , ξ 2 ). T he values of h i ( ξ 1 , ξ 2 ) and h +i ( ξ 1 , ξ 2 ) can be comput ed as follows. Let oi be t he project ion of t he point oi t o t he line L ( ξ 1 , ξ 2 ), see Fig. 3. T hen t he coordinat es of oi sat isfy x ( oi ) = λ i ξ 1 , y ( oi ) = λ i ξ 2 and z ( oi ) = λ i for some real number λ i . T he segment oi oi is ort hogonal t o t he segment O oi . T hus −
−
−
′
′
′
′
′
′
λ
i
ξ
1 (λ
i
ξ
xi ) + λ
1 −
λ
i
′
(ξ
2 1
+ ξ
2 2
(λ i − zi ) = 0 + 1) = ξ 1 x i + ξ 2 y i + z i . i
ξ
2 (λ
i
ξ
2 −
yi ) + λ
i
(1)
Let α = ξ 12 + ξ 22 + 1. Clearly, α > 0. T he planes t angent t o B i int ersect t he line L ( ξ 1 , ξ 2 ) at t he point s H i+ ( λ +i ξ 1 , λ +i ξ 2 , λ +i ) and H i ( λ i ξ 1 , λ i ξ 2 , λ i ) where λ +i = λ i + r i / α and λ i = λ i − r i / α , see Fig. 3. T he values of h i ( ξ 1 , ξ 2 ) and h +i ( ξ 1 , ξ 2 ) can be obt ained by subst it ut ing t he point s H i and H i+ t o t he equat ions of t he planes π i and π i+ −
−
−
h i (ξ
= ξ 1 x i + ξ 2 y i + zi − r i h i (ξ 1 , ξ 2 ) = ξ 1 x i + ξ 2 y i + zi + r i . +
1, ξ 2)
−
−
−
−
−
−
Cylindrical Hierarchy for Deforming Necklaces L
(ξ
25
1, ξ 2)
+
H i
′
oi
+
π i
− H i
−
π i
oi O
F ig. 3 .
T he point s
−
and
H i
+
H i
.
Suppose t hat H i+ and H j are t he ext reme point s on t he line L ( ξ i , ξ 2 ) among all t he point s H l , H l+ , l = 1, . . . , n . T hen t he point s H i+ and H j det ermine two disks of t he cylinder C . T he height of C is + ( λ +i ξ 1 − λ j ξ 1 ) 2 + ( λ +i ξ 2 − λ j ξ 2 ) 2 + ( λ +i − λ j ) 2 h = |H i H j | = −
−
−
−
+
= | (λ
+
Not e t hat λ
i
λ
−
i
−
λ
≤
h = (λ
−
j
+ i
−
j
−
−
√
α .
|
. T hen −
= (ξ 1 (x i
λ −
−
j
√
) α = (λ xj ) + ξ
i
+ ri / α
2 (y i −
−
λ
−
j
y j ) + (zi
−
rj / α )
√
(2) α
zj ) + (r i
r j )) /
−
√
α .
(3)
Since t he volume of t he cylinder is V = π r 2 h , t he radius of t he cylinder is r = V / ( π h ). T he exist ence of t he cylinder of radius r cont aining t he beads is relat ed t o t o t ransversals [1]. A line L is called a ( lin e ) t ran sversal of t he necklace N if it int ersect s every bead of N . Let T ( N ) denot e t he set of all t ransversals of N . T he reduct ion t o t ransversals is as follows. T he set of balls B i ( o i , r i ) can be wrapped by a cylinder of radius r if and only if (i) r i ≤ r for all i , and (ii) t he balls B i ( oi , r i − r ) admit a t ransversal. For our purposes we need a const rained reduct ion: t he set of balls B i ( oi , r i ) can be wrapped by a cylinder whose cent erline is parallel t o L ( ξ 1 , ξ 2 ) and radius r if and only if (i) r i ≤ r for all i , and (ii) t he balls B i ( oi , r i − r ) admit a t ransversal parallel t o L ( ξ 1 , ξ 2 ). Agarwal et al. [1] solves t he t ransversal det ect ion problem using minimizat ion/ maximizat ion diagrams of bivariat e funct ions. We apply t heir approach t o ot her funct ions since we use diff erent paramet rizat ion. A line L parallel t o t he line L ( ξ 1 , ξ 2 ) can be paramet rized using two more variables ξ 3 and ξ 4 as follows: ′
′
′
L ′ (ξ
1, ξ 2, ξ 3, ξ 4)
= { (ξ
3
+ tξ 1, ξ
4
+ tξ 2, t)
|
t ∈
R} .
26
S. Bespamyat nikh
Let π ( ξ 1 , ξ 2 , ξ 3 ) be t he plane cont aining all t he lines L ( ξ 1 , ξ 2 , ξ 3 , ξ 4 ) , ξ 4 ∈ R. Consider l -t h bead B l . We define two funct ions f l ( ξ 1 , ξ 2 , ξ 3 ) and gl ( ξ 1 , ξ 2 , ξ 3 ) as follows. Int ersect B l wit h t he plane τ l passing t hrough it s cent er and parallel t o t he x z -plane. T he equat ion of t he plane τ l is y = y l . Let σ l+ and σ l be two hemispheres defined by cut t ing B l by τ l . We assume t hat σ l+ lies in t he halfspace y ≥ y l and σ l lies in t he halfspace y ≤ y l . If t he plane π ( ξ 1 , ξ 2 , ξ 3 ) int ersect s t he bead B l , t hen t here are two lines L ( ξ 1 , ξ 2 , ξ 3 , a ) and L ( ξ 1 , ξ 2 , ξ 3 , b) , a ≤ b t angent t o t he hemispheres σ l and σ l+ , respect ively. We define gl ( ξ 1 , ξ 2 , ξ 3 ) = a and f l ( ξ 1 , ξ 2 , ξ 3 ) = b. In t he second case π ( ξ 1 , ξ 2 , ξ 3 ) ∩ B l = ∅ we define f l (ξ 1 , ξ 2 , ξ 3 ) = + ∞ and gl ( ξ 1 , ξ 2 , ξ 3 ) = − ∞ . T he funct ions f l and gl have property t hat t he line L ( ξ 1 , ξ 2 , ξ 3 , ξ 4 ) int ersect s t he bead B l if and only if f l ( ξ 1 , ξ 2 , ξ 3 ) ≤ ξ 4 ≤ gl ( ξ 1 , ξ 2 , ξ 3 ). T he line L ( ξ 1 , ξ 2 , ξ 3 , ξ 4 ) is t ransversal of t he beads if and only if ′
′
′
′
−
′
−
′
′
′
′
−
′
′
′
′
max f l ( ξ 1 , ξ 2 , ξ 3 )
1≤
ξ
≤
4 ≤
l≤ n
min gl ( ξ 1 , ξ 2 , ξ 3 ) .
1≤
l≤ n
We show t hat t he funct ions f l ( ξ 1 , ξ 2 , ξ 3 ) and gl ( ξ 1 , ξ 2 , ξ 3 ) have con st an t descript ion com plexit y [1], t hat is, t he graph of each funct ion is a semi-algebraic set in R4 defined by a const ant number of polynomial equalit ies and inequalit ies of const ant degree. We assume t hat i and j are fixed. By Equat ion (3) t he radius of cylinder sat isfies r 2 (ξ
2 1
+ ξ
2 2
+ 1) = ( ξ 1 ( x i
xj ) + ξ
−
2 (y i −
y j ) + (zi
−
zj ) + (r i
r j )) 2 .
−
(4)
T he lines t angent t o t he hemispheres σ l and σ l+ are at dist ance r − r l from t he cent er ol . T his is equivalent t o t he condit ion t hat t he line L ( ξ 1 , ξ 2 ) is at dist ance r − r l from t he point p l ( x l , y l , z l ) where x l = x l − ξ 3 , y l = y l − ξ 4 , z l = z l . Subst it ut ing i by l and oi by p l in Equat ion (1) t he nearest point on L ( ξ 1 , ξ 2 ) t o p l has coordinat es ( λ ξ 1 , λ ξ 2 , λ ) where −
′
λ
′
′
′
′
′
′
= (ξ 1 x l + ξ 2 y l + zl )/ (ξ
′
2 1
+ ξ
2 2
′
+ 1) .
(5)
T herefore t he t angent lines sat isfy (r
−
r l )2 = (λ ξ
x ′l ) 2 + ( λ ξ
y l′ ) 2 + ( λ
2 −
z l′ ) 2
−
2λ ( ξ 1 x l + ξ 2 y l + z l ) + ( x l ) 2 + ( y l ) 2 + ( z l ) 2 = (x l ) + (y l )2 + (zl )2 − λ 2 α . = λ
2
1 −
α
′
′
−
2
′
′
′
′
′
′
′
(6)
P lugging λ from (5) and x l , y l , z we obt ain a polynomial of const ant degree. Recent ly Kolt un and Sharir [10] proved t hat t he overlay of two t rivariat e diagrams has O ( n 3+ δ ) complexity. Applied t o t he maximizat ion diagram of f l ( ξ 1 , ξ 2 , ξ 3 ) and t he minimizat ion diagram of gl ( ξ 1 , ξ 2 , ξ 3 ) we obt ain O ( n 3+ δ ) bound for t he fixed pair ( i , j ). T he decision problem can be solved in O ( n 5+ δ ) t ime since t here O ( n 2 ) pairs ( i , j ). T he paramet ric search t echnique allows t o solve t he opt imizat ion problem wit hin t he same bound O ( n 5+ δ ). ′
′
′
Cylindrical Hierarchy for Deforming Necklaces
3
27
G e n e ra l k
In t his Sect ion we show how t o find an opt imal necklace packing int o cylinders. Our algorit hm is based on a dynamic programming approach. Essent ially, a polynomial t ime algorit hm is possible since t he problem is decomposable int o polynomially many subproblems. T h e o re m 4 . L et F ( C ) be on e of t he followin g fu n ct ion s: ( 1) t he radiu s of t he cy lin der C , or ( 2) t he volu m e of t he cy lin der C . L et F ( C 1 , . . . , C k ) is defi n ed t o be eit her m in m ax or m in su m of t he valu es F ( C 1 ) , . . . , F ( C k ) . T he problem of n ecklace packin g in t o cy lin ders m in im izin g F () can be solved in O ( n 5+ δ ) t im e for t he case ( 1) an d in O ( n 7+ δ ) t im e for t he case ( 2) . P roof. Let i and j be two int egers such t hat 1 ≤ i ≤ j ≤ n . Let N ( i , j ) denot e t he sub-necklace of N wit h beads B i , B i + 1 , . . . , B j . Let C ( i , j ) be t he opt imal cylinder covering t he necklace N ( i , j ). By T heorem 3 t he cylinder C ( i , j ) can be found in O ( n 5+ δ ) t ime if F ( C ) is t he volume funct ion. Let Ξ ( i , j ) denot e t he value F ( C ( i , j )). T herefore t he values Ξ ( i , j ) for all i and j can be comput ed in O ( n 7+ δ ) t ime. T he bound for t he first case follows if we apply O ( n 3+ δ )-algorit hm by Agarwal et al. [1]. Let m be an int eger 1 ≤ m ≤ k . Let C ( j , m ) = { C 1 , C 2 , . . . , C m } be t he set of m cylinders in t he opt imal packing of t he necklace N (1, j ) wit h m cylinders. Let Φ ( j , m ) denot e t he value F ( C 1 , C 2 , . . . , C m ). T hen Φ ( j , 1) = Ξ (1, j ) Φ ( j , m ) = min 1≤
{
for all 1 ≤ j ≤ n − 1) + Ξ ( i + 1, j ) }
Φ (i , m
for all 1 ≤ j
≤
n and 1
≤
m
≤
k
i < j
T he dynamic program comput es t he values Φ ( j , m ) using t he above equat ions. T his t akes O ( n 2 ) t ime. Clearly, t he opt imal value of t he necklace packing is Φ ( n , k ). T he t heorem follows. We remark t hat t he approach based on dynamic programming can be applied t o many ot her ob ject ive funct ions t hat are decomposable.
4
C y lin d r ic a l H ie r a r c h y
We consider two hierarchies wrapped and layered. T he cage of a node in t he wrapped hierarchy is defined as t he opt imal cylinder covering all beads in t he corresponding subt ree. In t he layered hierarchy t he cage is t he smallest cylinder cont aining t he cages of it s children. At first glance, comput at ion of t he wrapped hierarchy is more diffi cult t han comput at ion of one cylinder. We show t hat t he comput ing t ime is t he same for exact problem and slight ly bigger for t he approximat e one.
28 4 .1
S. Bespamyat nikh W ra p p e d H ie ra rch y
L e m m a 1 . T he wrapped hierarchy can be con st ru ct ed in ( a) O ( n 3+ δ ) t im e exact ly if t he object ive fu n ct ion is based on radiu s on ly , ( b) O ( n 5+ δ ) t im e exact ly if t he object ive fu n ct ion is based on volu m e, ( c) O (( n log n ) / ε 4 ) t im e approxim at ely for eit her radiu s based fu n ct ion or volu m e based fu n ct ion . P roof. T he main comput at ional t ask is t o const ruct all t he cages of t he hierarchy.
We const ruct each cage independent ly using t he algorit hms from T heorems 1 and 2. T he algorit hm is recursive. Let t ( n ) be t he running t ime for comput ing t he opt imal cylinder (or it s approximat ion) for n spheres. Let T ( n ) be t he running t ime t o const ruct t he hierarchy for n beads. T hen T (1) = con st ,
and T ( n ) = t ( n ) + 2T ( n / 2) if n
≥
2.
T he lemma follows since (a) t = n 3+ δ , (b) t = n 5+ δ , and (c) t ( n ) = O ( n / ε 4 ). 4 .2
L ay e re d H ie ra rch y
In t he layered hierarchy we have a new problem. C a g e P ro b le m . Let C 1 and C 2 be two cylinders in R3 . Find an opt imal
cylinder C t hat cont ains C 1 and C 2 where t he quality of a cylinder is measured by a funct ion F () as in t he necklace packing problem. L e m m a 2 . T he opt im al cage can be fou n d in O (1) t im e. T hu s t he lay ered hierarchy can be con st ru ct ed in O ( n ) t im e. P roof. We not e t hat it is necessary and suffi cient t o subst it ut e t he cylinders C 1 and C 2 by four circles in t heir boundaries, see Fig. 4.
s3
s2 s1 s4 F ig. 4 .
T he four circles
s 1, s 2, s 3
and
s4
on t he boundary of two cylinders.
T he problem of finding an opt imal cylinder has a const ant complexity. We paramet erize t he cylinder using six variables. Let a = ( a x , a y , 0) and b = ( a x +
Cylindrical Hierarchy for Deforming Necklaces
29
bx , a y + by , 1) be two point s t hat are int ersect ion of t he cent er line of t he cylinder and t he planes z = 0 and z = 1. We can assume t hat t he cent er line of an opt imal cylinder is not parallel t o t he plane O X Y by pert urbat ion argument . T wo disks on t he boundary of t he cylinder can be paramet erized as planes bx x + by y + z = h 1 and bx x + by y + z = h 1 . T he volume of t he cylinder can be expressed using t he variables a x , a y , bx , by , h 1 , h 2 . T he opt imal value of volume can be found in O (1) t ime. T he t ot al running t ime is linear since t he recurrence for t he running t ime is T ( n ) = O (1) + 2T ( n / 2).
R e fe r e n c e s 1. P. K. Agarwal, B. Aronov, and M. Sharir. Line t raversals of balls and smallest enclosing cylinders in t hree dimensions. D i scr et e C om put . G eom . , 21:373–388, 1999. 2. P. K. Agarwal and C. M. P rocopiuc. Approximat ion algorit hms for project ive clust ering. In P r oc. 11t h A C M -SI A M Sym pos. D i scr et e A lgor i t hm s, pp. 538–547, 2000. 3. T . Chan. Approximat ing t he diamet er, widt h, smallest enclosing cylinder and minimum-widt h annulus. In P r oc. 16t h A n n u. A C M Sym pos. C om put . G eom . , pp. 300–309, 2000. 4. S. De and K. J . Bat he. T he met hod of finit e spheres. C om put at i on al M echan i cs, 25:329–345, 2000. 5. L. Guibas, F . Xie, and L. Zhang. Kinet ic dat a st ruct ures for effi cient simulat ion. In P r oc. I E E E I n t er n . C on f. on Robot i cs an d A ut om at i on , 3:2903–2910, 2001. 6. L. J . Guibas. Kinet ic dat a st ruct ures — a st at e of t he art report . In P. K. Agarwal, L. E. Kavraki, and M. Mason, edit ors, P r oc. W or kshop A lgor i t hm i c Foun d. Robot . , pp. 191–209. A. K. P et ers, Wellesley, MA, 1998. 7. L. J . Guibas, A. Nguyen, D. Russel, and L. Zhang. Collision det ect ion for deforming necklaces. In P r oc. 18t h A n n u. A C M Sym pos. C om put . G eom . , pp. 33–42, 2002. 8. D. Halperin and M. Overmars. Spheres, molecules, and hidden surface removal. C om put . G eom . T heor y A ppl. , 11(2):83–102, 1998. 9. S. Har-P eled and K. Varadara jan. P roject ive clust ering in high dimensions using core-set s. In P r oc. 18t h A n n u. A C M Sym pos. C om put . G eom . , pp. 312–318. 10. V. Kolt un and M. Sharir. T he part it ion t echnique for overlays of envelopes. In P r oc. 43n d A n n u. I E E E Sym pos. Foun d. C om put . Sci . , pp. 637–646. 11. N. Megiddo. Applying parallel comput at ion algorit hms in t he design of serial algorit hms. J . A C M , 30(4):852–865, 1983. 12. S. Quinlan. Effi cient dist ance comput at ion between non-convex ob ject s. pp. 3324– 3329, 1994. 13. J . Sadoc and N. Rivier. Boerdijk-coxet er helix and biological helices. T he E ur opean P hysi cal J our n al B , 12(2):309–318, 1999. 14. E. Sch¨omer, J . Sellen, M. Teichmann, and C. K. Yap. Smallest enclosing cylinders. A lgor i t hm i ca , 27(2):170–186, 2000. 15. B. Zhu. Approximat ing 3D point s wit h cylindrical segment s. In P r oc. 8t h A n n . I n t er n at . C on f. C om put i n g an d C om bi n at or i cs, pp. 420–429, 2002.
G e o m e t ric A lg o rit h m s fo r A g g lo m e ra t iv e H ie ra rch ic a l C lu s t e rin g ⋆ Danny Z. Chen and Bin Xu Depart ment of Comput er Science and Engineering, University of Not re Dame, Not re Dame, IN 46556, USA { chen,bxu} @cse.nd.edu
Agglomerat ive Hierarchical Clust ering (AHC) met hods play an import ant role in t he science of classificat ion. In t his paper, We present exact cent roid and median AHC algorit hms and an approximat e singlelink AHC algorit hm for clust ering dat a ob ject s in t he d -D space for any const ant int eger d ≥ 2; t he t ime and space bounds of all our algorit hms are O ( n log n ) and O ( n ), where n is t he size of t he input dat a set . P reviously best algorit hmic approaches for t hese t hree met hods t ake at least quadrat ic t ime in t he worst case. We implement ed t hese AHC algorit hms, and t he experiment al result s show t hat our algorit hms are quit e effi cient and pract ical. A b st r a c t .
1
In t ro d u c t io n
AHC is especially import ant in chemical informat ion research (e.g., for molecule st ruct ure analysis and compound select ion). For example, recent research has suggest ed t hat hierarchical clust ering met hods perform bet t er t han t he more commonly-used non-hierarchical clust ering met hods in property-predict ion st udies and in separat ing act ive molecules and inact ives [4]. In fact , AHC algorit hms have been implement ed by many commercial softwares, e.g., SAS (SAS Inst it ut e Inc), S-P lus (Bell Labs), Oracle (Oracle Corporat ion), BCI (Barnard Chemical Informat ion Lt d), and Xplore (Medical Device Technologies, Inc). More precisely, AHC met hods can be described as performing t he following general process: 1. Begin wit h n clust ers, each consist ing of exact ly one input ob ject . 2. Search for t he most “similar” pair of clust ers. Let t he two such clust ers be labeled as A and B . 3. Merge clust ers A and B . Label t he clust er result ed from t he merge as C , and updat e t he dat a st ruct ure for t he clust ers t o reflect t he delet ion of A and B and t he insert ion of clust er C . 4. Repeat st eps 2 and 3 a t ot al of n − 1 t imes (by t hen, t he n input ob ject s are all in one clust er).
⋆
T his work was support ed in part by Lockheed Mart in Corporat ion and by t he Nat ional Science Foundat ion under Grant CCR-9988468.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 30–39, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering
31
In t his paper, we consider t hree kinds of AHC met hods for spat ial dat a object s in t he d -D space Rd ( d ≥ 2): cent roid, median, and single-link. T he crit erion t hat we use for merging ob ject s/ clust ers is t heir similarity or dissimilarity, which is based on t he Euclidean met ric (i.e., t he L 2 met ric). T he cent roid and median met hods are int ended for spat ial dat a consist ing of int erval-scaled measurement s. Suppose t hat we are given a set S of n point s p 1 , p 2 , . . . , p n in t he d -D space Rd (for any const ant int eger d ≥ 2). We denot e by x i j t he j -t h coordinat e of t he point p i , i = 1, 2, . . . , n and j = 1, 2, . . . , d . We first consider t he cent roid met hod. T he cen troid of a clust er R is t he point x¯ ( R ): x¯ ( R )
= ( x¯ 1 ( R ) , x¯ 2 ( R ) , . . . , x¯ d ( R ))
such t hat it s j -t h coordinat e x¯ j ( R ) is x¯ j ( R )
=
1 |R |
pi
xij ∈
R
Not e t hat x¯ ( R ) need not be an input point of S . T he dissimilarity between two clust ers A and B is defined as t he L 2 dist ance between t he two cent roids of A and B . When merging clust ers A and B t o form a new clust er R (i.e., R = A ∪ B ), t he cent roid of R can be obt ained as follows: x¯ ( R )
=
|A | |R |
x¯ ( A )
+
|B | |R |
x¯ ( B ) .
J ust like t he cent roid met hod in which we use t he cent roid of each clust er as a represent at ive for t he clust er, in t he median met hod, each clust er also has a represent at ive point which we simply call t he represen tative , and t he dissimilarity between two clust ers A and B is t he L 2 dist ance between t he two represent at ives of A and B . For a clust er of only one point , it s represent at ive is t he point it self. When merging two clust ers A and B t o form a new clust er R , wit h t heir represent at ives being x¯ ( A ) and x¯ ( B ), t he represent at ive x¯ ( R ) of R is x¯ ( R )
=
1 ( x¯ ( A ) + x¯ ( B )) 2
Due t o t he similarity between t he cent roid and median met hods, we can use a unified algorit hm for handling bot h met hods, wit h t he diff erence being only at t he calculat ion of t he cent roids (in t he cent roid met hod) and t he represent at ives (in t he median met hod). T he single-link algorit hm was first int roduced by Florek et al. and Sneat h. T he dissimilarity between any two clust ers A and B is defined as d ( A , B ) = min p i A , p j B d ( p i , p j ), i.e., t he minimum of all t he pairwise dist ances between t he point s in t he two set s A and B . All commonly-used AHC algorit hms of bot h types have at least a quadrat ic running t ime. For example, t he AHC algorit hms in BCI’ s chemical informat ion software package all run in quadrat ic t ime [4] and could be impract ical. ∈
∈
32
D.Z. Chen and B. Xu
T he single-link met hod is a common AHC met hod. It can be nat urally based on comput ing t he minimum spanning t ree (MST ) (which can be easily t ransformed t o a desired clust er hierarchy. Diff erent single-link algorit hms have been proposed. For example, Murt agh used Bent ley and Friedman’ s MST algorit hms in coordinat e spaces, which run in O ( n log n ) t ime on average; t hus t he singlelink algorit hm in [7] t akes on average O ( n log n ) t ime. However, a bad case occurs when t he dat a point s are equally dist ribut ed among a few very widely separat ed clust ers, for which t hose MST algorit hms t ake O ( n 2 ) t ime. Agarwal et al. [1] present ed an effi cient algorit hm for comput ing t he Euclidean MST in Rd , wit h an O ( n 2 2 / ( d / 2 + 1) + ǫ ) t ime bound for any value ǫ > 0. Hence a single-link algorit hm based on t he MST solut ion [1] t akes nearly O ( n 2 ) t ime for a large d . In t his paper, we present fast er exact algorit hms for t he cent roid and median AHC met hods and a (1 + ǫ )-approximat e algorit hm for t he single-link AHC met hod, using t he exact or approximat e Euclidean measure of dissimilarity between clust ers. Our main cont ribut ions are summarized below. −
⌈
⌉
1. All our AHC algorit hms run in an opt imal O ( n log n ) t ime and O ( n ) space for n input point s in Rd ( d ≥ 2). Our effi ciency does not depend on any dist ribut ions of t he input dat a. Our approximat ion algorit hm produces provably good solut ions (which are oft en suffi cient in applicat ions). 2. We implement ed and experiment ed wit h all our AHC algorit hms. In fact , some of our key geomet ric component s, such as dynamic closest pairs and well-separat ed pair decomposit ions, are not only t heoret ically complicat ed but also subst ant ially non-t rivial t o implement . Our experiment al result s, especially on general dat a set s of large sizes and high dimensions, show t hat our AHC algorit hms act ually perform much fast er t han t heir t heoret ical predict ions and are quit e effi cient . We believe t hat our fast AHC algorit hms are of considerable pract ical import ance.
2
E x a c t C e n t ro id a n d M e d ia n A H C M e t h o d s
We use a unified algorit hm t o handle bot h t he cent roid and median met hods, wit h t he only diff erence being at calculat ing t heir respect ive represent at ives for t he clust ers (see Sect ion 1 on t his). In each met hod, a clust er is represent ed by a represent at ive point , and t he dissimilarity between two clust ers is t he Euclidean dist ance between t heir represent at ive point s. T wo clust ers wit h t he smallest dissimilarity are merged t o form a new clust er (wit h it s own represent at ive point ). Hence, a key operat ion is t o ident ify among a set of point s under considerat ion two point s wit h t he smallest Euclidean dist ance. A diffi culty is: T he point set is dynamically changing in t he algorit hm, i.e., we need t o delet e point s which are t he represent at ives of t he merged clust ers and insert point s which are t he represent at ives of t he newly formed clust ers. Not e t hat dealing wit h dynamic point s in higher dimensions is also diffi cult .
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering
2 .1
33
T h e M ain A lg o rit h m
We make use of t he dynamic closest pair t echnique [3] in our cent roid and median AHC algorit hms. For t he dynamic closest pair problem, one would like t o design a dat a st ruct ure t hat can effi cient ly updat e t he closest pair as point s are insert ed int o and delet ed from S in an on-line fashion. Bespamyat nikh [3] gave an opt imal algorit hm for solving t he dynamic closest pair problem, using a dat a st ruct ure of size O ( n ) and maint aining t he closest pair in O (log n ) worst -case t ime under t he delet ion/ insert ion of arbit rary point s. However, T he algorit hm [3] is very complicat ed t heoret ically (and is act ually even harder t o implement effi cient ly). Our exact cent roid and median algorit hms are based on Bespamyat nikh’ s dynamic closest pair approach, and we implement ed t hese algorit hms eff ect ively. Bespamyat nikh’ s approach is based on t he fair-split t ree dat a st ruct ure 3[ , 6], which represent s a hierarchical subdivision of t he space Rd int o a set of axisparallel boxes. Our fair-split t ree T is for a set of clust ers (i.e., st oring t heir represent at ive point s). More precisely, each leaf node of T st ores t he represent at ive of exact ly one clust er. To calculat e t he represent at ive of a new clust er aft er merging two clust ers in t he cent roid met hod, we also need t o record t he number of point s in each clust er. Our main algorit hm works as follows. 1. Const ruct t he fair-split t ree T for t he input point set S by insert ing t he point s of S int o T one by one, maint aining t he fair-split t ree st ruct ure and t he closest pair in T . 2. While t here are at least two point s in T , do a) Let ( p, q) be t he closest pair of t he represent at ive point s st ored in T . b) Merge t he clust ers for p and q, and comput e t he new represent at ive z for t he new clust er. c) Delet e p and q from T and insert z int o T , maint aining t he fair-split t ree and closest pair. T he t ree T is const ruct ed from a hierarchical subdivision of Rd int o axisparallel boxes. It is easy t o see t hat our above main algorit hm is carried out essent ially by a sequence of on-line operat ions op 1 , op 2 , . . . , op N , where N = O ( n ) and each op i is one of t he t hree kinds of operat ions: (1) insert ing an arbit rary point in T , (2) delet ing a point from T , and (3) maint aining t he closest pair of t he point s in T . We omit t he maint enance of t he fair-split t ree and closest pair under delet ions and insert ions of point s (see [3] for more det ails) due t o t he space limit . Our maint enance algorit hms need t o keep performing several operat ions on T such as point locat ion (finding t he leaf node in which a point is st ored), point delet ion, and point insert ion. However, a diffi culty is: T he height h ( T ) of T t hus maint ained need not be O (log n ). Act ually, h ( T ) can be as large as O ( n ). To enable each operat ion on T t o run in O (log n ) t ime, we furt her apply t he sophist icat ed dynamic t ree t echniques [2,3]. Due t o t he space limit , we also omit t he det ails of t his part from t his version.
34
2 .2
D.Z. Chen and B. Xu
T h e F in al R e su lt
T he fair-split t ree T for t he input point set S can be built in O ( n log n ) t ime and O ( n ) space. T here are n − 1 it erat ions in our main algorit hm, and in each it erat ion we delet e two point s from and insert one point int o T , while maint aining t he closest pair in T . Since each operat ion (delet ing or insert ing a point ) t akes O (log n ) t ime, t he n − 1 it erat ions alt oget her t ake O ( n log n ) t ime. Hence, we obt ain t he following result for our exact cent roid and median algorit hms. T h e o re m 1 . Let S be a set of n poin ts in Rd , with d ≥ 2 bein g a con stan t in teger. T he exact cen troid an d m edian A HC problem s on S can be solved in O ((24d + 1) d · (36d + 19) d · d log d · n log n ) tim e an d O ( dn ) space based on the E uclidean distan ce m etric.
3
A p p ro x im a t e S in g le -L in k A H C M e t h o d
As discussed in Sect ion 1, a single-link AHC solut ion can be based on comput ing t he minimum spanning t ree (MST ). By using t he well-separat ed pair decomposit ion t echnique [5,6], one can comput e a sparse graph G s for S , such t hat t he MST of t he graph G s is a good approximat ion of t he exact Euclidean MST (EMST ) on S . 3 .1
W e ll-S e p arat e d P air D e co m p o sit io n
Roughly speaking, two point set s are said t o be well-separated if each set represent s a clust er of point s such t hat t he dist ance between t hese two clust ers is significant wit h respect t o t he larger radius of two balls each cont aining one of t he two clust ers. Below is a more precise definit ion of well-separat ion. D e fi n it io n 1 . [5,6] G iven a real n um ber s > 0 ( called the separat ion value) an d two fi n ite poin t sets A an d B in Rd , A an d B are said to be well-separat ed with respect to s if there are two disjoin t d -D balls C A an d C B of the sam e radius, such that C A con tain s A , C B con tain s B , an d the distan ce between C A an d C B is at least s tim es the radius of C A . D e fi n it io n 2 . [5,6] Let S be a set of n poin ts in Rd , an d s > 0 be a given separation value. A well-separat ed pair decomposit ion ( W S P D ) for S ( with respect to s ) is a sequen ce of pairs of n on -em pty subsets of S , den oted by { A 1 , B 1 } , { A 2 , B 2 } , . . . , { A m , B m } , of size m , such that 1. A i ∩ B i = ∅ for each i = 1, 2, . . . , m . 2. For every un ordered pair { p, q} of distin ct poin ts of S , there is exactly on e pair { A i , B i } in the sequen ce, such that either ( a ) p ∈ A i an d q ∈ B i , or ( b) p ∈ B i an d q ∈ A i . 3. A i an d B i are well-separated with respect to s , for each i = 1, 2, . . . , m .
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering
35
Callahan and Kosara ju [5,6] showed how such a WSP D of size m = O ( n ) on S can be comput ed using a binary t ree T , called split tree . Here we briefly describe t heir main idea. T he split t ree is similar t o a k d -t ree. T he algorit hm in [5,6] comput es t he axis-parallel bounding box of all point s in S , which is t hen successively split by d -D hyperplanes, each of which is ort hogonal t o an axis. As a box is split , each of t he two result ing boxes cont ains at least one point of S . When a box cont ains exact ly one point of S , t he split t ing process st ops (for t his box). T he result ing binary t ree T of such boxes st ores t he point s of S at it s leaves, one leaf per point . Each node u of T is associat ed wit h a subset of S , denot ed by S u , which is t he set of all point s of S t hat are st ored in t he subt ree of T root ed at u . Callahan and Kosara ju [5,6] showed t hat t he split t ree T for S can be comput ed in O ( n log n ) t ime, and, from T , a WSP D of size m = O ( n ) can be obt ained in an addit ional O ( n ) t ime. Each pair { A i , B i } in t his WSP D is represent ed by two nodes u i and v i of T , wit h A i = S u i and B i = S v i . 3 .2
T h e F in al R e su lt
An approximat e EMST is a spanning t ree of S whose t ot al weight is no more t han 1 + ǫ t imes t hat of t he exact EMST of S , where ǫ > 0 is relat ed t o t he approximat ion fact or. To comput e an approximat e EMST , we perform two st eps once a WSP D for S based on a separat ion value s > 0 is given: 1. Const ruct a sparse graph G s = ( V , E ), where V consist s of all point s of S , and E consist s of t he edges such t hat for every pair { A i , B i } in t he given WSP D for S , G s cont ains exact ly one edge ( a, b) connect ing two point s a, b ∈ S such t hat a ∈ A i and b ∈ B i . 2. Comput e an MST in G s using t he st andard graph t echniques for MST . T hen based on [5,6], we have t he following result on our approximat e singlelink AHC algorit hm. T h e o re m 2 . Let S be a set of n poin ts in Rd for a con stan t in teger d ≥ 2, s > 2 be a con stan t separation value, an d ǫ = s − 2 . T hen the (1 + ǫ ) -approxim ate sin gle-lin k A HC problem on S can be solved in O ( n log n + ( ǫ − d / 2 log 1ǫ ) · n ) tim e an d O ( ǫ − d / 2 n ) space based on the E uclidean m etric.
4
E x p e rim e n t a l R e s u lt s
To st udy t he pract ical performance of our AHC algorit hms present ed in Sect ions 2 and 3, we implement ed all of t hem using C+ + on a Sun Sparc 20 workst at ion running Solaris. Our experiment al st udy has several goals. T he first goal is t o find out , in various AHC set t ings, how t he execut ion t imes of our exact and approximat e AHC algorit hms vary as funct ions of two key paramet ers: t he input dat a size n = | S | and t he input dat a dimension d ≥ 2. Our second goal is t o
36
D.Z. Chen and B. Xu
F i g . 1 . T he relat ion between t he execut ion t imes of our exact cent roid AHC algorit hm and t he dat a sizes, for dat a set s in 2-D, 3-D, and 4-D.
develop effi cient software for our exact and approximat e AHC algorit hms, and make it available t o real AHC applicat ions. Besides, we were quit e concerned t hat t he t heoret ical upper t ime bounds of our exact cent roid and median AHC algorit hms (i.e., O ((24d + 1) d · (36d + 19) d · d log d · n log n )) and approximat e single-link AHC algorit hm (i.e., O ( n log n + ( s d log s ) n ) for a const ant s > 2) appear t o be quit e high for various pract ical set t ings in which d and s must be rat her “big”. Hence, our t hird goal is t o compare t he experiment al result s wit h t hese t heoret ical t ime bounds t o det ermine t he pract ical effi ciency of our AHC algorit hms. All input dat a set s used in our experiment al st udy were generat ed randomly. To mimic t he input dat a set s for real AHC applicat ions, we conduct ed a large number of experiment s wit h various dat a dist ribut ions such as uniform, Gaussian, Laplace, and ot her correlat ed dist ribut ions. Our experiment s have shown t hat t he eff ect s of diff erent dat a dist ribut ions on t he effi ciency of our exact and approximat e AHC algorit hms are not significant , and hence we may use input dat a set s of any dist ribut ions t o illust rat e t he performance of all our AHC algorit hms. Due t o t he space limit , we omit t he result s of many experiment s in t his version. Each point for t he curves in Figures 1, 2, 3, and 4 represent s t he average of 30 experiment s whose input dat a set s were generat ed wit h diff erent seeds for t he random number generat or t hat we used.
4 .1
E x p e rim e nt al R e su lt s o f O u r E x act A H C A p p ro ach e s
Since t he only (minor) diff erence between our exact cent roid and median AHC algorit hms is at t heir ways of calculat ing t he new represent at ive point aft er merging two clust ers, t here is no essent ial diff erence between t hese two algorit hms. Our experiment al result s t hat are omit t ed from t his version also proved t hat .
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering
37
We hence illust rat e only t he cent roid AHC algorit hm wit h t he experiment al dat a below.
F i g . 2 . T he relat ion between t he execut ion t imes of our exact cent roid AHC algorit hm and t he dimensions, for dat a set s of sizes 10K, 20K, and 30K.
T he relat ion between t he execut ion t imes of our approximat e single-link AHC algorit hm and t he dat a sizes, for 2-D dat a set s.
F ig. 3 .
We considered t he dat a sizes n of input point set s varying from 100K t o 1500K = 1.5M, in fixed dimensions d ≥ 2. Figure 1 shows t he execut ion t imes of our exact cent roid AHC algorit hm as funct ions of n , in dimensions 2, 3, and 4. In Figure 1, t he t hree curves for d = 2, 3, and 4 all indicat e t hat t he execut ion t imes of our exact cent roid AHC algorit hm increase almost linearly wit h respect t o t he increase of t he dat a sizes. More precisely, t he execut ion t imes increase very
38
D.Z. Chen and B. Xu
slowly as t he dat a sizes increase (wit h a small posit ive slope). For example, t he slopes are about 28.3 seconds/ 100K, 43.9 seconds/ 100K, and 65.5 seconds/ 100K for dimensions 2, 3, and 4, respect ively. Comparing t o t he t heoret ical upper t ime bound, t he increase of t he execut ion t imes is subst ant ially slower wit h respect t o t he increase of t he dat a sizes. A key issue is how our execut ion t imes depend on t he dimensionality of t he input dat a set s. Since t he dimension value d ≥ 2 act s as t he power paramet er in t he t heoret ical t ime bound, d is cert ainly a crucial fact or t o t he execut ion t imes as well. To det ermine t he relat ion between t he execut ion t imes of our exact cent roid AHC algorit hm and t he dimensions of t he input dat a set s, we considered dimensions varying from 2 t o 16, wit h dat a sizes 10K, 20K, and 30K. As shown in Figure 2, t he increase of t he execut ion t imes is much slower t han what t he t heoret ical t ime bound predict s. For example, for dat a sizes 10K, 20K, and 30K, when t he dimension d increases from 2 t o 10, t he execut ion t imes increase 26.9, 38.1, and 38.6 t imes, respect ively; when t he dimension d increases from 10 t o 16, t he execut ion t imes increase 7.8, 10.2, and 11.9 t imes, respect ively. T hese numbers are all significant ly smaller t han t he increase of t he upper t ime bound. 4 .2
E x p e rim e nt al R e su lt s o f O u r A p p rox im at e A H C A p p ro ach
To find out how t he execut ion t ime of our approximat e single-link AHC algorit hm varies as a funct ion of t he input dat a sizes, we considered dat a set s of sizes varying from 100K t o 1.5M, and t he separat ion values s varying from 6 t o 10. Figure 3 shows some of t he experiment al result s for 2-D dat a set s. In Figure 3, t he t hree curves for diff erent values of s all indicat e t hat t he execut ion t imes increase almost linearly wit h respect t o t he increase of t he dat a sizes. Furt her, t he execut ion t imes increase very slowly as t he dat a sizes increase (wit h a small posit ive slope). For example, t he slopes are about 19.8 seconds/ 100K, 36.7 seconds/ 100K, and 61.5 seconds/ 100K for t he s values 6, 8, and 10, respect ively. Comparing t o t he t heoret ical upper t ime bound, t he increase of t he execut ion t imes is clearly significant ly slower wit h respect t o t he increase of t he dat a sizes. We considered dimensions d varying from 2 t o 16, wit h t he separat ion values s = 6, 8, and 10, and dat a set s of sizes 20K. As shown in Figure 4, t he increase of t he execut ion t imes is much slower t han what t he t heoret ical t ime bound predict s. For example, for t he values of s = 6, 8, and 10, as t he dimension d changes from 2 t o 4, t he execut ion t imes increase 77.4, 71.8, and 55.6 t imes, respect ively; as t he dimension d changes from 4 t o 16, t he execut ion t imes increase 4.6, 2.3, and 1.7 t imes, respect ively. All t hese numbers are obviously much smaller t han t he increase of t he t heoret ical upper t ime bound. 4 .3
C o n clu d in g R e m arks
From t he above experiment al result s on all our exact and approximat e AHC algorit hms, one can see t hat comparing t o t heir t heoret ical t ime bounds, t he
Geomet ric Algorit hms for Agglomerat ive Hierarchical Clust ering
39
T he relat ion between t he execut ion t imes of our approximat e single-link AHC algorit hm and t he dimensions, for dat a set s of sizes 20K.
F ig. 4 .
increase of t he execut ion t imes of all our AHC algorit hms is quit e slow wit h respect t o t he increase of t he dat a sizes and t he dimensions. T herefore, t hese AHC algorit hms are expect ed t o be quit e effi cient and pract ical in real applicat ions.
R e fe re n c e s 1. P.K. Agarwal, H. Edelsbrunner, and O. Schwarzkopf, Euclidean Minimum Spanning Trees and Bichromat ic Closet P airs, D i scr et e C o m p u t . G eo m . , 6 (1991), 407–422. 2. S.W . Bent , D.D. Sleat or, and R.E. Tarjan, Biased Search Tress, SI A M J . C o m p u t . , 14 (1985), 545–568. 3. S.N. Bespamyat nikh, An Opt imal Algorit hm for Closest P air Maint enance, D i scr et e C o m p u t . G eo m . , 19 (1998), 175–195. 4. R.D. Brown and Y.C. Mart in, Use of St ruct ure-Act ivity Dat a t o Compare St ruct ureBased Clust ering Met hods and Descript ors for Use in Compound Select ion, J . C h em . I n f . C o m p u t . Sci . , 36 (3) (1996), 572–584. 5. P.B. Callahan, Dealing wit h Higher Dimensions: T he Well-Separat ed P air Decomposit ion and It s Applicat ions, P h.D. t hesis, Dept . Comput . Sci., J ohns Hopkins University, Balt imore, Maryland, 1995. 6. P.B. Callahan and S.R. Kosara ju, A Decomposit ion of Mult idimensional P oint Set s wit h Applicat ions t o k -Nearest -Neighbors and n -Body P ot ent ial F ields, J . A C M , 42 (1995), 67–90. 7. F . Murt agh, A Survey of Recent Advances in Hierarchical Clust ering Algorit hms, T h e C o m p u t er J o u r n a l , 26 (4) (1983), 354–359.
T r a v e lin g S a le s m a n P r o b le m o f S e g m e n t s ⋆ J inhui Xu, Yang Yang, and Zhiyong Lin Depart ment of Comput er Science and Engineering St at e University of New York at Buff alo Buff alo, NY 14260, USA { jinhui,yyang6,zlin} @cse.buffalo.edu
In t his paper, we present a polynomial t ime approximat ion scheme (P TAS) for a variant of t he t raveling salesman problem (called segm ent T SP ) in which a t raveling salesman t our is sought t o t raverse a set of n ǫ -separat ed segment s in two dimensional space. Our result s are based on a number of geomet ric observat ions and an int erest ing generalizat ion of Arora’ s t echnique [5] for Euclidean T SP (of a set of point s). 4 T he randomized version of our algorit hm t akes O ( n 2 (log n ) ( 1 ) ) t ime t o comput e a (1 + ǫ )-approximat ion wit h probability ≥ 1/ 2, and can be derandomized wit h an addit ional fact or of O ( n 2 ). Our t echnique is likely applicable t o T SP problems of cert ain J ordan arcs and relat ed problems. A b st r a c t .
O
1
/ ǫ
I n t r o d u c t io n
In t his paper, we st udy t he following generalizat ion of t he Euclidean t raveling salesman problem (T SP ), called segm en t T S P problem: Given a set S of n ǫ -separat ed segment s in 2-dimensional space, find a t our t o t raverse all t he segment s such t hat t he t ot al Euclidean dist ance of t his t our is minimized. We assume t hat all t he endpoint s of segment s have int egral coordinat es, t he minimum dist ance between any pair of segment s is at least ǫ , and t he size of t he smallest bounding square of S is O ( n ) (we call such segment s as ǫ -separat ed segment s). T he t our t raverses each input segment complet ely. However, it could ent er and leave a segment mult iple t imes, wit h each t ime visit ing a port ion of t his segment . Since t he Euclidean T SP can be reduced t o t his problem, t he segment T SP is clearly NP -hard. Our st udy on t his problem is mot ivat ed by applicat ions in radiosurgery [9, 29] and laser engraving. Radiosurgery (e.g., st ereot axic radiosurgery [29]) is a minimal-invasive surgical procedure of using a set (as many as 400 [29]) of radiat ion beams t o dest roy t umors. T he beams are oft en originat ed from grid point s in a discret ized beam space and appear consecut ively on a set of ǫ -separat ed segment s (i.e. port ions of t he grid lines). T he t raveling salesman problem (normally defined on a set of nodes) is a classical problem in combinat orial opt imizat ion, and has been st udied ext ensively ⋆
T his research was support ed in part by an IBM faculty part nership award, and an award from NYSTAR (New York st at e offi ce of science, t echnology, and academic research) t hrough MDC (Microelect ronics Design Cent er).
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 40–49, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Traveling Salesman P roblem of Segment s
41
in many diff erent forms [4,5,11,13,19,21,23,25,28]. For non-met ric T SP, most of t he previously known algorit hms are heurist ic, and none of t hem guarant ees a fixed approximat ion rat io for t he general non-met ric T SP problem. For met ric T SP, an early approximat ion algorit hm by Christ ofides [12] showed t hat a 1.5approximat ion algorit hm exist s for any inst ance of t he met ric T SP problem. In [27], Papadimit riou and Yannakakis proved t hat t he general met ric T SP problem is MAX SNP -hard, indicat ing t hat a polynomial t ime approximat ion scheme (P TAS) is unlikely. Bet t er approximat ion algorit hms have been obt ained for special met ric T SP problems. In [16], Grigni, Kout soupias and Papadimit riou showed t hat t he unweight ed planar graph (i.e., every edge has weight one) T SP problem wit h t he short est -pat h met ric has a P TAS. Lat er, Arora et al. [4] gave a P TAS for t he weight ed planar graph T SP problem. A breakt hrough in t he met ric T SP comes from t he discovery of P TAS for t he Euclidean T SP. Arora [5] and Mit chell [23] each independent ly obt ained a P TAS for t his problem. Based on a spanner of t he set of point s, Rao and Smit h [26] lat er gave an improved algorit hm t o Arora’ s algorit hm, which runs in O ( n log n ) t ime. Alt hough each of t he above result s provides powerful t echniques for a number of problems, it seems t hat t hey all have diffi culty t o solve t he segment T SP. T he ma jor obst acle is t he follows. In segment T SP, when performing a recursive part it ion on t he set of segment s, t here could be many segment s or subsegment s inside each (even t he smallest ) subproblem. Furt hermore, t he opt imal t our may ent er or leave each segment (or subsegment ) mult iple t imes and any point on t he segment could be a candidat e of such a point (called en t ry poin t ). T hus a dynamic programming on such a subproblem might t ake exponent ial t ime. Based on a number of int erest ing observat ions, t oget her wit h a generalizat ion of Arora’ s t echnique, we present in t his paper a P TAS for t he segment T SP problem. Due t o space limit , we omit many det ails.
2
P r e lim in a r ie s
Let S = { s 1 , s 2 , · · ·, s n } be a set of n input segment s wit h each segment s i = p i qi represent ed by it s two endpoint s p i and qi . A t raveling salesman t our π of S t raverses each segment in S and t hus cont ains two types of line segment s: input segment s (or subsegment s) and segment s connect ing two input segment s. To dist inguish t hem, we call t he former segm en t s and t he lat t er bridges . T he int ersect ions of segment s and bridges are called en t ry poin t s of π on t he corresponding segment s. T he bounding box B of S is t he smallest square box which covers all segment s in S . A dissect ion of t he bounding box B is a recursive quadt ree decomposit ion T of B such t hat each non-empty leaf square has unit size. A leaf square may cont ain no endpoint at all but only t he int erior of some input segment s. A leaf square is said non-empty if it cont ains some port ion of input segment s.
42
J . Xu, Y. Yang, and Z. Lin
A port al of a square is a prespecified point on t he boundary of t he square such t hat a t raveling salesman t our can deviat e it self t o pass t hrough it . Such deviat ed t our will be called a salesman pat h. An m -regular set of port als is t he set of point s evenly-spaced on each edge and t he corner of t he boundary of a square. A t raveling salesman pat h is ( m , r )-light wit h respect t o t he dissect ion T if it crosses each edge of any square at most r t imes and always at port als. Similar t o t he definit ion of port als on t he boundary of squares, we also define a set of evenly-spaced port als on t he input segment s. A t raveling salesman pat h is ( m , r )-connect ed wit h respect t o t he dissect ion T if t he port ion of each input segment inside a leaf square has m port als and t he t raveling salesman pat h has at most r ent ry point s on t hat port ion of segment wit h each ent ry point coincident wit h a port al. 3
M a in D iffi
c u lt ie s a n d I d e a s
Since our algorit hm for t he segment T SP problem follows t he main st eps of Arora’ s scheme, we first briefly int roduce Arora’ s algorit hm, and t hen point out t he main diffi cult ies encount ered in t he segment T SP and our main ideas for overcoming t hem. For t he Euclidean T SP problem, Arora’ s algorit hm performs t he following main st eps. 1. Pert urb t he set of input point s such t hat t hey are well rounded t o int egral point s and well separat ed. 2. Recursively part it ion t he set of rounded point s and build a randomly shift ed quadt ree such t hat each leaf cont ains at most one rounded point . 3. From bot t om t o t op, use dynamic programming on every node of t he quadt ree t o comput e t he short est bent ( m , r )-light pat h visit ing all t he point s in t hat node, where r = O (1/ ǫ ) and m = O ( logǫ n ). It was shown in [5] t hat t he bent ( m , r )-light pat h is a (1+ ǫ )-approximat ion of t he opt imal pat h wit h probability ≥ 1/ 2, and can be comput ed in O ( n (log n ) O ( 1 / ǫ ) ) t ime. T he success of t he above approach on t he Euclidean T SP relies on several key fact s. 1. T he set of point s can be well separat ed such t hat each leaf node of t he quadt ree cont ains at most one rounded point . 2. An ( m , r )-light pat h can be effi cien t ly comput ed by dynamic programming in each node of t he quadt ree. 3. An opt imal pat h can be “uncrossed” (or pat ched ) at t he boundary of each square of t he quadt ree and t ransformed t o an ( m , r )-light pat h. Unfort unat ely, when t he ob ject s change from point s t o segment s, none of t he above fact s seems t o be t rue. T he main reason is because each leaf square may cont ain many segment s, and each segment may have an unbounded number of
Traveling Salesman P roblem of Segment s
43
ent ry point s, seemingly suggest ing t hat t he dynamic programming may t ake exponent ial t ime. To overcome t hese diffi cult ies, our main ideas are t o int roduce port als on each segment and use t he port als as t he candidat es for ent ry point s.To reduce t he t ot al number of ent ry point s inside each leaf square, we require t he comput ed t raveling salesman pat h t o be ( m , r )-connect ed, t hat is, t he pat h can have at most r ent ry point s on t he port ion of each segment inside a square. Locally, t he ( m , r )-connect ed pat h could be much longer t han t he opt imal solut ion. T hus a ma jor challenge is t o bound t he t ot al increased lengt h by such a rest rict ed pat h. Unlike t he Euclidean T SP problem where t he increased lengt h by an ( m , r )-light pat h can be relat ively easily bounded by count ing t he number of crossings of t he t raveling salesman t our wit h t he dissect ion lines (e.g., t he t ot al increased lengt h is ǫ × # of cr ossi n gs ) which is no more t han O ( O P T ), t he increased lengt h in t he ( m , r )-connect ed pat h however depends on t he t ot al number of ent ry point s of an opt imal T SP t our which seemingly has no connect ion wit h t he value of O P T . By making use of t he propert ies of t he segment s and observat ions on t he behavior of bridges, we prove an int erest ing upper bound on t he t ot al number of ent ry point s in an opt imal solut ion which enables us t o bound t he t ot al increased dist ance by t he ( m , r )-connect ed pat h. Our algorit hm performs t he following main st eps. 1. Perform a dissect ion on t he bounding box B of t he segment s such t hat each non-empty leaf square has a unit size, and t hen make a random (a, b)-shift . 2. Use dynamic programming t o comput e an ( m , r )-light and ( m , r )-connect ed T SP pat h for each non-empty square in t he dissect ion in a bot t om-up manner. Based on a det ailed analysis, we show t he following main t heorem. T h e o re m
1 . G iven a set of n ǫ -separat ed segm en t s on plan e for som e con st an t
0, on e can com pu t e a (1 + ǫ ) -approxim at ion of t he segm en t T S P wit h prob4 abilit y at least 1/ 2 in O ( n 2 (log n ) O ( 1 / ǫ ) ) t im e. ǫ >
4
A lg o r it h m a n d A n a ly s is
As ment ioned in last sect ion, t o solve t he segment T SP problem effi cient ly, we need t o reduce t he complexity of each subproblem associat ed wit h a node in t he quadt ree dissect ion. Since t he high complexity may be due t o eit her t he number of segment s or t he number of ent ry point s. Below we discuss our ideas on each of t hem. T he following lemma shows t hat t he number of segment s in a leaf square is bounded. L e m m a 1 . I n an y leaf squ are Q , t he n u m ber of segm en t s in S in t ersect ed by Q is bou n ded by a con st an t ( i. e. , O (1/ ǫ ) ) , an d each segm en t in t ersect s t wo edges of Q .
44
J . Xu, Y. Yang, and Z. Lin
T hus, our focus is on how t o reduce t he number of ent ry point s. T he following lemma shows some property of an opt imal t our. L e m m a 2 . A n opt im al T S P t ou r does n ot in t ersect it self except at t he en t ry
poin t s.
To reduce t he number of ent ry point s, we int roduce m = O ( logǫ n ) port als on t he port ion of each segment inside a square of t he dissect ion, and rest rict t he T SP t our t o ent er and leave a segment only at it s port als. Based on t he set of port als, we comput e an ( m , r )-connect ed pat h t o approximat e t he opt imal t our. T he following key lemma bounds t he quality of such an approximat ion. ( m , r ) -con n ect ed t ravelin g + (12 + C ) ǫ ) -approxim at ion of t he opt im al
L e m m a 3 . For a set of segm en t s S , t here exist s an
salesm an pat h which is a (1 + 3C 0 solu t ion .
√
ǫ
To prove t his lemma, we need several ot her lemmas on t he opt imal T SP t our. We first st udy t he behavior of bridges in an opt imal t our. We call two bridges which share t he same ent ry point e on a segment s as a t wo-part -bridge . If t he two part s are in diff erent sides of s , t hen t he two-part bridge, say b, is called a bi-bridge , e a bi-ent ry, and s a bi-segment of b. If t he two part s of b are in t he same side of s , t hen we call b as a V -bridge (see Figure 1), e as a V -ent ry, and s as a V -segment . T he two part s of a V -bridge b may also int ersect wit h some ot her segment , say s ′ , and form an A -like shape (see Figure 1). We call s ′ as an A-segment of b. In a square Q , if a V -bridge b has an A -segment in Q , t hen b is called a shared V -bridge in Q , ot herwise an u n shared V -bridge in Q . L e m m a 4 . I n an opt im al T S P t ou r π , a bi-bridge b eit her has it s en t ry poin t coin ciden t wit h an en dpoin t of t he segm en t s or it s t wo part s are collin ear ( i. e. , on a st raight lin e) . C o r o l l a r y 1 . I n an opt im al t ou r, all bridges are align ed alon g a set of in t erior-
disjoin t lin e segm en t s whose en dpoin t s are eit her V -en t ries or en dpoin t s of in pu t segm en t s. L e m m a 5 . L et s 1 an d s 2 be an y pair of segm en t s in S which are con n ect ed by a bridge in an opt im al t ou r π . T hen t here is n o V -bridge in π which in t ersect s s 1 an d s 2 con secu t ively an d has on e of t hem as it s V -segm en t .
To bound t he number of ent ry point s inside a leaf square Q , we classify all t he segment s in Q int o classes based on t he pair of int ersect ed edges (of Q ). (Not e t hat by Lemma 1, each segment in Q int ersect s two edges.) Since all segment s are disjoint , t here are no more t han 5 classes (see Figure 1). In each class C , we call t he first and last segment s (along t he int ersect ed edges) as bounding segment s. L e m m a 6 . I n an opt im al t ou r π , an y segm en t s in a leaf squ are Q in t ersect s at m ost 6 shared V -bridges in Q .
Traveling Salesman P roblem of Segment s
45
Q s
Illust rat ing t he proof of Lemma 6. F ig. 1 .
F ig. 2 .
Illust rat ing t he proof of Lemma 7.
C o r o l l a r y 2 . L et Q be a leaf squ are in t ersect in g k segm en t s of S , an d π
be an opt im al t ou r of S . T hen t he t ot al n u m ber en t ry poin t s produ ced by all shared V -bridges in Q is at m ost 12k . L e m m a 7 . L et Q be a leaf squ are con t ain in g k segm en t s. I n an opt im al t ou r π , all u n shared V -bridges in Q produ ce in t ot al O ( k ) en t ry poin t s in Q .
T he above lemmas about V-bridges suggest t hat t o reduce t he t ot al number of ent ry point s inside a leaf square, we should focus on reducing t hose ent ry point s generat ed by bi-bridges. L e m m a 8 . L et Q be a leaf squ are con t ain in g k segm en t s. T hen t he t ot al len gt h
of all bridges in an opt im al T S P t ou r π
in side Q is bou n ded by a con st an t C 0 .
P roof. Sket ch of t he proof: Our main idea for proving t his lemma is t o first
remove Q and all it s cont ained segment s and bridges. We t hen build an Euler graph along t he out side boundary of Q such t hat t he st ruct ure of π out side Q is preserved and all segment s cont ained in Q are at t ached t o t he out side st ruct ure. T he t ot al lengt h of t he added edges for building up t he Euler graph is no more t han a const ant (e.g., 24). Since t he Euler graph provide an T SP t our t o t he set of segment s, t hus should have larger t ot al lengt h t han π , which implies t hat t he t ot al lengt h of all bridges in Q is less t han 24. In a leaf square, a bi-bridge eit her t ouches t he opposit e sides or t he neighboring sides. T he following two lemmas help us t o bound t he ent ry point s generat ed by bi-bridges. L e m m a 9 . I n a leaf squ are Q con t ain in g k segm en t s, t here are at m ost C 0 bi-bridges t ou chin g t he opposit e edges of Q ( S ee F igu re 3) .
For a bi-bridge b t ouching t he neighboring sides e and e′ , we say segment s and s ′ int ersect ed by b are t he surface segment s if t hey are t he fart hest pair of segment s (along b) in Q . We define t he su rface dist an ce of b as t he dist ance between it s corresponding surface segment s along b. Let δ be t he minimum surface dist ance among all bi-bridges int ersect ing e and e′ . Not e t hat t o bound t he ent ry point s generat ed by bi-bridges, we can ignore t hose bi-bridges which int ersect only one segment in Q as t heir generat ed ent ry
46
J . Xu, Y. Yang, and Z. Lin δ’
a2
e’ b2
δ
segment
e a
a1
b1 segment
b1 bi bridge
b
bj
bi−bridge
bb
T he number of bi-bridges t ouching opposit e sides of Q is a const ant . F ig. 3 .
T he maximum dist ance (along or e ′ ) between two neighboring bibridges is ≥ δ . F ig. 4 . e
point s can be bounded by t he t ot al number of crossings between grid lines and t he bridges, t hus can be handled in a way similar t o t he one used for ( m , r )-light pat h in t he Euclidean T SP problem [5]. T hus we can assume t hat δ ≥ ǫ . L e m m a 1 0 . L et Q , e, e′
an d δ be defi n ed as above. For t wo n eighborin g bibridges a an d b in t ersect in g e an d e′ , t heir m axim u m dist an ce ( alon g e or e′ ) δ ′ is ≥ δ . P roof. Sket ch of t he proof: Consider Figure 4. If δ ′ < δ , we can modify t he
opt imal t our in t he following way t o obt ain a short er t our. Draw a 2 b2 parallel t o e′ . Similarly, draw segment b1 a 1 parallel t o e′ , and delet e bridge a 1 a 2 and b1 b2 . Since δ ′ ≥ a 2 a b2 ≥ b1 a 1 , and a 1 a 2 ≥ δ , b1 b2 ≥ δ , t he new t our induced by such a modificat ion is short er t han opt imal t our. A cont radict ion. L e m m a 1 1 . I n a leaf squ are Q , t he n u m ber of bi-bridges in t ersect in g t wo n eigh-
bou rin g edges of Q is O (
1/ ǫ ) .
L e m m a 1 2 . G iven a set S of ǫ -separat ed segm en t s, t here exist s an opt im al T S P t ou r π su ch t hat E ( π , S ) = O (( 1/ ǫ + C ′ ) | O P T | ) , where E ( π , S ) is t he n u m ber of en t ry poin t s of π an d C ′ is a con st an t .
Now, we are ready t o prove Lemma 3. P roof. If an ( m , r )-connect ed T SP pat h is used t o approximat e t he opt imal T SP
t our π , t he increased cost comes from eit her moving t he ent ry point s t o t heir closest port als or reducing t he number of ent ry point s on segment s which cont ain more t han r ent ry point s. By t he proof of Lemma 12, t he number of ent ry point s on each segment in a leaf square is O ( 1/ ǫ + C ′ ) which is bounded by O ( r ). T hus t he t ot al increased cost is mainly due t o changing locat ions from ent ry √
point s t o port als, which is ǫ E ( π , S ) = ǫ ( 4 Cǫ 0 + C ′ ) | OP T | ≤ (3C 0 ǫ + (12 + C ) ǫ ) | OP T | . √ T herefore t his ( m , r )-connect ed T SP pat h is a (1 + 3C 0 ǫ + (12 + C ) ǫ )approximat ion of t he opt imal T SP t our. For t he bot t om-up dynamic programming, we are able t o prove an int erest ing “pat ching” lemma for ent ry point s and est ablish t he main result in T heorem 1.
Traveling Salesman P roblem of Segment s
47
L e m m a 1 3 . For a segm en t s of len gt h l an d con t ain in g m ore t han 3 en t ry poin t s from a T S P t ou r π , t here exist s a con st an t g an d a set of segm en t s on s whose t ot al len gt h is at m ost g × l an d whose addit ion t o π chan ges it in t o an ot her T S P t ou r which has t wo en t ry poin t s on s .
Based on Lemma 13, we can show t hat t here exist s a procedure t o change an opt imal T SP t our π and make each segment t o be ( m , r )-connect ed. Furt her, if we charge t he increased cost t o t he corresponding segment , t he following lemma holds. L e m m a 1 4 . T he expect ed cost for dy n am ic program m in g charged t o a segm en t
s can be bou n ded by ǫ × E ( π , s ) , where E ( π , s ) is t he n u m ber of en t ry poin t s on S in t he u n chan ged π .
Aft er proving all t he lemmas, we are ready t o prove our t heorem. P roof. First , let us analyze t he running t ime of our algorit hm. Our algorit hm
begins wit h randomly ( a , b)-shift ed dissect ion which t akes O ( n 2 log n ) t ime. T he t ime complexity of t his st ep is act ually equal t o t he number of nodes in t he dissect ion t ree T . Since in t he dissect ion we may have n 2 non-empty leaf squares, 2 | T | is t hus O ( n log n ). Next , our algorit hm performs a dynamic programming t o comput er t he T SP t our. It begins from leaf squares, and t hen bot t oms up t o t he ent ire bounding box of t he set of segment s. T he running t ime required depends on t he number of lookup t able ent ries. Observe t hat for each square in t he quadt ree, on each boundary edge we have m port als and use at most r of t hem. Moreover we have m port als on each segment in a leaf square and use at most r ent ry point s on t his segment . T hus we define t he ( m , r ) -m u lt ipat h problem as follows. T he input of t his problem is: 1. A square in t he shift ed quadt ree. 2. A mult iset of ≤ r port als on each of t he four edges of t his square such t hat t he sum of t he sizes of t hese mult iset s is an even number 2p ≤ 4r . 3. A mult iset of ≤ r ent ry point s on each of t he k segment s in t his square such t hat each ent ry point is on one of t he p pat hs. 4. A pairing { a 1 , a 2 } , { a 3 , a 4 } , . . . between t he 2p port als. By t his observat ion, we know t hat t he number of ent ries in t he lookup t able is t he number of diff erent inst ances of t he ( m , r )-mult ipat h problem in t he shift ed quadt ree. Let k be t he number of bridges in a leaf square. It is easy t o see t hat in a quadt ree wit h T squares, t his number is O ( T ( m + 4) 4 r ( m + 2) k r (4r + 2k r )!). In t he bot t om up procedure, suppose all t he nodes wit h dept h > i have been solved. Now we have a square S at dept h i which is t he parent of four squares S 1 , S 2 , S 3 and S 4 at dept h i + 1. T he algorit hm enumerat es all t he possible combinat ions of port als on t he inner edges of t he children squares. T he number of combinat ions is O (( m + 4) 4 r (4r ) 4 r (4r )!). T hus t he running t ime of our algorit hm is O ( T ( m + 4) 8 r ( m + 2) k r (4r ) 4 r ((4r )!) 2 2 (4r + 2k r )!), which is O ( n 2 (log n ) O ( 1 / ǫ ) ) if we t ake r = 18g/ ǫ + 4 and m = 36g log L / ǫ ( L = O ( n )).
48
J . Xu, Y. Yang, and Z. Lin
Suppose t he opt imal t our has lengt h | OP T | .√ While we force t he t our t o be ( m , r )-connect ed, t his will increase a cost of (3C 0 ǫ + (12+ C ) ǫ ) | OP T | by Lemma 3. T he MODIFY procedure for segment s and square edges will increase a cost of √ ǫ · E ( π , S ) ≤ 2C 0 ǫ + ( C 0 + 12 + C ) ǫ | OP T | by Lemma 14 and Lemma 12. To force t he t our t o be ( m , r )-light , we int roduce a cost of ǫ | OP T | / 2 (refer t o [5]). √ √ So t ot ally t he increased cost is ≤ (5C 0 ǫ + ( C 0 + 25+ 2C ) ǫ ) | OP T | ≤ C ′ ′ ǫ | OP T | 2 √ ǫ where C ′ ′ = 6C 0 + 25 + 2C . Let ǫ 0 = C ′ ′ ǫ , equally we get ǫ = ( C ′ 0′ ) 2 . T herefore we got a (1 + ǫ 0 )-approximat ion t our wit h running t ime of ′ ′ 4 4 4 O ( n 2 (log n ) O ( ( C ) / ǫ 0 ) ) = O ( n 2 (log n ) O ( 1 / ǫ 0 ) ) . R e fe r e n c e s 1. E. M. Arkin, Y.-J . Chiang, J . S. B. Mit chell, S. S. Skiena, and T . Yang. On t he maximum scat t er T SP, P roc. 8t h A CM -SI A M Sym pos. D i scret e A lgor i t hm s, pp. 211–220, 1997. 2. E. M. Arkin and R. Hassin, Approximat ion algorit hms for t he geomet ric covering salesman problem, D i scret e A ppl. M at h. , 55:197–218, 1994. 3. E. M. Arkin, J . S. B. Mit chell, and G. Narasimhan, Resource-const rained geomet ric network opt imizat ion, P roc. 14t h A nnu. A CM Sym pos. Com put . G eom . , pp. 419– 428, 1998. 4. S. Arora, M. Grigni, D. Karger, P. Klein, and A. Woloszyn, P olynomial T ime Approximat ion Scheme for Weight ed P lanar Graph T SP, P roc. 9t h A nnual A CM SI A M Sym posi um on D i scret e A lgor i t hm s ( SOD A ) , pp. 33–41, 1998. 5. S. Arora, P olynomial-t ime Approximat ion Schemes for Euclidean T SP and ot her Geomet ric P roblems, Jour nal of t he A CM , 45(5) pp. 753–782, 1998. 6. B. Awerbuch, Y. Azar, A. Blum, and S. Vempala, Improved approximat ion guarant ees for minimum-weight k -t rees and prize-collect ing salesman, P roc. 27t h A nnu. A CM Sym pos. T heor y Com put . , pp. 277–283,1995. 7. A. Blum, P.Chalasani, D. Coppersmit h, B. P ulleyblank, P. Raghavan, and M. Sudan, T he minimum lat ency problem, P roc. 26t h A nnu. A CM Sym pos. T heor y Com put . ( ST OC 94) , pp. 16 8. S. Carlsson, H. J onsson, and B. J . Nilsson, Approximat ing t he short est wat chman rout e in a simple polygon. Manuscript , Dept . Comput . Sci., Lund Univ., Lund, Sweden, 1997. 9. D.Z. Chen, O. Daescu, X. Hu, X. Wu, and J . Xu, Det ermining an Opt imal P enet rat ion among Weight ed Regions in 2 and 3 Dimensions, SCG’ 99, pp. 322–331. 10. X. Cheng, J . Kim, and B. Lu, A P olynomial T ime Approx. Scheme for t he problem of Int erconnect ing Highways, J. of Com bi n. Opt i m ., Vol.5(3), pp. 327–343, 2001. 11. J .L. Bent ley, Fast Algorit hms for Geomet ric Traveling Salesman P roblems, OR SA J. Com put . , 4(4):387–411, 1992. 12. N. Christ ofides, Worst -case analysis of a new heurist ic for t he t raveling salesman problem, In J .F . Traub, edit or, Sym posi um on N ew D i rect i ons and Recent Result s i n A lgor i t hm s and Com plexi t y , Academic P ress, NY, pp. 441, 1976. 13. A. Dumit rescu and J .S.B. Mit chell, Approximat ion algorit hms for T SP wit h neighborhoods in t he plane, P roc. 12t h A CM -SI A M Sym pos. D i scret e A lgor i t hm s ( SOD A ’ 2001), pp. 38–46, 2001. 14. N. Garg, A 3-approximat ion for t he minimum t ree spanning k vert ices, 37t h A nnual Sym posi um on Foundat i ons of Com put er Sci ence, pp. 302–309, Burlingt on, Vermont , Oct ober 14–16 1996.
Traveling Salesman P roblem of Segment s
49
15. M. X. Goemans and J . M. Kleinberg, An improved approximat ion rat io for t he minimum lat ency problem, P roc. 7t h A CM -SI A M Sym pos. D i scret e A lgor i t hm s ( SOD A ’ 96), pp. 152–158, 1996. 16. M. Grigni, E. Kout soupias, and C.H. P apadimit riou, An Approximat ion Scheme for P lanar Graph T SP, P roc. I E E E Sym posi um on Foundat i ons of Com put er Sci ence, pp. 640–645, 1995. 17. J . Gudmundsson and C. Levcopoulos, A fast approxmat ion algorit hm for T SP wit h neighborhoods. Technical Report LU-CS-T R:97–195, Dept . of Comp. Sci., Lund University, 1997. 18. R. Hassin and S. Rubinst ein, An approximat ion algorit hm for t he maximum t raveling salesman problem. Manuscript , submit t ed, Tel Aviv University, Tel Aviv, Israel, 1997. 19. M. J u¨ nger, G. Reinelt , adn G. Rinaldi, T he Traveling Salesman P roblem. In M. O. Ball, T .L. Magnant i, C. L. Monma, and G. L. Nemhauser, edit ors, N et wor k M odels, Handbook of Operat ions Research/ Management Science, Elsevier Science, Amst erdam, pp. 225–330, 1995. 20. S. Kosara ju, J . P ark, and C. St ein, Long t ours and short superst rings, P roc. 35t h A nnu. I E E E Sym pos. Found. Com put . Sci . ( F OCS 94) , 1994. 21. E.L. Lawler, J .K. Lenst ra, A.H.G. Rinnooy Kan, and D.B. Shmoys, edit ors. T he T raveli ng Salesm an P roblem , W iley, New York, NY, 1985. 22. C. Mat a and J . S. B. Mit chell, Approximat ion algorit hms for geomet ric t our and network design problems, P roc. 11t h A nnu. A CM Sym pos. Com put . G eom . , pages 360–369, 1995. 23. J .S.B. Mit chell, Guillot ine Subdivisions Approximat e P olygonal Subdivisions: P art II – A simple polynomial-t ime approximat ion scheme for geomet ric T SP, k-MST , and relat ed problems, SI A M J. Com put i ng, Vol.28, No. 4, pp. 1298–1309, 1999. 24. J .S.B. Mit chell, Guillot ine Subdivisions Approximat e P olygonal Subdivisions: P art III – Fast er P olynomial-t ime Approximat ion Schemes for Geomet ric Network Opt imizat ion, Manuscript , April 1997. 25. J .S.B. Mit chell, Geomet ric Short est P at hs and Network Opt imizat ion, chapt er in H andbook of Com put at i onal G eom et r y , Elsevier Science, (J .-R. Sack and J . Urrut ia, eds.), 2000. 26. S.B. Rao, and W .D. Smit h, Improved Approximat ion Schemes for Geomet rical Graphs via “spanners” and “banyans” P roc. 30t h A nnu. A CM Sym pos. T heor y Com put ., May 1998. 27. C.H. P apadimit riou and M. Yannakakis, T he Traveling Salesman P roblem wit h Dist ances One and T wo, M at hem at i cs of Operat i ons Research, Vol. 18, pp. 1–11, 1993. 28. G. Reinelt , Fast Heurist ics for Large Geomet ric Traveling Salesman P roblems, OR SA J. Com put . , 4:206–217, 1992. 29. A. Schweikard, J .R. Adler, and J .C. Lat ombe, Mot ion P lanning in St ereot axic Radiosurgery, I E E E T rans. on Robot i cs and A ut om at i on , Vol. 9, No. 6, pp. 764– 774, 1993. 30. X. Tan, T . Hirat a, and Y. Inagaki, Corrigendum t o ‘ An increment al algorit hm for const ruct ing short est wat chman rout es’ . Manuscript (su bmit t ed t o int ernat .j.comput .geom.appl.), Tokai University, J apan, 1998.
S u b e x p o n e n t ia l- T im e A lg o rit h m s fo r M a x im u m I n d e p e n d e n t S e t a n d R e la t e d P ro b le m s o n B o x G ra p h s ⋆ Andrzej Lingas and Mart in Wahlen Depart ment of Comput er Science, Lund University, Box 118, S-22100 Lund, Sweden { Andrzej.Lingas,martin} @cs.lth.se
A box graph is t he int ersect ion graph of ort hogonal rect angles in t he plane. We consider such basic combinat orial problems on box graphs as maximum independent set , minimum vert ex cover and maximum induced subgraph wit h polynomial-t ime t est able heredit ary property Π . We show t hat t hey can be exact ly solved in subexponent ial √ t ime, more precisely, in t ime 2O ( n l o g n ) , by applying Miller’ s simple cycle planar separat or t heorem [6] (in spit e of t he fact t hat t he input box graph might be st rongly non-planar). Furt hermore we ext end our idea t o include t he int ersect ion graphs of ort hogonal d -cubes of bounded aspect rat io and dimension. We present an algorit hm t hat solves maximum independent set and t he ot her afore1− 1 lo g n ) ment ioned problems in t ime 2O ( d 2 b n on such box graphs in d -dimensions. We do t his by applying a separat or t heorem by Smit h and Wormald [7]. F inally, we show t hat in general graph case subst ant ially subexponent ial algorit hms for maximum independent set and t he maximum induced subgraph wit h polynomial-t ime t est able heredit ary property Π problems can yield non-t rivial upper bounds on approximat ion fact ors achievable in polynomial t ime. A b st r a c t .
d
1
/ d
I n t ro d u c t io n
In [5] it was shown t hat t he exist ence of a sub exp onent ial algorit hm for Indep endent Set would imply t he exist ence of sub exp onent ial algorit hms for SAT , Colorabilit y, Set Cover, Clique, Vert ex Cover and any ot her search problems expressible by second order exist ent ial formulas whose first order part is universal. Moreover, as we observe in Sect ion 3 of t his pap er, proving subst ant ially sub exp onent ial upp er t ime b ounds for maximum indep endent set , or equivalent ly maximum clique or minimum vert ex cover 1 and generally for maximum induced subgraph wit h p olynomial-t ime t est able heredit ary prop ert y Π problems could ⋆
1
T his work is in part support ed by VR grant 621-2002-4049 Recall t hat minimum vert ex cover is always complement of maximum independent set .
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 50–56, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Subexponent ial-T ime Algorit hms for Maximum Independent Set
51
lead t o b et t er approximat ion fact ors achievable for maximum indep endent set and t he maximum induced subgraph wit h heredit ary prop ert y Π problems in p olynomial t ime. T his however seems very diffi cult or unlikely. For inst ance, t he 2 O ( n / log n ) approximat ion fact or for maximum indep endent set has not b een improved for more t han decade [3]. T his kind of evidence of t he diffi cult y of deriving sub exp onent ial algorit hms, e.g., for maximum indep endent set , does not necessarily exist in case of sp ecial graph classes for which relat ively good approximat ion algorit hms for maximum indep endent set running in p olynomial t ime are known. In t his pap er we st udy maximum indep endent set , minimum vert ex cover and maximum induced subgraph wit h p olynomial-t ime t est able heredit ary prop ert y Π problems on t he so called b ox graphs which are t he int ersect ion graphs of ort hogonal rect angles in t he plane (e.g., t he problem of maximum indep endent set on b ox graphs is known t o admit an O (log n )-approximat ion p olynomial-t ime algorit hm [1]). We show t hat t he aforement ioned problems can b e exact ly solved √ in sub exp onent ial t ime, more precisely, in t ime 2O ( n log n ) , by applying Miller’ s simple cycle planar separat or t heorem [6]. O u r a p p lica t io n o f t h e p la n a r sepa ra t o r t h eo rem seem s h igh ly n o n -st a n d a rd sin ce it relies ra t h er o n t h e st r u ct u re o f u n kn o w n o p t im a l so lu t io n s, i. e. , m a x im u m ca rd in a lit y su bset s o f d isjo in t rect a n gles, t h a n t h e st r u ct u re o f t h e in p u t bo x gra p h w h ich m igh t be st ro n gly n o n -p la n a r !
Furt hermore we ext end our idea t o include t he int ersect ion graphs of ort hogonal d -cub es of b ounded asp ect rat io and dimension. We present an algorit hm t hat solves maximum indep endent set and t he relat ed problems in t ime 1− 1 log n ) 2O ( d 2 b n on such b ox graphs in d -dimensions. We do t his by applying a separat or t heorem by Smit h and Wormald [7] in a similar fashion. T he st ruct ure of our pap er is as follows. In Sect ion 2, we present and analyze t he aforement ioned sub exp onent ial algorit hms for maximum indep endent set and t he relat ed problems on b ox graphs in t wo and d dimensions. In Sect ion 3, we observe t hat for general graphs subst ant ially sub exp onent ial algorit hms for maximum indep endent set and t he maximum induced subgraph wit h p olynomial-t ime t est able heredit ary prop ert y Π problems can yield non-t rivial upp er b ounds on approximat ion fact ors achievable in p olynomial t ime d
2
/ d
S u b e x p o n e n t ia l A lg o rit h m s
To b egin wit h, we need t he following lemma showing t hat we may assume w.l.o.g t he rect angles defining a b ox graph t o b e placed on a small int eger grid. L e m m a 1 . L et S be a set o f n o r t h ogo n a l rect a n gles in t h e p la n e. I n t im e O (n
log n ) , S ca n be o n e-t o -o n e t ra n sfo r m ed in t o a set U o f o r t h ogo n a l rect a n gles o n a n in t eger O ( n ) × O ( n ) gr id su ch t h a t t w o rect a n gles in S o ver la p iff t h eir im a ges in U o ver la p . P roo f. Draw t hrough each edge of each rect angle in S co-linear line. Sort t he result ing vert ical lines by t heir X -coordinat es as well as t he result ing horizont al
52
A. Lingas and M. Wahlen
lines by t heir Y -coordinat es. Move t he vert ical lines horizont ally so t he dist ance b et ween t wo consecut ive lines b ecomes 1. Analogously, move t he horizont al lines vert ically. in order t o obt ain an O ( n ) × O ( n ) int eger grid. T he aforement ioned line movement s t ransform rect angles in S int o rect angles on t he grid preserving overlaps. T he following lemma is crucial in t he design of our sub exp onent ial algorit hm for maximum indep endent set and relat ed problems. It makes use of Miller’ s simple cycle planar separat or t heorem [6]. L e m m a 2 . L et R be a set o f k ≤ n n o n -o ver la p p in g o r t h ogo n a l rect a n gles o n a n √in t eger O ( n ) × O ( n ) gr id . T h ere is a st ra igh t -lin e cy cle, co m po sed o f a t m o st O ( k ) segm en t s ly in g o n t h e gr id w h ich d oes n o t p ro per ly in t er sect a n y rect a n gle √ in R a n d sp lit s it in t o t w o su bset s, ea ch h a vin g a t m o st 32 k + O ( k ) rect a n gles.
P roo f. We const ruct a biconnect ed plane st raight -line graph G on t he grid including t he vert ices of t he rect angles in R as follows. Let b b e t he minimum size rect angle on t he grid t hat includes all rect angles in R . T he corners of b b ecome also vert ices of G . For each vert ex v of a rect angle in R we draw a vert ical line up t o t he first int ersect ion wit h anot her rect angle in R or b. At t he p oint of t he int ersect ion, we creat e a new vert ex of G . Symmet rically, we draw a vert ical line down t o t he first int ersect ion wit h a rect angle in R or b, creat ing a new vert ex of G at t he p oint of t he int ersect ion. Next , from each left vert ex of a rect angle in R we draw a horizont al line t o t he left up t o t he first int ersect ion wit h anot her rect angle in R , b, or a drawn vert ical line, creat ing a new vert ex of G at t he int ersect ion. Symmet rically we proceed wit h right vert ices of rect angles in R . T wo vert ices in G are adjacent iff t hey are connect ed by a fragment of t he p erimet er of a rect angle in R ∪ { b} or one of t he drawn lines free from ot her vert ices. It is clear t hat G is biconnect ed, has O ( k ) vert ices and all it s faces are rect angular. Let us assign t he weight 41k t o each vert ex of rect angle in R and t he weight 0 t o all remaining vert ices in G . By Miller’ s simple cycle planar separat or t heorem √ [6], t here is a simple cycle in G on O ( k ) vert ices which separat es t he vert ices of rect angles in R int o t wo part s, each cont aining at most 23 4k vert ices. Since t he simple cycle is comp osed of edges in G , it does not cross any rect angle in R . Hence, t he simple cycle separat es t he rect angles in R , p√ossibly t ouching some of t hem, int o t wo part s, each cont aining at most 32 k + O ( k ) rect angles.
Supp ose t hat R is a maximum cardinalit y set of k non-overlapping rect angles in and t hat we can guess t he separat ing cycle for R sp ecified in Lemma 2. T hen, we can det ermine t he rect angles in S wit hin t he cycle and t hose out side, and recursively find maximum indep endent set for each of t hese t wo set s t o out put t heir union. In t he recursive calls, t he size of t he grid can b e easily t rimmed down t o O ( m ) × O ( m ) where m is t he numb er of input rect angles. Inst ead of guessing such a separat ing cycle, we can enumerat e such simple cy√ cles by considering all p ermut at ions of O ( k )-element subset s of t he grid p oint s √ k ( log n + log k ) ) O ( and t est ing whet her t hey yield simple cycles. It t akes t ime 2 as √ O (n )2 t he numb er of t he subset s and t heir p ermut at ions is O ( √ k ) O ( k )! and t he t est s S
Subexponent ial-T ime Algorit hms for Maximum Independent Set
53
can b e done easily in p olynomial t ime. Next , we run recursively our procedure for all of t he enumerat ed cycles. Among t he pairs of opt imal solut ions for t he t wo subproblems induced by each of t he cycles, we choose t hat yielding t he largest cardinalit y union. T he recursion dept h is O (log k ). At it s b ot t om, we have subproblems of picking a const ant numb er of pairwise disjoint rect angles t hat can b e solved in √ p olynomial t ime. Not e t hat 23 k + O ( k ) ≤ 34 k for suffi cient ly large k . T herefore, a subproblem can b e generally describ ed by √O (log k ) fragment s of b ounding ( 34 ) i k = O ( k ) . Hence, t he t ot al numb er of cycles of t ot al lengt h O i = 1 √ √ √ subproblems is O ( √k k ) O ( k )! OO ( (logk k) ) , i.e., 2O ( k log k ) and a single subproblem √
can b e solved on t he basis of t he smaller ones in t ime 2O
(
k
( log
n
+ log k ) )
.
T h e o r e m 1 . L et S be a set o f n o r t h ogo n a l rect a n gles in t h e p la n e. A m a x im u m
ca rd in a lit√ y su bset o f S co m po sed o f n o n -o ver la p p in g rect a n gles ca n be fo u n d in t im e 2O ( n log n ) . C o r o l l a r y 1 . L et G be a bo x gra p h o n n ver t ices. G iven a bo x rep resen t a t io n
o f G , a m a x im u m √ in d epen d en t set a n d t h u s m in im u m ver t ex co ver o f G ca n be fo u n d in t im e 2O ( n log n ) .
To find an f -approximat ion of a maximum indep endent set in t he b ox graph we can run our met hod st art ing from a hyp ot het ical set of disjoint rect angles of size at most ⌈ n / f ⌉ . Hence, we easily obt ain t he following generalizat ion of Corollary 1. G,
C o r o l l a r y 2 . L et G be a bo x gra p h o n n ver t ices. G iven a bo x rep resen t a t io n
o f G , a n √ f -a p p ro x im a t io n o f a m a x im u m in d epen d en t set o f G ca n be fo u n d in (
t im e 2O
n / f
log
n
)
.
We can part ly generalize T heorem 1 and Corollary 1 t o higher dimensions by ut ilizing t he following fact proved in [7]. F a c t 1 . G iven n in t er io r -d isjo in t o r t h ogo n a l d -cu bes, o f a spect ra t io bo u n d ed by d
≤ 2 n / 3 d -cu bes’ in t er io r s a re en t irely in sid e it , ≤ 2n / 3 d -cu bes’ in t er io r s a re en t irely o u t sid e, a n d ≤ (4 + 1− 1/ d o (1)) bn a re pa r t ly in sid e a n d pa r t ly o u t sid e.
b, in R , t h ere ex ist s a n o r t h ogo n a l d -cu be su ch t h a t
By enlarging t he b oundary of t he separat ing d -cub e by t he b oundaries of t he cub es int ersect ed by it on it s out side, we immediat ely obt ain t he following corollary from Fact 1. C o r o l l a r y 3 . G iven n in t er io r -d isjo in t o r t h ogo n a l d -cu bes, o f a spect ra t io bo u n d ed by b, in R d , t h ere ex ist s a n o r t h ogo n a l d -so lid w it h (4 + o (1))2d n 1 − 1 / d ver t ices su ch t h a t ≤ 2n / 3+ (4+ o (1)) bn 1 − 1 / d d -cu bes’ in t er io r s a re en t irely in sid e it a n d ≤ 2n / 3 d -cu bes’ in t er io r s a re en t irely o u t sid e it , a n d ea ch o f t h e d -cu bes h a s it s in t er io r eit h er in sid e o r o u t sid e t h e so lid .
T he b oundary of t he separat ing, ort hogonal d -solid can b e describ ed by (2d bn 1 − 1 / d ) vert ices and O ( d 2d bn 1 − 1 / d ) edges. By a st raight forward generalizat ion of Lemma 1.1 t o include d -dimensional b oxes, we may assume wit hout
O
54
A. Lingas and M. Wahlen
loss of generalit y t hat t he d -cub es and t he solid are placed on an int eger grid of size O ( n ) d . T hus, we can enumerat e t he b oundaries of such separat ing solids 1− 1 ) ) d 1− 1/ d d O (2 bn ) ) . T he second t erm upp er in t ime O ( 2 bnn 1 − 1 ) × O ( 2 b n d d
d
/ d
d
/ d
d
b ounds t he numb er of ways of choosing vert ex neighb ors for t he O (2d n 1 − 1 / d ) d ) vert ices. By st raight forward calculat ions, t he enumerat ion t ime and t hus t he numb er of t he b oundaries of such separat ing solids are b ounded from ab ove 1− 1 log n ) by O (2O ( d 2 b n ) . Now, we can part ly generalize t he procedure from t he proof of T heorem 1 t o d -dimensions, plugging in Corollary 3 inst ead of Lemma 2, t o obt ain t he following t heorem by st raight forward calculat ions. d
/ d
T h e o r e m 2 . L et S be a set o f n o r t h ogo n a l d -cu bes o f a spect ra t io bo u n d ed by b, in R d . A m a x im u m ca rd in a lit y su bset o f S co m po sed o f n o n -o ver la p p in g d -cu bes
ca n be fo u n d in t im e 2O
( d 2d
bn
1− 1/
d
log
n
)
.
C o r o l l a r y 4 . L et G be a bo x gra p h o n n ver t ices in d -d im en sio n s. G iven a d -d im en sio n a l bo x rep resen t a t io n o f G , w h ere ea ch d -cu be h a s a n a spect ra t io
bo u n d ed by b, a m a x im u m in d epen d en t set a n d t h u s a m in im u m ver t ex co ver o f G ca n be fo u n d in t im e
2O
( d 2d
bn
1− 1/
d
log
n
)
.
Corollaries 1, 2, 4 can b e immediat ely generalized t o include t he problem of . T he lat t er problem is t o find a maximum cardinalit y subset of vert ices of t he input graph which induces a subgraph having t he prop ert y Π . If t he prop ert y Π holds for all induced subgraphs of a graph whenever it holds for t he graph t hen we call it h ered it a r y . Next , we call Π po ly n o m ia l-t im e t est a ble if one can det ermine in p olynomial t ime if it holds for a graph. If Π holds for arbit rarily large graphs, does not hold for all graphs, and is heredit ary t hen t he problem is NP -complet e (cp. G T 21 in [4]). E xamples of such prop ert ies Π are “b eing an indep endent set ”, “b eing bipart it e”, “b eing a forest ”, “b eing a planar graph”. T he following t heorem is a generalizat ion of not only Corollary 2 but also of Corollary 1 since an f -approximat ion for f = 1 means an exact solut ion. We leave it s proof which is a st raight forward generalizat ion of t hat of Corollaries 1, 2 t o t he reader. m a x im u m in d u ced su bgra p h w it h po ly n o m ia l-t im e t est a ble h ered it a r y p ro per t y Π
T h e o r e m 3 . L et G be a bo x gra p h o n n ver t ices. G iven a bo x rep resen t a t io n o f G , a n f -a p p ro x im a t io n o f a m a x im u m in d u ced su bgra p h o f G w it h po ly n o m ia l√
t im e t est a ble h ered it a r y p ro per t y Π
ca n be fo u n d in t im e 2O
(
n / f
log
n
)
.
T he proof t he consecut ive t heorem is in t urn a st raight forward generalizat ion of t hat of Corollary 4. T h e o r e m 4 . L et G be a bo x gra p h o n n ver t ices in d -d im en sio n s. G iven a d -d im en sio n a l bo x rep resen t a t io n o f G , w h ere ea ch d -cu be h a s a n a spect ra -
t io bo u n d ed by b, a n ex a ct so lu t io n t o a m a x im u m in d u ced su bgra p h w it h po ly n o m ia l-t im e t est a ble h ered it a r y p ro per t y Π p ro blem ca n be fo u n d in t im e
2O
( d 2d
bn
1− 1/
d
log
n
)
.
Subexponent ial-T ime Algorit hms for Maximum Independent Set
3
55
S u b e x p o n e n t ia l A lg o rit h m s v e rs u s A p p ro x im a t io n A lg o rit h m s
Algorit hms of subst ant ially sub exp onent ial t ime complexit y can yield non-t rivial approximat ion algorit hms. We shall exemplify t his st at ement wit h t he problem of maximum indep endent set . T h e o r e m 5 . S u p po se t h a t t h e m a x im u m in d epen d en t set a d m it s a n a lgo r it h m
r u n n in g in t im e O (2φ ( n ) n l ) w h ere φ ≤ n a n d l is a co n st a n t . I f t h e fu n ct io n γ ( n ) = y is w ell d efi n ed by t h e equ a t io n φ ( y ) = log n , it is m o n o t o n e a n d γ (2 n ) = O ( γ ( n )) t h en t h e m a x im u m in d epen d en t set p ro blem a d m it s a n n / γ ( n ) a p p ro x im a t io n a lgo r it h m . P roo f. Divide t he set of vert ices of t he input graph int o ⌊ n / γ ( n ) ⌋ disjoint subset s, each of size in t he int erval [γ ( n ) , 2γ ( n )) . For each of t he int ervals, run t he sub exp onent ial algorit hm in order t o find a maximum indep endent set in t he subgraph induced by t his subset . It t akes p olynomial t ime by t he prop ert ies of t he funct ion γ ( n ) . By pigeon hole principle, at least one of t he algorit hm runs will ret urn an indep endent set of size k γ ( n ) / n where k is t he maximum size of an indep endent set in G .
T heorem 5 can b e immediat ely generalized t o include t he problem of maximum induced subgraph wit h p olynomial-t ime t est able heredit ary prop ert y Π .
Π
T h e o r e m 6 . S u p po se t h a t fo r so m e po ly n o m ia l-t im e t est a ble h ered it a r y p ro p -
er t y Π t h e p ro blem o f m a x im u m in d u ced su bgra p h w it h t h e h ered it a r y p ro per t y a d m it s a n a lgo r it h m r u n n in g in t im e O (2φ ( n ) n l ) w h ere φ ≤ n a n d l is a co n st a n t . I f t h e fu n ct io n γ ( n ) = y is w ell d efi n ed by t h e equ a t io n φ ( y ) = log n , it is m o n o t o n e a n d γ (2n ) = O ( γ ( n )) t h en t h is p ro blem a d m it s a n n / γ ( n ) a p p ro x im a t io n a lgo r it h m . C o r o l l a r y 5 . I f fo r so m e po ly n o m ia l-t im e t est a ble h ered it a r y p ro per t y Π the p ro blem o f m a x im u m in d u ced su bgra p h w it h t h e p ro per t y Π a d m it s a n a lgo r it h m 1/
l
r u n n in g in t im e O (2n ) , w h ere l is a co n st a n t , t h en t h is p ro blem a d m it s a n l n / log n a p p ro x im a t io n a lgo r it h m .
R e fe re n c e s 1. P.K. Agarwal, M. van Kreveld and S. Suri, Label P lacement by Maximum Independent Set in Rect angles, C om pu t at i on al G eom et r y : T heor y an d A ppli cat i on s, 11(3-4), pp. 209–218, 1998. 2. M. Bern and D. Eppst ein. Approximat ion Algorit hms for Geomet ric P roblems. In D. S. Hochbaum, edit or, A ppr oxi m at i on A lgor i t hm s f or N P - H ar d P r oblem s, chapt er 8, pages 296–339. P W S P ublishing Company, Bost on, MA, 1996. 3. R. Boppana and M. M. Halld´orsson. Approximat ing maximum independent set s by excluding subgraphs. B I T 32(2): 180–196, 1992.
56
A. Lingas and M. Wahlen
4. M. R. Garey and D. S. J ohnson. C om pu t er s an d I n t r act abi li t y : A G u i de t o t he T heor y of N P - com plet en ess. Freeman, New York, NY, 1979. 5. R. Impagliazzo, R. P at uri and F . Zane. W hich P roblems Have St rongly Exponent ial Complexity? P roceedings 1998 Annual IEEE Symposium on Foundat ions of Comput er Science, pp 653–663, 1998. 6. G. Miller. F i n di n g sm al l si m ple cy cle separ at or s f or 2- con n ect ed plan ar gr aphs. P roc. 16t h Ann. ACM Symp. on T heory of Comput ing (1984) pp. 376–382. 7. W .D. Smit h and N.C. Wormald. Geomet ric separat or t heorems. In proc. ACM ST OC’ 98.
A Space E ffi
c i e n t A l g o r i t h m fo r S e q u e n c e
A lig n m e n t w it h In v e rs io n s Yong Gao1 , J unfeng Wu 1 , Robert Niewiadomski1 , Yang Wang1 , Zhi-Zhong Chen 2 ⋆ , and Guohui Lin 1 ⋆ ⋆ 1
2
Comput ing Science, University of Albert a, Edmont on, Albert a T 6G 2E8, Canada { ygao,jeffwu,niewiado,ywang,ghlin} @cs.ualberta.ca Mat hemat ical Sciences, Tokyo Denki Univ., Hat oyama, Sait ama 350-0394, J apan [email protected]
A dynamic programming algorit hm t o find an opt imal alignment for a pair of DNA sequences has been described by Sch¨oniger and Wat erman. T he alignment s use not only subst it ut ions, insert ions, and delet ions of single nucleot ides, but also inversions, which are t he reversed complement s, of subst rings of t he sequences. W it h t he rest rict ion t hat t he inversions are pairwise non-int ersect ing, t heir proposed algorit hm runs in O ( n 2 m 2 ) t ime and consumes O ( n 2 m 2 ) space, where n and m are t he lengt hs of t he input sequences respect ively. We develop a space effi cient algorit hm t o comput e such an opt imal alignment which consumes only O ( n m ) space wit hin t he same amount of t ime. Our algorit hm enables t he comput at ion for a pair of DNA sequences of lengt h up t o 10,000 t o be carried out on an ordinary deskt op comput er. Simulat ion st udy is conduct ed t o verify some biological fact s about gene shuffl ing across species. A b st ract .
1
In t ro d u c t io n
Sequence alignment has been well st udied in t he 80’ s and 90’,swhere a bunch of algorit hms have been designed for various purposes. T he int erest ed reader may refer t o [2] and t he references t herein. Normally, t he input sequence is considered as a linear series of symbols t aken from a fixed alphabet , which consist s of 4 nucleot ides in t he case of DNA/ RNA sequences or 20 amino acids in t he case of prot eins. An alignment of two sequences is obt ained by first insert ing spaces int o or at t he ends of t he sequences and t hen placing t he two result ing sequences one above t he ot her, so t hat every symbol or space in eit her sequence is opposit e t o a unique symbol or space in t he ot her sequence. An alignment , which is associat ed wit h some ob ject ive funct ion, can be nat urally part it ioned int o columns and t he column order is required t o agree wit h t he symbol orders in t he input sequences. ⋆
⋆ ⋆
Support ed in part by t he Grant -in-Aid for Scient ific Research of t he Minist ry of Educat ion, Science, Sport s and Cult ure of J apan, under Grant No. 14580390. P art of t he work done while visit ing at University of Albert a. Corresponding aut hor. Support ed in part by NSERC grant s RGP IN249633 and A008599, and a REE St art up Grant from t he University of Albert a.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 57–67, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
58
Y. Gao et al.
In ot her words, t hese alignment s use subst it ut ions, insert ions, and delet ions of symbols only and are called normal alignment s. For our purpose, we limit t he input sequences t o DNA sequences. In t he lit erat ure, a number of algorit hms [2] have been designed t o comput e an opt imal normal alignment between two DNA sequences, under various pre-det ermined score schemes. A score scheme basically specifies how t o calculat e t he score associat ed wit h an alignment . In t his paper, t he score schemes are symbol-independent . T he simplest such score scheme would be t he not ion of L o n ge s t C o m m o n S u bs equ e n ce , where every mat ch column get s a score of 1 and every ot her column get s a score of 0 and t he ob ject ive is t o maximize t he sum of t he column scores. In t he more general linear gap penalty score scheme specified by a t riple ( w m , w s , w i ), every mat ch column get s a score w m , every subst it ut ion column get s a score w s , and every insert ion or delet ion (an in d e l) get s a score w i . T he linear gap penalty score schemes assume every single nucleot ide mut at ion is independent of t he ot hers, which appears t o be not biologically significant . T he most commonly used score scheme nowadays is t he so-called a ffi n e ga p pe n a lt y s co re s c h e m e . Given an alignment , a maximal segment of consecut ive spaces in one sequence is called a ga p , whose lengt h is measured as t he number of spaces inside. An affi ne gap penalty score scheme is defined by a quadruple ( w m , w s , w o , w e ), where w m is t he score for a mat ch, w s is t he score for a replacement / subst it ut ion, and w o + w e × ℓ is t he penalty for a gap of lengt h ℓ . Int uit ively, affi ne gap penalty score schemes assume single nucleot ide mut at ions might depend on it s neighboring nucleot ide mut at ions. As an example, under t he affi ne gap penalty score scheme (10, − 11, − 15, − 5), t he following alignment has a score of 4: 1234567890123456789012345 -CCAATCTAC----TACTGCTTGCA ||| ||| | ||||| || GCCACTCT-CGCTGTACTG--TG--
In fact , one can easily verify t hat t he above alignment is opt imal for DNA sequences CCAATCTACTACTGCTTGCA and GCCACTCTCGCTGTACTGTG under t he specific score scheme. Alignment s are used t o reveal t he informat ion cont ent of genes in DNA sequences and t o make inferences about t he relat edness of genes or more general inferences about t he relat edness of long-range-segment s of DNA sequences. Wit h many genomic project s been carried out , emphasis has been put on t he st udy on t he genet ic linkage among species and/ or organisms. T he sequences t hus under considerat ion could come from diff erent species and inferences can be made about t he relat edness of species. In t his aspect , t he normal sequence alignment has t he limit at ion on using evolut ionary t ransformat ions t o subst it ut ions and indels. It has been widely accept ed t hat duplicat ions and inversions are common event s in molecular evolut ion [3,7]. Some pioneer work on st udying sequence alignment / comparison wit h inversions is done by Wagner [6] and Sch¨oniger and Wat erman [5]. In part icular, in [5], a dynamic programming algorit hm is developed t o comput e an opt imal (local) alignment wit h inversions. T he algorit hm
A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions
59
runs in O ( n 2 m 2 ) t ime and consumes O ( n 2 m 2 ) spaces, where n and m are t he lengt hs of two input sequences respect ively. T he high order of running t ime seems comput at ionally impract ical, nonet heless, it is t he huge space requirement t hat act ually makes t he comput at ion infeasible. For inst ance, suppose t he algorit hm needs 14 n 2 m 2 byt e memory, t hen an opt imal alignment between two sequences of lengt h 250 won’ t be carried out in a normal deskt op of 1Gb memory. Sch¨oniger and Wat erman [5] designed an algorit hm t o comput e a s u bo p t im a l alignment wit h inversions rest rict ed t o a const ant knumber of h igh e s t s co r in g in v e r s io n s . T his lat t erk algorit hm runs in O (n m + ℓ ) t ime and requires an order of O ( n m + ℓ ) space, where i= 1 i i= 1 i k is t he number of rest rict ed highest scoring inversions and ℓ i ’ s are t heir lengt hs respect ively. In t his paper, we develop a space effi cient algorit hm t o comput e an o p t im a l alignment wit h non-rest rict ed inversions, in t erms of bot h t he number and t heir scores, wit hin O ( m 2 n 2 ) t ime. T he algorit hm is non-t rivial in t he sense t hat deep comput at ion relat ionships are carefully charact erized. P ro b le m D e s c rip t io n . An inversion of a DNA subst ring is defined t o be t he
reverse complement of t he subst ring. In t his paper, we won’ t put a limit on t he number of inversions in t he alignment s, but we do want t o put a lower bound on t he lengt hs of inversions, for t he reason t hat we believe inversions correspond t o some conserved coding regions and a conserved region must have a least number of nucleot ides inside. We let L denot e t his lower bound. In t he ext reme case where L = 0, it becomes t he problem considered in [5]. T he inversions are rest rict ed t o be on one of t he two input sequences (by symmet ry) and t hey are not allowed t o int ersect one anot her. Moreover, t he subst rings from t he ot her sequence against which t hose inversions are aligned are not allowed t o int ersect one anot her eit her. T he score schemes used in t his paper are all affi ne gap penalty ones. For t he sake of comparison, t he paramet ers in t he schemes may be diff erent in diff erent simulat ions. We associat e each inversion wit h a (const ant ) penalty of C [5], t o compensat e for t he fact t hat t he inversion is an evolut ionary event . Now it is ready t o formulat e t he comput at ional problem we will be considering in t he paper. T he input is a pair of DNA sequences S 1 and S 2 over t he nucleot ide alphabet Σ = { A, C, G, T} , t oget her wit h an affi ne gap penalty score scheme ( w m , w s , w o , w e ), inversion lower bound L , and inversion penalty C . T he goal is t o comput e an opt imal alignment between S 1 and S 2 wit h inversions. For simplicity, we associat e s t a n d a rd s im ila r it y wit h a normal opt imal alignment , which t akes subst it ut ions and indels only; and we use in v e r s io n s im ila r it y t o associat e wit h an opt imal alignment t aking inversions in addit ion (called an o p t im a l in v e r s io n a lign m e n t ). Bot h similarit ies (also called sequence ident it ies hereaft er) are defined t o be t he rat io of t he number of mat ch columns in t he alignment over t he lengt h of t he short er sequence. O rg a n iz a t io n . T he paper is organized as follows: In t he next sect ion we will
det ail our algorit hm t o comput e an opt imal alignment between a pair of DNA sequences S 1 and S 2 . T he algorit hm runs in O ( m 2 n 2 ) t ime and requires only
60
Y. Gao et al.
O (m n )
space, where m and n are t he lengt hs of S 1 and S 2 , respect ively. In Sect ion 3, we show t he simulat ion result s of our algorit hm applied t o t he inst ances t est ed in [5]. We conclude t he paper wit h some remarks in Sect ion 4.
2
T h e A lg o rit h m s
Let S 1 [1. . m ] and S 2 [1. . n ] denot e t he two input sequences of lengt h m and n , respect ively. For simplicity of present at ion, we simplify t he problem a lit t le by requiring t hat gaps in non-inversion regions and inversion regions are count ed separat ely and independent ly. We let S [i ] denot e t he complement nucleot ide of S [i ] (t he Wat son-Crick rule); let S 1 [i 1 . . i 2 ] denot e t he inversion of S 1 [i 1 . . i 2 ], t hat is, S 1 [i 2 ] S 1 [i 2 − 1] . . . S 1 [i 1 ]. 2 .1
A Le s s S p a c e E ffi
c ie n t A lg o rit h m
In t his subsect ion, we int roduce a less space effi cient dynamic programming algorit hm which is concept ually simple t o underst and. T his algorit hm is for linear gap penalty score scheme (t hat is, we won’ t usew o and w e here, but use w i inst ead which is t he score for an indel). T he more complicat ed yet more space effi cient algorit hm in Sect ion 2.2 for t he affi ne gap penalty score scheme will be a refinement of t his simple algorit hm. In v e rs io n T a b le C o m p u t a t io n . Suppose t hat
S 1 [i 1 , i 2 ] and S 1 [i 3 , i 4 ] are two inversion subst rings in sequence S 1 , t hen by t he lengt h const raint and nonint ersect ing requirement we have: i 2 − i 1 ≥ L − 1, i 4 − i 3 ≥ L − 1, and eit her i 2 < i 3 or i 4 < i 1 . For every quart et ( i 1 , i 2 , j 1 , j 2 ), where 0 ≤ i 1 ≤ i 2 ≤ m and 0 ≤ j 1 ≤ j 2 ≤ n , let I [i 1 , i 2 ; j 1 , j 2 ] denot e t he st andard sequence similarity between two subst rings S 1 [i 1 . . i 2 ] and S 2 [j 1 . . j 2 ] (t hat is, wit hout inversions). As an easy example, S 1 = ACGT and S 2 = ACGA, t hen S 1 [2. . 4] = CGT and t hus S 1 [2. . 4] = ACG, and S 2 [1. . 3] = ACG. T herefore, I [2, 4; 1, 3] = 3w m . Let w ( a , b ) denot e t he score of mat ching nucleot ide a against nucleot ide b , where a and b are bot h in t he alphabet (which includes nucleot ides A, C, G, T). T herefore, w m , if a = b, w ( a , b) = w s , if a = b
Let S 1 [0] = S 2 [0] = − . To assist t he in v e r s io n t a ble t o include t he following boundary ent ries: – –
I [i
+ 1, i ; j 1 , j 2 ] = ( j 2 − + 1, j ] = ( i 2 −
I [i 1 , i 2 ; j
j1 i1
+ 1) w i , where 0 ≤ + 1) w i , where 0 ≤
I
i ≤ i1 ≤
comput at ion, m
I
and 0 ≤ j 1 ≤ m and 0 ≤
i2 ≤
is enlarged j2 ≤ j ≤
n; n.
T he recurrence relat ion for comput ing a general ent ry I [i 1 , i 2 ; j 1 , j 2 ] is as follows: I [i 1 + 1, i 2 ; j 1 , j 2 − 1] + w ( S 1 [i 1 ], S 2 [j 2 ]) , I [i 1 , i 2 ; j 1 , j 2 ] = max I [i 1 + 1, i 2 ; j 1 , j 2 ] + w i , I [i 1 , i 2 ; j 1 , j 2 − 1] + w i , where 1 ≤
i1 ≤
i2 ≤
m
and 1 ≤
j1 ≤
j2 ≤
n.
A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions
61
Not ice t hat t able I cont ains in t ot al 14 ( m + 1) 2 ( n + 1) 2 ent ries and filling each of t hem t akes a const ant amount of t ime. D y n a m ic P ro g ra m m in g T a b le C o m p u t a t io n . Let D P [i , j ] denot e t he score of an opt imal inversion alignment between prefixes S 1 [1. . i ] and S 2 [1. . j ], where 0 ≤ i ≤ m and 0 ≤ j ≤ n . T he boundary ent ries of t he d y n a m ic p rogra m m in g t a ble D P are: – –
D P
[0, j ] = 0] =
D P [i ,
, where 0 ≤ , where 0 ≤
j × wi i × wi
j ≤ i ≤
n; m
.
Recall t hat every inversion in S 1 , as well as it s aligned segment in S 2 , must have lengt h at least L . T he recurrence relat ion for comput ing a general ent ry D P [i , j ] is as follows: – When
i ≥
L
and
j ≥
,
D P [i −
D P [i , j
L
D P [i − D P [i , j
] = max
1≤ 1≤
max ′
1, j − 1] + 1, j ] + w i , − 1] + w i ,
i ≤ i− L ′ j ≤ j − L
w ( S 1 [i ], S 2 [j
D P [i − ′
1, j ′
−
]) ,
1] + I [i ′ , i ; j ′
,j
]
−
C.
+1 +1
– In t he ot her case,
D P [i −
D P [i , j
] = max
D P [i − D P [i , j
1, j − 1] + 1, j ] + w i , − 1] + w i .
w ( S 1 [i ], S 2 [j
]) ,
Since t he dynamic programming t able cont ains ( m + 1)( n + 1) ent ries and ent ry D P [i , j ] t akes up t o O ( i j ) t ime t o fill, t he running t ime of t he overall algorit hm is O ( m 2 n 2 ). T he correct ness of t he algorit hm follows direct ly from t he recurrences and t herefore we have t he following conclusion. T h e o re m 1 . T h e in v e r s io n s im ila r it y be t w ee n S 1 [1. . m p u t ed in O ( m 2 n 2 ) t im e u s in g O ( m 2 n 2 ) s pa ce . 2 .2
A Space E ffi S ch e m e s
c ie n t A lg o rit h m fo r A ffi
] an d
S 2 [1. . n ] ca n be co m -
n e G a p P e n a lt y S c o re
In t he algorit hm in Sect ion 2.1 we divide t he comput at ion int o two phases. In t he first phase we prepare all t he possible inversions t oget her wit h t heir all possible aligned subst rings from t he ot her sequence and t he associat ed scores. Direct ext ension can lead t o an algorit hm for affi ne gap penalty score schemes, running in t he same amount of t ime and requiring t he same amount of space. In t he following, we present a single-phase comput at ion. We fill t he dynamic
62
Y. Gao et al.
programming t able row-wise. Furt hermore, when filling t he i t h row, we comput e all possible inversions ending at posit ion i . We will prove t hat t here are O ( m n ) such possible inversions and each can be calculat ed in const ant t ime based on t he int ermediat e result s of comput at ion for t he ( i − 1) t h row. T his single-phase comput at ion st ill t akes O ( m 2 n 2 ) t ime, nonet heless requires O ( m n ) space only. Let D P M [i , j ], D P I [i , j ], and D P D [i , j ] denot e t he scores of an opt imal inversion alignment between prefixes S 1 [1. . i ] and S 2 [1. . j ], where 0 ≤ i ≤ m and 0 ≤ j ≤ n , such t hat t he last operat ion is eit her a mat ch or a mismat ch, an insert ion, and a delet ion, respect ively. T he boundary ent ries of t hese dynamic programming t ables are: – – –
[0, 0] = D P I [0, 0] = D P D [0, 0] = 0; [0, j ] = w o + j × w e , where 1 ≤ j ≤ n ; P D [i , 0] = w o + i × w e , where 1 ≤ i ≤ m .
D PM D PI D
Let I Mi , j [i ′ , j ′ ], I Ii , j [i ′ , j ′ ], and I Di , j [i ′ , j ′ ] denot e t he sequence similarit ies between inversion S 1 [i ′ . . i ] and S 2 [j ′ . . j ], where 1 ≤ i ′ ≤ i ≤ m and 1 ≤ j ′ ≤ j ≤ n , such t hat t he last operat ion is eit her a mat ch or a mismat ch, an insert ion, and a delet ion, respect ively. Again, t o assist t he comput at ion for t hese 3 inversion t ables, t hey are enlarged t o include t he following boundary ent ries: – – –
D
I I I
i ,j M i ,j I i ,j D
[i + 1, j + 1] = I Ii , j [i + 1, j + 1] = I Di , j [i + 1, j + 1] = 0; [i + 1, j ′ ] = w o + ( j − j ′ + 1) w e , where 1 ≤ j ′ ≤ j ; [i ′ , j + 1] = w o + ( i − i ′ + 1) w e , where 1 ≤ i ′ ≤ i .
T he recurrence relat ions for dynamic programming t ables comput at ion are: D P M [i − 1, j − 1], w ( S [i ], S [j ]) + max D P [i − 1, j − 1], I 1 2 D P D [i − 1, j − 1]; P M [i , j ] = max D P M [i ′ − 1, j ′ − 1], i , j max I [i ′ , j ′ ] + max D P I [i ′ − 1, j ′ − 1], − C 1 ≤ i ′′ ≤ i − L + 1 M ′ ′ D P [i − 1, j − 1] 1≤
D PM
+1
j − L
[i , j
D
−
D P I [i , j −
] = max
1≤
′
j
≤
j − L
[i
+1
1, j ] + w o + w e , 1, j ] + w o + w e , D P D [i − 1, j ] + w e , i ,j ′ ′ max I D [i , j ] + max 1≤ i ′ ≤ i − L + 1
D PM
D PM
[i ′
−
D P I [i − ′
D P D [i − ′
1, j ′ − 1], 1, j ′ − 1], 1, j ′ − 1]
−
C
−
C
−
D P I [i −
D P D [i , j
≤
1] + w o + w e , 1] + w e , D P D [i , j − 1] + w o + w e , i ,j ′ ′ max I I [i , j ] + max 1≤ i ′ ≤ i − L + 1
D P I [i , j
j
] = max
1≤
j
′
≤
j − L
+1
D PM
[i ′
−
D P I [i − ′
D P D [i − ′
1, j ′ − 1], 1, j ′ − 1], 1, j ′ − 1]
A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions
63
Before comput ing t hese i t h row ent ries, I Mi , j , I Ii , j , and I Di , j t ables are precomput ed using t he following recurrence relat ions. i ,j − 1 [i ′ + 1, j ′ ], IM i ,j i ,j − 1 ′ ′ ′ I M [i , j ] = w ( S 1 [i ], S 2 [j ]) + max I [i ′ + 1, j ′ ], Ii , j − 1 ′ ID [i + 1, j ′ ]
I
i ,j I
[i ′
,j
′
] = max
I I I
I
i ,j D
[i ′
,j
′
] = max
I I I
i ,j − M i ,j − I i ,j − D
i ,j M i ,j I i ,j D
1
[i ′ , j ′ ] + [i ′ , j ′ ] + 1 ′ [i , j ′ ] + 1
wo
+
w e,
+
we
w e, wo
[i ′ + 1, j ′ ] + [i ′ + 1, j ′ ] + [i ′ + 1, j ′ ] +
wo wo
+ +
w e, w e,
we
Not ice t hat t he comput at ion of I Mi , j , I Ii , j , and I Di , j t ables needs t he values in 1 IM , I Ii , j − 1 , and I Di , j − 1 t ables only. It follows t hat we may just keep 3 inversion t ables I Mi , j − 1 , I Ii , j − 1 , and I Di , j − 1 aft er comput ing ent ries D P M [i , j − 1], D P I [i , j − 1], and D P D [i , j − 1]. T hese 3 t ables are t hen used in comput ing ent ries D P M [i , j ], i ,j i ,j D P I [i , j ], and D P D [i , j ], where we creat e 3 new inversion t ables I M , I I , and i ,j i ,j − 1 I D . Aft er t hat , t hose 3 inversion t ables I M , I Ii , j − 1 , and I Di , j − 1 will no longer be used and t hus can be deallocat ed. In ot her words, we need only in t ot al 9 2-dimensional t ables during t he overall comput at ion, which consume O ( m n ) space. T he overall running t ime O ( m 2 n 2 ) is obviously seen from t he recurrences, where t rying all possible combinat ions of ′ ′ i and j for pair ( i , j ) dominat es t he comput at ion. i ,j −
S 1 [1. . m ] a n d S 2 [1. . n ], u s in g a ffi n e ga p pe n a lt y s co re s c h e m e s , ca n be co m p u t ed in O ( m 2 n 2 ) t im e u s in g O ( m n ) s pa ce .
T h e o re m 2 . T h e in v e r s io n s im ila r it y be t w ee n
3
S im u la t io n R e s u lt s
In t he example inst ance in t he int roduct ion, S 1 = CCAATCTACTACTGCTTGCA and S 2 = GCCACTCTCGCTGTACTGTG. Under t he affi ne gap penalty score scheme specified by (10, − 11, − 15, − 5), we showed t here an opt imal normal alignment . Using t he lower bound L = 5 and inversion penalty C = 2, t he following shows an opt imal inversion alignment , associat ed wit h a score of 43: 1234567890 -CCAATCTAC ||| ||| | GCCACTCT-C
123456 789012345 gcagta TTGCA || ||| || GCTGTA CTGTG
In which t he lower case subst ring “ gcagta” is an inversion from TACTGC.
S 1 [10. . 15]
=
64
Y. Gao et al.
In [5], it has been calculat ed under t he same score scheme t hat S 1 [10. . 15] is t he highest scoring inversion and S 1 [7. . 9] v s . S 2 [13. . 15] is t he second highest . And using t hese 2 highest scoring inversions, t he out put inversion alignment in t heir paper is exact ly t he same as ours as shown. T herefore, our work confirms t hat t he inversion alignment comput ed using 2 highest scoring inversions for t he above inst ance in [5] is in fact an opt imal one. A biological inst ance used for simulat ion in [5] consist s of a DNA sequence from D . y a k u ba mit ochondria genome using nucleot ides 9,987–11,651 and a DNA sequence from mouse mit ochondria genome using nucleot ides 13,546–15,282. Under t he affi ne gap penalty score scheme specified by (10, − 9, − 15, − 5) and inversion penalty C = 20, by pre-comput ing a list of 400 highest scoring inversions, t he alignment out put in [5] found an inversion subst ring in D . y a k u ba consist ing of nucleot ides 7–480 which aligns t o nucleot ides 58–542 from mouse. T he put at ive organizat ion of genes in t he two DNA sequences is described in Table 1: v s . S 2 [10. . 15]
T a b le 1 .
P ut at ive organizat ion of genes in t he two DNA sequences. D . yakuba
URF 6 t RNA Glu cyt ochrome b
1–525 529–1,665
mouse 519–1 (invert ed) 588–520 (invert ed) 594–1737
So t he ident ified inversion t o some ext ent det ect s t he biologically correct inversion. In our simulat ion, we use t he same score scheme and again add t he lower bound on t he inversion lengt hs L = 5. Unfort unat ely, t he algorit hm didn’ t det ect anygood inversions. What it found are t hree short inversions S 1 [344. . 349] which aligns t o S 2 [326. . 331], S 1 [387. . 391] which aligns t o S 2 [357. . 361], and S 1 [456. . 463] which aligns t o S 2 [417. . 424]. Wit h t hese t hree inversions, t he det ect ed inversion ident ity is 0. 6853, cont rast t o t he st andard ident ity 0. 6847. We did anot her experiment by cut t ing out t he two URF6 genes from bot h sequences and calculat ing t heir inversion ident ity, namely, t he first 525 nucleot ides from D . y a k u ba and t he first 519 nucleot ides from mouse. It t urned out t hat t he st andard ident ity between t hese two subst rings is 0. 5780 and t he inversion ident ity remains t he same as t he st andard one wit hout any inversion det ect ed. Since t he inversion algorit hm didn’ t det ect any meaningful inversions, we modified t he algorit hm t o det ect reversals, which only reverse a subst ring but not t ake t he complement . We define t he reversal ident ity similarly t o be t he rat io in an opt imal reversal alignment . For t he two URF6 genes, by set t ing t he lengt h lower bound L = 5, we found a lot of reversals which are list ed in t he Table 2. T he reversal ident ity is 0. 6301 as det ect ed. By set t ing L = 300, we found a reversal subst ring S 1 [128. . 513] which is aligned t o S 2 [121. . 507]. T he alignment score is improved from 152 t o 167 wit h a lit t le bit ident ity sacrifice down t o 0. 5742. T he st andard ident ity between t hese two segment s is 0. 5622 wit h alignment score 55 (an opt imal st andard alignment
A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions T a b le 2 .
65
Fragment al reversal segment s and t heir aligned part ner.
D . yakuba
15–23 37–41 44–73 78–82 100–114 130–165 180–192 209–227 244–249 254–261
mouse 16–25 37–44 47–70 75–79 105–119 134–172 187–199 216–238 255–260 265–272
D . yakuba
266–276 283–302 316–322 324–342 350–378 383–387 394–436 437–447 459–512 518–525
mouse 277–287 294–315 329–335 337–350 358–383 388–392 399–438 439–449 461–504 510–519
is shown in t he left side of Figure 1); T he reversal ident ity between t hem is 0. 5596 wit h alignment score 110 (an opt imal reversal alignment is shown in t he right side of Figure 1). Alignment Score:55 Matches: 217 Identity: 0.562176165803109 12345678901234567890123456789012345678901234567890 -------------------------------------------------0 TAATAACTAAAAGTTTTTGATACTCATACATTTTATTTTTAAT-TTTTTT 0 |||| || | | | |||||||| | | ||| | 0 ----AACTCCAACATCATCAACCTCATACA--TCA--ACCAATCTCCCAA
Alignment Score:110 Matches: 216 Identity: 0.559585492227979 12345678901234567890123456789012345678901234567890 -------------------------------------------------0 AGCCTATCCTGGAAATTTATCAA----AT-CATTAAAAATGATGTTGTTA 0 | | ||| || | ||||| || ||| || | || | | 0 AAC---TCC---AACATCATCAACCTCATACATCAACCA--ATCTCCCAA
1 1 1
AGGAGGAATACTTGTTTTATTTA--TTTATGTTACATCATT-AGC-TTCT | | || | || || | | || || || || ||| ||| | ACCATCAAGA-TTAATTACTCCAACTTCATCATA-ATAATTAAGCACACA
1 1 1
ATTTCATTA--ATTATTTATTAAATAATT-ATTTTAACAATGTTTTAAAC | ||| | |||| ||| | | | || || ||| || |||| | A--CCATCAAGATTAATTACTCCA-ACTTCATCATAATAA----TTAAGC
2 2 2
AATGAAATATTTAA--TTTATCAATTA-----AATTAACTTTATTTTCCA ||| ||| | || | ||| ||| | ||| ||| | ||| AATTAAAAA---AACCTCTAT-AATCACCCCCAAT--ACTAAAAAACCCA
2 2 2
A-ACCTTTTAATATATTAAATAAATTTCTATTTCTTAAAAGACATTTTAT | || || |||||| ||| ||||| || || || ACAC-----AA---ATTAAAAAAACCTCTAT------AATCACCCCCAAT
3 3 3
TATTTATTTTATTTTTTATAT---TTATTTTATCAATAATTCTTGA-TAA | ||| || ||| || | | | | || |||| | | | AAATTA----ATCAGTTAGATCCCCAAGTCTCTGGAT-ATTCCTCAGT--
3 3 3
TCTTAAATAAAGTTATTATCTAACATAAAGCAATAAATAATTTTTATTTC || ||| ||| || ||| ||| | || || | ACTAAAA--------------AACCCAA---AATTAATCAGTTAGATCCC
4 4 4
AACTTCTATTACT-TTATTTTTAATAAATAACGAA-ATACAATCT--ATT | | | || | | ||| | || | | ||| || || | || || AGC-TATAGCAGTCGTATATCCAA-ACACAACCAACATCCCCCCTAAATA
4 4 4
--ATTATCTTCAAAATAGTTCTTAATAACTATTTTATTTATATTTTTTAT | | ||| ||| | || | || |||| | | ||| | | CAAGTCTCT---GGATATTCCTCAGTAGCTATAGCAGTCGTATATCCAAA
5 5 5
ATTGAAATAAATTCTTATTTTAC--AGAAA--ATTC-TTTATCTTTAAAT | | ||| ||| | |||| || | ||| || | | | |||| AATTAAAAAAA--C-TATTAAACCTAAAAACGATCCACCAAACCCTAAAA
5 5 5
TTTA---TTTATACCTTTTATTTCAATTAAATTAACTATTTAATTTATAA | || || || | ||||||| ||||||| || || || CACAACCAACATCCCCCCTAAATAAATTAAAAAAACTATTAAACCTAAAA
6 6 6
AAATTATATAATTTTCCAACAAATTTTGTAACAATTTTA-TTAA---TAA |||| | || |||||||| |||||||| | ||| | CCATTAAACAA----CCAACAAACCCACTAACAATTAAACCTAAACCTCC
6 6 6
A-G-T------AATCTT----CGATTA------CTACA----TTGTATTT | | | || | | | |||| | ||| || ACGATCCACCAAACCCTAAAACCATTAAACAACCAACAAACCCACTAACA
7 7 7
ATTATTTATTAATTACTTTAATTGTTGTAGTAAAAATTACTAAAC-TATT || | | | | |||||| || | | || | || || | | ATAAATAGGTGAAGGCTTTAA-TGCT-AACCCAAGACAACCAACCAAAAA
7 7 7
ATTTATTTT----GTTCATAAGGAG--GATTTTTTTAATTTTTA--TTTT ||| | | | ||||| || || |||||| | | ATTAAACCTAAACCTCCATAAATAGGTGAAGGCTTTAATGCTAACCCAAG
8 8 8
TAAAGGTCCT-ATCCGA---||| | | | | | | TAATGAACTTAAAACAAAAAT
8 8 8
ACATAC---TCATAGTTTTTGA----AAATCAATAAT ||| || || | | ||| ||| ||| ||| ACA-ACCAACCAAAAATAATGAACTTAAAACAAAAAT
F i g . 1 . An opt imal st andard alignment (left ) and an opt imal reversal alignment (right ) between S 1 [128. . 513] and S 2 [121. . 507].
66
4
Y. Gao et al.
C o n c lu s io n s
T he space effi cient algorit hm developed in t his paper enables t he comput at ion of an opt imal inversion alignment between two DNA sequences of lengt h up t o 10,000bp on a normal deskt op wit h 1Gb memory. P revious algorit hms eit her fail on long sequences or only produce a subopt imal inversion alignment rest rict ed t o a number of pre-comput ed highest scoring inversions. T he simulat ion conduct ed shows a disagreement wit h previous simulat ion. Furt her invest igat ion is necessary, typically on t he select ion of suit able score schemes. T he recurrences for comput ing D P M , D P I , and D P D t ables are writ t en for t he case where gaps inside inversion segment s and gaps inside non-inversion segment s are t reat ed separat ely and independent ly. If two gaps from diff erent cat egories are adjacent t o each, t hen t hey might be count ed as one gap. T he recurrences can be slight ly modified, where one copy of inversion penalty C should be merged t o D P M [i ′ − 1, j ′ − 1], D P I [i ′ − 1, j ′ − 1], and D P D [i ′ − 1, j ′ − 1] during t he comput at ion, t o t ake care of t his case. Our algorit hm can be easily modified t o comput e an opt imal reversal alignment between sequences. Some simulat ion has been run which shows somet hing diff erent from inversions. We have also done some preliminary simulat ion st udy on applying t he inversion and reversal algorit hms t o det ect similar secondary st ruct ure unit s for RNA sequences, which correspond t o reversed subst rings, in t he RNase P Dat abase ( http://www.mbio.ncsu.edu/RNaseP/home.html) [1]. T he result will be report ed elsewhere. Upon accept ance, we were informed of a recent work [4], where Mut hukrishnan and Sahinalp consider t he problem of minimizing t he number of charact er replacement s (no insert ions and delet ions) and reversals and propose an 2 O ( n log n ) t ime det erminist ic algorit hm, where n is t he lengt h of eit her sequence. A ck n ow le d g m e n t s . We t hank Dr. Pat ricia Evans (Comput er Science, Univer-
sity of New Brunswick) and Bin Li (Biological Science, University of Albert a) for helpful discussions.
R e fe r e n c e s 1. J . W . Brown. T he Ribonuclease P Dat abase. N uclei c A ci ds Research , 27:314, 1999. 2. D. Gusfield. A lgor i t hm s on St r i ngs, T rees, and Sequences. Cambridge, 1997. 3. C. J . Howe, R. F . Barker, C. M. Bowman, and T . A. Dyer. Common feat ures of t hree inversions in wheat chloroplast dna. C ur rent G enet i cs, 13:343–349, 1988. 4. S. Mut hukrishnan and S. C. Sahinalp. An improved algorit hm for sequence comparison wit h block reversals. In P roceedi ngs of T he 5t h L at i n A m er i can T heoret i cal I nfor m at i cs Sym posi um ( L A T I N ’ 02), LNCS 2286, pages 319–325, 2002. 5. M. Sch¨oniger and M. S. Wat erman. A local algorit hm for DNA sequence alignment wit h inversions. B ul let i n of M at hem at i cal B i ology , 54:521–536, 1992.
A Space Effi cient Algorit hm for Sequence Alignment wit h Inversions
67
6. R. A. Wagner. On t he complexity of t he ext ended st ring-t o-st ring correct ion problem. In D. Sankoff and J . B. Kruskal, edit ors, T i m e W ar ps, St r i ngs E di t s, and M acrom olecules: t he T heor y and P ract i ce of Sequence C om par i son , pages 215–235. Addison-Wesley, 1983. 7. D. X. Zhou, O. Massenet , F . Quigley, M. J . Marion, F . Mon´eger, P. Huber, and R. Mache. Charact erizat ion of a large inversion in t he spinach chloroplast genome relat ive t o m archant i a : a possible t ransposon-mediat ed origin. C ur rent G enet i cs, 13:433–439, 1988.
O n t h e S im ila rit y o f S e t s o f P e rm u t a t io n s a n d It s A p p lic a t io n s t o G e n o m e C o m p a ris o n Anne Bergeron 1 and J ens St oye2 1
2
LaCIM, Universit´e du Qu´ebec `a Mont r´eal, Canada, [email protected] Technische Fakult ¨a t , Universit ¨a t Bielefeld, Germany, [email protected]
T he comparison of genomes wit h t he same gene cont ent relies on our ability t o compare permut at ions, eit her by measuring how much t hey diff er, or by measuring how much t hey are alike. W it h t he not able except ion of t he breakpoint dist ance, which is based on t he concept of conserved adjacencies, measures of dist ance do not generalize easily t o set s of more t han two permut at ions. In t his paper, we present a basic unifying not ion, conser ved i nter vals, as a powerful generalizat ion of adjacencies, and as a key feat ure of genome rearrangement t heories. We also show t hat set s of conserved int ervals have elegant nest ing and chaining propert ies t hat allow t he development of compact graphic represent at ions, and linear t ime algorit hms t o manipulat e t hem. A b st ract .
1
In t ro d u c t io n
Gene order analysis in a set of organisms is a powerful t echnique for phylogenet ic inference. Current met hods are based on not ions of distan ces between genomes, which are usually defined as t he minimum number of such and such operat ions needed t o t ransform one genome int o t he ot her one. Dist ance mat rices can eit her be used direct ly as dat a for phylogenet ic reconst ruct ion, or in more qualit at ive at t empt s t o reconst ruct ancest ral genomes [9]. All t hese met hods, wit h t he not able except ion of t he breakpoin t distan ce [6], are closely t ied t o init ial choices of allowable rearrangement operat ions. T hey are also pu re dist ances, in t he sense t hat similarit ies between genomes are purposefully ignored. T he breakpoint dist ance is based on t he not ion of conserved adjacencies. Compared t o ot her dist ances, it is easy t o comput e, but it oft en fails t o capt ure more global relat ions between genomes [17]. Nevert heless, conserved adjacencies have two highly desirable propert ies:
1. T hey can be defined on a set of more t han two genomes, allowing for t he ident ificat ion of similar feat ures in a family of organisms. 2. T hey are invariant under opt imal rearrangement scenarios, in t he sense t hat it is not necessary t o break adjacencies t o explain how a genome evolved from anot her one [10,15,21]. T . W a r n ow a n d B . Zh u ( E d s.) : C O C O O N 2003, LN C S 2697, p p . 68–79, 2003. c Sp r in ger -Ver la g B er lin H eid elb er g 2003
On t he Similarity of Set s of P ermut at ions and It s Applicat ions T a b le 1 .
Fr u it F ly M osq u it o Silk wor m Locu st T ick C en t ip ed e
1 1 1 1 1 1
69
Condensed mit ochondrial genomes of six Art hropoda 2 2 2 2 3 3
3 3 3 3 4 4
4 4 4 5 5 5
5 5 5 4 6 6
6 6 6 6 7 7
7 8 7 7 8 8
8 7 8 8 9 9
9 9 9 9 10 10
−
10 10 10 10 11 11
11 11 11 11 − 2 − 2
12 12 12 12 12 12
13 13 14 13 13 16
14 14 13 14 14 13
15 15 15 15 15 14
16 16 16 16 16 15
17 17 17 17 17 17
A first generalizat ion of adjacencies is t he not ion of com m on in tervals t hat ident ify subset s of genes t hat appear consecut ively in two or more genomes [13,22]. Common int ervals ident ify more global relat ions between genomes, but oft en lose t he invariant property of adjacencies wit h respect t o opt imal rearrangement scenarios. For example, all opt imal sort ings by reversals of t he permut at ion (1 3 2 5 − 4 6) break, in some of t he int ermediat e permut at ions, t he common int erval (2 3). Are adjacencies t he only st ruct ures t hat are invariant under biologically meaningful rearrangement operat ions? No. T here exist s a class of common int ervals, called con served in tervals , t hat may be t he best of two worlds. We will show t hat t hese st ruct ures capt ure bot h local and global propert ies of genomes; are invariant under most rearrangement scenarios; and t heir number and nat ure can be comput ed in linear t ime.
2
P e rm u t a t io n s , G e n e O rd e r, a n d R e a rra n g e m e n t s
In t he following we will t ake for grant ed t he simplifying hypot hesis t hat t he genes of an organism are ordered and orient ed along linear or circular DNA molecules. For example t he 37 mit ochondrial genes of t he Fruit F ly are list ed in [7], wit h minus signs t o reflect orient at ion, as: cox1, L2, cox2, K, D, atp8, atp6, cox3, G, nad3, A, R, N, S1, E, -F, -nad5, -H, -nad4, -nad4L, T, -P, nad6, cob, S2, -nad1, -L1, -rrnL, -V, -rrnS, UNK, I, -Q, M, nad2, W, -C, -Y
T he first gene is arbit rary, since mit ochondrial genomes are circular molecules. When organisms wit h t he same gene cont ent are compared, one of t hem is chosen as a base organism, and all ident ical st rips of genes are convert ed t o int egers. By ext ension, t hese are also called “genes”. Table 1 present s t he result of t his t ransformat ion applied t o t he mit ochondrial genomes of six A rthropoda , wit h Fruit F ly as base organism. T he original 37 genes have been divided in 17 blocks: some represent isolat ed genes, and ot hers represent longer st rips. For example, 10 st ands for S1, and 11 for E, -F, -nad5, -H, -nad4, -nad4L, T, -P, nad6, cob, S2, -nad1. Various t echniques are t hen used t o compare t he result ing permut at ions. T he distan ce approaches focus on t he diff erences between two part icular genomes. For example, Fruit F ly diff ers from Mosquit o by t he reversal of gene 10, and t he tran sposition of genes 7 and 8. One can count t he minimal number of reversals and/ or t ransposit ions necessary t o t ransform each genome int o any ot her, yielding a dist ance mat rix for t he set of species. Explicit rearrangement scenar-
70
A. Bergeron and J . St oye
ios, t hat is, sequences of operat ions t hat t ransform opt imally one genome int o anot her, are also used t o reconst ruct ancest ral genomes. Anot her approach, t he breakpoin t distan ce , count s t he lost adjacencies between genomes. It does not rely on part icular rearrangement operat ions or an evolut ionary model, and it has an associat ed measure of similarity: t he number of con served adjacencies. For example, given t he circularity of t he genomes, Fruit F ly and Mosquit o have 12 conserved adjacencies, and t heir breakpoint dist ance is 5. Such a similarity measure ext ends easily t o set s of species. For example, t he first four species of Table 1 share 6 adjacencies: [1, 2], [2, 3], [11, 12], [15, 16], [16, 17], and [17, 1]. When comparing all six species, t he only left adjacency is [17, 1]: t his lack of conserved adjacencies is a direct consequence of how t he dat a was t ransformed. Does t his mean t hat losing common adjacencies amount s t o losing all common st ruct ures? A quick glance at Table 1 reveals t hat t he six permut at ions are very “similar”. For example, t he genes in t he int erval [1, 12] are all t he same, wit h small variat ions in t heir ordering. T his is also t rue for t he genes in t he int ervals [3, 6], [6, 9], [9, 11], and [12, 17]. It t urns out t hat such int ervals, t oget her wit h conserved adjacencies, play a fundament al role in rearrangement and dist ance t heories, ancest ral genome reconst ruct ions, and phylogeny. T he following fam ily portrait gives a represent at ion of t he conserved int ervals of t he permut at ions of Table 1: 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
T his represent at ion boxes t he element s in rect angles, which can be glued t oget her t o form larger ob ject s. It t akes it s root s in P Q -t rees [8] t hat are used t o represent set s of permut at ions. All permut at ions of Table 1 fit t he represent at ion wit h t he following convent ions: (1) free ob ject s wit hin a rect angle can be reordered, or can change sign, (2) connect ions between rect angles are fixed. T his represent at ion also capt ures t he feat ures t hat should be invariant in biologically plausible rearrangement scenarios wit hin t he family. In order t o illust rat e t his last point , consider t he two following rearrangement scenarios t hat t ransform Silkworm int o Locust using a minimal number of reversals (operat ions t hat reverse t he element s of a consecut ive block while changing t heir signs). 1 1 1 1 1 1 1
2 2 2 2 2 2 2
3 3 3 3 3 3 3
4 -4 -4 5 5 5 5
5 5 -5 4 4 4 4
6 6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8
9 9 9 9 9 9 9
10 10 10 10 10 10 10
11 11 11 11 11 11 11
12 12 12 12 12 12 12
14 14 14 14 -14 -14 13
13 13 13 13 13 -13 14
15 15 15 15 15 15 15
16 16 16 16 16 16 16
17 17 17 17 17 17 17
1 1 1 1 1 1 1
2 2 2 2 2 2 2
3 3 3 3 3 3 3
4 5 6 7 8 9 10 11 4 -14 -12 -11 -10 -9 -8 -7 4 -14 5 6 7 8 9 10 4 -13 -12 -11 -10 -9 -8 -7 5 6 7 8 9 10 11 12 5 4 -13 -12 -11 -10 -9 -8 5 4 6 7 8 9 10 11
12 -6 11 -6 13 -7 12
14 -5 12 -5 -4 -6 13
13 13 13 14 14 14 14
15 15 15 15 15 15 15
16 16 16 16 16 16 16
17 17 17 17 17 17 17
T hose two scenarios are fundament ally diff erent , even if t hey bot h use six reversals. T he right one uses much longer reversals t han t he left one, and t he right one breaks conserved int ervals between Silkworm and Locust in int ermediat e permut at ions, namely [3, 6], [1, 12], and [12, 17]. If a rearrangement scenario
On t he Similarity of Set s of P ermut at ions and It s Applicat ions
71
is expect ed t o reflect t he various int ermediat e species between Silkworm and Locust , t he right one looks highly suspicious. Recent papers address t hese problems in various ways, for example by assigning weight s t o operat ions [1], or wit h probabilist ic st udies of t he possible scenarios [16]. T he two main flaws of t he second scenario – long reversals and breaking conserved int ervals – are closely t ied: breaking conserved int ervals, as we will show in Sect . 6, oft en involves long range operat ions t hat radically dist urb a genome. In t his sense, conserved int ervals can be used as an int rinsic measure t hat allows t o screen out rearrangement scenarios, or phylogenet ic hypot heses, wit hout t he need of arbit rary weight s or probability measures.
3
C o n s e rv e d In t e rva ls
T his sect ion present s a formalizat ion of t he not ion of conserved int ervals, t oget her wit h propert ies t hat allow t he development of linear t ime algorit hms t o manipulat e t hem. D e fi n it io n 1 . Let G be a set of sign ed perm u tation s on n elem en ts. A n in terval [a , b] is a conserved int erval of the set G if: 1) either a precedes b, or − b precedes − a , in each perm u tation , an d 2) the set of u n sign ed elem en ts that appear between a an d b is the sam e for all perm u tation s in G .
An element ary consequence of t his definit ion is t he fact t hat if [a , b] is a conserved int erval, so is [− b, − a ]. We will consider t hese int ervals as equivalent . Table 1 cont ains several examples of conserved int ervals. T heir descript ion is eased by t he fact t hat t he ident ity permut at ion belongs t o t he set G . When t his is t he case, all conserved int ervals can be ident ified wit h t heir posit ive endpoint s a < b, and t he set of element s t hat appear between a and b is { a + 1, . . . , b − 1} . T he following example illust rat es a more general case. Consider t he two permut at ions: P = 1 2 3 7 5 6 − 4 8 Q = 1 7 − 3 − 2 5 − 6 − 4 8 In t his example, [1, 5] and [2, 3] are conserved int ervals, but not [1, 6]. T he ot her conserved int ervals of P and Q are [1, − 4], [1, 8], [5, − 4], [5, 8], and [− 4, 8]. T he diagram represent at ion of t hese int ervals, wit h respect t o t he permut at ion P , is: 1
2 3
7
5
6
-4 8
When t he ident ity permut at ion is not in G , it is always possible t o ren am e t he element s of G such t hat conserved int ervals will be int ervals of consecut ive element s. For example, if one composes1 t he permut at ions P and Q of t he above example wit h t he inverse permut at ion P − 1 , t he first permut at ion becomes t he 1
Here, composit ion is underst ood as t he st andard composit ion of funct ions. Dealing wit h signed permut at ions requires t he addit ional axiom t hat P ( − a ) = − P ( a ).
72
A. Bergeron and J . St oye
ident ity permut at ion I d = P − 1 ◦ P . In general, it is element ary t o t ransform a set of conserved int ervals t o it s equivalent up t o renaming. It is a consequence of t he following proposit ion: P ro p o s it io n 1 . Let R be a perm u tation an d G a set of perm u tation s, den ote by R ◦ G the set of perm u tation s obtain ed by com posin g each perm u tation in G with R . T he in terval [a , b] is con served in G if an d on ly if the in terval [R ( a ) , R ( b)] is con served in R ◦ G .
Some int ervals, such as [1, − 4] for t he set { P , Q } in t he above example, are t he union of smaller int ervals: [1, − 4] = [1, 5] ∪ [5, − 4]. Int ervals t hat are not unions are specially useful: D e fi n it io n 2 . C on served in tervals that are n ot the u n ion of shorter con served in tervals are called irreducible.
Set s of conserved int ervals can be simply charact erized by t he corresponding set of irreducible int ervals. Indeed, disjoint irreducible int ervals, as highlight ed in t he diagram represent at ion, are eit her chain ed or n ested . T he following proposit ion capt ures t he basic propert ies of t hese st ruct ures. P ro p o s it io n 2 ( [5 ]) . T wo diff eren t irredu cible con served in tervals [a , b] an d G of perm u tation s, are either: 1) disjoin t, 2) n ested with diff eren t en dpoin ts, or 3) overlappin g on on e elem en t.
[c, d ] of a set
Overlapping irreducible int ervals form chains linked by t heir successive common element s. A chain of k − 1 int ervals [a 1 , a 2 ][a 2 , a 3 ] . . . [a k − 1 , a k ] will be denot ed simply by it s k links [a 1 , a 2 , a 3 , . . . , a k ]. For example, [1, 5, − 4, 8] is a chain of t he set of conserved int ervals of P and Q . A m axim al chain is a chain t hat cannot be ext ended. We have: P ro p o s it io n 3 . E very irredu cible con served in terval belon gs to a u n iqu e m axim al chain .
One consequence of P roposit ion 3 is t hat maximal chains, as set s of links, t oget her wit h isolat ed genes, form a part it ion of t he set of genes. T his will reveal useful t o const ruct dat a st ruct ures t o keep t rack of conserved int ervals. A set of permut at ions on n element s can have as many as n ( n − 1) / 2 conserved int ervals, but at most n − 1 irreducible int ervals. T hese bounds are achieved wit h set s cont aining only one permut at ion. A key observat ion, t hat will event ually lead t o linear t ime algorit hms t o comput e t he number of conserved int ervals, is t he following: P ro p o s it io n 4 . E ach m axim al chain of k lin ks con tribu tes k ( k total n u m ber of con served in tervals.
−
1) / 2 to the
F inally, we will want t o const ruct set s of conserved int ervals for t he union of two set s of permut at ions. Definit ion 1 implies t hat t he set of conserved int ervals
On t he Similarity of Set s of P ermut at ions and It s Applicat ions
73
of a union of two set s of permut at ions is t he int ersect ion of t heir set s of conserved int ervals. T he following proposit ion, shown in [5], relat es t hese set s t o t heir respect ive irreducible int ervals when bot h set s of permut at ions have at least one permut at ion in common. P ro p o s it io n 5 . Let P be a perm u tation that is con tain ed in both sets of perm u tation s G 1 an d G 2 . T he in terval [a , b] is a con served in terval of G = G 1 ∪ G 2 if an d on ly if there exist two chain s of irredu cible con served in tervals, with respect to P , with k ≥ 0, m ≥ 0:
[a , x 1 , . . . , x k , b] in [a , y 1 , . . . , y m , b] in T he in terval [a , b] is irredu cible if an d on ly if disjoin t.
{
G 1, G 2. x 1 , . . . , x k } an d { y 1 , . . . , y m } are
V a ria b le G e o m e t ry G e n o m e s . Alt hough t he definit ion of conserved int er-
vals was given for permut at ions t hat model genomes composed of single linear chromosomes, t hey can be adapt ed t o ot her types of genomes. For det ails, see [5].
4
A lg o rit h m s
T his sect ion discusses t hree algorit hms. T he first one is an adapt at ion of an exist ing algorit hm t hat comput es t he conserved int ervals of two permut at ions. T he second one comput es t he conserved int ervals of a set of permut at ions. T he t hird one, finally, comput es t he conserved int ervals of two set s of permut at ions, direct ly from t heir two individual set s of conserved int ervals. C o n s e rv e d I n t e rv a ls o f T w o P e rm u t a t io n s . Conserved int ervals between
two permut at ions are st rongly relat ed t o t he not ion of connect ed component s of t he overlap graph of a signed permut at ion. T his graph plays a fundament al role in t he sort ing by reversals problem [11], and t he sort ing by reversals and t ranslocat ions problem [12]. In t he last few years, linear algorit hms t o ident ify t hese component s have been devised [2]. T he following algorit hm is adapt ed from [4], and ident ifies all irreducible conserved int ervals2 [a , b] of a permut at ion π wit h t he ident ity permut at ion such t hat bot h a and b have posit ive sign in π . T he case of negat ive endpoint s is t reat ed by reversing π . For example, for t he permut at ion P
=
0
−
4
−
3
−
2 5 8 6 7 9
−
1 10,
Algorit hm 1 ident ifies t he posit ive irreducible conserved int ervals [6, 7], [5, 9], and [0, 10]. It will ident ify [2, 3] and [3, 4] on t he reversed permut at ion. 2
In t he original paper, t hese were called framed common i nter vals.
74
A. Bergeron and J . St oye
A lg o rit h m 1 (P osit ive irreducible int ervals wit h t he ident ity permut at ion) 1: st ack 0 on S 2: st ack n on M 3: M 0 ← n 4: f o r i = 1, . . . , n d o 5: / / Comput at ion of M i 6: unst ack from M all element s m smaller t han | π i | 7: M i ← m 8: st ack t he element | π i | on M 9: / / Ident ificat ion of irreducible int ervals 10: unst ack from S all indices s such t hat ( | π i | < π s or | π i | > M s ) 11: if i − s = π i − π s a n d M i = M s t h e n 12: out put [π s , π i ] 13: e n d if 14: i f π i is posit ive t h e n 15: st ack t he index i on S 16: e n d if 17: e n d f o r
T he algorit hm assumes t hat t he input permut at ion is in t he form π = (0, π 1 , . . . , π n − 1 , n ). Define M i t o be t he nearest unsigned element of t he permut at ion t hat precedes π i and is great er t han | π i | . (Set M i t o n , if such an element does not exist ). T he following lemma relat es t he values of M i t o conserved int ervals. L e m m a 1 . If [π s , π e ] is a positive con served in terval of π m u tation , then M s = M e .
an d the iden tity per-
T he algorit hm uses two st acks: S cont ains t he possible st art posit ions of conserved int ervals; M cont ains possible candidat es for M i . T he t op of S is always denot ed by s . T he t op of M is always denot ed by m . P ro p o s it io n 6 ( [4 , 5 ]) . A lgorithm 1 ou tpu ts the positive irredu cible con served in tervals of a perm u tation π with the iden tity perm u tation in O ( n ) tim e. C o ro lla ry 1 . B y apply in g A lgorithm 1 both to π = P − 1 ◦ Q an d to the reverse of π , the irredu cible con served in tervals of two perm u tation s P an d Q can be fou n d in O ( n ) tim e. C o n s e rv e d I n t e rv a ls o f a S e t o f P e rm u t a t io n s . In order t o find t he irre-
ducible conserved int ervals of a set of permut at ions, t he first st ep is t o comput e t he irreducible int ervals of each permut at ion wit h one part icular permut at ion from t he set , say π 1 , using Algorit hm 1, and t hen merge t oget her t he result ing set s of irreducible int ervals. For example, comput ing t he irreducible int ervals of t he set : I d = 0 1 2 3 4 5 6 7 8 9 10 P = 0 − 4 − 3 − 2 5 8 6 7 9 − 1 10 Q = 0 5 − 7 − 6 8 9 1 2 3 − 4 10
On t he Similarity of Set s of P ermut at ions and It s Applicat ions A lg o rit h m 2 (Irreducible int ervals of G 1 ∪
G 2,
75
bot h cont aining t he ident ity
permut at ion) 1: st ack 0 on S 2: f o r i = 1, . . . , n d o 3: i f t here is an int erval [x , i ] in I 1 t h e n 4: unst ack from S all element s larger t han x 5: e n d if 6: i f t here is an int erval [x , i ] in I 2 t h e n 7: unst ack from S all element s larger t han x 8: e n d if 9: i f s and i belong t o t he same chain bot h in I 1 and I 2 t h e n 10: unst ack s from S and out put [s , i ] 11: e n d if 12: i f t here is an int erval t hat st art s at i in I 1 , and one in I 2 t h e n 13: st ack i on S 14: e n d if 15: e n d f o r
would first yield t he two set s of maximal chains { [0, 10], [2, 3, 4][5, 9], [6, 7]} (of and t he ident ity) and { [0, 10], [1, 2, 3], [5, 8, 9], [6, 7]} (of Q and t he ident ity), respect ively, in graphic represent at ion: P
0
1
2 3 4
5
6 7
8
9
10
0
1 2 3
4
5
6 7
8 9
10
Assume t hat each set of irreducible conserved int ervals is given by it s maximal chains. Since t hese form part it ions of t he genes t hat are endpoint s of conserved int ervals, t here exist s a dat a st ruct ure wit h t he following propert ies: (1) For each index from 1 t o n , it is possible t o det ermine in const ant t ime t he int erval, if any, t hat st art s and/ or ends at t his index. (2) It is possible t o det ermine in const ant t ime if two int ervals belong t o t he same chain. Let I 1 and I 2 be two set s of irreducible conserved int ervals of set s of permut at ions G 1 and G 2 t hat have one permut at ion π 1 in common. For t he moment we will assume t hat π 1 is t he ident ity permut at ion. T hen Algorit hm 2 finds all irreducible conserved int ervals of G 1 ∪ G 2 . It uses a st ack S t hat cont ains possible st art posit ions – or, equivalent ly, element s of t he ident ity permut at ion. T he t op of t he st ack S is always denot ed by s . T he correct ness and t ime complexity of Algorit hm 2 are est ablished by t he following t heorem, whose proof can be found in [5]. T h e o re m 1 . A lgorithm 2 ou tpu ts the irredu cible in tervals of G = G 1 ∪ G 2 in O ( n ) tim e, given I 1 an d I 2 , the irredu cible in tervals of two sets of perm u tation s G 1 an d G 2 that both con tain the iden tity perm u tation . C o ro lla ry 2 . Let I 1 an d I 2 be the irredu cible in tervals of two sets of perm u tation s G 1 an d G 2 that both con tain a perm u tation P . T he irredu cible in tervals of G = G 1 ∪ G 2 can be fou n d in O ( n ) tim e by apply in g A lgorithm 2 to I 1′ = { [P − 1 ( a ) , P − 1 ( b)] | [a , b] ∈ I 1 } an d I 2′ = { [P − 1 ( a ) , P − 1 ( b)] | [a , b] ∈ I 2 } .
76
A. Bergeron and J . St oye
C o ro lla ry 3 . T he set of irredu cible con served in tervals of a set of perm u tation s G can be com pu ted in O ( | G | n ) tim e an d O ( n ) addition al space.
C o n s e rv e d I n t e rv a ls o f D is jo in t S e t s . F inally we are int erest ed in comput ing
t he conserved int ervals of two set s of permut at ions G 1 = { P 1 , . . . , P k } and G 2 = { Q 1 , . . . , Q m } t hat not necessarily have a permut at ion in common, given t heir set s of irreducible conserved int ervals I 1 and I 2 , respect ively. T his can be done in linear t ime by properly combining Algorit hms 1 and 2. T he idea is t o select one permut at ion from each set , say P 1 from G 1 and Q 1 from G 2 , and comput e t he conserved int ervals of t hese two by Algorit hm 1. T hen observe t hat t he two set s { P 1 , Q 1 } and G 1 = { P 1 , . . . , P k } have a joint permut at ion P 1 , and hence t heir common irreducible int ervals can be comput ed by Algorit hm 2. Similarly, { Q 1 , P 1 , . . . , P k } and G 2 = { Q 1 , . . . , Q m } cont ain a joint permut at ion Q 1 , so t heir common irreducible int ervals can also be comput ed by Algorit hm 2.
5
S im ila rit y a n d D is t a n c e
T he number of conserved int ervals of a set of permut at ions is a measure of similarity, but it can easily be t ransformed int o a dist ance between two permut at ions, or two set s of permut at ions. T he basic idea is t hat two set s of conserved int ervals can be compared wit h t he cardinality of t heir symmet ric diff erence. D e fi n it io n 3 . Let G 1 an d G 2 be two sets of perm u tation s on n elem en ts, with respectively N 1 an d N 2 con served in tervals. Let N be the n u m ber of con served in tervals in G 1 ∪ G 2 . T he int erval dist ance between G 1 an d G 2 is defi n ed by d ( G 1 , G 2 ) = N 1 + N 2 − 2N .
N ote: T he int erval dist ance sat isfies t he fundament al propert ies of a mat hemat ical dist ance since one can prove t hat t he relat ion is symmet ric, reflexive, and sat isfies t he trian gle in equ ality : d ( G 1 , G ′ ) + d ( G ′ , G 2 ) ≥ d ( G 1 , G 2 ). A det ailed comparison of t he int erval dist ance wit h ot her rearrangement dist ances can be found in [5]. T he behavior of t he int erval dist ance is a consequence of t he fact t hat it is aff ect ed be t he lengt h – or number of genes – involved in a rearrangement operat ion: short reversals, for example, are less dist urbing t han long ones. In part icular, t he amount of disrupt ion due t o a single rearrangement operat ion can readily be comput ed. For example, we have t he following: P ro p o s it io n 7 . S u ppose that P an d Q have n elem en ts, then : 1) if P is obtain ed from Q by reversin g k elem en ts, then the in terval distan ce between P an d Q is k ( n − k ) ; 2) if P is obtain ed from Q by tran sposin g two con secu tive blocks of a an d b elem en ts, then the in terval distan ce between P an d Q is ( a + b)( n − ( a + b)) + a b.
Since t he int erval dist ance is aff ect ed by lengt h, t he pract ice of collapsing ident ical st rips of genes should be quest ioned. Indeed, as we saw in t he example
On t he Similarity of Set s of P ermut at ions and It s Applicat ions
77
of Sect . 2, t he int egers result ing from such a t ransformat ion st and for st rips of genes t hat vary great ly in lengt h. We believe t hat whole genome comparison should use all available informat ion, and t hat lengt h of segment s is relevant t o t he st udy of rearrangement scenarios, as advocat ed in [19].
6
Lin k s W it h R e a rra n g e m e n t T h e o rie s
In Sect . 2, we gave an example of how conserved int ervals could be used t o evaluat e opt imal reversal scenarios between two genomes. Reversals are one of t he many operat ions t hat are current ly used t o model genome evolut ion: t he main ot her ones – among t hose t hat do not need t o model duplicat ion of genes – are t ransposit ions, reverse t ransposit ions, t ranslocat ions, fusions, and fissions. In t his sect ion, we want t o charact erize t he rearrangement operat ions, or scenarios, t hat preserve conserved int ervals: D e fi n it io n 4 . Let P an d Q be two perm u tation s, an d ρ a rearran gem en t operation applied to P y ieldin g P ′ . W e say that ρ preserves the con served in tervals of P an d Q if the con served in tervals of { P , Q } are con tain ed in those of { P ′ , Q } .
Keeping in mind t he graphical represent at ion of t he conserved int ervals, it is easy t o ident ify t he operat ions t hat preserve conserved int ervals: only rearrangement s wit hin blocks are preserving. To be more formal, not e t hat all operat ions, except fusions, dest roy some adjacencies t hat exist ed in t he original permut at ion: t he number and nat ure of t hese adjacencies is a key concept . D e fi n it io n 5 . Let ρ be a rearran gem en t operation that tran sform s P in to P ′ . A breakpoint of ρ is a pair of elem en ts that are adjacen t in P bu t n ot in P ′ .
In ot her words, breakpoint s are where one has t o cut P in order t o apply . Reversals and t ranslocat ions have 2 breakpoint s, t ransposit ions have 3, and fissions have 1. Consider t he irreducible int ervals of P and P ′ wit h respect t o P . Adjacencies in P eit her belong t o a (smallest ) irreducible int erval, or are free . For example, in t he diagram ρ
1
2 3
4
5
6
7 8
9 10
t he adjacency (3, 4) belongs t o t he int erval [1, 5], (2, 3) belongs t o [2, 3], and (8, 9) is free. Not e t hat when two or more adjacencies belong t o t he same irreducible int erval, t hen none of t hese adjacencies is conserved between P and P ′ . T h e o re m 2 ( [5 ]) . R eversals, tran sposition s, an d reverse tran sposition s are preservin g if an d on ly if all their breakpoin ts belon g to the sam e irredu cible in terval, or are free. T ran slocation s an d fi ssion s are preservin g if an d on ly if all their breakpoin ts are free.
It t urns out t hat most rearrangement operat ions used in opt imal scenarios are indeed preserving. It is out side t he scope of t his paper t o discuss t hese result s
78
A. Bergeron and J . St oye
in det ail: t hey involve t he cy cle st ruct ure of a permut at ion, which are special subset s of t he breakpoint s of a permut at ion P wit h respect t o a permut at ion P ′ . T he following result has been proved in various disguises in recent years [4,11, 14]: T h e o re m 3 . A ll the breakpoin ts of a cy cle belon g to the sam e irredu cible in terval.
In t he sort ing by reversals t heory, a sortin g reversal is defined as a reversal t hat decreases t he reversal dist ance by 1. It is shown [11,20] t hat t he breakpoint s of sort ing reversals, except for one type called com pon en t m ergin g, belong t o a single cycle, t hus we have: C o ro lla ry 4 . A ll sortin g reversals, except com pon en t m ergin g, are preservin g.
Component mergings are a rare type of reversals in opt imal scenarios: t hey break at least two irreducible int ervals, t hus t hey oft en involve long reversals. T he t heory of t ranslocat ions, fusions, and fissions [12,18] relies on t he propert ies of sort ing by reversals, t hus most sort ing reversals are preserving. F inally, t ransposit ions are a more delicat e mat t er since sort ing t ransposit ions are not (yet ) charact erized. Nevert heless, it is known t hat t ransposit ions t hat increase t he number of cycles – a desirable property when sort ing permut at ions – have all t heir breakpoint s in t he same cycle [3]. T hus we have: C o ro lla ry 5 . A ll tran sposition s that create two adjacen cies are preservin g.
7
C o n c lu s io n
We have int roduced a new similarity measure for permut at ions, based on t he concept of conserved int ervals. Conserved int ervals have very int erest ing propert ies wit h respect t o preserving t he usual genome rearrangement operat ions. We believe t hat conserved int ervals are a fundament al concept of rearrangement t heory: t hey provide t he unifying grounds t o underst and t he variety of operat ions t hat are used t o model genome evolut ion. Support ed by recent result s on t he expect ed size of rearranged genome segment s, one could go as far and claim t hat any rearrangement scenario t hat breaks conserved int ervals is mat hemat ical rambling wit hout connect ion t o evolut ionary reality.
R e fe re n c e s 1. Y. Ajana, J .-F . Lefebvre, E. R. M. T illier, and N. El-Mabrouk. Exploring t he set of all minimal sequences of reversals – an applicat ion t o t est t he replicat ion-direct ed reversal hypot hesis. In P roc. W A B I 2002, volume 2452 of L N CS, pages 300–315. Springer Verlag, 2002. 2. D. A. Bader, B. M. E. Moret , and M. Yan. A linear-t ime algorit hm for comput ing inversion dist ance between signed permut at ions wit h an experiment al st udy. J. Comp. B i ol. , 8(5):483–492, 2001.
On t he Similarity of Set s of P ermut at ions and It s Applicat ions
79
3. V. Bafna and P. A. P evzner. Sort ing by t ransposit ions. SI A M J. D i sc. M ath. , 11(2):224–240, 1998. 4. A. Bergeron, S. Heber, and J . St oye. Common int ervals and sort ing by reversals: A marriage of necessity. B i oi nfor mati cs, 18(Suppl. 2):S54–S63, 2002. (P roc. ECCB 2002). 5. A. Bergeron and J . St oye. On t he similarity of set s of permut at ions and it s applicat ion t o genome comparison. Report 2003-01, Technische Fakult ¨a t der Universit ¨a t Bielefeld, 2003. (Available at www.techfak.uni-bielefeld.de/ stoye/rpublications/report2003-01.pdf). 6. M. Blanchet t e, T . Kunisawa, and D. Sankoff . Gene order breakpoint evidence in animal mit ochondrial phylogeny. J. M ol. E vol. , 49(2):193–203, 1999. 7. J . L. Boore. Mit ochondrial gene arrangement source guide. www.jgi.doe.gov/programs/comparative/Mito top level.html. 8. K. S. Boot h and G. S. Lueker. Test ing for t he consecut ive ones property, int erval graphs and graph planarity using P Q -t ree algorit hms. J. Comput. Syst. Sci . , 13(3):335–379, 1976. 9. G. Bourque and P. A. P evzner. Genome-scale evolut ion: Reconst ruct ing gene orders in t he ancest ral species. G enome Res. , 12(1):26–36, 2002. 10. D. A. Christ ie. G enome Rear rangement P roblems. P hD t hesis, T he University of Glasgow, 1998. 11. S. Hannenhalli and P. A. P evzner. Transforming men int o mice (polynomial algorit hm for genomic dist ance problem). In P roc. F OCS 1995, pages 581–592. IEEE P ress, 1995. 12. S. Hannenhalli and P. A. P evzner. Transforming cabbage int o t urnip: P olynomial algorit hm for sort ing signed permut at ions by reversals. J. A CM , 46(1):1–27, 1999. 13. S. Heber and J . St oye. F inding all common int ervals of k permut at ions. In P roc. CP M 2001, volume 2089 of L N CS, pages 207–218. Springer Verlag, 2001. 14. H. Kaplan, R. Shamir, and R. E. Tarjan. A fast er and simpler algorit hm for sort ing signed permut at ions by reversals. SI A M J. Computi ng, 29(3):880–892, 1999. 15. J . D. Kececioglu and D. Sankoff . Effi cient bounds for orient ed chromosome inversion dist ance. In P roc. CP M 1994, volume 807 of L N CS, pages 307–325. Springer Verlag, 1994. 16. B. Larget , J . Kadane, and D. Simon. A Markov chain Mont e Carlo approach t o reconst ruct ing ancest ral genome rearrangement s. Technical report , Carnegie Mellon University, P it t sburgh, 2002. 17. B. M. E. Moret , A. C. Siepel, J . Tang, and T . Liu. Inversion medians out perform breakpoint medians in phylogeny reconst ruct ion from gene-order dat a. In P roc. W A B I 2002, volume 2452 of L N CS, pages 521–536. Springer Verlag, 2002. 18. M. Ozery-F lat o and R. Shamir. T wo not es on genome rearrangement s. J. B i oi nf. Comput. B i ol. , t o appear. 19. D. Sankoff . Short inversions and conserved gene clust ers. B i oi nfor mati cs, 18(10):1305–1308, 2002. 20. A. Siepel. An algorit hm t o find all sort ing reversals. In P roc. R E COM B 2002, pages 281–290. ACM P ress, 2002. 21. G. Tesler. Effi cient algorit hms for mult ichromosomal genome rearrangement . J. Comput. Syst. Sci . , 65(3):587–609, 2002. 22. T . Uno and M. Yagiura. Fast algorit hms t o enumerat e all common int ervals of two permut at ions. A lgor i thmi ca, 26(2):290–309, 2000.
O n A ll-S u b s t rin g s A lig n m e n t P ro b le m s Wei Fu 1 , Wing-Kai Hon 2 , and Wing-Kin Sung1 ⋆ 1
2
School of Comput ing, Nat ional University of Singapore, Singapore, { fuwei,ksung} @comp.nus.edu.sg, Depart ment of Comput er Science and Informat ion Syst ems, T he University of Hong Kong, Hong Kong, [email protected]
A b s t r a c t . Consider two st rings A and B of lengt hs n and m respect ively, wit h n ≪ m . T he problem of comput ing global and local alignment s between A and all m 2 subst rings of B can be solved by t he classical Needleman-Wunsch and Smit h-Wat erman algorit hms, respect ively, which t akes O ( m 2 n ) t ime and O ( m 2 ) space. T his paper proposes fast er algorit hms t hat t ake O ( m n 2 ) t ime and O ( m n ) space. T he improvement st ems from a compact way t o represent all t he alignment scores.
1
In t ro d u c t io n
Sequence comparisons have been st udied ext ensively for t he last few decades [4, 5]. Many useful met rics are defined, which find applicat ions in various areas. A lign m en t score is perhaps t he most popular met ric in t he lit erat ure. Examples of it s usages can be found in t ext processing, such as synt ax error correct ion [1] and spelling correct ion [3], or in comparing graphs [6]. Due t o t he breakt hrough in bio-t echnology in recent decades, biological sequences such as DNA, RNA or prot ein, are being rapidly produced in t he laborat ories everyday. Sequence comparison now plays an import ant role in ext ract ing useful informat ion from t hese raw biological dat a. Scient ist s are oft en int erest ed in comparing a short sequence (usually, a known gene or a mot if) wit h many subst rings in a long sequence (usually, a genome). In such scenario, it is good for us t o perform a preprocessing so t hat t he above kind of comparison between t he two st rings can be done effi cient ly aft erwards. T his mot ivat es t he All-Subst rings Alignment P roblem: Given two st rings A and B of lengt hs n and m respect ively, wit h n ≪ m , t he problem is t o find t he alignment scores between A and all subst rings B [i ..j ]. T he alignment can be global alignment , suffi x alignment , local alignment , or semi-global alignment . A naive solut ion t o t his problem is t o comput e t he alignment scores between A and all subst rings of B explicit ly using t he classical Needleman-Wunsch and Smit h-Wat erman algorit hms [7,9]. Such approach requires O ( m 2 n ) t ime and O ( m 2 ) space. T his paper solves t hese problems by devising an O ( m n 2 )-t ime algorit hm. T his is significant since n is much smaller t han m .
⋆
Research support ed in part by NUS Academic Research Grant R-252-000-119-112.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 80–89, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
On All-Subst rings Alignment P roblems
81
For global alignment , our improvement is from t he observat ion t hat , alt hough t he alignment s between A and diff erent subst rings of B vary, t heir scores can act ually be ‘ compressed’ under suit able t ransformat ion. P r ecisely, for any fixed prefix A [1..k ], t he global alignment scores between A [1..k ] and all subst rings of B can be st ored in O ( m n ) space inst ead of t he t rivial O ( m 2 ) space. We also show t hat t his compressed st ruct ure for A [1..k ] can be comput ed direct ly from t hat for A [1..k − 1]. T hese ideas lead t o our algorit hm, which is increment al in nat ure. Moreover, t he compressed st ruct ures t hemselves can serve as a compact index for st oring all t he global alignment scores between A and any subst ring of B , so t hat ret rieving a part icular value t akes O (log n ) t ime. For local, semi-global, and suffi x alignment s, we observe t hat among t he m 2 n alignment s between A [1..k ] and B [i ..j ] for all 1 ≤ k ≤ n and 1 ≤ i < j ≤ m , many of t hem are t he same. More precisely, t here are at most m n 2 useful values, which can be found in O ( m n 2 ) t ime. To ret rieve a part icular alignment score between A [1..k ] and B [i ..j ], we only need t o do a range maximum query over t hese O ( m n 2 ) value. T he organizat ion of t he paper is as follows. Sect ion 2 gives basic definit ions of t he problems. Sect ion 3 describes t he O ( m n 2 )-t ime algorit hm for solving t he All-Subst rings Global Alignment P roblem, while t he ot her alignment problems are discussed in Sect ion 4. Finally, Sect ion 5 concludes wit h some open problems. 2
P re lim in a rie s
We formally define some not at ions which are used t hroughout t he paper. D e fi n it io n 1 . [8] A n alignment between two sequ en ces is form ed by the in sertion of spaces in arbitrary location s alon g the sequ en ces so that they en d u p with the sam e len gth.
Having t he same lengt h, t he augment ed sequences of an alignment can be placed one over t he ot her, creat ing a mapping between charact ers or spaces in t he first sequence and charact ers or space in t he second sequence. In general, we assume t hat no space in one sequence is aligned wit h a space in anot her sequence. To measure t he similarity of an alignment , we need t he concept of score schem e . D e fi n it io n 2 . Let Σ den ote a set of characters an d let Σ ′ den ote Σ ∪ { ⊔ } , where the sym bol ⊔ represen ts a space. A score scheme over Σ is a fu n ction δ :Σ ′ × Σ ′ → Q, where Q den otes the set of ration al n u m bers.
Given a score scheme, t he score of an alignment is defined as follows. D e fi n it io n 3 . T he score of an align m en t is the su m m ation of the δ fu n ction over every pair of the correspon din g characters in the given align m en t.
We now define t he problems t hat we are int erest ed in t his paper. Let and B [1..m ] be two sequences of charact ers over an alphabet Σ .
A [1..n ]
82
W . Fu, W .-K. Hon, and W .-K. Sung
D e fi n it io n 4 . T he global alignment score between two sequ en ces is defi n ed as the score of the highest scorin g align m en t between the two sequ en ces. T he AllSubst rings Global Alignment P roblem on (A,B) is to fi n d the global align m en t scores between A an d an y su bstrin g of B . D e fi n it io n 5 . T he suffi x alignment score between two sequ en ces is defi n ed as the score of the highest scorin g align m en t between a su ffi x of on e sequ en ce an d a su ffi x of the other on e. T he All-Subst rings Suffi x Alignment P roblem on (A,B) is to fi n d the su ffi x align m en t scores between A an d an y su bstrin g of B . D e fi n it io n 6 . T he semi-global alignment score between two sequ en ces S an d T is defi n ed as the score of the highest scorin g align m en t between S an d a su bstrin g of T . T he All-Subst rings Semi-global Alignment P roblem on (A,B) is to fi n d the sem i-global align m en t scores between A an d an y su bstrin g of B . D e fi n it io n 7 . T he local alignment score between two sequ en ces is defi n ed as the score of the highest scorin g align m en t between a su bstrin g of on e sequ en ce an d a su bstrin g of the other on e. T he All-Subst rings Local Alignment P roblem on (A,B) is to fi n d the local align m en t scores between A an d an y su bstrin g of B .
3
A ll-S u b s t rin g s G lo b a l A lig n m e n t
In t his sect ion, we consider t he All-Subst rings Global Alignment P roblem on ( A , B ) between two sequences A [1..n ] and B [1..m ]. We first assume t he followng score scheme. 1. 2.
δ δ
( x , ⊔ ) = δ ( ⊔ , x ) = − 1. 1, if x = (x , y ) = − 1, if x =
y y
and and
x,y x,y
= =
⊔ ⊔
Let H k [i , j ] denot e t he global alignment score between a prefix A [1..k ] of A and a subst ring B [i ..j ] of B . Our problem is t hus equivalent t o finding all t he values H n [i , j ] for every 1 ≤ i ≤ j ≤ m . T his can be solved based on t he following lemma. Lem m a 1.
H
k
[i , j ] = max
[i , j − 1] + δ ( ⊔ , B [j ]) + δ ( A [k ], ⊔ ) 1 [i , j ] H k − 1 [i , j − 1] + δ ( A [k ], B [j ])
H
k
H
k −
T he framework of comput ing H n is simple: First comput e H 0 , t hen complet e t he mat rices H k for k = 1, 2, . . . , n . Not e t hat each H k has O ( m 2 ) ent ries, and each ent ry can be filled in O (1) t ime by Lemma 1. T hus, we get H n in O ( m 2 n ) t ime. For t he space, it t akes O ( m 2 ), since t o comput e any mat rix H k , we only need t o keep H k − 1 . When m is very large (which is common in t he problem we are modeling), t he above t ime and space complexit ies are not pract ical. We propose an alt ernat ive way t o solve t his problem in O ( m n 2 ) t ime and O ( m n ) space, making use of a simple modificat ion on t he mat rices. T he next sect ion shows such modificat ion, while t he det ails of t he new algorit hm is discussed aft erwards.
On All-Subst rings Alignment P roblems 3 .1
83
T r a n s fo r m a t io n o f H k ’ s
Inst ead of comput ing
H
k
’ s, we comput e anot her set of mat ricesF k ’ s as follows.
D e fi n it io n 8 . F k [i , j ] = H k [i , j ] + j
i
−
+ 1 + k.
Similar t o Lemma 1, we have a corresponding formula t hat relat es t he adjacent mat rices F k − 1 and F k .
Fact 1 .
F k [i , j
F k [i , j
] = max
−
1] ]
Fk
−
1 [i , j
Fk
−
1 [i , j −
1] + 2 + δ
( A [k ], B [j ])
Not e t hat H k [i , j ] can be ret rieved in const ant t ime given F k [i , j ]. T hus, our problem can be solved by finding all t he values of F n [i , j ]. Alt hough t he definit ion of F k looks similar t o H k , t he following propert ies make t he comput at ion of F k a bet t er choice over H k . F a c t 2 . For 1
≤
k
≤
n an d
1. F k [i , j ] ≤ F k [i , j + 1] 2. F k [i , j ] ≤ F k [i − 1, j ] 3. 0 ≤ F k [i , j ] ≤ 3k .
1≤
i
≤
if j + 1 ≤ if i ≥ 2
j
≤
m,
m
P roof. ( sketch.) St at ement 1 follows direct ly from Fact 1, and St at ement 2 can
be proved by induct ion on j . For St at ement 3, it can be proved as follows. In any highest -scoring global alignment of A [1..k ] and B [i ..j ], each charact er in A or B cont ribut e at least − 1 in t he alignment score, so H k [i , j ] ≥ − ( j − i + 1 + k ). T his implies F k [i , j ] ≥ 0. On t he ot her hand, t here are at least | j − i + 1 − k | charact er-space alignment , and at most k mat ching-charact er alignment . T hus H k [i , j ] ≤ k − | j − i + 1 − k | . T his implies t hat F k [i , j ] ≤ k + ( k + j − i + 1) − | j − i + i − k | = k + 2 min { k , j − i + 1} ≤ 3k . T he above fact s imply t hat t he values of F k are bounded and are monot onic increasing in each row (and decreasing in each column). We next give a relat ed definit ion, and t hen show t hat F k can be st ored in a compact manner. D e fi n it io n 9 . For each row i of the m atrix F k , a row int erval point is the valu e j su ch that F k [i , j − 1] < F k [i , j ]. N ote that we assu m e i ≤ j ≤ m . S im ilarly, for each colu m n j of the m atrix, a column int erval point s is the valu e i su ch that F k [i , j ] < F k [i − 1, j ]. L e m m a 2 . F k can be stored com pactly in O ( k m ) space. A n y valu e of F k [i , j ] can be qu eried in O (log k ) tim e.
P roof. For each row i of F k , we use an array of size 3k + 1 such t hat t he x -t h ent ry st ores t he smallest j wit h F k [i , j ] ≥ x . Not e t hat t hese values are in essence t he row int erval point s. As t here are m rows in F k , t he t ot al space is O ( k m ). Given such a represent at ion, each value of F k [i , j ] can be found by a binary search in t he array corresponding t o t he i -t h row. T he query t ime is O (log k ).
84 3 .2
W . Fu, W .-K. Hon, and W .-K. Sung C o m p u t a t io n o f F n
We aim at comput ing F n by first comput ing F 1 , and t hen F k based on F k − 1 effi cient ly for k = 2, 3, . . . , n . For each F k , inst ead of comput ing all t he ent ries, we comput e it s compact represent at ion as st at ed in Lemma 2. We first discuss t he comput at ion of t he compact form of F 1 . For any i , j such t hat 1 ≤ i ≤ j ≤ m , under t he current score scheme, we have − ( j − i + 2) if B [i ..j ] does not cont ain A [1] H 1 [i , j ] = − ( j − i − 1) if B [i ..j ] cont ains A [1] Accordingly, we have
F 1 [i , j
]=
0 3
if if
B [i ..j B [i ..j
] does not cont ain ] cont ains A [1]
A [1]
T hen, t o st ore F 1 , we just need t o keep an array L [1..m ] such t hat L [i ] st ores t he smallest j such t hat B [i ..j ] cont ains A [1]. In fact , L [i ] st ores t he only row int erval point of row i of F 1 (Recall t hat t here is one row int erval point in each row of F 1 ). Aft erwards, we can det ermine whet her t he value of F 1 [i , j ′ ] is 0 or 3 by comparing j ′ wit h L [i ], for any j ′ . T he array L can be comput ed easily by scanning B once as follows: 1. 2. 3. 4.
Init ialize all ent ries of L t o 0. Traverse B from B [1], B [2], . . . , B [m ], and set L [i ] = i if B [i ] = If L [m ] = 0, set L [m ] = m + 1. Examine L backwardly from L [m − 1], L [m − 2], . . . , L [1]. If L [k L [k − 1] = L [k ].
A [1]. −
1] = 0, set
T his gives t he following lemma. L e m m a 3 . T he com pact form of F 1 can be com pu ted in O ( m ) tim e an d O ( m ) space.
Next , we show how t o comput e t he compact form of F k from t hat of F k − 1 . First ly, based on Fact 1 and recursively expand t hs F k t erms on t he right side, we have an alt ernat ive definit ion of F k as follows: F k [i , j − 1] F k − 1 [i , j ] F k [i , j ] = max F k − 1 [i , j − 1] + 2 + δ ( A [k ], B [j ]) F k [i , j − 2] F k − 1 [i , j − 1] = max F k − 1 [i , j − 2] + 2 + δ ( A [k ], B [j − 1]) F k − 1 [i , j ] F k − 1 [i , j − 1] + 2 + δ ( A [k ], B [j ]) .. . maxi ≤ j ′ ≤ j F k − 1 [i , j ′ ] = max ′ ′ maxi + 1 ≤ j ′ ≤ j F k − 1 [i , j − 1] + 2 + δ ( A [k ], B [j ]) F k − 1 [i , j ] = max maxi + 1 ≤ j ′ ≤ j F k − 1 [i , j ′ − 1] + 2 + δ ( A [k ], B [j ′ ])
On All-Subst rings Alignment P roblems
85
T he above definit ion is int uit ively simpler t han t hat in Fact 1, as each ent ry of F k depends only on ent ries in F k − 1 . In cont rast , t he definit ion in Fact 1 relies on some ot her ent ries in F k it self. Now, let G k [i , j ] denot e maxi + 1 ≤ j ′ ≤ j F k − 1 [i , j ′ − 1]+ 2 + δ ( A [k ], B [j ′ ]), where we assume G k [i , j ] = 0 if i = j . T hen, we have F k [i , j
] = max{
T he crit ical part t o comput e O b s e r v a t io n 1 . For an y 1
1. G k [i , j ] ≤ G k [i , j + 1] 2. G k [i , j ] ≥ G k [i + 1, j ] 3. 0 ≤ G k [i , j ] ≤ 3k .
Fk k
≤
if if
Fk
−
1 [i , j ], G k [i , j ]} .
is t o comput e n an d
≤
j
≤
m
i
≥
2
−
1≤
i
Gk
. For
≤
j
≤
Gk
, we observe t hat
m,
1
P roof. ( sketch) St at ement 1 follows from definit ion of G k , while St at ement 2 can be proved by induct ion on j . For St at ement 3, since we have G k [i , j ] ≤ F k [i , j ] and G k [i , j ] ≥ F k − 1 [i , j − 1] + 2 + δ ( A [k ], B [j ]), it t hus follows immediat ely from Fact 2(3) t hat 0 ≤ F k [i , j ] ≤ 3k .
T hese observat ions suggest t hat G k can be st ored using row int erval point s. If we have collect ed all t he possible row int erval point s of G k , it is easy t o see t hat t hey can be merged wit h t hose of F k − 1 t o get t he compact form of F k , using t ime linear t o t he t ot al number of row int erval point s we consider. We now claim t hat in O ( k m ) t ime, we can find all t he possible row int erval point s of G k , and t he number of which is at most O ( k m ). Suppose t hat t his is t rue, we have t he following result s. L e m m a 4 . G iven the com pact form of F k − 1 , we can com pu te the com pact form of F k in O ( k m ) tim e an d O ( k m ) space. T h e o r e m 1 . T he com pact form of F n can be com pu ted in O ( m n 2 ) tim e an d O ( m n ) space.
P roof. Follows direct ly from Lemmas 3 and 4.
T he remaining part focuses on proving t he previous claim. First ly, we show a new property of G k . D e fi n it io n 1 0 . A corner point of the m atrix G k is a tu ple ( i , j ) satisfyin g G k [i , j
−
1]
G k [i + 1, j ] ≥ F k − 1 [i + 1, j − 1] + 2 + δ ( A [k ], B [j ]). T his implies i + 1 is a column int erval point of column j in F k − 1 .
T he above shows t hat t he number of possible row int erval point s for G k is at most O ( k m ), as t here are at most O ( k m ) column int erval point s in F k − 1 . T he following algorit hm complet es our claim by showing t hat t he column int erval point s of F k − 1 can be found from t he row int erval point s of F k − 1 in O ( k m ) t ime and O ( k m ) space. T he algorit hm for finding t he possible row int erval point s of G k is as follows. 1. Examine t he compact form, or t he row int erval point s, of F k − 1 . Comput e t he corn er poin ts of F k − 1 . 2. Sort t he corner point s ( i , j ) in t he descen din g order of j first , and t hen in descen din g order of i . 3. Comput e t he column int erval point s of F k − 1 from t he corner point s of F k − 1 . 4. Comput e t he possible column int erval point s of G k . 5. Comput e t he possible row int erval point s of G k . St ep 1 can be complet ed by processing t he row int erval point s of F k − 1 row by row. St ep 2 can be complet ed by bucket sort . St ep 3 can be complet ed by processing t he corner point s in t he sort ed order of St ep 2. We use L [j ][x ] st ores t he smallest i such t hat F k − 1 [i , j ] = x . Init ially, we set all t he O ( k m ) ent ries of L t o be 0. When we process ( i , j ), we let x = F k − 1 [i , j ] and fill L [j ′ ][x ] = i for j ′ = j , j + 1, . . . unt il it is not equal t o 0. T hen t he array L , and t hus t he column int erval point s, will be set correct ly. (T he correct ness is post poned in t he full paper.) St ep 4 can be complet ed based on Observat ion 2. For St ep 5, it convert s t he possible column int erval point s of G k t o t he possible row int erval point s of G k , which can be done by a similar approach as St ep 1 t hrough St ep 3, which convert s t he row int erval point s of F k − 1 t o t he column int erval point s. Finally, all t he above st eps t ake O ( k m ) t ime and O ( k m ) space. T his complet es t he proof of t he claim. 3 .3
G e n e r a liz in g t h e S c o r e S c h e m e
Finally, we consider t he general score scheme as follows. 1. 2.
δ δ
(x , ⊔ ) = δ (⊔ , x ) = − β . 1, if x = (x , y ) = − α , if x =
y y
and and
x,y x,y
= =
⊔ ⊔
where we consider α and β t o be rat ional numbers. By set t ing F k [i , j ] = H k [i , j ] + ( j − i + 1 + k ) β + as before, we have t he following t heorem.
kα
, and using similar t ricks
T h e o r e m 2 . U n der the gen eral score schem e, the A ll-S u bstrin gs G lobal A lign m en t P roblem can be solved in O ( m n 2 ) tim e an d O ( m n ) space.
On All-Subst rings Alignment P roblems
4
87
O t h e r A lig n m e n t P ro b le m s
Given two st rings A [1..n ] and B [1..m ], t his sect ion discusses t he All-Subst rings Alignment P roblem for suffi x, semi-global, and local alignment . Denot e C k [i , j ], D k [i , j ], and E k [i , j ] be t he suffi x alignment score, t he semi-global alignment score and t he local alignment score between A [1..k ] and B [i ..j ], respect ively. Our problem is t o comput e C k [i , j ], D k [i , j ], and E k [i , j ] for all 1 ≤ k ≤ n and 1 ≤ i ≤ j ≤ m . T he t hree lemmas below st at e t he recursive equat ions for C k [i , j ], D k [i , j ], and E k [i , j ]. Lem m a 5.
C k [i , j
C k [i , j
] = max
Ck
−
Ck
−
− 1] + δ ( ⊔ , B [j ]) [ i , j ] + δ ( A [k ], ⊔ ) 1 [ i , j − 1] + δ ( A [k ], B [j ]) 1
Lem m a 6.
D
k [i , j ] = max
[i , j − 1] + δ ( A [k ], ⊔ ) k − 1 [i , j ] C k − 1 [i , j − 1] + δ ( A [k ], B [j ])
D
k
D
if
A [k ] = B [j
]
if
A [k ] = B [j
]
Ck
,
Ek
Lem m a 7.
E k [i , j
E k [i , j
] = max
1] ]
−
Ek
−
1 [i , j
Ck
−
1 [i , j −
1] + δ ( A [k ], B [j ])
Using t he generalized score scheme as in Sect ion 3.3, t he following lemma. L e m m a 8 . For an y i , j , k (1
1. C k [i , j ] = C k [j − ⌊ k / β 2. D k [i , j ] = max i ≤ i ′ ≤ j − 3. E k [i , j ] = max i ≤ i ′ ≤ j −
⌋
−
k
≤
k, j
]
≤
(k +
⌊ k / β
(k +
⌊ k / β ⌋
⌋
n ,1
i
≤
j
≤
k
m ) su ch that j
, and
−
i
≥
sat isfy
k+ ⌊ k/ β ⌋
,
[i ′ , i ′ + ( k + ⌊ k / β ⌋ )] E k [i ′ , i ′ + ( k + ⌊ k / β ⌋ )]
) D )
≤
D
k
P roof. For St at ement 1, consider t he suffi x alignment between A [1..k ] and B [i ..j ] which achieves t he highest score (say, A [i 1 ..k ] wit h B [i 2 ..j ]). Since any suffi x of A [1..k ] is of lengt h at most k , t he suffi x alignment cont ains at most k pairs of mat ching charact ers, which cont ribut es at most score k t o t he alignment . On t he ot her hand, since t he alignment score must be at least 0, t he suffi x alignment can cont ain at most ⌊ k / β ⌋ pairs of charact er-space mat ch. T hus, j − i 2 + 1 ≤ k + ⌊ k / β ⌋ , and if j − i ≥ k + ⌊ k / β ⌋ , we have C k [i , j ] = C k [j − k − ⌊ k / β ⌋ , j ]. St at ement s 2 and 3 can be proved similarly.
88
W . Fu, W .-K. Hon, and W .-K. Sung C o m p u t in g C k ’ s
4 .1
By Lemma 8(1), we observe t hat many C k [i , j ] values are redundant . P recisely, we only need t o comput e C = { C k [i , j ] | 1 ≤ k ≤ n and j − i ≤ k + ⌊ k / β ⌋ } , while t he ot her ent ries can be derived by Lemma 8(1). T hus, we have L e m m a 9 . W e can com pu te the valu es in
C
in O ( m n 2 ) tim e an d O ( m n ) space.
P roof. For each k = 1, 2, . . . , n , we can apply Lemma 5 t o comput e t hose C k [i , j ]
wit h
j
−
i
≤
k
+ ⌊
k/ β
in ⌋
O (k m )
t ime and
O (k m )
L e m m a 1 0 . G iven the valu es in C , for an y 1 C k [i , j ] can be retrieved in O (1) tim e.
space. T he lemma t hus follows. ≤
k
n an d
≤
1
≤
i
≤
j
P roof. If j − i ≤ k + ⌊ k / β ⌋ , C k [i , j ] is available in C . Ot herwise, if j − i > k + ⌊ by Lemma 8(1), C k [i , j ] = C k [j − ( k + ⌊ k / β ⌋ ) , j ], which is available in C . 4 .2
≤
k/ β
m,
⌋
,
C o m p u t in g D k ’ s a n d E k ’ s
Similar t o C k , many D k ’ s and E k ’ s ent ries are redundant . We act ually require t o comput e t he following two set s of values: D = { D k [i , j ] | 1 ≤ k ≤ n and j − i ≤ ( k + ⌊ k / β ⌋ ) } and E = { E k [i , j ] | 1 ≤ k ≤ n and j − i ≤ ( k + ⌊ k / β ⌋ ) } . T he ot her D k and E k values can be derived using Lemma 8(2) and 8(3). T he lemma below indicat es t hat D and E can be found in O ( m n 2 ) t ime. L e m m a 1 1 . W e can com pu te the valu es in space.
D
an d
E
in O ( m n 2 ) tim e an d O ( m n )
P roof. By Lemmas 9 and 10, aft er an O ( m n 2 ) t ime preprocessing, each C k [i , j ]
can be ret rieved in O (1) t ime. T hen given C k , all ent ries in D and E can be comput ed in O ( m n 2 ) t ime and O ( m n ) space, using dynamic programming based on Lemmas 6 and 7. Given D and E , t he following lemmas imply t hat ret rieved effi cient ly aft er a preprocessing. L e m m a 1 2 . G iven 1 ≤ k ≤ n an d 1 ≤ i
D ≤
D
k
[i , j ] and
E k [i , j
] can be
, we can do an O ( m n ) tim e preprocessin g so that, for all j ≤ m , D k [i , j ] can be retrieved in O (1) tim e.
P roof. For j − i ≤ k + ⌊ k / β ⌋ , t he values D k [i , j ]’ s are available in D and t hey can be ret rieved in O (1) t ime. For j − i > k + ⌊ k / β ⌋ , by Lemma 8(2), D k [i , j ] = maxi ≤ i ′ ≤ j − ( k + ⌊ k / β ⌋ ) D k [i ′ , i ′ + ( k + ⌊ k / β ⌋ )]. T his is a range maximum query over an array of m numbers. By Lemma 7 of [2], aft er an O ( m ) t ime preprocessing, we obt ain an auxiliary dat a-st ruct ure so t hat D k [i , j ] can be ret rieved in O (1) t ime. We need t o do such preprocessing for k = 1, 2, . . . , n . T hus, t he t ot al preprocessing t ime is O ( m n ).
On All-Subst rings Alignment P roblems L e m m a 1 3 . G iven 1 ≤ k ≤ n an d 1 ≤ i
E ≤
89
, we can do an O ( m n ) tim e preprocessin g so that, for all j ≤ m , E k [i , j ] can be retrieved in O (1) tim e.
P roof. Similar t o Lemma 12.
We conclude t his sect ion wit h t he following t heorem. T h e o r e m 3 . T he A ll-S u bstrin gs S u ffi x/ S em i-global/ Local A lign m en t P roblem s can be solved in O ( m n 2 ) tim e an d O ( m n ) space.
P roof. T he t ime complexity follows direct ly from Lemmas 9, 12, and 13. T he
space complexity follows from t he fact t hat only require only t he mat rices C n , D n and E n . 5
O (m n )
space is needed if we
C o n c lu s io n
Given two st rings A [1..n ] and B [1..m ], wit h n ≪ m , t his paper consider t he problems of comput ing t he global, local, semi-global, and suffi x alignment s between A and all m 2 subst rings of B . T his paper proposes an O ( m n 2 )-t ime algorit hm t o solve t hese problems. Since n ≪ m , t his improves t he previous best algorit hms which t ake O ( m 2 n ) t ime. T he improvement st ems from a compact represent at ion of all alignment scores. One fut ure work is t o include t he affi ne or t he convex gap penalty int o t he alignment score scheme. Such enhancement is useful and import ant t o biological applicat ions. R e fe r e n c e s 1. A. V. Aho and T . G. P et erson. A Minimum Dist ance Error-Correct ing P arser for Cont ext -Free Languages. SI A M J ou r n al on C om pu t i n g, 1(4):305–312, 1972. 2. M. A. Bender and M. Farach-Colt on. T he LCA P roblem Revisit ed. In L at i n A m er i can Sym posi u m on T heor et i cal I n for m at i cs, pages 88–94, 2000. 3. M. W . Du and S. C. Chang. A Model and a Fast Algorit hm for Mult iple Errors Spelling Correct ion. A ct a I n for m at i ca , 29(3):281–302, 1992. 4. D. Gusfield. A lgor i t hm s on St r i n gs, T r ees an d Sequ en ces: C om pu t er Sci en ce an d C om pu t at i on al B i ology . P ress Syndicat e of t he University of Cambridge, 1997. 5. J . B. Kruskal. An Overview of Sequences Comparison. In D. Sankoff and J . B. Kruskal, edit ors, T i m e W ar ps, St r i n g E di t s an d M acr om olecu les: t he T heor y an d P r act i ce of Sequ en ce C om par i son , pages 1–44. Addison-Wesley, 1983. 6. S. Y. Lu and K. S. Fu. Error-Correct ing Tree Aut omat a for Synt act ic P at t ern Recognit ion. I E E E T r an sact i on s on C om pu t er s, C-27:1040–1053, 1978. 7. S. B. Needleman and C. D. Wunsch. A General Met hod Applicable t o t he Search for Similiarit ies in t he Amino Acid Sequences of T wo P rot eins. J ou r n al of M olecu lar B i ology , 48:443–453, 1970. 8. J . Seit ubal and J . Meidanis. I n t r odu ct i on t o C om pu t at i on al B i ology . P W S P ublishing Company, 1997. 9. T . F . Smit h and M. S. Wat erman. Comparison of Biosequences. A dvan ces i n A ppli ed M at hem at i cs, 2:482–489, 1981.
T h e S p e c k e r- B la t t e r T h e o re m R e v is it e d E. Fischer ⋆ and J .A. Makowsky⋆
⋆
Faculty of Comput er Science Technion - Israel Inst it ut e of Technology Haifa, Israel
In t his paper we st udy t he generat ing funct ion of classes of graphs and hypergraphs modulo a fixed nat ural number m . For a class of labeled graphs C we denot e by f C ( n ) t he number of st ruct ures of size n . For C definable in Monadic Second Order Logic M S O L wit h unary and binary relat ion symbols only, E. Specker and C. Blat t er showed in 1981 t hat for every m ∈ N, f C ( n ) sat isfies a linear recurrence relat ion A b st r a c t .
f
C(n ) =
dm j
(m )
aj
f
C(n −
j ),
=1
over Zm , and hence is ult imat ely periodic for each m . In t his paper we show how t he Specker-Blat t er T heorem depends on t he choice of const ant s and relat ions allowed in t he definit ion of C . Among t he main result s we have t he following: – For n -ary relat ions of degree at most d , where each element a is relat ed t o at most d ot her element s by any of t he relat ions, a linear recurrence relat ion holds, irrespect ive of t he arity of t he relat ions involved. – In all t he result s M S O L can be replaced by C M S O L , Monadic Second Order Logic wit h (modular) Count ing. T his covers many new cases, for which such a recurrence relat ion was not known before.
1
I n t ro d u c t io n a n d M a in R e s u lt s
Count ing ob ject s of a specified kind belongs t o t he oldest act ivit ies in mat hemat ics. In part icular, count ing t he number of (labeled or unlabeled) graphs sat isfying a given property is a classic undert aking in combinat orial t heory. T he first deep result s for count ing unlabeled graphs are due t o J .H. Redfield (1927) and t o G. Polya (1937), but were only popularized aft er 1960. F. Harary, E.M. Palmer and R.C. Read unified t hese early result s, as wit nessed in t he st ill enjoyable [HP 73]. It is unfort unat e t hat a remarkable t heorem due t o E. Specker on count ing labeled graphs (and more generally, labeled binary relat ional st ruct ures), first ⋆
⋆ ⋆
P art ially support ed by t he VP R fund – Dent Charit able Trust – non-milit ary research fund of t he Technion-Israeli Inst it ut e of Technology. P art ially support ed by a Grant of t he Fund for P romot ion of Research of t he Technion-Israeli Inst it ut e of Technology.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 90–101, 2003. c Sp r in ger -Ver la g B er lin H eid elb er g 2003
T he Specker-Blat t er T heorem Revisit ed
91
announced by C. Blat t er and E. Specker in 1981, cf. [BS81,BS84,Spe88], has not found t he at t ent ion it deserves, bot h for t he beauty of t he result and t he ingenuity in it s proof. E. Specker and C. Blat t er look at t he funct ion f C ( n ) which count s t he number of labeled relat ional st ruct ures of size n wit h k relat ions R 1 , . . . , R k , which belong t o a class C . We shall call t his funct ion t he density function for C . It is required t hat C be definable in Monadic Second Order Logic and t hat t he relat ions are all unary or binary relat ions. T he t heorem says t hat under t hese hypot heses t he funct ion f C ( n ) sat isfies a linear recurrence relat ion modulo m for every m ∈ Z. Special cases of t his t heorem have been st udied ext ensively, cf. [HP 73,Ges84, Wil90] and t he references t herein. However, t he possibility of using a formal logical classificat ion as a means t o collect many special cases seems t o have most ly escaped not ice in t his case. In t he present paper, we shall discuss bot h t he Specker-Blat t er t heorem, and it s variat ions and limit s of generalizabilty. In t he long survey version of t he paper, [FM] we shall also give numerous examples, most ly t aken from [HP 73,Ges84,Wil90], which in t urn provide combinat orial corollaries t o t he Specker-Blat t er T heorem. P roving direct ly t he linear recurrence relat ions over every modulus m for all t he given examples would have been a nearly impossible undert aking. We should also not e t hat count ing st ruct ures up t o isomorphism is a very diff erent t ask, cf. [HP 73]. From P roposit ion 8 below one can easily deduce t hat t he Specker-Blat t er T heorem does not hold in t his set t ing. 1.1
C ount ing Lab eled St ruct ures
Let R¯ = { R 1 , . . . , R ℓ } be a set of relat ion symbols where each R i is of arity ρ ( i ). Let C be a class of relat ional R¯ -st ruct ures. For an R¯ -st ruct ure A wit h universe A we denot e t he int erpret at ion of R i by R i ( A ). We denot e by f C ( n ) t he number of st ruct ures in C over t he labeled set A n = { 1, . . . , n } , i.e., f C ( n ) = | { ( R 1 ( A n ) , . . . , R ℓ ( A n )) : A n , R 1 ( A n ) , . . . , R ℓ ( A n ) ∈
C} |
.
T he not ion of R¯ -isomorphism is t he expect ed one: T wo st ruct ures A, B are isomorphic, if t here is a biject ion between t heir respect ive universes which preserves relat ions in bot h direct ions. P rov iso: When we speak of a class of st ruct ures C , we always assume t hat C is closed under R¯ -isomorphisms. However, we count two isomorphic but diff erent ly labeled st ruct ures as two diff erent members of C . 1.2
Logical Form alism s
First Order Logic F OL ( R¯ ), Monadic Second Order Logic M SOL ( R¯ ), and Count ing Monadic Second Order Logic C M SOL ( R¯ ) are defined as usual, cf. [EF95]. A class of R¯ -st ruct ures C is is called F OL ( R¯ ) -definable if t here exist s an F OL ( R¯ ) formula φ wit h no free (non-quant ified) variables such t hat for every A we have
92
E. F ischer and J .A. Makowsky
A ∈ C if and only if A |= φ . Definability for M SOL ( R¯ ) and C M SOL ( R¯ ) is defined analoguously. We shall also look at two variat ions1 of C M SOL ( R¯ ), and analogously for F OL and M SOL . T he first variat ion is denot ed by C M SOL l ab( R¯ ), where t he set of relat ion symbols is ext ended by an infinit e set of const ant symbols ci , i ∈ N. In a labeled st ruct ure over { 1, . . . , n } t he const ant ci , i ≤ n is int erpret ed as i . If φ ∈ M SOL l ab( R¯ ) and ck is t he const ant occurring in φ wit h largest index, t hen t he universe of a model of φ has t o cont ain t he set { 1, . . . , k } . T he second variat ion is denot ed by C M SOL or d ( R¯ ), where t he set of relat ion symbols is augment ed by a binary relat ion symbol R < which is int erpret ed on { 1, . . . , n } as t he nat ural order 1 < 2 < · · · < n . Ex am ples 1. Let R¯ consist of one binary relation sym bol R . ( i) ( ii)
C = ORD , the class of all linear orders, satisfies f O R D ( n ) = n !. ORD is F OL ( R ) -definable. In F OL l ab we can look at the above property and additionally require by a form ula φ k that the elem ents 1, . . . , k ∈ [n ] indeed occupy the first k positions of the order defined by R , preserving their natural order. It is easily seen that f O R D ∧ φ ( n ) = ( n − k )!. In F OL or d we can express even m ore stringent com patibilities of the order with the natural order of { 1, . . . , n } . For C = GRA P H S , the class of sim ple graphs ( without loops or m ultiple k
( iii)
edges) , f G R A P H S ( n ) = 2( ) . GRA P H S is F OL ( R ) -definable. T he class RE G r of sim ple regular graphs where every vertex has degree r is F OL -definable ( for any fixed r ) . Counting the num ber of labeled regular graphs is treated com pletely in [HP 73, Chapter 7]. For cubic graphs, the function is explicitly given in [HP 73, page 175] as f R (2n + 1) = 0 and n
2
( iv)
3
f R (2n ) = 3
( v)
(2n )! 6n
j ,k
( − 1) j (6k − 2j )!6j 48k (3k − j )!(2k − j )!( n − k )!
which is ultim ately 0 for every m odulus m . T he class C ON N of all connected graphs is not F OL ( R ) -definable, but it is M SOL ( R ) -definable using a universal quantifier over set variables. For C ON N [HP 73, page 7] gives the following recurrence:
f C O N N ( n ) = 2( ) n
2
( vi)
1
i
( − 1) i j ! ( j − 2i )!i !
−
n− 1
n
1
k= 1
k
n ( 2 k
n
−
2
k
)f
C ON N
(k ).
Counting labeled connected graphs is treated in [HP 73, Chapter 1] and in [W il90, Chapter 3]. B ut our T heorem 5 will give directly, that for every m this functionis ultim ately 0 m odulo m .
In [Cou90] anot her version, M S O L 2 is considered, where one allows also quant ificat ion over set s of edges. T he Specker-Blat t er T heorem does not hold in t his case, as t he class C B I P E Q of complet e bipart it e graphs Kn , n wit h bot h part s of equal size is definable in M S O L 2 and f C B I P E Q (2n ) = 21 2nn .
T he Specker-Blat t er T heorem Revisit ed
93
( vii) Let C = B I P E Q be the class of sim ple bipartite graphs with m elem ents on each side ( hence n = 2m ) . B I P E Q is not C M SOL ( R ) -definable. However, the class B I P of bipartite graphs with unspecified num ber of vertices on each side is M SOL -definable. A gain this is treated in [HP 73, Chapter 1]. ( viii) Let C = E V E N D E G be the class of sim ple graphs where each vertex has an even degree. E V E N D E G is not M SOL -definable, but it is C M SOL definable. f E V E N D E G ( n ) = 2( ) , cf. [HP 73, page 11]. Let C = E U L E R be the class of sim ple connected graphs in E V E N D E G . E U L E R is not M SOL -definable, but it is C M SOL -definable. In [HP 73, page 7] a recurrence form ula for the num ber of labeled eulerian graphs is given. ( ix) Let C = E QC L I QU E be the class of sim ple graphs which consist of two disjoint cliques of the sam e size. T hen we have f E Q C L I Q U E (2n ) = 12 2nn and f E Q C L I Q U E (2n + 1) = 0. E QC L I QU E is not even C M SOL ( R ) definable, but it is definable in Second Order Logic SOL , when we allow quantification also over binary relations. W e can m odify C = E QC L I QU E by adding another binary relation sym bol R 1 and expressing in F OL ( R 1 ) that R 1 is a bijection between the two cliques. W e denote the resulting class of structures by C = E QC L I QU E 1 . f E Q C L I Q U E (2n ) = n ! 12 2nn and f E Q C L I Q U E (2n + 1) = 0. A further m odification is C = E QC L I QU E 2 , which is F OL or d ( R, R 1 ) definable. W e require additionally that the bijection R 1 is such that the first elem ents ( in the order R < ) of the cliques are m atched, and if ( v1 , v2 ) ∈ R 1 then the R < - successors ( suc( v1 ) , suc( v2 )) ∈ R 1 . T his m akes the m atching unique ( if it exists) , and we have f E Q C L I Q U E ( n ) = f E Q C L I Q U E ( n ) . Sim ilarly, we can look at E Q m C L I QU E , E Q m C L I QU E 1 and E Q m C L I QU E 2 respectively, where we require m equal size cliques instead of two. Here we also have f E Q C L I Q U E ( n ) = f E Q C L I Q U E ( n ) . n
−
1
2
1
1
2
m
m
2
T he non-definability st at ement s are all relat ively easy, using Ehrenfeucht -Fra¨ıss´e Games, cf. [EF95]. 1.3
T he Sp ecker-B lat t er T heorem
T he following remarkable t heorem was announced in [BS81], and proven in [BS84,Spe88]: T heorem 1 ( Sp ecker and B lat t er, 1981) . Let C be definable in M onadic Second Order Logic with unary and binary relation sym bols only. For every m ∈ (m ) N, there are dm , aj ∈ N such that the function f C satisfies the linear recurrence relation f C ( n ) m odulo m .
≡
dm j=1
(m )
aj
f C (n − j )
(mod m ) , and hence is ultim ately periodic
T he case of t ernary relat ion symbols, and more generally of arity k ≥ 3, was left open in [BS84,Spe88] and appears in t he list of open problems in Finit e Model
94
E. F ischer and J .A. Makowsky
T heory, [Mak00, P roblem 3.5]. Count erexamples for quat ernary relat ions were first found by E. Fischer, cf. [Fis03]. T heorem 2 ( F ischer, 2002) . For every prim e p there exists a class of structures C p which is definable in first order logic by a form ula φ I m , with one binary relation sym bol E and one quaternary relation sym bol R , such that f C is not ultim ately periodic m odulo p. p
p
From t his t heorem t he exist ence of such classes are easily deduced also for every non-prime number m (just t ake p t o be a prime divisor of m ). T he proof of t he t heorem is based on t he class E Q p C L I QU E from Example (1) above. 1.4
Im provem ent s and Variat ions
T he purpose of t his paper is t o explore variat ions and ext ensions of t he SpeckerBlat t er T heorem. First , we not e t hat in t he case of unary relat ions symbols, M SOL or d and C M SOL or d have t he same expressive power, [Cou90], and M SOL or d -sent ences define exact ly t he regular languages. Sch¨u t zenberger’ s T heorem charact erizes regular languages in t erms of t he propert ies of t he power series of t heir generat ing funct ion. T he property in quest ion is N-rat ionality, which implies rat ionality. For det ails t he reader should consult [BR84] and for const ruct ive versions [BDFR01]. Hence, t he Specker-Blat t er T heorem has an import ant precursor in formal language t heory, reformulat ed for our purposes as: T heorem 3 ( Sch u ¨ t zenb erger) . For any C definable in Counting M onadic Second Order Logic with an order, C M SOL or d ( R¯ ) , where R¯ contains only unary relations, the function f C satisfies d a linear recurrence relation f C ( n ) = j = 1 aj f C ( n − j ) over the integers Z, and in particular satisfies the sam e relation for every m odulus m .
Next we ext end t he Specker-Blat t er T heorem t o allow C M SOL , rat her t hen M SOL .
T heorem 4. For any
C definable in Counting M onadic Second Order Logic ( C M SOL ) with unary and binary relation sym bols only, the function f C sat d (m ) isfies a linear recurrence relation f C ( n ) ≡ f C ( n − j ) (mod m ) , for j = 1 aj every m ∈ N. m
T he proof is sket ched in Sect ion 3.2. T heorem 4 covers cases not covered by t he Specker-Blat t er T heorem (T heorem (1). Alt hough E V E N D E G is not M SOL -definable, it is C M SOL definable, and it s funct ion sat isfies f E V E N D E G ( n + 1) = f G R A P H S ( n ). However, it seems not very obvious t hat t he funct ion f E U L E R sat isfies modular recurrence relat ions. Finally, we st udy t he case of relat ions of bounded degree. D efinit ion 1. ( i)
G iven a structure A = A , R 1A , . . . , R kA , u ∈ A is called a neighbor of v ∈ A if there exists a relation R iA and som e a ¯ ∈ R iA containing both u and v .
T he Specker-Blat t er T heorem Revisit ed
95
( ii) W e define the Gaifman graph Gai f (A) of a structure A as the graph with the vertex set A and the neighbor relation defined above. ( iii) T he degree of a vertex v ∈ A in A is the num ber of its neighbors. T he degree of A is defined as the m axim um over the degrees of its vertices. It is the degree of its G aifm an graph Gai f (A) . ( iv) A structure A is connect ed if its G aifm an graph Gai f (A) is connected.
T heorem 5. For any
C definable in Counting M onadic Second Order Logic C M SOL , with all relations in all m em bers of C being of bounded degree d, the d (m ) function f C satisfies a linear recurrence relation f C ( n ) ≡ f C (n − j ) j = 1 aj (mod m ) , for every m ∈ N. Furtherm ore, if all the m odels in C are connected, then f C = 0 (mod m ) for m ∈ N large enough. m
T he proof is given in Sect ion 4.
2 2.1
V a ria t io n s a n d C o u n t e re x a m p le s W hy M o dular R ecurrence?
T heorem 1 provides linear recurrence relat ions modulo m for every m ∈ N. T heorem 3 provides a uniform linear recurrence relat ion over Z. For t he following F OL -definable C , wit h one binary relat ion symbol, f C ( n ) does not sat isfy a linear recurrence over Z: t he class of all binary relat ions over any finit e set , for which f C ( n ) = 2n , and t he class of all linear orders over any finit e set , for which f C ( n ) = n !. T his follows from t he well known fact , cf. [LN83], t hat every funct ion f : Z → k Z, which sat isfies a linear recurrence relat ion f ( n + 1) = i = 0 ai f ( n − i ) over Z, grows at most exponent ially, i.e. t here is a const ant c ∈ Z such t hat f ( n ) ≤ 2cn . 2
2.2
Triv ial R ecurrence R elat ions
We say t hat a funct ion f ( n ) sat isfies a trivial m odular recurrence if t here are funct ions g( n ) , h ( n ) wit h g( n ) t ending t o infinity such t hat f ( n ) = g( n )! · h ( n ). We call t his a t rivial recurrence, because it is equivalent t o t he st at ement t hat for every m ∈ N and large enough n , f ( n ) ≡ 0 (mod m ). T he most obvious example is t he number of labeled linear orderings, given by f or d ( n ) = n ! and g( n ) = f ( n ). Clearly, also f E Q C L I Q U E ( n ) and f R E G ( n ) sat isfy t rivial modular recurrences. For t he class of all graphs t he recurrences are non-t rivial. More generally, for a set of relat ion symbols R¯ wit h k j many j -ary relation symbols, t he set of all labeled st ruct ures on n element s is given by f R¯ ( n ) = 2 k n which is only divisible by 2. It follows immediat ely t hat 1
3
j
j
j
Observat ion 6. If C is a class of R¯ -structures, and C¯ its com plem ent, then at least one of f C ( n ) or f C¯ ( n ) does not satisfy the trivial m odular recurrence relations.
96
E. F ischer and J .A. Makowsky
2.3
Ex ist ent ial Second Order Logic Is t o o St rong
T he example E Q p C L I QU E , cf. Example 1 (1) is definable in Second Order Logic wit h exist ent ial quant ificat ion over one binary relat ion, but it is not C M SOL definable. Let p be a prime number bp ( n ) = f E Q C L I Q U E ( n ) = f E Q C L I Q U E ( n ) t he number of graphs wit h [n ] as a set of vert ices which are disjoint unions of exact ly p same-size cliques, t hat is, bp ( n ) = f E Q C ( n ), As an example for p = 2, not e t hat b2 (2k + 1) = 0 and b2 (2k ) = 12 k2 for every k . p
p
2
p
P rop osit ion 7. For every n which is not a power of p, we have bp ( n ) ≡ 0 (mod p) , and for every n which is a power of p we have bp ( n ) ≡ 1 (mod p) . In particular, bp ( n ) is not ultim ately periodic m odulo p. T he proof is given in [Fis03]. T herefore, f E Q C L I Q U E is not periodic modulo p, and hence does not sat isfy a linear recurrence relat ion modulo p. p
2.4
U sing t he Lab els
Labeled st ruct ures have addit ional st ruct ure which can not be exploit ed in defining classes of models in C M SOL ( R¯ ). T he addit ional st ruct ure consist s of t he labels. We can import t hem int o our language as addit ional const ant s (wit h fixed int erpret at ion) as in C M SOL l ab( R¯ ) or, assuming t he labels are linearly ordered, as a linear order wit h a fixed int erpret at ion, as in C M SOL or d ( R¯ ). T heorem 3 st at es t hat , when we rest rict R¯ t o unary predicat es, adding t he linear order st ill gives us even a uniform recurrence relat ion. T here are φ ∈ F OL or d ( R ) wit h binary relat ion symbols only, such t hat even t he non-uniform linear recurrences over Zp do not hold. Here we use E Q p C L I QU E 2 from Example 1, wit h P roposit ion 7. P rop osit ion 8. E Q p C L I QU E 2 is F OL or d -definable, using the order. However f E Q C L I Q U E is not ultim ately periodic m odulo p. T herefore f E Q C L I Q U E does not satisfy a linear recurrence relation m odulo p. p
p
2
In fact , it is not t oo hard t o formulat e in F OL or d a property wit h one binary relat ion symbol t hat has t he same density funct ion as E Q p C L I QU E . On t he ot her hand, using t he labels as const ant s does not change t he sit uat ion, T heorem 4 also holds for C M SOL l ab. T his is proven using st andard reduct ion t echniques, and t he proof is omit t ed. ∈ C M SOL l ab( R¯ ) ( resp. M SOL l ab( R¯ ) , F OL l ab( R¯ ) ) , where the arities of the relation sym bols in R¯ are bounded by r and there are k labels used in φ , there exists ψ ∈ M SOL ( S¯ ) ( resp. M SOL ( S¯ ) , F OL ( S¯ ) ) for suitable S¯ with the arities of S¯ bounded by r such that f φ ( n ) = f ψ ( n − k )
P rop osit ion 9. For φ
We finally not e t hat in t he presence of a fixed order, t he modular count ing quant ifiers are definable in M SOL or d . T hey are, however, not definable in F OL or d . T his was already observed in [Cou90].
T he Specker-Blat t er T heorem Revisit ed
3
D U
97
-In d e x a n d S p e cke r In d e x
Specker’ s proof of T heorem 1 is based on t he analysis of an equivalence relat ion induced by a class of st ruct ures C . It is reminiscent of t he Myhill-Nerode congruence relat ion for words, cf. [HU80], but generalized t o graph grammars, and t o general st ruct ures. Not e however, t hat t he Myhill-Nerode congruence is, st rict ly speaking, not a special case of t he Specker equivalence. What one get s is t he synt act ic congruence relat ion for formal languages. 3.1
Subst it ut ion of St ruct ures
A point ed R¯ -st ruct ure is a pair (A, a), wit h A an R¯ -st ruct ure and a an element of t he universe A of A. In (A, a), we speak of t he st ruct ure A and t he context a. T he t erminology is borrowed from t he t erminology used in dealing wit h t ree aut omat a, cf. [GS97]. D efinit ion 2. G iven two pointed structures (A, a) and (B, b) we form a new pointed structure (C, c) = Subst ((A, a) , (B, b)) defined as follows: – T he universe of C is A ∪ B − { a} . – T he context c is given by b, i.e., c = b. – For R ∈ R¯ of arity r , R C is defined by R C = ( R A
a} ) r ) ∪ R B ∪ I where for every relation in R which contains a, I contains all possibilities for replacing these occurrences of a with a m em ber of B . ∩
(A
−
{
A
We similarly define Subst ((A, a) , B) for a st ruct ure B t hat is not point ed, in which case t he result ing st ruct ure C is also not point ed. T he disjoint union of two st ruct ures A and B is denot ed by A ⊔ B. be a class of, possibly pointed, R¯ -structures. W e define two equivalence relations between R¯ -structures:
D efinit ion 3. Let
C
– W e say that A1 and A2 are Su ( C )-equivalent , denoted A1 ∼ Su ( C ) A2 , if for every pointed structure (S, s) we have that Subst ((S, s) , A1 ) ∈ C if and only if Subst ((S, s) , A2 ) ∈ C . – Sim ilarly, W e say that A1 and A2 are D U ( C )-equivalent , denoted A1 ∼ D U ( C ) A2 , if for every structure B we have that A1 ⊔ B ∈ C iff A2 ⊔ B ∈ C . – T he Specker index ( resp. D U -index) of C is the num ber of equivalence classes of ∼
Su ( C )
( resp. of ∼
D U (C ) ).
Specker’ s proof in [Spe88] of T heorem 1 has a purely combinat orial part : be a class of R¯ -structures of finite Specker index with all the relation sym bols in R¯ at m ost binary. T hen f C ( n ) satisfies m odular linear recurrence relations for every m ∈ N.
Lem m a 10 ( Sp ecker’ s Lem m a) . Let
C
In Sect ion 4 we shall prove an analogue of Specker’ s lemma (T heorem 14) for C of finit e D -index wit h st ruct ures of bounded degree, which generalizes a similar st at ement du t o I. Gessel, [Ges84].
98
E. F ischer and J .A. Makowsky
3.2
C lasses of F init e Sp ecker Index
Clearly, if C has finit e Specker index, t hen it has finit e D U -index. Furt hermore, every class of connect ed graphs has D U -index 2. T he class E Q 2 C L I QU E has an infinit e Specker index. Let t he class C ON N − E Q 2 C L I QU E be t he class of all graphs obt ained from members of E Q 2 C L I QU E by connect ing any two vert ices from diff erent cliques. We not e t hat C ON N − E Q 2 C L I QU E cont ains st ruct ures of arbit rary large degree. T he class C ON N − E Q 2 C L I QU E has D U -index 2, but infinit e Specker index. It is an easy exercise t o show t he same for t he class of graphs which cont ain a hamilt onian cycle. None of t hese classes wit h an infinit e Specker index are C M SOL -definable. T his is no accident . Specker not ed t hat all M SOL definable classes of R¯ -st ruct ures (wit h all relat ions at most binary) have a finit e Specker index. We shall see t hat t his can be ext ended t o C M SOL . is a class of R¯ -structures ( with no restrictions on the arity) which is C M SOL -definable, then C has a finite Specker index.
T heorem 11. If
C
T he proof is given in [FM]. It uses a form of t he Feferman-Vaught T heorem for C M SOL due t o Courcelle, [Cou90], see also [Mak01]. Specker 2 not ed t hat t here is a cont inuum of classes (of graphs, of R¯ -st ruct ures) of finit e Specker index which are not C M SOL -definable. Wit hout logic, t he underlying principle for est ablishing a finit e Specker index of a class C is t he following: be a class of graphs and F be a binary operation on R¯ structures which is isom orphism invariant. W e say that A0 and A1 are F ( C ) equivalent if for every B, F (A0 , B) ∈ C iff F (A1 , B) ∈ C . C has a finite F -index if the num ber of F ( C ) -equivalence classes is finite.
D efinit ion 4. Let
C
P rop osit ion 12. A class of R¯ -structures C has a finite F -index iff there are α N and classes of R¯ -structures K ji ( 0 ≤ j ≤ α , 0 ≤ i ≤ 1) such that F (A0 , A1 ) ∈ iff there exists j such that A0 ∈ K j0 and A1 ∈ K j1 . P roof. If
is of finit e F -index α classes and for each j ≤ α C
1
K j
t hen we can choose for
= { A ∈ St r ( R¯ ) : F (A′ , A) ∈
C
for A′ ∈
0
K j
∈ C
t he equivalence
0
K j }
Conversely, if t he K j0 are all disjoint , t he pairs (A, A′ ) wit h A ∈ K j0 , A′ ∈ K j0 are all in t he same equivalence class. But wit hout loss of generality, but possibly increasing α , we can assume t hat t he t he K j0 are all disjoint . ✷ C orollary 13. ( i) If C 0 , C 1 are classes of finite tions. 2
P ersonal communicat ion
F
-index, then so are all their boolean com bina-
T he Specker-Blat t er T heorem Revisit ed
( ii) If C is a class of R¯ -structures such that the F ( C ) -index of C is at m ost 2.
F
(A, B) ∈
C
iff
P roof. For (i) t ake t he coarsest common refinement of t he
both A, B
F
∈
99 C
then
( C 0 )-equivalence
and t he F ( C 1 )-equivalence relat ions. (ii) is left t o t he reader.
4
✷
S t ru c t u re s o f B o u n d e d D e g re e ( d)
For an MSOL class C , denot e by f C ( n ) t he number of st ruct ures over [n ] t hat are in C and whose degree is at most d. In t his sect ion we prove T heorem 5 in t he following form: T heorem 14. If C is a class of R¯ -structures which has a finite D U -index, then ( d) ( d) f C ( n ) is ultim ately periodic m odulo m , hence, f C ( n ) satisfies for every m ∈ N a linear recurrence relation m odulo m . Furtherm ore, if all structures of C are connected, then this m odular linear recurrence is trivial.
Lem m a 15. If A ∼
B, then for every C we have C ⊔ A ∼
D U (C )
D U (C )
C ⊔ B. ✷
P roof. Easy, using t he associat ivity of t he disjoint union.
To prove T heorem 14 we define orbit s for permut at ion groups. D efinit ion 5. G iven a perm utation group G that acts on A ( and in the natural m anner acts on m odels over the universe A ) , the orbit in G of a m odel A with the universe A is the set Orb G (A) = { σ (A) : σ ∈ G } . For A ′ ⊂ A we denot e by SA t he group of all permut at ions for which σ ( u ) = u for every u ∈ A ′ . T he following lemma is useful for showing linear congruences modulo m . ′
Lem m a 16. G iven A, if a vertex v |A | | Orb S (A) | is divisible by d .
A − A ′ has exactly d neighbors in A ′ , then ∈
′
A
′
P roof. Let N be t he set of all neighbors of v which are in A ′ , and let G ⊂ SA be t he subgroup { σ 1 σ 2 : σ 1 ∈ SN ∧ σ 2 ∈ SA − N } ; in ot her words, G is t he subgroup of t he permut at ions in SA t hat in addit ion send all members of N t o members of N . It is not hard t o see t hat | Orb S (A) | = || AN || | Orb G (A) | . ✷ ′
′
′
′
A
′
T he following simple observat ion is used t o enable us t o require in advance t hat all st ruct ure in C have a degree bounded by d. Observat ion 17. W e denote by C d the class of all m em bers of C that in addition have bounded degree d. If C has a finite D U -index then so does C d . ✷
100
E. F ischer and J .A. Makowsky
In t he following we fix m and d. Inst ead of C we look at C d , which by Observat ion 17 also has a finit e D U -index. We now not e t hat t here is only one equivalence class cont aining any st ruct ures whose maximum degree is larger t han d, which ( d) ( d) is t he class N C = { A : ∀ B (B ⊔ A) |= C d ) } In order t o show t hat f C ( n ) is ult imat ely periodic modulo m , we show a linear recurrence relat ion modulo m on t he vect or funct ion ( f E ( n )) E where E ranges over all ot her equivalence classes wit h respect t o C d . Let C = md!. We not e t hat for every t ∈ N and 0 < d′ ≤ d, m divides tdC . T his wit h Lemma 16 allows us t o prove t he following. ′
Lem m a 18. Let D =
N φ be an equivalence class for φ , that includes the requirem ent of the m axim um degree not being larger than d. T hen f D (n )
aD ≡
, E ,m , ( n m o d C ) f
E
E
for som e fixed appropriate aD
(C ⌊
n
−
C
1 ⌋
)
(mod m ) ,
, E ,m , ( n m o d C ) .
P roof. Let t = ⌊ n C− 1 ⌋ . We look at t he set of st ruct ures in D wit h t he universe [n ], and look at t heir orbit s wit h respect t o S[t C ] . If a model A has a vert ex v ∈ [n ] − [t C ] wit h neighbors in [t C ], let us denot e t he number of it s neighbors by d′ . Clearly 0 < d′ ≤ d, and by Lemma 16 t he size of Orb S (A) is divisible
tC d′
[t C ]
, and t herefore it is divisible by m . T herefore, f D ( n ) is equivalent modulo m t o t he number of st ruct ures in D wit h t he universe [n ] t hat in addit ion have no vert ices in [n ] − [t C ] wit h neighbors in [t C ]. We now not e t hat any such st ruct ure can be uniquely writ t en as B ⊔ C where B is any st ruct ure wit h t he universe [n − t C ], and C is any st ruct ure over t he universe [t C ]. We also not e using Lemma 15 t hat t he quest ion as t o whet her A is in D depends only on t he equivalence class of C and on B (whose universe size is bounded by t he const ant C ). By summing over all possible B we get t he ( d) required linear recurrence relat ion (cases where C ∈ N C do not ent er t his sum ( d) because t hat would necessarily imply A ∈ N C = D ). ✷ by
P roof ( of T heorem 14:) . We use Lemma 18: Since t here is only a finit e number of possible values modulo m t o t he finit e dimensional vect or ( f E ( n )) E , t he linear recurrence relat ion in Lemma 18 implies ult imat e periodicity for n ’ s which are mult iples of C . From t his t he ult imat e periodicity for ot her values of n follows, since t he value of ( f E ( n )) E for an n which is not a mult iple of C is linearly relat ed modulo m t o t he value at t he nearest mult iple of C .
Finally, if all st ruct ures are connect ed we use Lemma 16. Given A, connect edness implies t hat t here exist s a vert ex v ∈ A ′ t hat has neighbors in A − A ′ . Denot ing t he number of such neighbors by dv , we not e t hat | Orb S (A) | is divis ible by | Ad | , and since 1 ≤ dv ≤ d (using | A ′ | = t C ) it is also divisible by m . T his makes t he t ot al number of models divisible by m (remember t hat t he set of ( d) all models wit h A = [n ] is a disjoint union of such orbit s), so f C ( n ) ult imat ely vanishes modulo m . ✷ ′
A
′
v
T he Specker-Blat t er T heorem Revisit ed
101
A cknow ledgm ent . We are grat eful t o E. Specker, for his encouragement and int erest in our work, and for his various suggest ions and clarificat ions.
R e fe re n c e s [BDF R01] E. Barcucci, A. Del Lungo, A Forsini, and S Rinaldi. A t echnology for reverse-engineering a combinat orial problem from a rat ional generat ing funct ion. A dvances i n A ppli ed M athemati cs, 26:129–153, 2001. [BR84] J . Berst el and C. Reut enauer. Rati onal Ser i es and thei r languages, volume 12 of EAT CS M onographs on T heoreti cal Computer Sci ence. Springer, 1984. [BS81] C. Blat t er and E. Specker. Le nombre de st ruct ures finies d’ une t h´eorie `a charact`ere fin. Sci ences M ath´emati ques, Fonds N ati onale de la recherche Sci enti fi que, B r uxel les, pages 41–44, 1981. [BS84] C. Blat t er and E. Specker. Recurrence relat ions for t he number of labeled st ruct ures on a finit e set . In E. B¨orger, G. Hasenjaeger, and D. R¨odding, edit ors, I n Logi c and M achi nes: D eci si on Problems and Complexi ty , volume 171 of Lecture N otes i n Computer Sci ence, pages 43–61. Springer, 1984. [Cou90] B. Courcelle. T he monadic second–order t heory of graphs I: Recognizable set s of finit e graphs. I nfor mati on and Computati on , 85:12–75, 1990. [EF 95] H.D. Ebbinghaus and J . F lum. F i ni te M odel T heor y . P erspect ives in Mat hemat ical Logic. Springer, 1995. [F is03] E. F ischer. T he Specker-Blat t er t heorem does not hold for quat ernary relat ions. Jour nal of Combi nator i al T heor y, Ser i es A , 2003. in press. [F M] E. F ischer and J .A. Makowsky. T he Specker-Blat t er t heorem revisit ed. in preparat ion. [Ges84] I. Gessel. Combinat orial proofs of congruences. In D.M. J ackson and S.A. Vanst one, edit ors, Enumerati on and desi gn , pages 157–197. Academic P ress, 1984. [GS97] F . G´ecseg and M. St einby. Tree languages. In G. Rozenberg and A. Salomaa, edit ors, H andbook of for mal languages, Vol. 3 : B eyond words, pages 1–68. Springer Verlag, Berlin, 1997. [HP 73] F . Harary and E. P almer. Graphi cal Enumerati on . Academic P ress, 1973. [HU80] J . E. Hopcroft and J . D. Ullman. I ntroducti on to A utomata T heor y, Languages and Computati on . Addison-Wesley Series in Comput er Science. Addison-Wesley, 1980. [LN83] R. Lidl and H. Niederreit er. F i ni te F i elds, volume 20 of Encyclopedi a of M athemati cs and i ts A ppli cati ons. Cambridge University P ress, 1983. [Mak00] J .A. Makowsky. Specker’ s problem. In E. Gr¨a del and C. Hirsch, edit ors, Problems i n F i ni te M odel T heor y . T HE F MT Homepage, 2000. Last version: J une 2000, http://www-mgi.informatik.rwth-aachen.de/FMT/problems.ps. [Mak01] J .A. Makowsky. Algorit hmic uses of t he F eferman-Vaught t heorem. Lect ure delivered at t he Tarski Cent enary Conference, Warsaw, May 2001, paper submit t ed t o APAL in J anuary 2003, special issue of t he conference, 2001. [Spe88] E. Specker. Applicat ion of logic and combinat orics t o enumerat ion problems. In E. B¨orger, edit or, Trends i n T heoreti cal Computer Sci ence, pages 141– 169. Comput er Science P ress, 1988. Reprint ed in: Ernst Specker, Select a, Birkh¨a user 1990, pp. 324–350. [W il90] H.S. W ilf. generati ngfuncti onology . Academic P ress, 1990.
O n t h e D iv e rg e n c e B o u n d e d C o m p u t a b le R e a l N u m b e rs Xizhong Zheng T heoret ische Informat ik Brandenburgische Technische Universit ¨a t Cot t bus D-03044 Cot t bus, Germany [email protected]
A b s t r a c t . For any funct ion h : N → N, we call a real number x h boun ded com put able ( h -bc for short ) if t here is a comput able sequence
( x s ) of rat ional numbers which converges t o x such t hat , for any n ∈ N, t here are at most h ( n ) pairs of non-overlapped indices ( i , j ) wit h |x i − x j | ≥ 2− n . In t his paper we invest igat e h -bc real numbers for various funct ions h . We will show a simple suffi cient condit ion for class of funct ions such t hat t he corresponding h -bc real numbers form a field. T hen we prove a hierarchy t heorem for h -bc real numbers. Besides we compare t he semi-comput ability and weak comput ability wit h t he h bounded comput ability for special funct ions h .
1
In t ro d u c t io n
Classically, in order t o discuss t he eff ect iveness of a real number x , we consider a comput able sequence ( x s ) of rat ional numbers which converges t o x . In t he opt imal sit uat ion, t he comput able sequence ( x s ) converges t o x e ff ec t iv e ly in t he sense t hat | x − x s | ≤ 2 s for all s ∈ N. In t his case, t he real number x can be eff ect ively approximat ed wit h an eff ect ive error est imat ion. According t o Alan Turing [13], such kind of real numbers are called co m p u t a ble . We denot e by E C t he class of all comput able real numbers. As shown by Raphael M. Robinson [8], x is comput able iff it s Dedekind cut L x := i{ r ∈ Q : r < x } is a comput able set and 2 is comput able (i.e., A is a comput able iff it s binary expansion 1 x A := i A set ). Of course, not every real number is comput able, because t here are only count ably many comput able sequences of rat ional numbers and hence t here are only count ably many comput able real numbers while t he set of real numbers is uncount able. But as shown by Ernst Specker [12], t here are also non-comput able real numbers which are comput ably approximable. Here a real number is called co m p u t a bly a p p ro x im a ble if t here is a comput able sequence of rat ional numbers which converges t o it . T he class of all comput ably approximable real numbers is denot ed by C A . Act ually, Specker gives an example of comput able increasing −
−
∈
1
In t his case we consider only t he real numbers from t he unit int erval [0; 1]. For ot her real numbers y , t here are an n ∈ N and an x ∈ [0; 1] such t hat y = x ± n . x and y have obviously t he same eff ect iveness in any reasonable sense.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 102–111, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
On t he Divergence Bounded Comput able Real Numbers
103
sequence ( x s ) defined by x s := x A , where ( A s ) is an eff ect ive enumerat ion of a non-comput able but comput ably enumerable set A ⊆ N. T he limit of an increasing comput able sequence of rat ional numbers is called le ft co m p u t a ble (or co m p u t a bly e n u m e ra ble , c . e . , for short , see [2,4]) and L C denot es t he class of all left comput able real numbers. T hus, we have E C L C . Similarly, t he limit of a decreasing comput able sequence of rat ional numbers is called r igh t co m p u t a ble . Left and right comput able real numbers are called se m i-co m p u t a ble . T he classes of right and semi-comput able real numbers are denot ed by R C and S C , respect ively. T he arit hmet ical closure of L C is denot ed by W C , t he class of w ea k ly co m p u t a ble real numbers. It is shown by Ambos-Spies, Weihrauch and Zheng [1], t hat x is weakly comput able iff t here is a comput able sequence ( x s ) |x x − x s+ 1| ≤ c for some of rat ional numbers which converges t o x and s N const ant c. Non-comput able real numbers can be classified furt her by, say, Turing reduct ion by means of binary expansion (see for example Dunlop and Pour-El [5] and Zheng [14]). Namely, x A ≤ T x B iff A is Turing reducible t o B (denot ed by A ≤ T B ) for any A , B ⊆ N. In recursion t heory, t he Turing degree deg( A ) of a set A is defined as t he class of all subset s of N which are Turing equivalent t o A . For real number x A , we can define it s Turing degree simply by degT ( x A ) := degT ( A ). However, t he classificat ion of real numbers by Turing degrees is very coarse and is not relat ed t o t he analyt ical property of real numbers very well. For example, Zheng [14] has shown t hat t here are real numbers x , y of c.e. Turing degrees such t hat t heir diff erence x − y does not have even an ω -c.e. Turing degree. Here a Turing degree is ω -c.e. if it cont ains an ω -c.e. set which is t he limit of a comput able sequence ( A s ) of finit e set s such t hat | { s : n ∈ ( A s \ A s + 1 ) ∪ ( A s + 1 \ A s ) } | ≤ f ( n ) for all n and some comput able funct ion f . A much finer classificat ion of non-comput able real numbers is int roduced by so-called “Solovay reduct ion” [11] which can be applied t o t he class L C . Here, for any c.e. real numbers x , y , we say t hat x is S o lo v a y red u c ible t o y (denot ed by x ≤ S y ) if t here are a const ant c and a part ial comput able funct ion f :⊆ Q → Q such t hat ( ∀ r ∈ Q)( r < y = ⇒ c · ( y − r ) > x − f ( r )). Very int erest ingly, t he Solovay reduct ion gives a nat ural descript ion of t he c.e. random real numbers. Namely, a real number x is c.e. random iff it is Solovay complet e, i.e., y ≤ S x for any c.e. real number y (see [2] for t he det ails about t his result ). Essent ially, Solovay reduct ion compares t he convergence speed of t he (increasing) approximat ions t o diff erent c.e. real numbers. Based on t he approximat ion speed, Calude and Hert ling [3] discuss t he c-monot onic comput ability of real numbers which is ext ended furt her t o t he h -m o n o t o n ic co m p u t a bilit y of real numbers by Ret t inger, Zheng, Gengler and von Braunm¨u hl [7]. For any funct ion h :N→ Q, a real number x is called h -monot onic comput able ( h -mc, for short ) if t here is a comput able sequence ( x s ) of rat ional numbers which converges t o x h -monot onically in t he sense t hat , h ( n ) | x − x n | ≥ | x − x m | for any n < m . Obviously, if h ( n ) ≤ c < 1, t hen h -mc reals are comput able. For t he const ant funct ion h ≡ c ≥ 1, a dense hierarchy t heorem is shown in [6]. Unfort unat ely, t he classes of real numbers defined by h -monot onic comput ability do not have good s
∈
104
X. Zheng
analyt ic property t oo. For example, even t he class of ω -monot onic comput able real numbers does not closed under t he addit ion and subt ract ion, here a real number is ω -mc if it is h -mc for a comput able funct ion h . T he convergence speed of an approximat ion ( x s ) t o x can also be described by count ing jumps of cert ain lengt h. In [15], a real number is called h -C a u c h y co m p u t a ble ( h -cec, for short ) if t here is a comput able sequence ( x s ) of rat ional numbers which converges t o x such t hat , for any n ∈ N, t here are at most h ( n ) pairs of indices ( i , j ) wit h n ≤ i < j and 2 n ≤ | x i − x j | < 2 n + 1 . Denot e by h -cE C t he class of all h -cec real numbers. T hen, we have obviously t hat E C = 0-cE C . Furt hermore, a hierarchy t heorem of [15] shows t hat g -cE C f -cE C for any comput able funct ions f , g such t hat ( ∃ n )( f ( n ) < g ( n )). Int uit ively, if f ( n ) < g ( n ) for all n ∈ N, t hen an f -cec real number is easier t o be approximat ed t han a g -cec number. T hus, h -Cauchy comput ability int roduces a series of classes of non-comput able real numbers which have diff erent levels of (non)comput ability. In t his paper, we explore anot her approach t o describe t he approximat ion speed. For any sequence ( x s ) which converges t o x , if t he number of nonoverlapped index pairs ( i , j ) such t hat | x i − x j | ≥ 2 n is bounded by h ( n ), t hen we say t hat ( x s ) converges t o x h -bo u n d ed e ff ec t iv e ly . A real number x is h -bo u n d ed co m p u t a ble ( h -bc, for short ) if t here is a comput able sequence of rat ional numbers which converges t o x h -bounded eff ect ively. Comparing wit h t he h -eff ect ive convergence, h -bounded eff ect ive convergence consider all jumps which are larger t han 2 n inst ead of only jumps between 2 n and 2 n + 1 . T his t olerance int roduces much bet t er analyt ic propert ies of h -bounded comput able real numbers. For example, a quit e simple property about t he class C of funct ions guarant ees t hat t he class of all C -bc real numbers is a field, where a real number is C -bc if it is h -bc for some h ∈ C . Obviously, t he hierarchy t heorem like t he case of h -cec real numbers does not hold any more. For example, for any const ant funct ion h ≡ c, only rat ional numbers are h -bc. Nevert heless, we can show anot her nat ural version of hierarchy t heorem t hat , t here is a g -bc real number which is not f -bc, if for any const ant c, t here are infinit ely many n ∈ N such t hat f ( n ) + c < g ( n ). Also t he weak comput ability of [1] can be well locat ed in t he hierarchy of h -bounded comput able real numbers. −
−
∞
−
−
2
−
−
D iv e rg e n c e B o u n d e d C o m p u t a b ilit y
In t his sect ion, we give t he precise definit ion of h -bounded comput ability of real numbers at first . T hen we discuss t he basic propert ies of t his not ion. Especially, we show a simple condit ion on t he funct ion class C such t hat corresponding h -bounded real number class is closed under t he arit hmet ical operat ions. D e fi n it io n 2 . 1 . Let h : N class of t ot al funct ions. →
N be a t ot al funct ion, x a real number and C a
1. A sequence ( x s ) converges t o x h -bo u n d ed e ff ec t iv e ly if, for any n ∈ N, t here are at most h ( n ) non-overlapped pairs ( i , j ) of indices wit h | x i − x j | ≥ 2 n . 2. x is h -bo u n d ed co m p u t a ble ( h -bc, for short ) if t here is a comput able sequence ( x s ) of rat ional numbers which converges t o x h -bounded eff ect ively. −
On t he Divergence Bounded Comput able Real Numbers
3. x is C -bo u n d ed co m p u t a ble ( C -bc, for short ) if it is h -bc for some h
105 C. ∈
T he classes of all h -bc and C -bc real numbers are denot ed by h -B C and respect ively. Especially, if C is t he class of all comput able t ot al funct ions, t hen C -B C is denot ed also by ω -B C . Reasonably, we consider only t he h -bounded comput ability for t he non-decreasing funct ions h : N → N. T he next lemma is st raight forward from t he definit ion. C -B C
L e m m a 2 . 2 . L e t x be a rea l n u m be r a n d f , g : N 1. 2. 3. 4.
N t o t a l fu n c t io n s. →
x is ra t io n a l iff x is f -bc a n d lim inf n → ∞ f ( n ) < ∞ ; I f x is co m p u t a ble , t h e n x is i d -bc fo r t h e id e n t it y fu n c t io n i d ( n ) I f f ( n ) ≤ g ( n ) fo r a lm o st a ll n ∈ N, t h e n f - B C ⊆ g - B C . ( f + c) - B C = f - B C fo r a n y co n st a n t c ∈ N.
:= n .
T h e o re m 2 . 3 . L e t C be a c la ss o f fu n c t io n s f : N → N. I f, fo r a n y f , g ∈ C a n d co n st a n t c ∈ N, t h e fu n c t io n h d e fi n ed by h ( n ) := f ( n + c ) + g ( n + c ) is bo u n d ed a bo v e by so m e fu n c t io n o f C , t h e n t h e c la ss C - B C is a c lo sed fi e ld . P roo f. Let f , g ∈ C . If ( x s ) and ( y s ) are comput able sequences of rat ional numbers which converge t o x and y f - and g -bounded eff ect ively, respect ively, t hen by t riangle inequat ions t he comput able sequences ( x s + y s ) and ( x s − y s ) converge t o x + y and x − y h -bounded eff ect ively, respect ively, for t he funct ion h defined by h 1 ( n ) := f ( n + 1) + g ( n + 1). Let N ∈ N such t hat | x n | , | y n | ≤ 2N and h 2 ( n ) := f ( N + n + 1) + g ( N + n + 1) for any n ∈ N. If | x i − x j | ≤ 2 n and | y i − y j | ≤ 2 n , t hen we have −
|xi
yi
−
x j yj
| ≤
| x i | | yi −
yj
−
|
+ | yj | | x i
xj
−
2N
| ≤
·
2
−
n
+1
−
= 2
(n
−
N
−
1)
.
T his means t hat ( x s y s ) converges t o x y h 2 -bounded eff ect ively. Now suppose t hat y = 0 and w.l.o.g. t hat y s = 0 for all s . Let N be a nat ural number such t hat | x s | , | y s | ≤ 2N and | y s | ≥ 2 N for all s ∈ N. If | x i − x j | ≤ 2 n and | y i − y j | ≤ 2 n , t hen we have x i yj − x j yi xi xj ≤ | x i | | yi − yj | + | yj | | x i − x j | − = −
−
−
yi
yj
yi yj
≤
3N
2
·
−
2
| yi
n
+1
−
= 2
(n
−
3N
−
1)
yj
|
.
T hat is, t he sequence ( x s / y s ) converges t o ( x / y ) h 3 -bounded eff ect ively for t he funct ion h 3 : N → N defined by h 3 ( n ) := f (3N + n + 1) + g (3N + n + 1). Since t he funct ions h 1 , h 2 , h 3 are bounded by some funct ions of C , t he class C -B C is closed under arit hmet ical operat ions + , − , × and ÷ . C o ro lla ry 2 . 4 . T h e c la sse s C - B C a re fi e ld s fo r a n y c la sse s C o f fu n c t io n s d e fi n ed in t h e fo llo w in g: 1. 2. 3. 4.
L in
:= { f : f ( n ) = c · n + d fo r so m e c, d (k )
∈
N} ;
L og ( k ) := { f : f ( n ) = c log ( n ) + d fo r so m e c, d P ol y := { f : f ( n ) = c · n d fo r so m e c, d ∈ N} ; E x p 1 := { f : f ( n ) = c · 2n fo r so m e c ∈ N} . ∈
N} ;
106
3
X. Zheng
H ie ra rch y T h e o re m
In t his sect ion we will prove a hierarchy t heorem for t he h -bounded comput able real numbers. By definit ion, t he inclusion f -B C ⊆ g -B C holds obviously, if f ( n ) ≤ g ( n ) for almost all n . On t he ot her hand, as shown in Lemma 2.2, it does not suffi ce t o separat e t he classes f -B C from g -B C if t he funct ions f and g have at most a const ant dist ance. T he next hierarchy t heorem shows t hat more t han a const ant dist ance suffi ces for t he separat ion in fact . T h e o re m 3 . 1 . L e t f , g : N → N be t w o co m p u t a ble fu n c t io n s w h ic h sa t isfy t h e co n d it io n t h a t ( ∀ c ∈ N)( ∃ ∞ m ∈ N)( c + f ( m ) < g ( m )) , t h e n t h e re e x ist s a g -bc rea l n u m be r w h ic h is n o t f -bc . T h e re fo re , g - B C f - B C . P roo f. We will const ruct a comput able sequence ( x s ) of rat ional numbers which converges g -bounded eff ect ively t o some real number x such t hat x sat isfies for all e ∈ N t he following requirement s
:
Re
(ϕ
e
( s )) converges f -bounded eff ect ively t o y e = ⇒
ye
= x,
where ( ϕ e ) is an eff ect ive enumerat ion of part ial comput able funct ions ϕ e :⊆ N → Q. To sat isfy a single requirement R e , we choose an int erval I and an m such t hat f ( m ) < g ( m ). Choose furt her two subint ervals I e , J e ⊂ I of t he dist ant 2 m . T hen we can find a real number x eit her from I e or J e t o avoid t he limit y e of t he sequence ( ϕ e ( s )). To sat isfy all t he requirement s simult aneously, we use a finit e injury priority const ruct ion as follows. St age s = 0: Let m 0 := min { m : m ≥ 3 & f ( m ) < g ( m ) } , I 0 := [2 m 0 ; 2 · m 0 2 ], J 0 := [3 · 2 m 0 ; 4 · 2 m 0 ], x 0 := 3 · 2 ( m 0 + 1) and t e , 0 := − 1 for all e ∈ N. St age s + 1: Given t e , s , x s and t he rat ional int ervals I 0 , I 1 , · · · , I k and J 0 , · · · J k for some k s ≥ 0 such t hat I e , J e I e 1 , l ( I e ) = l ( J e ) = 2 m and t he dist ance between t he int ervals I e and J e is also 2 m , for any 0 ≤ e ≤ k s . We say t hat a requirement R e requ ire s a t t e n t io n if e ≤ k s and t here is a nat ural number t > t e , s such t hat ϕ e , s ( t ) ∈ I e , s and max G e , s ( m e , t ) ≤ f ( m e ), for t he finit e set G e , s ( n , t ) := { m : ( ∃ v 0 < · · · < v m ≤ t )( ∀ i < m )( | ϕ e , s ( v i ) − ϕ e , s ( v i + 1 ) | ≥ 2 n ) } . Let R e be t he requirement of t he minimal index which requires at t ent ion and t t he corresponding nat ural number. T hen we exchange t he int ervals I e and J e , t hat is, define I e , s + 1 := J e , s and J e , s + 1 := I e , s . All int ervals I i and J i for i > e are set t o be undefined. Besides, define x s + 1 := mid( I e , s + 1 ), t e , s + 1 := t and k s + 1 := e. Ot herwise, if no requirement requires at t ent ion at t his st age, t hen let e := k s and n s t he maximal m i , t which are defined so far for some i ∈ N and t ≤ s . Denot e by j ( s ) t he maximal number of t he non-overlapped index pairs ( i , j ) such t hat i < j ≤ s and | x i − x j | ≥ 2 n . T hen define −
−
−
−
−
−
s
−
e
−
s
−
e
−
−
m e+ 1
:= ( µ m ) ( m
≥
ns
s
+ 3 & j ( s ) + f ( m ) < g ( m )) .
(1)
Choose four rat ional numbers a i ( i < 4) by a 0 := x s − 2 ( m + 1 + 1) and a i := x s + i · 2 m + 1 for i := 1, 2, 3. T hen define I e + 1 , s + 1 := [a 0 ; a 1 ], J e + 1 , s + 1 := [a 2 ; a 3 ] and x s + 1 := x s . −
−
e
e
On t he Divergence Bounded Comput able Real Numbers
107
We can show t hat , for any e ∈ N, t he requirement R e requires and receives at t ent ion only finit ely many t imes and t he sequence ( x s ) converges g -bounded effect ively t o some x which sat isfies all requirement s R e . T herefore, x is g -bounded comput able but not f -bounded comput able. C o ro lla ry 3 . 2 . I f f , g : N t h e n f -B C g-B C .
4
→
N a re co m p u t a ble fu n c t io n s su c h t h a t f ∈
o( g ) ,
S e m i-C o m p u t a b ilit y a n d W e a k ly C o m p u t a b ilit y
T his sect ion discusses t he relat ionship between h -bounded comput ability and ot her known comput ability of real numbers. Our first result shows t hat , t he classical comput ability of real numbers cannot be described direct ly by h -bounded comput ability for any monot one funct ion h . T h e o re m 4 . 1 . L e t h : N
→ N be a n u n bo u n d ed n o n d ec rea sin g co m p u t a ble fu n c t io n . T h e n a n y co m p u t a ble rea l n u m be r x is a lso h -bc bu t t h e re is a n h -bc rea l n u m be r w h ic h is n o t co m p u t a ble . T h a t is, E C h - B C .
P roo f. Suppose t hat t he comput able funct ion h is nondecreasing and unbounded. T hen we can define a st rict ly increasing comput able funct ion g : N → N induct ively by g (0) := 0 (2) g ( n + 1) := ( µ t ) ( t > g ( n ) & h ( t ) > h ( g ( n ))) .
T his implies t hat , for any nat ural numbers n , m , if g ( n ) ≤ m < g ( n + 1), t hen n ≤ h ( g ( n )) = h ( m ) < h ( g ( n + 1)). If x is a comput able real number, t hen t here is a comput able sequence ( x s ) of rat ional numbers which converges t o x such t hat | x t − x s | < 2 ( s + 1) for all t ≥ s . Suppose wit hout loss of generality t hat | x 0 − x | < 1. Define a comput able sequence ( y s ) by y s := x g ( s ) for any s ∈ N. For any nat ural number n , we can choose an i 0 ∈ N such t hat g ( i 0 ) ≤ n < g ( i 0 + 1). T hen we have i 0 ≤ h g ( i 0 ) = h ( n ) by t he definit ion (2). If ( i , j ) is a pair of indices such t hat i < j and | y i − y j | = | x g ( i ) − x g ( j ) | ≥ 2 n , t hen, by t he assumpt ion on ( x s ), t his implies t hat g ( i ) < n and hence i < i 0 . T his means t hat t here are at most i 0 non-overlapped pairs of indices ( i , j ) such t hat n | yi − yj | ≥ 2 . T herefore, t he sequence ( y s ) converges t o x h -bounded eff ect ively and hence x is a h -bc real number. To show t he inequality, we can const ruct a comput able sequence ( x s ) of rat ional numbers which converges h -bounded eff ect ively t o a non-comput able real number x , i.e., x sat isfies, for all e ∈ N, t he following requirement s −
−
−
Re
:
( ∀ s )( ∀ t
≥
s )( | ϕ
e
(s) − ϕ
e
(t )|
≤
2
−
s
) =⇒
x
= lim ϕ
s→
e
(s)
∞
where ( ϕ e ) is an eff ect ive enumerat ion of part ial comput able funct ions ϕ e :⊆ N → Q. T his const ruct ion can be easily implement ed by finit e injury priority t echnique. Act ually, t his result can also be followed direct ly from a more general result t hat h -B C S C of T heorem 4.3.
108
A ⊕
X. Zheng
To prove h -B C S C , we apply a crit erion of non-semi-comput ability. Let B := { 2n : n ∈ A } ∪ { 2n + 1 : n ∈ B } be t he join of set s A and B .
T h e o re m 4 . 2 ( A m b o s -S p ie s , W e ih ra u ch a n d Z h e n g [1 ]) . Fo r a n y T u r in g in co m pa ra ble c . e . se t s A , B ⊆
N, t h e rea l n u m be r x A ⊕
is n o t se m i-co m p u t a ble .
B
Let h : N → N be a funct ion. A set A ⊆ N is called h -spa r se if, for any n ∈ N, cont ains at most h ( n ) element s which are less t han n , namely, | A ↾ n | ≤ h ( n ). Applying a finit e injury priority const ruct ion similar t o t he original proof of t he classical Friedberg-Muchnik T heorem (cf. Soare [10], page 118) we can show t hat , if h : N → N is an unbounded and nondecreasing comput able funct ion, t hen t here are Turing incomparable h -sparse c.e. set s A , B ⊆ N, i.e., A ≤ T B & B ≤ T A . Using t his observat ion we can show t hat h -B C S C for any unbounded and nondecreasing comput able h . A
T h e o re m 4 . 3 . L e t h : N
→ N be a n u n bo u n d ed n o n d ec rea sin g co m p u t a ble fu n c t io n . T h e n t h e re e x ist s a n h -bc rea l n u m be r w h ic h is n o t se m i-co m p u t a ble .
P roo f. For any unbounded nondecreasing comput able funct ion h , let A , B ⊆ N be Turing incomparable h -sparse c.e. set s. T hen x A B is not semi-comput able. If ( A s ) and ( B s ) are eff ect ive enumerat ions of set s A and B , respect ively and , t hen ( x s ) is a comput able sequence of rat ional numbers which x s := x A B converges t o x A B . If i < j are two indices such t hat | x i − x j | ≥ 2 n , t hen t here is some m ≤ n such t hat eit her m / 2 ent ers A or ( m − 1) / 2 ent ers B between st ages i and j . Because bot h A and B are h -sparse, t here are at most h ( n ) such non-overlapped index pairs ( i , j ). T herefore, x A B is h -bounded comput able. ⊕
⊕
s
s
−
⊕
⊕
T he T heorem 4.3 shows t hat t he class S C does not cont ain all h -bc real numbers if h is unbounded no mat t er how slowly t he funct ion h increases. However, as observed by Soare [9], t he set A must be 2n -c.e. if x A is a semi-comput able real number. Here a set A ⊆ N is called h -c.e. for some funct ion h means t hat t here is a comput able sequence ( A s ) of finit e set s such t hat lim s N A s = A and, for any n ∈ N, t here are at most h ( n ) st ages s wit h n ∈ A s + 1 \ A s or n ∈ A s \ A s + 1 . T his implies immediat ely t hat S C ⊆ 2n -B C . On t he ot her hand, t he next result shows t hat S C is not cont ained complet ely in any class f -B C any more, if f is a comput able funct ion such t hat f ∈ o (2n ). →
T h e o re m 4 . 4 . L e t o e (2n ) be t h e c la ss o f a ll co m p u t a ble fu n c t io n s h : N →
N
su c h t h a t h ∈ o (2n ) . T h e n t h e re e x ist s a le ft co m p u t a ble rea l n u m be r x w h ic h is n o t o e (2n ) -bo u n d ed co m p u t a ble . T h u s, S C o e (2n ) - B C . P roo f. We will const ruct an increasing comput able sequence ( x s ) of rat ional numbers which converges t o some real number x and x sat isfies, for all nat ural numbers e = i , j , t he following requirement s
ϕ
Re
:
ϕ
i
and ψ j are t ot al funct ions and ψ j ∈ o (2n ) ( ϕ i ( s )) converges ψ j -bounded eff ect ively
=⇒
x
= lim ϕ i ( s ) ,
s→
∞
where ( ϕ e ) and ( ψ e ) are eff ect ive enumerat ions of part ial comput able funct ions N → Q and ψ e :⊆ N → N, respect ively. e :⊆
On t he Divergence Bounded Comput able Real Numbers
109
To sat isfy a single requirement R e ( e = i , j ), we choose a rat ional int erval of t he lengt h 2 m 1 for some nat ural number m e 1 . T hen look for a wit ness int erval I e ⊆ I e 1 such t hat each element of I e sat isfies R e . At t he beginning, t he int erval I e 1 is divided int o four subint ervals J et for t < 4 and let I e := J e1 as t he (default ) candidat e of wit ness int erval of R e . If ψ j ∈ o (2n ), t hen t here exist s a nat ural number m e > m e 1 + 2 such t hat 2( ψ j ( m e ) + 2) · 2 m ≤ 2 ( m 1 + 2) . In t his case, we divide t he int erval J e3 (which is of lengt h 2 ( m 1 + 2) ) int o subint ervals I et of t he lengt h 2 m for t < 2m ( m 1 + 2) and let I e := I e1 as t he new candidat e of wit ness int erval of R e . If t he sequence ( ϕ i ( s )) does not ent er t he int erval I e1 at all, t hen it is a correct wit ness int erval. Ot herwise, suppose t hat ϕ i ( s 0 ) ∈ I e1 for some s 0 ∈ N. T hen we change t he wit ness int erval t o be I e3 . If ϕ i ( s 1 ) ∈ I e3 for some s 1 > s 0 , t hen let I e := I e5 , and so on. T his can happen at most ψ j ( m e ) t imes if t he sequence ( ϕ i ( s )) converges ψ j -bounded eff ect ively. To sat isfy all t he requirement s R e simult aneously, we apply t he finit e injury priority const ruct ion which is precisely described as follows. St age s = 0: Let m 0 := 2, J 0k := [k / 4; ( k + 1) / 4] for k < 4, I 0 := J 01 and x 0 := 1/ 4. Set t he requirement R 0 int o t he st at e of “default ” and all ot her requirement s R e for e > 0 int o t he st at e of “wait ing”. St age s + 1: Given es ∈ N such t hat , for all e ≤ es , t he nat ural number m e , t he rat ional int ervals I e and J ek for k < 4 (if R e is in t he st at e “default ”) or I et for some t ’ s (ifR e is in t he st at e “wait ing” of “sat isfied”) are defined. A requirement R e for e = i , j requ ire s a t t e n t io n if e ≤ es and one of t he following sit uat ions appear. −
I e− 1
e −
−
−
−
−
−
−
−
e
e −
−
e −
e
e
( R 1 ) R e is in t he st at e of “default ” and t here is an m m > m e,s
+ 2 & (ψ
j ,s
( m ) + 2) · 2
−
( R 2 ) R e is in t he st at e of “ready” and t here is a t
m
∈
+1
−
e −
N such t hat ∈
≤
−
2
m
e , s
(3)
.
N such t hat ϕ
i ,s
(t )
I e. ∈
If no requirement requires at t ent ion, t hen we define es + 1 := es + 1 and + 2. T hen divide t he int erval I e int o four subint ervals J ek + 1 for + 1 := m e k < 4 and let I e + 1 := J e1 + 1 . Finally, set R e + 1 int o t he st at e of “default ”. Ot herwise, let R e ( e = i , j ) be t he requirement of t he highest priority (i.e., of t he least index e) which requires at t ent ion and consider t he following cases. Case 1. T he requirement R e is in t he st at e of “default ” at t he st age s . Define m e , s + 1 as t he minimal nat ural number m which sat isfies t he condit ion (3). T hen we divide t he int erval J e3 int o subint ervals I et of lengt h 2 m + 1 for t < 2m + 1 m . Let I e , s + 1 := I e1 be t he new wit ness int erval of R e . T he requirement R e is set int o t he st at e of “ready” and all requirement s R e for e > e are set back int o t he st at e of “wait ing”. Case 2. T he requirement R e is in t he st at e of “ready”. If I e , s = I et , s for some t ∈ N and I et ,+s 1 is also defined, t hen let es + 1 := e and I e , s + 1 := I et ,+s 1 and set all requirement s R e for e > e int o t he st at e of “wait ing”. Ot herwise, if I e , s = I et , s and I et ,+s 1 is not defined any more, t hen set simply t he requirement R e int o t he st at e of “sat isfied” and go direct ly t o t he next st age. me
s
s
s
s
s
s
s
−
e , s
−
e , s
e , s
′
′
′
′
110
X. Zheng
At t he end of st age s + 1, we define x s + 1 as t he left endpoint of t he rat ional int ervals I e + 1 . T hen t he limit x of t he non-decreasing comput able sequence ( x s ) sat isfies all t he requirement s R e hence is not o e (2n )-bounded comput able. s
For t he class o (2n ) t he sit uat ion is diff erent as shown in t he next result s. L e m m a 4 . 5 . I f x is a se m i-co m p u t a ble rea l n u m be r , t h e n t h e re is a fu n c t io n h ∈ o (2n ) su c h t h a t x is h -bc . T h u s, S C ⊆ o (2n ) - B C . P roo f. We consider only t he left comput able x . For right comput able real number t he proof is similar. Let ( x s ) be a st rict increasing comput able sequence of rat ional numbers which converges t o x . Define a funct ion g : N → N by n n+ 1 g ( n ) := { s ∈ N : 2 ≤ (x s + 1 − x s ) < 2 } . T hen we have n N g ( n ) · 2 n ≤ | x s − x s + 1 | = x 0 − x . T his implies t hat s N g ∈ o (2n ). Especially, t here is an N 0 ∈ N such t hat g ( n ) ≤ 2n for all n ≥ N 0 . n Let h ( n ) := g ( i + N 0 ). Given any const ant c > 0, t here is an N 1 ∈ N such i= 0 t hat g ( n ) ≤ c/ 4 · 2n for all n ≥ N 1 . T hus, for any enough large n such t hat n N1 i n 2n ≥ 2N 1 + 2 / c, we have h ( n ) := c/ 4 · 2i ≤ 2 + g(i + N 0 ) ≤ i= 0 i= N 1 i= 0 N 1+ 1 n+ 1 n ( N 1 + 1) n n n 2 + c/ 4 · 2 = 2 2 + c/ 2 ≤ c · 2 . T hus, h ∈ o (2 ) and t he sequence ( x s ) converges h -bounded eff ect ively. Hence x is an h -bc real number. −
−
−
∈
∈
−
By T heorem 2.3, t he class o (2n )-B C is a field which cont ains all semicomput able real numbers. T herefore, we have C o ro lla ry 4 . 6 . I f x is a w ea k ly co m p u t a ble rea l n u m be r , t h e n t h e re is a fu n c t io n ∈ o (2n ) su c h t h a t x is h -bo u n d ed co m p u t a ble . N a m e ly , W C ⊆ o (2n ) - B C .
h
Our next result shows t hat t he inclusion W C
o (2n ⊆
)-B C is proper.
T h e o re m 4 . 7 . T h e re is a n o (2n ) -bc rea l n u m be r w h ic h is n o t w ea k ly co m p u t a ble . T h e re fo re , W C o (2n ) - B C P roo f. We const ruct a comput able sequence ( x s ) of rat ional numbers and a (noncomput able) funct ion h : N → N such t hat ( x s ) converges h -bounded eff ect ively t o x which sat isfies all t he following requirement s ϕ e is a t ot al funct ion, and =⇒ lim ϕ e ( s ) = x Re : | ϕ e ( s ) − ϕ e ( s + 1) | ≤ 1 s s N →
∈
∞
where ( ϕ e ) is an eff ect ive enumerat ion of all part ial comput able funct ions ϕ e :⊆ N → Q. To sat isfy a single requirement R e , we choose two rat ional int ervals I e and J e of dist ance 2 m for some m e . T hen we choose t he middle point of I e as x whenever t he sequence ( ϕ e ( s )) does not ent er t he I e . Ot herwise, we choose t he middle of J e . T his can be changed lat er again if t he sequence ( ϕ e ( s )) ent ers t he int erval J e , and so on. Because of t he condit ion s N | ϕ e ( s ) − ϕ e ( s + 1) | ≤ 1, we need at most 2m changes. By a finit e injury priority const ruct ion, t his works for all requirement s simult aneously. However, t he real number x const ruct ed in −
e
∈
e
On t he Divergence Bounded Comput able Real Numbers
111
t his way is only a 2n -bounded comput able real number. To guarant ee t he o (2n )bounded comput ability of x , we need several m e ’ s inst ead of just one. T hat is, we choose at first a nat ural number m e > e, two rat ional int ervals I e and e J e and implement t he above st rat egy, but at most 2m t imes. T hen we look for a new m e > m e and apply t he same procedure up t o 2m e t imes, and so on. T his means t hat , in worst case, we need 2e diff erent m e ’ s t o sat isfy a single requirement R e . T his t echnique works also in a finit e injury priority const ruct ion. We omit t he det ail here. e
′
−
′
e
−
R e fe re n c e s [1] K. Ambos-Spies, K. Weihrauch, and X. Zheng. Weakly comput able real numbers. J our n al of C om plexi t y , 16(4):676–690, 2000. [2] C. S. Calude. A charact erizat ion of c.e. random reals. T heor et i cal C om put er Sci en ce, 271:3–14, 2002. [3] C. S. Calude and P. Hert ling. Comput able approximat ions of reals: An informat ion-t heoret ic analysis. Fun dam en t a I n for m at i cae, 33(2):105–120, 1998. [4] R. G. Downey. Some comput ability-t heoret ical aspect s of real and randomness. P reprint , Sept ember 2001. [5] A. J . Dunlop and M. B. P our-El. T he degree of unsolvability of a real number. In J . Blanck, V. Brat t ka, and P. Hert ling, edit ors, C om put abi li t y an d C om plexi t y i n A n alysi s, volume 2064 of L N C S, pages 16–29, Berlin, 2001. Springer. CCA 2000, Swansea, UK, Sept ember 2000. [6] R. Ret t inger and X. Zheng. Hierarchy of monot onically comput able real numbers. In P r oceedi n gs of M F C S’ 01, M ar i a´ n sk´e L ´a znˇe, C zech Republi c, A ugust 2731, 2001 , volume 2136 of L N C S, pages 633–644. Springer, 2001. [7] R. Ret t inger, X. Zheng, R. Gengler, and B. von Braunm u¨ hl. Monot onically comput able real numbers. M at h. L og. Q uar t . , 48(3):459–479, 2002. [8] R. M. Robinson. Review of “P et er, R., Rekursive F unkt ionen”. T he J our n al of Sym boli c L ogi c , 16:280–282, 1951. [9] R. Soare. Cohesive set s and recursively enumerable Dedekind cut s. P aci fi c J . M at h. , 31:215–231, 1969. [10] R. I. Soare. Recur si vely en um er able set s an d degr ees. A st udy of com put able fun ct i on s an d com put ably gen er at ed set s. P erspect ives in Mat hemat ical Logic. Springer-Verlag, Berlin, 1987. [11] R. M. Solovay. Draft of a paper (or a series of papers) on chait in’ s work . . . . manuscript , IBM T homas J . Wat son Research Cent er, Yorkt own Height s, NY, p. 215, 1975. [12] E. Specker. Nicht konst rukt iv beweisbare S¨a t ze der Analysis. T he J our n al of Sym boli c L ogi c , 14(3):145–158, 1949. [13] A. M. Turing. On comput able numbers, wit h an applicat ion t o t he “Ent scheidungsproblem”. P r oceedi n gs of t he L on don M at hem at i cal Soci et y , 42(2):230–265, 1936. [14] X. Zheng. On t he T uring degrees of weakly comput able real numbers. J our n al of L ogi c an d C om put at i on , 13, 2003. (t o appear). [15] X. Zheng, R. Ret t inger, and R. Gengler. Weak comput ability and represent at ion of real numbers. Comput er Science Report s 02/ 03, BT U Cot t bus, 2003.
S p arse P arit y -C h e ck M at ric e s ov e r F in it e F ie ld s ( E x t e n d e d A b st rac t ) Hanno Lefmann Fakult ¨a t f¨u r Informat ik, T U Chemnit z, D-09107 Chemnit z, Germany [email protected]
For fixed posit ive int egers k , q , r wit h q a prime power and large m , we invest igat e mat rices wit h m rows and a maximum number N q ( m , k , r ) of columns, such t hat each column cont ains at most r nonzero ent ries from t he finit e field G F ( q ) and each k columns are linearly independent over G F ( q ). For even k we prove t he lower bounds k r / ( 2( k 1) ) N q (m , k , r ) = Ω (m ), and N q ( m , k , r ) = Ω ( m ( k 1) r / ( 2( k 2) ) ) for odd k ≥ 3. For k = 2i and gcd( k − 1, r ) = k − 1 we obt ain N q ( m , k , r ) = k r / ( 2( k 1) ) Θ (m ), while for any even k ≥ 4 and gcd( k − 1, r ) = 1 we have k r / ( 2( k 1) ) 1 / ( k 1) N q (m , k , r ) = Ω (m · (log m ) ). For char ( G F ( q )) > 2 we 4r / 3 / 2 prove t hat N q ( m , 4, r ) = Θ ( m ), while for q = 2l we only have 4r / 3 / 2 N q ( m , 4, r ) = O ( m ). We can find mat rices, fulfilling t hese lower bounds, in polynomial t ime. Our result s ext end and complement earlier result s from [4,14], where t he case q = 2 was considered. A b st r a c t .
−
−
−
−
−
−
⌈
⌈
1
⌉
⌉
Int ro d u c t io n
For a prime p ower q, let GF ( q) b e t he finit e field wit h q element s. We consider mat rices over GF ( q) wit h k -wise indep endent columns, i.e. each k columns are linearly indep endent over GF ( q), and each column cont ains at most r nonzero ent ries from GF ( q) \ { 0} . Such mat rices are called ( k , r ) - m a t r ice s . For a given numb er m of rows, let N q ( m , k , r ) denot e t he maximum numb er of columns a ( k , r )-mat rix can have. Mat rices wit h k -wise indep endent columns are just parit y-check mat rices for linear codes wit h minimum dist ance at least k + 1, hence we invest igat e sizes of sparse parit y-check mat rices over GF ( q). Here, k , r , q are always fixed p osit ive int egers and m is large. By monot onicit y, we have N q ( m , k + 1, r ) ≤ N q ( m , k , r ) for k = 2, 3, . . .. For q = 2 it was shown in [14] t hat N 2 ( m , 2k + 1, r ) ≥ 1/ 2 · N 2 ( m , 2k , r ), hence asympt ot ically it suffi ces here t o consider even indep endences. T he values of N 2 ( m , k , 2) are asympt ot ically equal t o t he maximum numb er of edges in a graph on m vert ices wit hout any cycles of lengt h at most k . Alt hough graphs wit hout short cycles are widely used, not t hat much is known on t he exact growt h rat e of N 2 ( m , k , 2): known is N 2 ( m , 4, 2) = Θ ( m 3 / 2 ), see [8,9], as well as N 2 ( m , 6, 2) = Θ ( m 4 / 3 ) and N 2 ( m , 10, 2) = Θ ( m 6 / 5 ), see [3,18]. Improving result s by Margulis [17] and Lub ot zky, P hillips and Sarnak [15], Lazebnik, Ust imenko and Woldar [13] showed t hat N 2 ( m , 2k , 2) = Ω ( m 1+ 2 / ( 3 k − 3+ ε ) ) wit h ε = 0 for k odd, and ε = 1 for k
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 112–121, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Sparse P arity-Check Mat rices over F init e F ields
113
even. Concerning upp er b ounds we have N 2 ( m , 2k , 2) = O ( m 1+ 1 / k ) by t he work of Bondy and Simonovit s [7]. For q = 2 and any fixed r ≥ 1, k ≥ 4 even, t he following b ounds were given by P udl´a k, Savick´y and t his aut hor [14]: N 2 ( m , k , r ) = Ω ( m k r / ( 2( k − 1) ) ), and, for k = 2i it is N 2 ( m , k , r ) = O ( m ⌈ k · r / ( k − 1) ⌉ / 2 ). T hus for k = 2i and gcd( k − 1, r ) = k − 1 lower and upp er b ounds mat ch. However, for gcd( k − 1, r ) = 1 t he lower b ound was improved by Bert ram-Kret zb erg, Hofmeist er and t his aut hor [4] t o N 2 ( m , k , r ) = Ω ( m k r / ( 2( k − 1) ) · (ln m ) 1 / ( k − 1) ). Here we generalize and ext end some of t hese earlier result s t o arbit rary finit e fields GF ( q): we obt ain t he lower b ounds N q ( m , k , r ) = Ω ( m k r / ( 2( k − 1) ) ) for even k , and N q ( m , k , r ) = Ω ( m ( k − 1) r / ( 2( k − 2) ) ) for odd k ≥ 3. For k = 2i we show t hat N q ( m , k , r ) = Θ ( m k r / ( 2( k − 1) ) ) for gcd( k − 1, r ) = k − 1, while for every even k ≥ 4 wit h gcd( k − 1, r ) = 1 we have N q ( m , k , r ) = Ω ( m k r / ( 2( k − 1) ) · (log m ) 1 / ( k − 1) ). Also, for k = 4 and char ( GF ( q)) > 2 we prove t hat N q ( m , 4, r ) = Θ ( m ⌈ 4 r / 3 ⌉ / 2 ), while for q = 2l we can only show t hat N q ( m , 4, r ) = O ( m ⌈ 4 r / 3 ⌉ / 2 ). Mat rices, which fulfill t hese lower b ounds, can b e found in p olynomial t ime. In Sect ion 4 we discuss some applicat ions.
2
U pp er B ounds
Since we only care ab out indep endencies, h e re in every mat rix M all columns are pairwise dist inct , in each column t he first nonzero does not is 1 andi − M m ry r ent 1 · ( q − 1) = Θ ( m r ). cont ain an all zeros column, hence N q ( m , 2, r ) = i= 1 i L e m m a 1 . L e t M be a n m
× n - m a t r ix o v e r GF ( q) w it h a t m o s t r ≥ 1 n o n z e ro e n t r ie s in ea c h co lu m n . T h e n t h e m a t r ix M co n t a in s a n m × n ′ - s u bm a t r ix M ′ w it h t h e fo llo w in g p ro pe r t ie s : r r ≥ r !/ ( r · q ) · n , a n d t h e re is a pa r t it io n { 1, . . . , m } = R 1 ∪ . . . ∪ R r o f t h e s e t o f ro w - in d ice s o f M ′ a n d a s equ e n ce ( f 1 , f 2 , . . . , f r ) ∈ ( GF ( q)) r s u c h t h a t fo r ea c h co lu m n in M ′ fo r j = 1, . . . , r t h e fo llo w in g h o ld s : if f j = 0 t h e n t h e re a re o n ly z e ro s w it h in t h e ro w s o f R j , a n d if f j = 0 t h e n t h e re is e x a c t ly o n e e n t r y f j w it h in t h e ro w s o f R j a n d t h e o t h e r e n t r ie s in R j a re equ a l t o z e ro , a n d ( iii) t h e co lu m n s o f M ′ a re 3- w is e in d e pe n d e n t .
( i) ( ii)
n′
P roo f. P art it ion at random t he set { 1, . . . , m } of row-indices of t he m × n -mat rix M int o r part s R 1 , . . . , R r all of nearly equal size ⌊ m / r ⌋ or ⌈ m / r ⌉ . It is easily seen t hat t he exp ect ed numb er of columns of M wit h at most one nonzero ent ry in each row-set R j , j = 1, . . . , r , is at least r !/ r r · n . Take such a subset of columns of M wit h corresp onding part it ion { 1, . . . , m } = R 1 ∪ . . . ∪ R r and call t he result ing mat rix M ∗ . For each column in M ∗ record for j = 1, . . . , r t he occurring nonzero ent ry f j wit hin row-set R j , and set f j = 0, if all ent ries from R j are zero. As t here are less t han qr such sequences, t here are n ′ ≥ r !/ ( r r · qr ) · n columns wit h t he same pat t ern ( f 1 , . . . , f r ). T hese columns form a submat rix M ′ , which fulfills (i) and (ii). P rop ert y (iii) easily follows from prop ert y (ii). ⊓⊔
114
H. Lefmann
Lemma 1 can b e made const ruct ive in p olynomial t ime by applying derandomizat ion t echniques. From Lemma 1 for fixed r ≥ 1 and q a prime p ower we obt ain N q ( m , 3, r ) = Θ ( m r ) and N q ( m , 5, r ) = Θ ( N q ( m , 4, r )). T h e o r e m 1 . Let k
≥ 4 be e v e n , r ≥ 1, a n d q a p r im e po w e r . T h e n , fo r a co n s t a n t c > 0 a n d s = 0, . . . , r − 1, a n d fo r in t ege r s m ≥ 1,
N q (m , k , r )
≤
m s · N q ( m , k / 2, 2r
c·
−
2 s) + c · m s .
(1)
P roo f. T he proof is similar, but diff erent , t o t hat in [14], where q = 2 was
considered. Let M b e a ( k , r )-mat rix of dimension m × n , n = N q ( m , k , r ), wit h ent ries from GF ( q). By Lemma 1, t he mat rix M cont ains an m × n ′ -submat rix M ′ , n ′ ≥ c∗ · n wit h c∗ = r !/ ( r r · qr ), which sat isfies (ii), (iii) t here. P ut t he columns of M ′ int o t wo mat rices M 1 and M 2 of dimensions m × n 1 and m × n 2 , resp ect ively, wit h n ′ = n 1 + n 2 . In M 1 put t hose columns of M ′ which have wit h anot her column from M ′ at least s nonzero at t he same mries s ent . p osit ions. In M 2 put t he remaining columns, t hus n 2 ≤ i= 1 i Set [m ] := { 1, . . . , m } , let | c| denot e t he numb er of nonzero ent ries in any column c, and for each subset S ∈ [[m ]]s of row-indices, let n ( S ) b e t he numb er of columns c in M 1 wit h cs = 0 for each p osit ion s ∈ S . Using | c| ≥ s for each column c in M 1 , and t hen t he Cauchy-Schwart z inequalit y we infer | c| n 1 ≤ L := , n (S) = s c∈ M 1 S ∈ [[m ]] m n (S) 1 L · L − s ≥ . (2) · m 2 2 s s
S∈
[[m ]]s
Form a mat rix M 1∗ by t aking all diff erences ci − cj , i < j , of t hose columns of M 1 , which share at least at s p osit ions t he same nonzero ent ries. E ach column in M 1∗ cont ains at most 2r − 2s nonzero ent ries and t hese columns are k / 2wise indep endent , hence M 1∗ has at most N q ( m , k / 2, 2r − 2s) columns. T he sum n (S ) count s every pair of dist inct columns at most r −s 1 t imes, t hus S ∈ [[m ]] 2 n (S) r − 1 ≤ · N q ( m , k / 2 , 2 r − 2 s) 2 s s
S∈
n1
≤
L
≤
m s
W it h n 1 + n 2
[[m ]]s
+ ≥
c∗
2· ·
m s
n and n 2
C o r o lla r y 1 . Let k, r
·
r
1
s i=
N q ( m , k / 2, 2r
·
s
≤
−
1
m i
−
2 s)
(by (2)).
, t he upp er b ound (1) follows.
1 a n d q a p r im e po w e r . Fo r po s it iv e in t ege r s m ,
lo g 2 N q ( m , k , 2) = O m 1+ 2 / 2
N q ( m , k , r ) = O m ⌈ k r / ( k − 1) ⌉ / 2 if k = 2j .
⊓⊔
≥
⌊
k
⌋
(3) (4)
Sparse P arity-Check Mat rices over F init e F ields
115
P roo f. Inequalit y (3) follows by induct ion on ⌊ log 2 k ⌋ from (1) for s := 1, and (4)
follows by induct ion on j and (1) for s := L e m m a 2 . Let k
≥
⌊ ⌈
k r / (k
1) ⌉ / 2⌋ , compare [14].
−
⊓⊔
2 a n d q a p r im e po w e r . Fo r po s it iv e in t ege r s m , N q ( m , k , 2)
(1 − o(1)) · N 2 ( m , k , 2) .
≥
P roo f. T his follows by considering t he incidence mat rix of a graph wit hout cycles of lengt h at most k as a mat rix over GF ( q). Det ails are in t he full version. ⊓⊔
W it h Lemma 2 we obt ain t he following (const ruct ive) lower b ounds from graphs, see [3,13,18], for every k ≥ 1 and q a prime p ower: N q ( m , 4, 2) = Θ ( m 3 / 2 ), N q ( m , 5, 2) = Θ ( m 3 / 2 ), N q ( m , 6, 2) = Ω ( m 4 / 3 ), N q ( m , 10, 2) = Ω ( m 6 / 5 ), and N q ( m , 2k , 2) = Ω ( m 1+ 2 / ( 3 k − 3+ ε ) ) wit h ε ∈ { 0, 1} and ε = 1 iff k is even. T he next lemma shows t hat asympt ot ically it suffi ces t o consider N q ( m , k , r ) for q a prime. We omit t he proof, which uses linear algebra. L e m m a 3 . Let k
≥
2, a n d l , r
1, a n d p a p r im e . Fo r po s it iv e in t ege r s m ,
≥
N p l ( m , k , r ) = Θ ( N p ( m , k , r )) .
From t he result s for graphs [3,7,18] and by Lemma 3 we obt ain t he following: C o r o lla r y 2 . Let q
= 2l a n d k
1. Fo r po s it iv e in t ege r s m ,
≥
N q ( m , 6, 2) = Θ ( m 4 / 3 )
N q ( m , 10, 2) = Θ ( m 6 / 5 )
an d
N q ( m , 2k , 2) =
O ( m 1+ 1 / k ) .
Next we consider (4, r )-mat rices over GF ( q). L e m m a 4 . L e t GF ( q) be a fi n it e fi e ld w it h c h a r
m
( GF ( q)) > 2. L e t M ′
be a n
n - m a t r ix o v e r GF ( q) w it h e x a c t ly r n o n z e ro e n t r ie s in ea c h co lu m n , s u c h t h a t L e m m a 1 ( ii) , ( iii) a re s a t is fi ed . L e t F 1′ , . . . , F n′ be t h e s e t s o f po s it io n s o f t h e n o n z e ro e n t r ie s in t h e n co lu m n s o f M ′ . I f fo r n o fo u r s e t s bo t h F g′ ∪ F h′ = F i′ ∪ F j′ a n d F g′ ∩ F h′ = F i′ ∩ F j′ a re fu lfi lled , t h e n t h e co lu m n s o f M ′ a re 4- w is e in d e pe n d e n t . ×
P roo f. Assume t hat some columns a1 , . . . , a4 of M ′ , wit h corresp onding set s
4
F 1′ , . . . , F 4′ , are linearly dep endent over GF ( q), i.e. λ i · ai = 0 for some i= 1 λ 1 , . . . , λ 4 ∈ GF ( q) \ { 0} . Let F i := F i′ \ ( F 1′ ∩ . . . ∩ F 4′ ) for i = 1, . . . , 4. L e m m a 5 . Fo r
1
≤
i < j < k
≤
4 it is F i ∩
Fj ∩
Fk = ∅
.
P roo f. T his follows wit h Lemma 1 (ii). Det ails are in t he full version. ⊓⊔
Assume w.l.o.g. t hat F 1 ∩ F 2 = ∅ . By Lemma 5 we have F 3 ⊆ F 1 ∪ F 2 , hence F := F 3 \ ( F 1 ∪ F 2 ) = ∅ . T he dep endence of a1 , . . . , a4 implies F 4 \ ( F 1 ∪ F 2 ) = F , t hus λ 3 = − λ 4 . If F 3 ∩ ( F 1 \ F 2 ) = ∅ and F 4 ∩ ( F 1 \ F 2 ) = ∅ , t hen λ 3 = − λ 1 and λ 4 = − λ 1 , which shows λ 3 = λ 4 = 0 for char ( GF ( q)) > 2, a cont radict ion. Hence, F 3 ∩ ( F 1 \ F 2 ) = ∅ or F 4 ∩ ( F 1 \ F 2 ) = ∅ . T hen w.l.o.g. F 3 = F ∪ ( F 2 \ F 1 ) and F 4 = F ∪ ( F 1 \ F 2 ), hence F 1 ∪ F 3 = F 2 ∪ F 4 and F 1 ∩ F 3 = F 2 ∩ F 4 , which cont radict s t he assumpt ion. ⊓⊔
116
H. Lefmann
Frankl and F u¨ redi [11] const ruct ed a family F ⊆ [[m ]]r cont aining no four set s F 1 , . . . , F 4 ∈ F wit h F 1 ∪ F 2 = F 3 ∪ F 4 and F 1 ∩ F 2 = F 3 ∩ F 4 , where | F | = Θ ( m ⌈ 4 r / 3 ⌉ / 2 ), as follows. Let r = 3t + 1 (For ot her values of ( r mod 3) t he const ruct ion is similar.), and let K b e any field wit h m / 2 ≤ | K | ≤ m . For a x j . For h ≥ 1 define subset X = { x 1 , . . . , x g } ⊆ K let si ( X ) := j ∈ I I ∈ [[g ]] an h × h -mat rix M h ( X ) wit h ent ries m i , j = s2 i − j ( X ) (where sl ( X ) = 0 for l < 0 or l > | X | ). Using an averaging argument , for suit able c2 , c4 , . . . , c2 t ∈ K t he family F ⊆ [K ]r is defined as follows: X = { x 1 , . . . , x r } ∈ F if s2 i ( X ) = c2 i for i = 1, . . . , t and det ( M h ( S )) = 0 for every subset S ⊆ X and h = 1, . . . , | S | − 1. T his yields a p olynomial t ime (semi-) const ruct ion. i
T h e o r e m 2 . Let r
1 a n d q a p r im e po w e r . Fo r po s it iv e in t ege r s m , if c h a r ( GF ( q)) > 2 Θ m ⌈ 4r / 3⌉ / 2 N q ( m , 4, r ) = O m ⌈ 4r / 3⌉ / 2 if c h a r ( GF ( q)) = 2. ≥
For q = 2 t his was shown in [14]. For q = 2l and r ≡ 0 mod 3 lower and upp er b ound mat ch by T heorem 5, compare also T heorem 3. F = { F1 , . . . , Fn } [[m ]]r wit h n = Θ ( m ⌈ 4 r / 3 ⌉ / 2 ), such t hat for no four set s F 1 , . . . , F 4 ∈ F it is F 1 ∪ F 2 = F 3 ∪ F 4 and F 1 ∩ F 2 = F 3 ∩ F 4 . Such a family exist s by t he result s in [11]. Define an m × n -mat rix M wit h columns c1 , . . . , cn ∈ { 0, 1} m : in column ci put a 1 at p osit ion s iff s ∈ F i , i = 1, . . . , n . By Lemma 1 we obt ain an m × n ′ -submat rix M ′ of M such t hat (i) – (iii) t here are sat isfied. By Lemma 4, t he columns of M ′ are 4-wise indep endent and t he lower b ound follows. ⊓⊔
P roo f. For t he upp er b ounds see (4). For t he lower b ound, let ⊆
3
Low e r B o u n d s
For proving lower b ounds on N q ( m , k , r ), we will look for a large indep endent set in a suit able hyp ergraph. A h y pe rgra p h G = ( V, E ) has vert ex set V and edge set E where E ⊆ V for every edge E ∈ E . A hyp ergraph G = ( V, E ) is l - u n ifo r m , if t he edge set E cont ains only l -element edges, i.e. E ⊆ [V ]l . An in d e pe n d e n t s e t in G = ( V, E ) is a subset I ⊆ V which cont ains no edges from E . T h e o r e m 3 . Let k
≥
4, r
k r
N q (m , k , r ) = Ω
m 2(k
N q (m , k , r ) = Ω
2, a n d q a p r im e po w e r . Fo r po s it iv e in t ege r s m ,
1 1) 1 · (log m ) fo r k e v e n , gcd( k − 1, r ) = 1 (5)
1) 1 2) 2 fo r k od d , gcd( k − 2, r ) = 1. (6) · (log m ) ≥
(k
−
−
k
−
r
−
m 2(k
k
−
For q = 2 t his was shown in [4], t hus (5), (6) hold for q = 2l by Lemma 3. { 1 , . . . , m } of row-indices int o r subset s R 1 , . . . , R r of sizes ⌊ m / r ⌋ or ⌈ m / r ⌉ , and fix a sequence ( f 1 = 1, f 2 , . . . , f r ) ∈ ( GF ( q) \ { 0} ) r of nonzero element s. Let C q ( m , r ) b e t he set of all column vect ors of lengt h m which cont ain wit hin each row-set R j exact ly one nonzero ent ry f j ∈ GF ( q) \ { 0} , j = 1, . . . , r . Hence | C q ( m , r ) | = c · m r for some const ant c > 0.
P roo f. P art it ion t he set
Sparse P arity-Check Mat rices over F init e F ields
117
Form a hyp ergraph G = ( V, E 3 ∪ . . . ∪ E k ) wit h vert ex set V = C q ( m , r ), where an i -element subset { a1 , . . . , ai } of V , i = 3, . . . , k , is an edge in t his hyp ergraph G , t hat is { a 1 , . . . , a i } ∈ E i , if and only if a 1 , . . . , a i are linearly dep endent over GF ( q) but any ( i − 1) columns of a1 , . . . , ai are linearly indep endent . We will prove a lower b ound on t he size of a maximum indep endent set in G , which yields a set of k -wise indep endent columns. F irst we will b ound from ab ove t he numb ers | E i | , i = 3, . . . , k , of i -element edges in G . For a subset E ∈ [C q ( m , r )]i of i column vect ors, t he m × i -mat rix M ( E ) formed by t hese columns has exact ly i · r nonzero ent ries. If E ∈ E i , t hen in M ( E ) each row-set R j cont ains at most ⌊ i / 2⌋ non-zero rows, hence M ( E ) cont ains at most ⌊ i / 2⌋ · r nonzero rows. T hus, for some const ant s ci > 0, i = 3, . . . , k , we have r ⌈ m/ r ⌉ i · ⌊ i / 2⌋ · r ⌊ i / 2⌋ · r · ≤ ci · m . (7) |Ei | ≤ ir ⌊ i / 2⌋ Next we consider only edges in E l , where l := k for k even and l := k − 1 for k odd, hence l ≥ 4 is a lw a y s e v e n . For a subset J ∈ [C q ( m , r )]j , j = 2, . . . , l − 1, let p( J ) b e t he numb er of nonzero rows in t he mat rix M ( J ), and let p1 ( J ) b e t he numb er of rows in M ( J ) wit h exact ly one nonzero ent ry. Let b( J ) b e t he numb er of subset s S ∈ [C q ( m , r )]l − j where J ∪ S ∈ E l . For J ∪ S ∈ E l in each row in M ( J ) wit h exact ly one nonzero ent ry t here must b e at least one such nonzero ent ry in t he same row in M ( S ). Let M ( J ) have t he nonzero rows 1, . . . , p( J ), say. E ach nonzero row s > p( J ) in M ( S ) has at least t wo nonzero ent ries, as t he columns in J ∪ S are linearly dep endent , hence t here are at most ⌊ (( l − j ) r − p1 ( J )) / 2⌋ such rows in M ( S ), i.e. at most ⌊ ( ( l − j m) r−− pp(1J()J ) ) / 2 ⌋ choices for t hese, t hus for a const ant cp > 0: (l
b( J )
≤
cp · m ⌊
−
j )r
−
2
p 1 (J )
⌋
.
(8)
A 2- c y c le in an l -uniform hyp ergraph G = ( V, E ) is a pair { E , E } of dist inct edges E , E ′ ∈ E wit h | E ∩ E ′ | ≥ 2. We will apply a result of Ajt ai, Koml´os, P int z, Sp encer and Szemer´edi [1], originally an exist ence result , in t he sequel ext ended and t urned int o a det erminist ic p olynomial t ime algorit hm in [10,5]. ′
T h e o r e m 4 . Let l
≥ 3 be a fi x ed in t ege r . L e t G = ( V, E ) be a n l - u n ifo r m h y pe r gra p h o n | V | = N v e r t ice s w it h a v e ra ge d egree t l − 1 := l · | E | / | V | . I f t h e h y pe rgra p h G = ( V, E ) co n t a in s n o 2 - c y c le s , t h e n o n e ca n fi n d fo r a n y fi x ed δ > 0 in G in t im e O ( N · t l − 1 + N 3 / t 3 − δ ) a n in d e pe n d e n t s e t o f s iz e Ω ( N / t · (log t ) 1 / ( l − 1) ) . T h e a s s e r t io n a ls o h o ld s , if t l − 1 is o n ly a n u p pe r bo u n d o n t h e a v e ra ge d egree .
For j = 2, . . . , l − 1 and u = 0, . . . , j r , let s2 , j ( u ; G l ) b e t he numb er of 2-cycles E , E ′ } in G l = ( V, E l ) wit h | E ∩ E ′ | = j and p1 ( E ∩ E ′ ) = u . T he numb ers pj , u ( V ) of subset s J ∈ [C q ( m , r )]j wit h p1 ( J ) = u sat isfy for const ant s c∗j , u , cj , u > 0: m m− u ⌋ ∗ u+ ⌊ 2 , (9) pj , u ( V ) ≤ cj , u · · ≤ cj , u · m u ⌊ ( j r − u ) / 2⌋
{
j r
−
u
since t he mat rix M ( J ) has u rows wit h exact ly one nonzero ent ry and t he remaining j r − u nonzero ent ries are cont ained in rows wit h at least t wo nonzero ent ries, t hus by (8) and (9) for some const ant C 1 > 0:
118
H. Lefmann
s2 , j ( u ; G l )
b( J ) 2
≤ J
[C q ( m , r ) ] ; p 1 ( J ) = u j
∈
(l
C1 · m 2· ⌊
≤
j )r
−
u
−
+ u+ ⌋
2
⌊
j r
−
u
2
⌋
. (10)
By (7) t he a v e ra ge d egree t l − 1 of t he l -uniform hyp ergraph G l = ( V, E l ) sat isfies t l − 1 = ( l · | El | ) / | V | ≤ ( l · cl · m ⌊ l / 2 ⌋ · r ) / ( c · m r ), hence t ≤ t 0 := C 2 · m ( ⌊ l / 2 ⌋ · r − r ) / ( l − 1) for a const ant C 2 > 0. To apply T heorem 4, we choose a random subset V ∗ ⊆ V by picking vert ices at random from V , indep endent ly of each ot her wit h probabilit y p := t −0 1 · m ε for some const ant ε > 0, heading for an l -uniform hyp ergraph wit hout any 2-cycles. We est imat e t he exp ect ed values E ( · ) of some paramet ers of t he induced random hyp ergraph G ∗ = ( V ∗ , E 3∗ ∪ . . . ∪ E k∗ ) wit h E i∗ := E i ∩ [V ∗ ]i , i = 3, . . . , k , using (7) for some const ant s c∗ , c∗i > 0 as follows: E ( | V ∗ | ) = p · |C q ( m , r ) | E ( | E i∗ | ) = pi
pi
· |Ei | ≤
ci
·
i
m⌊
·
2
r
⌋ ·
c∗
≥
·
c∗i
≤
⌋
l
i
m⌊
·
l/ 2 ⌊
mr −
⌋ ·
2
·
r
+ε
l/ 2 ⌊
r
r
−
1
−
−
l
⌋
r
·
1
−
W it h (9), (10) we infer for j = 2, . . . , l − 1 and u = 0, . . . , j ( V ∗ , E l∗ ), for some const ant s C 0∗ , C 1∗ > 0: E ( pj , u ( V ∗ )) = pj
2l − j
∗
E ( s2 , j ( u ; G l )) = p
C 1∗
≤
C 0∗
·
s2 , j ( u ; G l )
≤
pj , u ( V )
·
·
·
m 2· ⌊
(l
≤
j )r
−
u
−
+ u+ ⌋
2
j r
mu + ⌊ j r
⌊
−
u
2
−
u
2
l/ 2 ⌊
⌋ −
⌊
⌋ −
l/ 2 l
⌋
·
⌋
·
−
1
r
−
r
1
−
r
l
−
·
r
(11) r
−
·
j
·
·
i+ i·ε
.
(12)
r , where
+ j ·ε
( 2l − j ) + ( 2l − j ) · ε
∗
Gl
=
(13)
. (14)
By (11)–(14), Markov’ s and Chebychev’ s inequalit y, t here xist e s a subhyp ergraph ∗ = ( V ∗ , E 3∗ ∪ . . . ∪ E k∗ ) of G which sat isfies for i = 2, . . . , k , and j = 2, . . . , l − 1, G and u = 0, . . . , j r , (using simply t he same not at ion for t he const ant fact ors) ∗
|V
c∗
| ≥ ∗
c∗i
|Ei | ≤ ∗
s2 , j ( u ; G l )
· · ∗
C1
≤
i
m⌊ ·
2
m
2·
l/ 2 ⌊
mr −
l
⌋ ·
⌊
⌋
·
r
⌊
r
−
(l
−
−
r
l/ 2 ⌋
1
−
l j )r
·
−
u
−
2
mu + ⌊
j r
−
u
+ε r
−
i+ i·ε
·
1
+ u+ ⌋
⌊
⌋ −
(15) r
l/ 2 ⌋
·
(16)
j r
⌊
u
−
2 r
−
r
·
j
⌊
⌋ −
+ j ·ε
pj , u ( V ∗ )
≤
C 0∗
L e m m a 6 . Fo r k
≥
4 a n d ε = r / (2k 2 ) it h o ld s :
·
∗
2
l
−
1
l/ 2 l
⌊
i / 2⌋
·
r + (i
−
−
1
r
·
( 2l − j ) + ( 2l − j ) · ε
.
P roo f. By (15) and (16), since l is even, we have | E i∗ −
r
·
−
1)( l
−
2) r / (2( l
−
1))
−
(17) (18)
= o( | V ∗ | ) fo r e v e r y i = l.
|Ei |
r
⌋
|
(i
(19) = o( | V ∗ | ), i = l , if −
1) · ε > 0 .
(20)
Inequalit y (20) holds, if ( l − i ) r / (2( l − 1)) − ( i − 1) · ε > 0, which is fulfilled for i = 2, . . . , l − 1 and 0 < ε < r / (2l 2 ). For i > l , which is only p ossible for i = k odd and l = k − 1, inequalit y (20) is equivalent t o ( k − 3) r / (2( k − 2)) − ( k − 1) · ε > 0, which wit h k ≥ 4 holds for 0 < ε ≤ r / (2k 2 ), t hus (19) is sat isfied. ⊓⊔ We have t he following consequence:
Sparse P arity-Check Mat rices over F init e F ields T h e o r e m 5 . Let k
4, r
119
1, a n d q a p r im e po w e r . Fo r po s it iv e in t ege r s m ,
Ω m 2( 1) if k is e v e n ,
N q (m , k , r ) = ( 1) Ω m 2( 2) if k is od d . ≥
≥
k r k −
k
r
−
k
−
T hus, for k = 2i and gcd( k − 1, r ) = k − 1 lower and upp er b ound (4) mat ch, i.e. N q ( m , k , r ) = Θ ( m k r / ( 2( k − 1) ) ). Mat rices sat isfying t he b ounds in T heorem 5 can b e found in p olynomial t ime by using t he met hod of condit ional probabilit ies. = r / (2k 2 ) we have | E i∗ | = o( | V ∗ | ) by (19), and we remove one vert ex from each edge E ∈ E i∗ , and we obt ain a subset V ∗ ∗ ⊆ V ∗ wit h | V ∗ ∗ | ≥ ( c∗ / 2) · m l r / ( 2( l − 1) ) + ε , such t hat t he subhyp ergraph G ∗ ∗ = ( V ∗ ∗ , [V ∗ ∗ ]l ∩ E l∗ ) of G ∗ is l -uniform wit h | [V ∗ ∗ ]l ∩ E l∗ | ≤ c∗l · m l r / ( 2( l − 1) ) + l · ε . Again we choose a random subset V ∗ ∗ ∗ ⊆ V ∗ ∗ by picking vert ices from V ∗ ∗ uniformly at random, indep endent ly of each ot her wit h probabilit y p := ch · m − ε , ch := ( c∗ / (4c∗l )) 1 / ( l − 1) . We est imat e E ( | V ∗ ∗ ∗ | ) − E ( | [V ∗ ∗ ∗ ]l ∩ E l∗ | ), hence t here exist s a subset V ∗ ∗ ∗ ⊆ V ∗ ∗ such t hat P roo f. For every i = l and ε
|V
∗
∗
∗
| −
| [V
∗
∗
∗
]l ∩
( ch · c∗ / 4) · m l r / ( 2( l −
∗
El | ≥
1) )
.
We delet e one vert ex from every edge in [V ∗ ∗ ∗ ]l ∩ E l∗ and we obt ain an indep endent set I in G wit h | I | = Ω ( m l r / ( 2( l − 1) ) ), and t he lower b ounds follow by insert ing l := k for k even, and l := k − 1 for k odd. We remark, t hat we could have derived t he b ounds in T heorem 5 already from (7), by picking vert ices right away from t he set V at random, indep endent ly from each ot her, each wit h probabilit y p := cg · t −0 1 for some const ant cg > 0. ⊓⊔ L e m m a 7 . Fo r ε
= 1/ (4k 2 ) , j = 2, . . . , l
m in
u
= 0,...,j r {
1, a n d gcd( l
−
1, r ) = 1 it is
−
pj , u ( V ∗ ) , s2 , j ( u ; G l∗ ) } = o( | V ∗ | ) .
(21)
P roo f. By (15) and (17), we have s2 , j ( u ; G l∗ ) = o( | V ∗ | ), j = 2, . . . , l
0 > (l
−
1) · r
−
j r / 2 − u/ 2 − ( l
−
2)(2l
−
j
−
1) r / (2( l
−
1)) + (2l
−
1, if
−
j
which holds for u > ( l − j ) r / ( l − 1) + 2 · (2l − j − 1) · ε . For l even by (15) and (18) we have pj , u ( V ∗ ) = o( | V ∗ | ), j = 2, . . . , l u/ 2 + j r / 2 − r
−
(l
−
2)( j
−
1) r / (2( l
−
1)) + ( j
−
1) · ε
−
−
1, if
1) · ε < 0
which holds for u < ( l − j ) r / ( l − 1) − 2 · ( j − 1) · ε . For j = 2, . . . , l − 1 and gcd( l − 1, r ) = 1, t he quot ient s ( l − j ) r / ( l − 1) are never int egers, in part icular, t hey are at least 1/ ( l − 1) apart from t he nearest int eger. For ε := 1/ (4k 2 ), t he st at ement ‘ fo r u > ( l − j ) r / ( l − 1) + 2 · (2l − j − 1) · ε o r u < ( l − j ) r / ( l − 1) − 2 · ( j − 1) · ε ’ reads as ‘ fo r u = 0, . . . , j r ’ , and (21) follows. ⊓⊔
120
H. Lefmann
Let ε := 1/ (4k 2 ) and u 0 ( j ) := ⌊ ( l − j ) r / ( l − 1) ⌋ . For i = l we delet e one vert ex from each edge E ∈ E i∗ and, by Lemma 6, we obt ain a subset V ∗ ∗ ⊆ V ∗ wit h ∗ ∗ ∗ ∗ ∗ |V | = (1 − o(1)) · |V | . T he result ing induced subhyp ergraph of G on V ∗ ∗ is l -uniform. For j = 2, . . . , l − 1 and u > u 0 ( j ) we delet e one vert ex from each 2-cycle { E , E ′ } ∈ [E l∗ ∩ [V ∗ ∗ ]l ]2 wit h | E ∩ E ′ | = j and p1 ( E ∩ E ′ ) = u . For u ≤ u 0 ( j ) we remove one vert ex from each subset J ∈ [V ∗ ∗ ]j wit h p1 ( J ) = u . By Lemma 7 we obt ain a subset V ∗ ∗ ∗ ⊆ V ∗ ∗ , which does not cont ain any 2-cycles and sat isfies | V ∗ ∗ ∗ | = (1 − o(1)) · |V ∗ | . We apply T heorem 4 t o our hyp ergraph ∗ ∗ ∗ G = ( V ∗ ∗ ∗ , [V ∗ ∗ ∗ ]l ∩ E l∗ ) wit h average degree t l∗ − 1 ≤ c0 · (1 + o(1)) · ( p · t 0 ) l − 1 for some const ant c0 > 0, and we obt ain an indep endent set I ⊆ V ∗ ∗ ∗ of size
1 1 ∗ ∗ ∗ 1 = Ω m 2 ( 1 ) · (log m ) 1 , |I | = Ω |V | / ( p · t 0 ) · (log( p · t 0 )) l
−
lr l−
l
−
which yields t he desired lower b ounds (5), (6) by insert ing t he appropriat e value of l , i.e. l := k for k even, and l := k − 1 for k odd. W it h t he met hod of condit ional probabilit ies, t he running t ime is essent ially b ounded by t he numb er s2 , 2 ( u 0 (2) + 1; G l ) = O ( m ( l − 3) r + r / ( l − 1) ) of 2-cycles. Compared wit h N 3 / t 30 − 3 δ in T heorem 4, wit h t 0 = Θ ( m ε ) (else, for t 0 = o( m ε ), we can improve (5), (6)), we get t he t ime b ound O ( m ( l − 3) r + r / ( l − 1) ) for l ≥ 6. R e m a r k : All calculat ions are valid, if we pick t he columns uniformly at random according t o a (2l − 2)-wise indep endent dist ribut ion. For simulat ing t his, t here exist sample spaces of sizes O ( m r ( 4 l − 4) ), see [12], hence wit h t his we also obt ain p olynomial running t ime. T his finishes t he proof of T heorem 3. ⊓⊔
4
C o n c lu d in g R e m arks
Some of t he following p ossible applicat ions have b een st at ed already in [14] for t he case q = 2 and can b e ext ended t o arbit rary prime p owers q. For example, we can ext end t he lengt h of a linear code, but we reduce it s minimum dist ance: P r o p o s i t i o n 1 . L e t A be a n l × m pa r it y - c h ec k m a t r ix o v e r GF ( q) o f a lin ea r cod e o f le n gt h m w it h m in im u m d is t a n ce a t lea s t k r + 1, a n d le t B be a ( k , r ) m a t r ix o f d im e n s io n m × n o v e r GF ( q) . T h e n t h e m a t r ix - p rod u c t A × B is a pa r it y - c h ec k m a t r ix o f a cod e o f le n gt h n w it h m in im u m d is t a n ce a t lea s t k + 1. P r o p o s i t i o n 2 . L e t A be a n l × m - m a t r ix o v e r GF ( q) w it h k r - w is e in d e pe n d e n t co lu m n s , a n d le t B be a ( k , r ) - m a t r ix o v e r GF ( q) w it h d im e n s io n m × n . T h e n t h e co lu m n s in t h e m a t r ix A × B a re k - w is e in d e pe n d e n t .
We can use sparse mat rices t o const ruct small probabilit y spaces, see [2,6]: P r o p o s i t i o n 3 . L e t M be a
( k , r ) - m a t r ix o v e r GF ( q) o f d im e n s io n m
×
n.
I f X = ( X 1 , . . . , X m ) is a k r - w is e ε - bia s ed ra n d o m v ec t o r o v e r GF ( q) , t h e n t h e v ec t o r Y = ( Y1 , . . . , Yn ) = X × M is k - w is e ε - bia s ed . ( ii) I f S ⊆ ( GF ( q)) m is a k r - w is e ε - bia s ed s a m p le s pa ce , t h e n t h e s a m p le s pa ce T = { s × M | sT ∈ S } ⊆ ( GF ( q)) n is k - w is e ε - bia s ed , h e n ce a ls o (2 · ε · (1 − q− k ) / q, k ) - in d e pe n d e n t .
( i)
Sparse P arity-Check Mat rices over F init e F ields
121
R e m a r k s : We can const ruct large ( k , r )-mat rices in p olynomial t ime, but our t ime
b ound increases (in t he exp onent ) wit h k , r . For p ossibly pract ical applicat ions (quit e oft en algorit hms run fast on such mat rices) and furt her st udies explicit const ruct ions of ( k , r )-mat rices are desirable. T he const ruct ions in [14] for q = 2 can b e adapt ed t o arbit rary finit e fields, however t hey yield weaker lower b ounds on N q ( m , k , r ) t han we proved. Apart from (4, 2)-mat rices over GF ( q), t he only known asympt ot ically opt imal const ruct ion is for (4, r )-mat rices. Also one might like t o invest igat e p ossible connect ions t o low-densit y codes [16].
R e fe re n c e s 1. M. Ajt ai, J . K´omlos, J . P int z, J . Spencer and E. Szemer´edi, Ext remal uncrowded hypergraphs, J . Comb. T heory A 32, 1982, 321–335. 2. N. Alon, O. Goldreich, J . H˚ast ad and R. P eralt a, Simple const ruct ions of almost k wise independent random variables, Rand. St ruct . & Algorit hms 3, 1992, 289–304, and 4, 1993, 119–120. 3. C. T . Benson, Minimal regular graphs of girt h eight and twelve, Canad. J . Mat hemat ics 18, 1966, 1091–1094. 4. C. Bert ram-Kret zberg, T . Hofmeist er and H. Lefmann, Sparse 0-1-mat rices and forbidden hypergraphs, Comb., P rob. and Comput ing 8, 1999, 417–427. 5. C. Bert ram-Kret zberg and H. Lefmann, T he algorit hmic aspect s of uncrowded hypergraphs, SIAM J . Comput ing 29, 1999, 201–230. 6. C. Bert ram-Kret zberg and H. Lefmann, M O D p -t est s, almost independence and small probability spaces, Rand. St ruct . & Algorit hms 16, 2000, 293–313. 7. A. Bondy and M. Simonovit s, Cycles of even lengt h in graphs, J . Comb. T heory Ser. B 16, 1974, 97–105. 8. W . G. Brown, On graphs t hat do not cont ain a T homsen graph, Canad. Mat h. Bullet in 9, 1966, 281–289. 9. P. Erd¨os, A. R´enyi and V. T . S´os, On a problem of graph t heory, St ud. Sci. Mat h. Hungarica 1, 1966, 213–235. 10. A. Fundia, Derandomizing Chebychev’ s inequality t o findindependent set s in uncrowded hypergraphs, Rand. St ruct . & Algorit hms 8, 1996, 131–147. 11. P. Frankl and Z. F u¨ redi, Union-free families of set s and equat ions over fields, J . Numb. T heory 23, 1986, 210–218. 12. H. Karloff and Y. Mansour, On const ruct ion of k -wise independent random variables, P roc. 26t h ST OC, 1994, 564–573. 13. F . Lazebnik, V. A. Ust imenko and A. J . Woldar, A new series of dense graphs of high girt h, Bull. (New Series) of t he AMS 32, 1995, 73–79. 14. H. Lefmann, P. P udl´a k and P. Savick´y , On sparse parity-check mat rices, Designs, Codes and Crypt ography 12, 1997, 107–130. 15. A. Lubot zky, R. P hillips and P. Sarnak, Ramanujan graphs, Combinat orica 8, 1988, 261–277. 16. M. Luby, M. Mit zenmacher, A. Shokrollahi and D. Spielman, Analysis of lowdensity codes and improved designs using irregular graphs, P roc. 30t h ST OC, 1998, 249–258. 17. G. A. Margulis, Explicit group t heoret ical const ruct ion of combinat orial schemes and t heir applicat ion t o t he design of expanders and concent rat ors, J . P robl. Inform. Transm. 24, 1988, 39–46. 18. R. Wenger, Ext remal graphs wit h no C 4 ’ s, C 6 ’ s or C 10 ’ s, J . Comb. T heory Ser. B 52, 1991, 113–116.
O n t h e Fu ll a n d B o t t le n e ck Fu ll S t e in e r T re e P ro b le m s ⋆ Yen Hung Chen 1 , Chin Lung Lu 2 , and Chuan Yi Tang1 1
2
Depart ment of Comput er Science, Nat ional T sing Hua University, Hsinchu 300, Taiwan, R.O.C. { dr884336,cytang} @cs.nthu.edu.tw Depart ment of Biological Science and Technology, Nat ional Chiao Tung University, Hsinchu 300, Taiwan, R.O.C. [email protected]
Given a graph G = ( V , E ) wit h a lengt h funct ion on edges and a subset R of V , t he full St einer t ree is defined t o be a St einer t ree in G wit h all t he vert ices of R as it s leaves. T hen t he full St einer t ree problem is t o find a full St einer t ree in G wit h minimum lengt h, and t he bot t leneck full St einer t ree problem is t o find a full St einer t ree T in G such t hat t he lengt h of t he largest edge in T is minimized. In t his paper, we present a new approximat ion algorit hm wit h performance rat io 2ρ for t he full St einer t ree problem, where ρ is t he best -known performance rat io for t he St einer t ree problem. Moreover, we give an exact algorit hm of O (|E | log |E |) t ime t o solve t he bot t leneck full St einer t ree problem.
A b st r a c t .
1
In t ro d u c t io n
Given an arbit rary graph G = ( V , E ), a subset R ⊆ V of vert ices, and a lengt h (or weight ) funct ion d : E → R + on t he edges, a S t e in e r t ree is an acyclic subgraph of G spanning all vert ices in R . T he vert ices of R are usually referred t o as t e r m in a ls and t he vert ices of V \ R as S t e in e r (or o p t io n a l) vert ices. T he lengt h of a St einer t ree is defined t o be t he sum of t he lengt hs of all it s edges. T he S t e in e r t ree p ro ble m (ST P for short ) is t o find a St einer t ree of minimum lengt h in G [4,7,12]. T his problem has been shown t o be NP -complet e [9] and many approximat ion algorit hms have been proposed [1,2,11,14,18,19,20,21,22]. However, t he bo t t le n ec k S t e in e r t ree p ro ble m , which is t o find a St einer t ree T in G such t hat t he lengt h of t he largest edge in T is minimized, can be solved in polynomial t ime [5,8]. It has been shown t hat t hese two problems have many import ant applicat ions in VLSI design, network communicat ion, comput at ional biology and so on [3,4,7,10,12,13,15]. Mot ivat ed by t he reconst ruct ion of evolut ionary t ree in biology, Lu, Tang and Lee st udied a variant of t he St einer t ree problem, called as t he full St einer t ree problem (FST P for short ) [17]. Independent ly, mot ivat ed by VLSI global
⋆
T his work was part ly support ed by t he Nat ional Science Council of t he Republic of China under grant s NSC91-2321-B-007-002 and NSC91-2213-E-321-001.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 122–129, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
On t he Full and Bot t leneck Full St einer Tree P roblems
123
rout ing and t elecommunicat ions, Lin and Xue defined t he t erminal St einer t ree problem, which is equal t o t he FST P [16]. A St einer t ree is fu ll if all t erminals are t he leaves of t he St einer t ree [2,12,17]. T he fu ll S t e in e r t ree p ro ble m is t o find a full St einer t ree for R in G wit h minimum lengt h. T he problem is shown t o be NP -complet e and MAX SNP -hard [16], even when t he lengt hs of edges are rest rict ed t o be eit her 1 or 2 [17]. However, Lu, Tang and Lee [17] gave a 8 -approximat ion algorit hm for t he FST P wit h t he rest rict ion t hat t he lengt hs of 5 edges are eit her 1 or 2, and Lin and Xue [16] present ed a ( ρ + 2)-approximat ion algorit hm for t he FST P if t he lengt h funct ion is m e t r ic (i.e., t he lengt hs of edges sat isfy t he t riangle inequality), where ρ is t he best -known performance rat io for t he ST P whose performance rat io is 1 + ln2 3 ≈ 1. 55 [19]. T he bo t t le n ec k fu ll S t e in e r t ree p ro ble m (BFST P for short ) is t o find a full St einer t ree T for R in G such t hat t he lengt h of t he largest edge in T is minimized. In t his paper, we present a new approximat ion algorit hm wit h performance rat io 2ρ for t he FST P, which improves t he previous result ρ + 2 of Lin and Xue [16]. Moreover, we give an O ( | E | log | E | ) t ime algorit hm t o opt imally solve t he BFST P. T he rest of t his paper is organized as follows. In Sect ion 2, we describe a 2ρ approximat ion algorit hm for t he FST P. In sect ion 3, we give an O ( | E | log | E | ) t ime algorit hm for opt imally solving t he BFST P. Finally, we make a conclusion in Sect ion 4.
2
A 2 ρ -A p p ro x im a t io n A lg o rit h m fo r t h e Fu ll S t e in e r T re e P ro b le m
F S T P (Full St einer Tree P roblem) In st an c e : A complet e graph G = ( V , E ) wit h d : E
R+
, and a proper subset of t erminals, where t he lengt h funct ion d is met ric. Q u e st io n : Find a full St einer t ree for R in G wit h minimum lengt h. R
⊂
→
V
In t his sect ion, we will give a 2ρ approximat ion algorit hm for solving t he above FST P, whose lengt h funct ion is met ric, in polynomial t ime. By definit ion, any full St einer t ree T for R in G = ( V , E ) cont ains no edge in E R = { ( u , v ) | u , v ∈ R , u = v } . Hence, t hroughout t he rest of t his paper, we assume t hat G cont ains no edge in E R (i.e., E ∩ E R = φ ). Let A S T P be t he best -known approximat ion algorit hm for t he ST P, whose performance rat io is 1 + ln2 3 ≈ 1. 55 [19]. T hen we apply algorit hm A S T P t o G and obt ain a St einer t ree S A P X = ( V , E ) for R in G . Not e t hat if all vert ices of R are leaves in S A P X , t hen S A P X is also a full St einer t ree of G . If not , t hen we use Algorit hm 1 t o t ransform it int o a full St einer t ree. For convenience, we let N ( r ) be t he set of t he neighbors of r ∈ R in S A P X (i.e., N ( r ) = { v | ( r , v ) ∈ E } and it s members are all St einer vert ices) and N 1 ( r ) be t he nearest neighbor of r in S A P X (i.e., d ( r , N 1 ( r )) = min { d ( r , v ) | v ∈ N ( r ) } ). ′
′
′
A lg o rit h m 1 : M e t h o d o f t ran sfo rm in g S AP X int o a fu ll S t e in e r t re e Fo r each r ∈ R wit h | N ( r ) | ≥ 2 in S A P X d o
124
Y.H. Chen, C.L. Lu and C.Y. Tang
1 . Let st a r ( r ) be t he subt ree of S A P X induced by { ( r , v ) | v
∈ N ( r ) } . T hen remove all t he edges in st a r ( r ) \ { ( r , N 1 ( r )) } from S A P X . 2 . Let G [N ( r )] be t he subgraph of G induced by N ( r ). T hen find a minimum spanning t ree of G [N ( r )], denot ed by M S T ( N ( r )), and add all t he edges of M S T ( N ( r )) int o S A P X .
e n d fo r
T he purpose of each it erat ion in Algorit hm 1 is t o t ransform one non-leaf t erminal in S A P X int o a leaf by delet ing all t he edges, except ( r , N 1 ( r )), incident wit h r and adding all t he edges in M S T ( N ( r )). Aft er running Algorit hm 1, S A P X becomes a full St einer t ree. Since t here are at most | R | non-leaf t erminals in S A P X , t here are at most | R | it erat ions in Algorit hm 1. For st ep 1, it s t ot al cost is O ( | E | ) t ime since for any two non-leaf t erminals r and r in S A P X , we have { ( r , v ) | v ∈ N ( r ) } ∩ { ( r , v ) | v ∈ N ( r ) } = φ . In st ep 2, we need t o comput e a minimum spanning t ree of G [N ( r )] in each it erat ion, which can be done by P rim’ s Algorit hm in O ( | N ( r ) | 2 ) t ime [6]. Hence, it s t ot al cost is O ( | V | 3 ) t ime. As a result , t he t ime-complexity of Algorit hm 1 is O ( | V | 3 ). Now, for clarificat ion, we describe our approximat ion algorit hm for t he FST P as follows. ′
′
′
A lg o rit h m A P X -F S T P In p u t : A complet e graph G = ( V , E ) and a set R
⊂ V of t erminals, where we assume t hat G cont ains no edge in E R and t he lengt h funct ion is met ric. O u t p u t : A full St einer t ree T A P X for R in G .
1 . / * F in d a S t e in e r t re e in
G
*/
Use t he current ly best -known approximat ion algorit hm t o find a St einer t ree S A P X in G . 2 . / * Tran sfo rm S AP X int o a fu ll S t e in e r t re e If S A P X is not a full St einer t ree t h e n
T AP X
A ST P
for t he ST P
*/
Use Algorit hm 1 t o t ransform S A P X int o a full St einer t ree and let T A P X be such a full St einer t ree. e lse Let T A P X = S A P X . T h e o re m 1 . A lgo r it h m A P X -F S T P is a 2ρ -a p p ro x im a t io n a lgo r it h m fo r t h e FST P. P roo f. Not e t hat t he t ime-complexity of Algorit hm AP X-FST P is dominat ed
by t he cost of t he st ep 1 for running t he current ly best -known approximat ion algorit hm for t he ST P [19]. For convenience, we use l en ( H ) t o denot e t he lengt h of any subgraph H of G (i.e., l en ( H ) equals t o t he sum of t he lengt hs of all t he edges of H ). Let T O P T and S O P T be t he opt imal full St einer t ree and St einer t ree for R in G , respect ively. Not e t hat we use t he current ly best -known approximat ion algorit hm A S T P for t he ST P t o find a St einer t ree S A P X for R in G . Hence, we have l en ( S A P X ) ≤ ρ · l en ( S O P T ), where ρ is t he performance rat io of A S T P . Since T O P T is also a St einer t ree for R in G , we have l en ( S O P T ) ≤ l en ( T O P T ) and hence l en ( S A P X ) ≤ ρ · l en ( T O P T ). Recall t hat in each it erat ion of Algorit hm 1, we t ransform a non-leaf t erminal r in S A P X int o
On t he Full and Bot t leneck Full St einer Tree P roblems
125
a leaf by first removing all t he edges, except ( r , N 1 ( r )), and t hen adding all t he edges in M S T ( N ( r )). Let N 2 ( r ) denot e t he second nearest neighbor of r in N ( r ) and let P = ( v 1 ≡ N 1 ( r ) , v 2 , . . . , v k ≡ N 2 ( r )) be any arbit rary pat h which exact ly visit s each vert ex in N ( r ) and bot h N 1 ( r ) and N 2 ( r ) are it s end-vert ices, where k = | N ( r ) | . By t riangle inequality, we have t he following inequalit ies. d (v 1 , v 2 )
≤
d (r , v 1 )
+ d (r , v 2 )
d (v 2 , v 3 )
≤
d (r , v 2 )
+ d (r , v 3 )
.. . d (v k − 1 , v k )
d (r , v k − 1 )
≤
+ d (r , v k )
By above inequalit ies, we have d ( v 1 , v 2 ) + d ( v 2 , v 3 ) + . . . + d ( v k 1 , v k ) ≤ 2 · l en ( st a r ( r )) − d ( r , v 1 ) − d ( r , v k ) and hence l en ( P ) ≤ 2 · l en ( st a r ( r )) − d ( r , N 1 ( r )) − d ( r , N 2 ( r )). Since M S T ( N ( r )) is a minimum spanning t ree of G [N ( r )], we have l en ( M S T ( N ( r ))) ≤ l en ( P ). In ot her words, we have l en ( M S T ( N ( r ))) ≤ 2 · l en ( st a r ( r )) − d ( r , N 1 ( r )) − d ( r , N 2 ( r )). By const ruct ion of T A P X , we have ( l en ( M S T ( N ( r ))) − l en ( st a r ( r )) + d ( r , N 1 ( r ))) l en ( T A P X ) = l en ( S A P X ) + −
r
≤
l en ( S A
P X
R ∈
( l en ( st a r ( r )) − d ( r , N 2 ( r )))
)+ r
≤
l en ( S A
P X
R ∈
l en ( st a r ( r )) .
)+ r
R ∈
Not e t hat for any two t erminals r , r ∈ R , st a r ( r ) and st a r ( r ) are edge-disjoint in S A P X . Hence, we have r R l en ( st a r ( r )) ≤ l en ( S A P X ). As a result , we have l en ( T A P X ) ≤ 2 · l en ( S A P X ) ≤ 2ρ · l en ( T O P T ), which implies t hat t he performance rat io of Algorit hm AP X-FST P is 2ρ . ⊓⊔ ′
′
∈
3
A n E x a c t A lg o rit h m fo r t h e B o t t le n e ck Fu ll S t e n ie r T re e P ro b le m
B F S T P (Bot t leneck Full St einer Tree P roblem) In st an c e : A complet e graph G = ( V , E ) wit h d : E
→ R + , and a proper subset of t erminals. Q u e st io n : Find a full St einer t ree for R in G such t hat t he lengt h of t he largest edge is minimized.
R
⊂
V
In t he sect ion, we will present an exact algorit hm for solving t he above BFST P in O ( | E | log | E | ) t ime. Recall t hat we assume t hat G cont ains no edge in E R . T hen we call an edge in E as S t e in e r ed ge if bot h it s end-vert ices are St einer vert ices; ot herwise, as t e r m in a l ed ge . Wit hout loss of generality, we use { e1 , e2 , . . . , eβ } t o denot e t he set of all St einer edges in E and assume t hat t heir lengt hs are
126
Y.H. Chen, C.L. Lu and C.Y. Tang
diff erent (i.e., d ( e1 ) < d ( e2 ) < . . . < d ( eβ )). For any arbit rary t ree T , we let E b ( T ) denot e t he bot t leneck edge wit h t he largest lengt h in T and let l en b ( T ) denot e t he lengt h of E b ( T ). In t he following, we describe our algorit hm t o find an opt imal bot t leneck full St einer t ree for R in G . In t he beginning, we const ruct a st ar T u for each St einer vert ex u ∈ V \ R by let t ing u as t he cent er of T u and all t erminal vert ices of R as t he leaves of T u . T hen we let C denot e t he collect ion of all such st ars (i.e., C = { Tu | u ∈ V \ R } ). Clearly, each t ree in C is a feasible solut ion for t he BFST P, but may not be t he opt imal one. For convenience, we let T ⋆ ( C ) denot e t he t ree in C wit h t he minimum bot t leneck edge (i.e., l en b ( T ⋆ ( C )) = min { l en b ( T ) | T ∈ C } ). It is not hard t o see t hat if l en b ( T ⋆ ( C )) ≤ d ( e1 ), t hen T ⋆ ( C ) is t he opt imal solut ion for t he BFST P, since we have l en b ( T ⋆ ( C )) ≤ l en b ( T ) for any full St einer t ree T in G cont aining at least one St einer edge. On t he ot her hand, if l en b ( T ⋆ ( C )) > d ( e1 ), t hen we perform t he following Algorit hm 2 t o merge some t rees in C int o larger t rees cont aining more St einer vert ices, and t hen we can show lat er t hat t he full St einer t ree in t he result ing C wit h t he smallest bot t leneck edge is an opt imal bot t leneck full St einer t ree in G . For each t erminal vert ex r ∈ R , we use eT ( r , T ) t o denot e t he t erminal edge in a full St einer t ree T incident wit h r . A lg o rit h m 2 : R e p e at e d ly m e rg e t h e t re e s in C 1 . Let ei = e1 . 2 . Repeat t he following st eps unt il t he condit ion (1) l en b ( T ⋆ ( C ))
≤ d ( e i ) or (2) = 1 holds. 2 .1 . Let v 1 ( ei ) and v 2 ( ei ) be t he end-vert ices of ei . Find t he t rees in C , say T i 1 and T i 2 respect ively, cont aining v 1 ( ei ) and v 2 ( ei ). 2 .2 . If T i 1 = T i 2 t h e n let T i = T i 1 e lse 2 .2 .1 . Connect T i 1 wit h T i 2 by ei and let T i be t he result ing t ree. |C|
2 .2 .2 . / * M ake su re e ach t e rm in al v e rt e x r ∈ R is ad jac e nt t o t h e n e are st S t e in e r v e rt e x v in T i ( i.e ., d ( r , v ) = m in { ( r , v ′ ) | v ′ is a S t e in e r v e rt e x in T i } ) . * / For each r ∈ R , if d ( eT ( r , T i 1 )) ≤ d ( eT ( r , T i 2 )) t h e n delet e eT ( r , T i 2 ) in T i e lse delet e eT ( r , T i 1 ) in T i . 2 .3 . Let i = i + 1.
It is not hard t o see t hat in each it erat ion of Algorit hm 2, we have l en b ( T i ) ≤ and l en b ( T i ) ≤ l en b ( T i 2 ), which implies t hat t he merged t ree T i may have a bet t er bot t leneck edge wit h smaller lengt h. Aft er performing Algorit hm 2, we use T ⋆ ( C ) in t he result ing C as t he out put of our algorit hm for t he BFST P. For clarificat ion, we describe our algorit hm for t he BFST P as follows. l en b ( T i 1 )
A lg o rit h m E x ac t -B F S T P In p u t : A complet e graph G = ( V , E ) and a set R
⊂ V of t erminals, where we assume t hat G cont ains no edge in E R . O u t p u t : An opt imal bot t leneck full St einer t ree T O P T for R in G . 1 . For each St einer vert ex u ∈ V \ R , const ruct a st ar T u by let t ing u as it s cent er and all t erminal vert ices of R as it s leaves, and let C = { T u | u ∈ V \ R } . 2 . If l en b ( T ⋆ ( C )) > d ( e1 ), t h e n perform t he following st eps.
On t he Full and Bot t leneck Full St einer Tree P roblems
127
2 .1 . Sort all St einer edges of G int o an increasing order, say e1 , e2 , . . . , eβ ,
wit h d ( e1 ) < d ( e2 ) < . . . < d ( eβ ). 2 .2 . Perform Algorit hm 2. 2 .3 . Repeat edly remove all St einer vert ices of T ⋆ ( C ) whose degrees are 1. 3 . Let T O P T = T ⋆ ( C ). T h e o re m 2 . A lgo r it h m E x a c t -B F S T P is a n O ( | E | log | E | ) t im e a lgo r it h m fo r so lv in g t h e B F S T P . P roo f. We first analyze t he t ime-complexity of Algorit hm Exact -BFST P as fol-
lows. It is not hard t o see t hat it s t ime-complexity is dominat ed by t he st eps 2. Clearly, st ep 2.1 can be done in O ( | E | log | E | ) t ime by heap sort ing algorit hm [6]. For st ep 2.2 of execut ing Algorit hm 2, it can be implement ed by t he disjoint -set operat ions (i.e., Make-set, Union and Find-set operat ions), since for each full St einer t ree of C , we can represent it by using t he set of it s St einer vert ices and clearly, any two such set s are disjoint . Init ially, we make | V \ R | singlet on set s wit h each consist ing of a St einer vert ex u and represent ing an init ial T u in C . Aft er t hat , in each it erat ion of Algorit hm 2, we can use two Find-set operat ions t o ident ify T i 1 and T i 2 , and t hen use a Union operat ion t o merge t hem int o T i . Tot ally, we have | V \ R | Make-set operat ions, at most 2 · |E | Find-set operat ions, and at most | V \ R | − 1 Union operat ions. Not e t hat t he cost of m disjoint -set operat ions on n element s t akes O ( m · α ( n )), where α ( n ) is an inverse Ackermann’ s funct ion ofn which is almost a const ant for all pract ical purposes (i.e., α ( n ) ≤ 4 for all n ≤ 1080 ) [6]. In ot her words, above operat ions can be implement ed in O ( | V \ R | + 2 · |E | + | V \ R | − 1) = O ( | E | ) t ime. Clearly, t he t ot al cost of st ep 2.2.2 of Algorit hm 2 is at most O ( | V \ R | × | R | ) = O ( | V | 2 ) t ime. Hence, t he t ot al t ime-complexity of Algorit hm 2 is O ( | E | ) t ime. As ment ioned above, t he t ime-complexity is O ( | E | log | E | ). Next , we prove t he correct ness of Algorit hm Exact -BFST P by showing t hat for any full St einer t ree T for R in G , we have l en b ( T O P T ) ≤ l en b ( T ), where T O P T is t he out put of our algorit hm. Let V s ( T ) be t he set of t he St einer vert ices in T . Suppose t hat | V s ( T ) | = 1. T hen T must be a full St einer t ree in t he init ial ⋆ C of Algorit hm Exact -BFST P. Since aft er performing Algorit hm 2, l en b ( T ( C )) may be improved and hence, l en b ( T o p t ) ≤ l en b ( T ). Suppose t hat | V s ( T ) | ≥ 2. Let eγ be t he edge wit h t he largest lengt h in St einer edges of T . Assume t hat Algorit hm Exact -BFST P out put s it s result T O P T aft er it s Algorit hm 2 considers St einer edge ek , where 1 ≤ k ≤ β . T hen we consider t he following two cases. Case 1: k ≤ γ . In t his case, we have eit her l en b ( T O P T ) ≤ d ( ek ) or t he result ing C has size 1. For t he former case, we have l en b ( T O P T ) ≤ l en b ( T ) since d ( ek ) ≤ d ( eγ ) ≤ l en b ( T ). For t he lat t er case, it is clear t hat ek 1 is t he largest St einer edge of T O P T , whose lengt h is less t han d ( eγ ). Moreover, we have V s ( T ) ⊆ V s ( T O P T ) since V s ( T O P T ) = V \ R , which implies t hat for each t erminal r ∈ R , it s corresponding t erminal edge in T O P T has lengt h smaller t han or equal t o t hat in T . T he reason is t hat our algorit hm always connect s r t o t he nearest St einer vert ex in T O P T , which cont ains all St einer vert ices. As discussed above, we have l en b ( T O P T ) ≤ l en b ( T ). Case 2: k > γ . For each St einer edge of −
128
Y.H. Chen, C.L. Lu and C.Y. Tang
being considered by our algorit hm, it is not hard t o see t hat t here is a t ree in C cont aining it s two end-vert ices. Since t he subgraph of T induced by V s ( T ) is connect ed, T γ in C cont ains all vert ices in V s ( T ) aft er eγ is considered (i.e., V s ( T ) ⊆ V s ( T γ )). T hen for each t erminal r ∈ R , it s corresponding t erminal edge in T γ has lengt h smaller t han or equal t o t hat in T . In addit ion, t he largest St einer edge of T γ has lengt h less t han or equal t o d ( eγ ). Hence, we have l en b ( T γ ) ≤ l en b ( T ). Since l en b ( T O P T ) ≤ l en b ( T γ ), we have l en b ( T O P T ) ≤ l en b ( T ). ⊓⊔ T
4
C o n c lu s io n
In t his paper, we first present ed a new approximat ion algorit hm wit h performance rat io 2ρ for t he full St einer t ree problem under t he met ric space, and t hen we gave an exact algorit hm of O ( | E | log | E | ) t ime for solving t he bot t leneck full St einer t ree problem. It would be int erest ing t o find a bet t er (approximat ion) algorit hm for t he (bot t leneck) full St einer t ree problem. Not e t hat if t he lengt h funct ion is not met ric, t hen whet her t here exist s an approximat ion algorit hm wit h const ant rat io for t he full St einer t ree problem is st ill open.
R e fe re n c e s 1. Berman, P., Ramaiyer, V.: Improved approximat ions for t he St einer t ree problem. J ournal of Algorit hms 1 7 (1994) 381–408. 2. Borchers, A., Du, D.Z.: T he k -St einer rat io in graphs. SIAM J ournal on Comput ing 2 6 (1997) 857–869. 3. Caldwell, A., Kahng, A., Mant ik, S., Markov, I., Zelikovsky, A.: On wirelengt h est imat ions for row-based placement . In: P roceedings of t he 1998 Int ernat ional Symposium on P hysical Design (ISP D 1998) 4–11. 4. Cheng, X., Du, D.Z.: St einer Tree in Indust ry. Kluwer Academic P ublishers, Dordrecht , Net herlands (2001). 5. Chiang, C., Sarrafzadeh, M., Wong, C.K.: Global rout er based on St einer min-max t rees. IEEE Transact ion on Comput er-Aided Design 9 (1990) 1318–1325. 6. Cormen, T .H., Leiserson, C.E., Rivest , R.L., St ein, C.: Int roduct ion t o Algorit hm. 2nd edit ion MIT P ress, Cambridge (2001). 7. Du, D.Z., Smit h, J .M., Rubinst ein, J .H.: Advances in St einer Tree. Kluwer Academic P ublishers, Dordrecht , Net herlands (2000). 8. Duin, C.W ., Volgenant , A.: T he part ial sum crit erion for St einer t rees in graphs and short est pat hs. European J ournal of Operat ions Research 9 7 (1997) 172–182. 9. Garey, M.R., Graham, R.L., J ohnson, D.S.: T he complexity of comput ing St einer minimal t rees. SIAM J ournal of Applied Mat hemat ics 3 2 (1997) 835–859. 10. Graur, D., Li, W .H.: Fundament als of Molecular Evolut ion. 2nd edit ion Sinauer P ublishers, Sunderland, Massachuset t s (2000). 11. Hougardy, S., P rommel, H.J .: A 1.598 approximat ion algorit hm for t he St einer problem in graphs. In: P roceedings of t he 10t h Annual ACM-SIAM Symposium on Discret e Algorit hms (SODA 1999) 448–453. 12. Hwang, F .K., Richards, D.S., W int er, P.: T he St einer Tree P roblem. Annuals of Discret e Mat hemat ics 53, Elsevier Science P ublishers, Amst erdam (1992).
On t he Full and Bot t leneck Full St einer Tree P roblems
129
13. Kahng, A.B., Robins, G.: On Opt imal Int erconnect ions for VLSI. Kluwer P ublishers (1995). 14. Karpinski, M., Zelikovsky, A.: New approximat ion algorit hms for t he St einer t ree problems. J ournal of Combinat orial Opt imizat ion 1 (1997) 47–65. 15. Kim, J ., Warnow, T .: Tut orial on P hylogenet ic Tree Est imat ion. Manuscript , Depart ment of Ecology and Evolut ionary Biology, Yale University (1999). 16. Lin, G.H., Xue, G.L.: On t he t erminal St einer t ree problem. Informat ion P rocessing Let t ers 8 4 (2002) 103–107. 17. Lu, C.L., Tang, C.Y., Lee, R.C.T .: T he full St einer t ree problem. T heoret ical Comput er Science (t o appear). 18. P rommel, H.J ., St eger, A.: A New Approximat ion Algorit hm for t he St einer Tree P roblem wit h P erformance Rat io 5/ 3. J ournal of Algorit hms 3 6 (2000) 89–101. 19. Robins, G., Zelikovsky A.: Improved St einer t ree approximat ion in graphs. In: P roceedings of t he 11t h Annual ACM-SIAM Symposium on Discret e Algorit hms (SODA 2000) 770–779. 20. Zelikovsky, A.: An 11/ 6-approximat ion algorit hm for t he network St einer problem. Algorit hmica 9 (1993) 463–470. 21. Zelikovsky, A.: A fast er approximat ion algorit hm for t he St einer t ree problem in graphs. Informat ion P rocessing Let t ers 4 6 (1993) 79–83. 22. Zelikovsky, A.: Bet t er approximat ion bounds for t he network and Euclidean St einer t ree problems. Technical report CS-96-06, University of Virginia (1996).
T h e S t ru c t u re a n d N u m b e r o f G lo b a l R o u n d in g s o f a G ra p h Tet suo Asano1 , Naoki Kat oh 2 , Hisao Tamaki3 , and Takeshi Tokuyama 4 1
School of Informat ion Science, J apan Advanced Inst it ut e of Science and Technology, Tat sunokuchi, J apan [email protected] 2 Graduat e School of Engineering, Kyot o University, Kyot o, J apan. [email protected] 3 Meiji University, Kawasaki, J apan, [email protected] 4 GSIS, Tohoku University, Sendai, J apan. [email protected]
A b s t r a c t . Given a connect ed weight ed graph G = ( V , E ), we consider a hypergraph H G = ( V , P G ) corresponding t o t he set of all short est pat hs in G . For a given real assignment a on V sat isfying 0 ≤ a ( v ) ≤ 1, a global rounding α wit h respect t o H G is a binary assignment sat isfying t hat | v ∈ F a ( v ) − α ( v ) | < 1 for every F ∈ P G . We conject ure t hat t here are at most | V | + 1 global roundings for H G , and also t he set of global roundings is an affi ne independent set . We give several posit ive evidences for t he conject ure.
1
In t ro d u c t io n
Given a real number a, an int eger k is a rou n din g of a if t he diff erence between a and k is st rict ly less t han 1, or equivalent ly, if k is t he floor ⌊ a⌋ or t he ceiling ⌈ a ⌉ of a . We ext end t his usual not ion of rounding int o t hat of global rou n din g on hypergraphs as follows. Let H = ( V, F ), where F ⊂ 2V , be a hypergraph on a set V of n nodes. Given a real valued funct ion a on V , we say t hat an int eger valued funct ion α on V is a global rou n din g of a wit h respect t o H , if w F ( α ) is a rounding of f ( v ). We assume in t his w F ( a ) for each F ∈ F , where w F ( f ) denot es v∈ F paper t hat t he hypergraph cont ains all t he singlet on set s as hyperedges; t hus, α ( v ) is a rounding of α ( v ) for each v , and we can rest rict our at t ent ion t o t he case where t he ranges of a and α are [0, 1] and { 0, 1} respect ively. T his not ion of global roundings on hypergraphs is closely relat ed t o t hat of discrepan cy of hypergraphs[6,10,11,4]. Given a and b ∈ [0, 1]V , define t he discrepan cy D H ( a , b ) between t hem on H by D H ( a , b ) = max | w F ( a )
F
∈
−
wF (b )| .
F
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 130–138, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
T he St ruct ure and Number of Global Roundings of a Graph
131
T he supremum sup a ∈ [0 , 1] min α ∈ { 0 , 1 } D H ( a , α ) is called t he linear (or inhomogeneous) discrepancy of H , and it is a quality measure of approximability of a real vect or wit h an int egral vect or t o sat isfy a const raint given by a linear syst em corresponding t o H . T hus, t he set of global roundings of a is t he set on int egral point s in t he open unit ball around a by using t he discrepancy D H as t he dist ance funct ion. It is known t hat t he open ball always cont ains an int egral point for any “input ” a if and only if t he hypergraph is unimodular (see [4,7]). T he fact is ut ilized in digit al halft oning applicat ions [1,2]. It is NP -hard t o decide whet her t he ball is empty (i.e. cont aining no int egral point ) or not even for some very simple hypergraphs [3]. In t his paper, we are int erest ed in t he maximum number ν ( H ) of int ergral point s in an open unit ball under t he discrepancy dist ance. T his direct ion of research is init iat ed by Sadakane et al. [13] where t he aut hors discovered a somewhat surprising fact t hat ν ( I n ) ≤ n + 1 where I n is a hypergraph on V = { 1, 2, .., n } wit h edge set { [i , j ]; 1 ≤ i ≤ j ≤ n } consist ing of all subint ervals of V . We can also see t hat ν ( H ) ≥ n + 1 for any any hypergraph H : if we let a ( v ) = ǫ for every v , where ǫ < 1/ n , t hen any binary assignment on V t hat assigns 1 t o at most one vert ex is a global rounding of H , and hence ν ( H ) ≥ n + 1. Given t his discovery, it is nat ural t o ask for which class of hypergraphs t his property ν ( H ) = n + 1 holds. T he underst anding of such classes may well be relat ed t o algorit hmic quest ions ment ioned above. In fact , Sadakane et al. give an effi cient algorit hm t o enumerat e all t he global roundings of a given input on In. In t his paper, we show t hat ν ( H ) = n + 1 holds for a considerably wider class of hypergraphs. Given a connect ed G in which edges are possibly weight ed by a posit ive value, we define a shor t est -pat h hy pergraph H G generat ed by G as follows: a set F of vert ices of G is an edge of H G , if and only if F is t he set of vert ices of some short est pat h in G wit h respect t o t he given edge weight s. In t his not at ion, I n = H P for t he pat h P n on n vert ices. Not e t hat we permit more t han one short est pat h between a pair of nodes if t hey have t he same lengt h. V
V
n
T h e o re m 1 . ν ( H G ) = n + 1 holds for t he shor t est -pat h hy pergraph H G , if G is a t ree, a cy cle, a t ree of cy cles, or an u n w eight ed m esh.
Based on t he posit ive evidence above and some failed at t empt s in creat ing count erexamples, we conject ure t hat t he result holds for general connect ed graphs. C on ject u re 1. ν ( H G ) = n + 1 for any connect ed graph G wit h n nodes.
2
P re lim in a rie s
We st art wit h t he following easy observat ions: L e m m a 1 . For hy pergraphs H = ( V, F ) an d H ′ = ( V, F ′ ) su ch t hat ν (H ) ≥ ν (H ′ ).
F
⊂
F
′
,
132
T . Asano et al.
D e fi n it io n 1 . A set A of bin ar y fu n ct ion s on V is called H -com pat ible if, for each pair α an d β in A , | w F ( α ) − w F ( β ) | ≤ 1 holds for ever y hy peredge F of H .
L e m m a 2 . For a given in pu t real vect or a , t he set of global rou n din gs w it h respect t o H is H -com pat ible. P roof. Suppose t hat α and β are two diff erent global roundings of an input a wit h respect t o a hypergraph H . We have | w F ( α ) − w F ( β ) | ≤ | w F ( a ) − w F ( α ) | + | w F ( a ) − w F ( β ) | < 2. Since t he value must be int egral, we have t he lemma.
Let µ ( H ) be t he maximum cardinality of an H -compat ible set . Because of t he above lemma, µ ( H ) ≥ ν ( H ). Indeed, inst ead of an open unit ball, µ ( H ) gives t he largest cardinality of a unit -diamet er set wit h respect t o D H . For a vect or q in t he n -dimensional real space R n , q˜ is t he vect or in R n + 1 obt ained by appending 1 as t he last coordinat e value: i.e., q˜ = ( q1 , q2 , . . . , qn , 1) if q = ( q1 , q2 , . . . , qn ). Vect ors q 1 , q 2 , . . . q s are called affi n e in depen den t in R n if q˜1 , q˜2 , . . . , q˜s are linearly independent in R n + 1 . If every H -compat ible set is an affi ne independent set regarded as a set of vect ors in t he n -dimensional space, we call H sat isfies t he affi n e in depen den ce proper t y . T he definit ion of H -compat ible set does not include t he input vect or a , and facilit at es t he combinat orial analysis. T hus, inst ead of Conject ure 1, we consider t he following (possibly st ronger) variant s: C on ject u re 2. µ ( H G ) = n + 1 for any connect ed graph G wit h n nodes.
C on ject u re 3. For any connect ed graph G , H G sat isfies t he affi ne independence
property. It is clear t hat Conject ure 3 implies Conject ure 2, and t hat Conject ure 2 implies Conject ure 1.
3
P ro p e rt ie s fo r G e n e ra l G ra p h s
For a binary assignment α on V and a subset X of V , α | X denot es t he rest rict ion of α on X . Let V = X ∪ Y be a part it ion of V int o nonint ersect ing subset s X and Y of vert ices. For binary assignment s α on X and β on Y , α ⊕ β is a binary assignment on V obt ained by concat enat ing α and β : T hat is, α ⊕ β ( v ) = α ( v ) if v ∈ X , ot herwise it is β ( v ). T he following lemma is a key lemma for our t heory: L e m m a 3 . L et G = ( V, E ) be a con n ect ed graph, an d let V = X ∪ Y be a par t it ion of V . L et α 1 an d α 2 be diff eren t assign m en t s on X an d let β 1 an d β 2 be diff eren t assign m en t s on Y . T hen , t he set F = { α 1 ⊕ β 1 , α 1 ⊕ β 2 , α 2 ⊕ β 1 , α 2 ⊕ β 2 } can n ot be H G -com pat ible.
T he St ruct ure and Number of Global Roundings of a Graph
133
P roof. Consider x
∈ X sat isfying α 1 ( x ) = α 2 ( x ) and y ∈ Y sat isfying β 1 ( y ) = ( y ). We choose such x and y wit h t he minimum short est pat h lengt h. T hus, 2 on each int ernal node of a short est pat h p from x t o y , all four assignment s in F t ake t he same value. Wit hout loss of generality, we assume α 1 ( x ) = β 1 ( y ) = 0 and α 2 ( x ) = β 2 ( y ) = 1. T hen, w p ( α 2 ⊕ β 2 ) = w p ( α 1 ⊕ β 1 ) + 2, and hence violat e t he compat ibility.
β
C o ro lla ry 1 . L et A be a set of H G -com pat ible set , an d let A | X an d A | Y be t he set obt ain ed by rest r ict in g assign m en t s of A t o X an d Y , respect ively , for a par t it ion of V . I f A | X an d A | Y has µ X an d µ Y elem en t s, respect ively , an d √ µ X ≥ µ Y , | A | ≤ min { µ Y ( µ Y − 1) / 2 + µ X , µ Y µ X + µ X } . P roof. If we const ruct a bipart it e graph wit h node set s corresponding t o A | X and A | Y , in which two nodes α ∈ A | X and β ∈ A | Y are connect ed by an edge if α ⊕ β ∈ A , Lemma3 implies t he K 22 -free property of t he graph. T hus, t he corollary follows from a famous result in ext remal graph t heory ([5], Lemma 9).
Alt hough t he recursion f ( n ) ≤ f (1)( f (1) − 1) / 2 + f ( n − 1) gives a linear upper bound of f ( n ), t his does not imply t hat | A | = O ( n ), since t he rest rict ion A | X is not always an H G -compat ible set where G ′ is t he induced subgraph by X of G . T he affi ne independence of an H -compat ible set A = { α 1 , α 2 , . . . , α m } means t hat any linear relat ion 1 ≤ i ≤ m ci α i = 0 sat isfying t hat 1 ≤ i ≤ m ci = 0 implies t hat ci = 0 for 1 ≤ i ≤ m . We can prove it s special case as follows: 1 ′
P ro p o s it io n 1 . I f α , β , α ′ , an d β ′ are m u t u ally dist in ct elem en t s of an H G com pat ible set for som e graph G , t hen it can n ot happen t hat α − β = α ′ − β ′ . P roof. Let X be t he subset of V consist ing of u sat isfying α ( u ) = β ( u ), and let Y be it s complement in V . Let α = ξ ⊕ η , where ξ and η are t he part s of α on X and Y , respect ively. T hus, β = ξ ⊕ η ¯ , where η ¯ is obt ained by flipping all t he ent ries of η . Let α ′ = ξ ′ ⊕ η ′ . T hen, since α − β = α ′ − β ′ , β ′ = ξ ′ ⊕ η ¯ ′ . Moreover, η − η ¯ and η ′ − η ¯ ′ are vect ors whose ent ries are 1 and − 1, and hence η − η ¯ = η ′ − η ¯ ′ implies t hat η = η ′ . T hus, all of ξ ⊕ η , ξ ⊕ η ¯ , ξ ′ ⊕ η , and ξ ′ ⊕ η ¯ are in A ; t his cont radict s wit h
Lemma 3 if t hey are diff erent t o each ot her.
4
G ra p h s fo r w h ic h t h e C o n je c t u re s H o ld
4 .1
G ra p h s w it h P a t h -P re s e rv in g O rd e rin g
Given a connect ed graph G = ( V, E ), consider an ordering v 1 , v 2 , . . . , vn of nodes of V . Let Vi = { v 1 , v 2 , . . . , vi } , and let G i be t he induced subgraph of G by Vi . T he ordering is pat h-preserving if G i is connect ed for each i , and a short est 1
T his fact was suggest ed by G u¨ nt er Rot e.
134
T . Asano et al.
pat h in G i is always a short est pat h in G . It is clear t hat a t ree wit h arbit rary edge lengt hs and a complet e graph wit h a uniform edge lengt h have pat hpreserving orderings. More generally, a k -t ree wit h a unform edge lengt h has a pat h-preserving ordering by it s definit ion. A d-dimensional mesh, where each edge has unit lengt h, is also a typical example. T h e o re m 2 . I f G has a pat h-preser vin g order in g, H G sat isfi es t he affi pen den ce proper t y .
n e in de-
P roof. We prove t he st at ement by induct ion on | V | . If n = 1, t he st at ement is
t rivial, since (0, 1) and (1, 1) are linearly independent . If G has a pat h-preserving ordering, it gives a pat h-preserving ordering for G n − 1 t hat has n − 1 nodes. T hus, from t he induct ion hypot hesis, we assume t hat any H G 1 -compat ible set of binary assignment s is an affi ne independent set . Let π be t he rest rict ion map from V { 0, 1} t o { 0, 1} V 1 corresponding t o rest rict ion of a binary assignment on V t o t he one on Vn − 1 . Let A be an H G -compat ible set , and let π ( A ) = { π ( α ) : α ∈ A } be t he set obt ained by rest rict ing A t o Vn − 1 and removing t he mult iplicit ies. T he set π ( A ) must be an H G 1 -compat ible set : ot herwise, t here must be a short est pat h in G n − 1 violat ing t he compat ibility condit ion for A , which cannot happen since t he pat h is also a short est pat h in G . For each β ∈ π ( A ), let β ⊕ 0 and β ⊕ 1 be it s ext ension in { 0, 1} V obt ained by assigning 0 and 1 t o v n , respect ively. Nat urally, π − 1 ( β ) is a subset of { β ⊕ 0, β ⊕ 1} . For any two diff erent assignment s β and γ in π ( A ), it cannot happen t hat all of β ⊕ 0, β ⊕ 1, γ ⊕ 0, and γ ⊕ 1 are in A . Indeed, t his is a special case of Lemma 3 for X = Vn − 1 and Y = { v n } . T hus, t here is at most one rounding in π ( A ) sat isfying t hat it s inverse image by π cont ains two element s. Let t he element s of A list ed as α 1 , . . . , α k where α 1 = β ⊕ 0 and α 2 = β ⊕ 1 for some β ∈ π ( A ). Suppose a linear relat ion 1 ≤ i ≤ k ci α i = 0 holds wit h = 0. By t he induct ion hypot hesis t hat π ( A ) is affi ne independent , we 1≤ i ≤ k have c1 + c2 = 0 and ci = 0 for 3 ≤ i ≤ k . Because of t he last component s of t he vect ors, it follows t hat c1 = c2 = 0 as well. n
n
−
−
n
−
C o ro lla ry 2 . For a con n ect ed graph G , if w e con sider t he hy pergraph H associat ed w it h t he set of all pat hs in G ( ir respect ive of t heir len gt hs) , H sat isfi es t he affi n e in depen den ce proper t y . P roof. Consider a spanning t ree T of G . T hen t he hypergraph associat ed wit h t he set of all pat hs in G has t he same node set as H , and it s hyperedge set is a subset of t hat of H . Hence, it suffi ces t o prove t he st at ement for T , which has a pat h-preserving ordering. Every pat h in T is a short est pat h in T ; hence, t he set is H T -compat ible, and consequent ly, affi ne independent .
A graph G is ser ies con n ect ion of two graphs G 1 and G 2 if G = G 1 ∪ G 2 and G 1 ∩ G 2 = { v } (implying t hat t hey share no edge), where v is called t he separat or . We have t he following (proof is omit ed in t his version): T h e o re m 3 . S u ppose t hat a graph G is a ser ies con n ect ion of t w o con n ect ed graphs G 1 an d G 2 . T hen , µ ( G ) ≤ µ ( G 1 ) + µ ( G 2 ) − 2. I f bot h of H G 1 an d H G 2 sat isfy t he affi n e in depen den ce proper t y , so does H G .
T he St ruct ure and Number of Global Roundings of a Graph 4 .2
135
T h e C a s e o f a C y c le
Let C n be a cycle on n vert ices V = { 1, 2, . . . , n } wit h edge set { e1 , . . . , en } where ei = ( i , i + 1), 1 ≤ i ≤ n . T he arit hmet ics on vert ices are cyclic, i.e., n + 1 = 1. We somet imes refer t o t he edge en as e0 as well. For i , j ∈ V , let P ( i , j ) denot e t he pat h from i t o j cont aining t he nodes v i , v i + 1 , . . . vj in t his cyclic order. Not e t hat P ( j , i ) is diff erent from P ( i , j ) if i = j . P ( i , i ) is nat urally int erpret ed as an empty pat h consist ing of a single vert ex and no edge. Let P = P C be a set of short est pat hs on C n . Not e t hat for any given edge lengt hs, P sat isfies t he following condit ions: (1) P ( i , i ) ∈ P for every i ∈ V , (2) if P ∈ P t hen every subpat h of P is in P , and (3) for every pair i , j of dist inct vert ices of C n , at least one of P ( i , j ) and P ( j , i ) is in P . n
T h e o re m 4 . µ ( H C n ) = n + 1.
As a corollary of T heorem 4 and T heorem 3, we have t he following: C o ro lla ry 3 . µ ( H G ) = n + 1 if G is a t ree of cy cles w it h n ver t ices.
We oft en writ e P for H C ident ifying t he hypergraph and t he set of hyperedges in t his sect ion for abbreviat ion. We devot e t he rest of t his sect ion for proving T heorem 4. We omit proofs of some lemmas because of space limit at ion. For n ≤ 2 t he t heorem is t rivial t o verify, so we will assume n ≥ 3 in t he α ( v ) t o be t he sequel. For an assignment α , we define w ( α ) = w V ( α ) = v∈ C weight of α over all vert ices in C n . n
n
L e m m a 4 . L et α an d β be w ( β ) diff er by at m ost 1.
P
-com pat ible assign m en t s on C n . T hen , w ( α ) an d
L e m m a 5 . S u ppose w ( α ) = w ( β ) for assign m en t α an d β . T hen , if α are P -com pat ible t hey are com pat ible on every pat h of C n .
an d β
From t he above observat ions and Corollary 2, it is clear t hat µ ( H C ) ≤ 2( n + 1). We reduce it t o n + 1 by using a pair of equivalence relat ions on t he set of edges of C n each of which is generat ed from t he P -compat ible set of assignment s wit h a uniform weight . T he following not ion of edge opposit ion is one of our main t ools. Let ei and ej be two edges of C n . We say ei opposes ej (and vice versa) if pat hs P ( i + 1, j ) and P ( j + 1, i ) are bot h in P . Not e t hat when P ( i + 1, i ) ∈ P , ei opposes it self in t his definit ion. However, in t his case, t he lengt h of ei is so large t hat it does not appear in any short est pat h, and we can cut t he cycle int o a pat h at ei t o reduce t he problem int o t he sequence rounding problem. T hus, we assume t his does not happen. It is rout ine t o verify t he following lemma n
L e m m a 6 . For ever y edge ei of C n , t here is at least on e edge ej t hat opposes ei . M oreover , if edges ei an d ej oppose each ot her , t hen , eit her ei + 1 opposes ej or ej + 1 opposes ei .
Define t he opposit ion graph , denot ed by opp( P ), t o be t he graph on E ( C n ) in which { ei , ej } is an edge if and only if ei and ej oppose each ot her. By Lemma 6, we obt ain t he following:
136
T . Asano et al.
L e m m a 7 . T he opposit ion graph opp( P ) is con n ect ed.
We next prove a lemma regarding two equivalence relat ions on t he vert ex set of a graph. Let G be a graph. We say t hat a pair ( R 1 , R 2 ) of equivalence relat ions on V ( G ) hon or s G , if for every edge { u, v } of G , u and v are equivalent eit her in R 1 or in R 2 . For an equivalence relat ion R , denot e by ec( R ) t he number of equivalence classes of R . L e m m a 8 . L et G be a con n ect ed graph on n ver t ices an d su ppose a pair ( R 1 , R 2 ) of equ ivalen ce relat ion s on V ( G ) hon or s G . T hen ec( R 1 ) + ec( R 2 ) ≤ n + 1. P roof. F ix an arbit rary spanning t ree T of G . We assume ( R 1 , R 2 ) honors G and hence it honors T . We grow t ree S from a singlet on t ree t owards T , and consider f ( S ) t hat is t he sum of t he number of equivalence classes for R 1 and R 2 among t he nodes of S . Init ially, we have one node, and hence f ( S ) = 2. If we add an edge and a vert ex, f ( S ) increases by at most one, since t he vert ex is equivalent t o an exist ing class for at least one of t he equivalence relat ions. Hence, f ( T ) ≤ n + 1.
T he following equivalence relat ion on t he edge set of C n plays a cent ral role in our proof. Let A be a set of assignment s of uniform weight . We say t hat two edges ei , ej of C n are A -equ ivalen t and writ e ei ∼ A ej if and only if eit her i = j or w P ( i + 1 , j ) ( α ) is t he same for every α ∈ A . T his relat ion is symmet ric since t he assignment s in A have t he same weight on t he ent ire cycle and P ( i + 1, j ) and P ( j + 1, i ) are complement t o each ot her in t erms of t heir vert ex set s. It is indeed st raight forward t o check t he t ransit ivity t o confirm t hat A -equivalence is an equivalence relat ion for any assignment set A of uniform weight . L e m m a 9 . L et A an d B be set s of assign m en t s on C n su ch -com pat ible set an d, for som e fi xed in t eger w , w ( a) = w for w ( b) = w + 1 for ever y b ∈ B . T hen , for an y pair of edges ei each ot her w it h respect t o P , eit her ei ∼ A ej or ei ∼ B ej ; in pair ( ∼ A , ∼ B ) hon or s t he opposit ion graph opp( P ) . P
t hat A ∪ B is a ever y a ∈ A an d an d ej opposin g ot her w ords, t he
Consider a set A of of P -compat ible assignment s in which all assingment s have t he same weight . From Lemma 5, t he set A is an I n -compat ible assignment , where I n is t he hypergraph on V associat ed wit h all t he int ervals on t he graph obt ained by cut t ing C n at t he edge e0 = ( v n , v 1 ). Let Vi = { 1, 2, . . . , i } ⊂ V , and let A ( Vi ) be t he set of assignment s on Vi obt ained by rest rict ing A t o Vi . L e m m a 1 0 . | A ( Vi ) |
≤
|A
( Vi − 1 ) | + 1.
P roof. Vi = Vi −
1 ∪ { v i } . Applying Lemma 3, t here is at most one assignment α in A ( Vi − 1 ) such t hat bot h of α ⊕ 0 and α ⊕ 1 are in A ( Vi ). T hus, we obt ain t he lemma.
We call t he index i a bran chin g in dex of A if | A ( Vi ) | = | A ( Vi − 1 ) | + 1 holds. Not e t hat for a branching index, t here must be an assignment α in A ( Vi − 1 ) such t hat bot h of α ⊕ 0 and α ⊕ 1 are in A ( Vi ).
T he St ruct ure and Number of Global Roundings of a Graph
137
L e m m a 1 1 . L et A be a set of pair w ise P -com pat ible assign m en t s in w hich all assin gm en t s have t he sam e w eight . T hen , i is a bran chin g in dex in A on ly if t he edge ei = ( i , i + 1) is A -equ ivalen t t o n on e of e0 , e1 , e2 , . . . , ei − 1 . P roof. Suppose level i is a branching index. T hen, we have α
∈ A ( Vi − 1 ) such t hat 0 and α ⊕ 1 are in A ( Vi ). If ei is A -equivalent t o ej for j < i , t he assignment s α ⊕ 0 and α ⊕ 1 must have t he same t ot al weight on Vi \ Vj = { j + 1, . . . , i } . T his is impossible, since two assignment s are t he same on Vi \ Vj except on i .
α
⊕
Consider t he number ec( ∼ A ) | V of equivalence classes in Vi . Lemma 11 implies t hat | A ( Vi ) | − | A ( Vi − 1 ) | ≤ ec( ∼ A ) | V − ec( ∼ A ) | V 1 . T hus, we have t he following corollary: i
i
i
−
C o ro lla ry 4 . L et A be a set of assign m en t s t hat are pair w ise com pat ible an d have t he sam e w eight . T hen | A | ≤ ec( ∼ A ) .
We are now ready t o prove T heorem 4. Let P be an arbit rary short est pat h syst em on C n and let A be an arbit rary set of pairwise P -compat ible assignment s on C n . By Lemma 4, t he assignment s of A have at most two weight s. If t here is only one weight , t hen | A | ≤ ec( ∼ A ) by Corollary 4 and hence | A | ≤ n + 1. Suppose A consist s of two subset s A 1 and A 2 , wit h t he assignment s in A 1 having weight w and t hose in A 2 having weight w + 1. By Lemma 9, t he pair of equivalence relat ions ( ∼ A 1 , ∼ A 2 ) honors t he opposit ion graph opp( P ). Since opp( P ) is connect ed (Lemma 7), we have ec( ∼ A 1 ) + ec( ∼ A 2 ) ≤ n + 1 by Lemma 8. We are done, since | A i | ≤ ec( ∼ A ) for i = 1, 2 by Corollary 4. i
5
C o n c lu d in g R e m a rk s
We have proven t he conject ures only for special graphs. It will be nice if t he conject ures are proven for wider classes of graphs such as out er-planar graphs and series parallel graphs 2 . Also, t he affi ne independence property for t he cycle graph has not been proven in t his paper. For a general graph, we do not even know whet her ν ( H G ) is polynomially bounded by t he number of vert ices. It is plausible t hat t he number of roundings can become large if t he ent ries have some middle values (around 0.5). However, for a special input a consist ing of ent ries wit h a same value 0.5 + ǫ , we can show t hat t he number of global roundings of a is bounded by n + 1 if G is bipart it e; ot herwise by m + 1, where m is t he number of edges in G [9]. A ck n o w le d g e m e n t . T he aut hors t hank J esper J ansson, G u ¨ nt er Rot e, and
Akiyoshi Shioura for fruit ful discussion.
2
One of t he aut hors recent ly proved it for out er-planar graphs
138
T . Asano et al.
R e fe re n c e s 1. T . Asano, N. Kat oh, K. Obokat a, and T . Tokuyama, Mat rix Rounding under t he L p -Discrepancy Measure and It s Applicat ion t o Digit al Halft oning, P roc. 13th A CM -SI A M SOD A (2002) pp. 896–904. 2. T . Asano, T . Mat sui, and T . Tokuyama, Opt imal Roundings of Sequences and Mat rices, N ordi c Jour nal of Computi ng 7 (2000) pp.241–256. (P reliminary version in SWAT 00). 3. T . Asano and T . Tokuyama, How t o Color a Checkerboard wit h a Given Dist ribut ion – Mat rix Rounding Achieving Low 2 × 2 Discrepancy, P roc. 12th I SA A C, L N CS 2223(2001) pp. 636–648. 4. J . Beck and V. T . S´os, D i screpancy T heor y , in H andbook of Combi nator i cs Volume I I (ed. T . Graham, M. Gr¨ot shel, and L. Lov´a sz) 1995, Elsevier. 5. B. Bollob´a s. M oder n Graph T heor y , GT M 184, Springer-Verlag, 1998. 6. B. Chazelle, T he D i screpancy M ethod: Randomness and Complexi ty , P rincet on University, 2000. 7. B. Doerr, Lat t ice Approximat ion and Linear Discrepancy of Tot ally Unimodular Mat rices, P roc. 12th A CM -SI A M SOD A (2001) pp.119–125. 8. A. Hoff man and G. Kruskal, Int egral Boundary P oint s of Convex P olyhedra, In L i near I nequali ti es and Related Systems (ed. W . Kuhn and A. Tucker) (1956) pp. 223–246. 9. J . J ansson and T . Tokuyama, Semi-Balanced Coloring of Graphs– 2-Colorings Based on a Relaxed Discrepancy Condit ion, Submit t ed. 10. J . Mat ouˇsek, Geometr i c D i screpancy , Algorit hms and Combinat orics 18, Springer Verlag 1999. 11. H. Niederreit er, Random N umber Generati ons and Quasi M onte Car lo M ethods, CBMS-NSF Regional Conference Series in Applied Mat h., SIAM, 1992. 12. J . P ach and P. Agarwal, Combi nator i al Geometr y, J ohn-W iley & Sons, 1995. 13. K. Sadakane, N. Takki-Chebihi, and T . Tokuyama, Combinat orics and Algorit hms on Low-Discrepancy Roundings of a Real Sequence, P roc. 28th I CA L P , L N CS 2076 (2001) pp. 166–177.
O n E v e n Tria n g u la t io n s o f 2 -C o n n e c t e d E m b e d d e d G ra p h s ⋆ Huaming Zhang and Xin He Depart ment of Comput er Science and Engineering, SUNY at Buff alo, Amherst , NY, 14260, USA
Recent ly, Hoff mann and Kriegel proved an import ant combinat orial t heorem [4]: Every 2-connect ed bipart it e plane graph G has a t riangulat ion in which all vert ices have even degree (it ’ s called an even t r i an gu l at i on ). Combined wit h a classical W hit ney’ s T heorem, t his result implies t hat every such a graph has a 3-colorable plane t riangulat ion. Using t his t heorem, Hoff mann and Kriegel significant ly improved t he upper bounds of several art gallery and prison guard problems. In [7], Zhang and He present ed a linear t ime algorit hm which relies on t he complicat ed algebraic proof in [4]. T his proof cannot be ext ended t o similar graphs embedded on high genus surfaces. It ’ s not known whet her Hoff mann and Kriegel’ s T heorem is t rue for such graphs. In t his paper, we describe a t ot ally independent and much simpler proof of t he above t heorem, using only graph-t heoret ic argument s. Our new proof can be easily ext end t o show t he exist ence of even t riangulat ions for similar graphs on high genus surfaces. Hence we show t hat Hoff mann and Kriegel’ s t heorem remains valid for such graphs. Our newproof leads t o a very simple linear t ime algorit hm for finding even t riangulat ions. A b st r a c t .
1
In t ro d u c t io n
Let G = ( V , E ) be a 2-connect ed bipart it e plane graph. A trian gu lation of G is a plane graph obt ained from G by adding new edges int o t he faces of G so t hat all of it s faces are t riangles. A t riangulat ion G of G is called even if all vert ices of G have even degree. Recent ly, Hoff mann and Kriegel proved an import ant combinat orial t heorem [3,4]: ′
′
T h e o r e m 1 . E very 2-con n ected bipartite plan e graph has an even trian gu lation .
Combined wit h t he following classical Whit ney’ s T heorem: T h e o r e m 2 . A plan e trian gu lation is 3-colorable iff
all of its vertices have even
degree.
T heorem 1 implies t hat every 2-connect ed bipart it e plane graph has a 3-colorable plane t riangulat ion. T heorem 1 was proved in [4] by showing t hat a linear equat ion syst em derived from t he input graph G has a solut ion. An even t riangulat ion of G is found by
⋆
Research support ed in part by NSF Grant CCR-9912418.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 139–148, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
140
H. Zhang and X. He
solving t his linear equat ion syst em. In [7], a linear t ime algorit hm for solving t his problem was present ed. T his algorit hm relies on t he complicat ed algebraic t echniques in [3,4]. It cannot be ext ended t o graphs on high genus surfaces. In t his paper, we present a new proof of T heorem 1. It is t ot ally diff erent and much simpler t han t he proof in [4]. Our new proof is based on newly revealed propert ies of G and it s dual graph G , which leads t o a very sim ple O ( n ) t ime algorit hm for const ruct ing an even t riangulat ion of G . Because a crucial property t hat is t rue for plane graphs does not hold for graphs on high genus surfaces, t he proof of T heorem 1 in [4] fails for such graphs. It ’ s not known whet her T heorem 1 is valid for such graphs. We show t hat our new proof of T heorem 1 and t he algorit hm for const ruct ing even t riangulat ions of 2-connect ed bipart it e plane graphs also apply t o similar graphs on high genus surfaces. On t he ot her hand, because t he above-ment ioned crucial diff erence between t he plane graphs and graphs on high genus surfaces, we can only prove a lower bound on t he number of dist inct even t riangulat ions of such graphs. T he problem of det ermining t he exact value of t his number remains an open problem. T he rest of t he paper is organized as follows. In Sect ion 2, we int roduce t he definit ions and preliminary result s in [3,4]. In Sect ion 3, we provide new proofs of T heorem 1 and anot her key t heorem in [3,4]. In Sect ion 4, we invest igat e t he problem for graphs on high genus surfaces. Det ails of t his paper are in t echnical report 2002-13 at CSE depart ment of SUNY at Buff alo. ∗
2
P re lim in a rie s
In t his sect ion, we give definit ions and preliminary result s. All definit ions are st andard and can be found in [1]. Let G = ( V , E ) be a plane graph wit h n = | V | vert ices and m = | E | edges. T he degree of a vert ex v ∈ V , denot ed by d eg G ( v ) (or simply by d eg ( v ).), is t he number of edges incident t o v . A diagon al of G is an edge which does not belong t o E and connect s two vert ices of a facial cycle. G is trian gu lated if it has no diagonals. (Namely all of it s facial cycles, including t he ext erior face, are t riangles). A trian gu lation of G is obt ained from G by adding a set of diagonals such t hat t he result ing graph is plane and t riangulat ed. An even trian gu lation is a t riangulat ion in which all vert ices have even degree. In t his case, we also call t he set of diagonals added int o G an even t riangulat ion of G . Wit hout loss of generality, let G be a 2-connect ed bipart it e plane graph all of whose facial cycles have lengt h 4 (Add diagonals if necessary). Such a graph will be called a 2-connect ed maximal bipart it e plane graph (2MBP graph for short ). By Euler’ s formula, a 2MBP graph wit hn vert ices always has n − 2 faces and m = 2n − 4 edges. We denot e t he faces of G by Q ( G ) = { q1 , q2 , . . . , qn 2 } . When G is clearly underst ood, we simply use Q t o denot e Q ( G ). Since G is bipart it e, we can fix a 2-coloring of G wit h colors 0 and 1. Denot e t he color of a vert ex v by c ( v ). For any face qi ∈ Q , t he set of t he four vert ices on t he boundary of qi is denot ed by V q i and we set Q v = { qi ∈ Q | v ∈ V q i } . Since every facial cycle of G is a 4-cycle, every face qi ∈ Q has two diagonals: −
On Even Triangulat ions of 2-Connect ed Embedded Graphs
141
t he diagonal joining t he two 0-colored (1-colored, respect ively) vert ices in V q i is called t he 0-diagonal (1-diagonal, respect ively). T hus a t riangulat ion of G is not hing but choosing for each face qi eit her t he 0-diagonal or t he 1-diagonal and adding it int o qi . To fl ip a diagon al of qi means t o choose t he ot her diagonal of qi . We associat e each face qi ∈ Q wit h a { 0, 1} -valued variable x i , and each t riangulat ion T of G wit h a vect or x = ( x 1 , x 2 , . . . , x n 2 ) ∈ G F (2) n 2 , where: T cont ains t he 0-diagonal of t he face qi ⇐ ⇒ xi = 1 T his mapping defines a one-t o-one correspondence between t he set of t riangulat ions of G and G F (2) n 2 . Hoff mann and Kriegel [3,4] proved t hat a vect or x = (x i )1 i n G F (2) n 2 represent s an even t riangulat ion of G iff x is a 2 ∈ solut ion of t he following linear equat ion syst em over G F (2): −
−
−
−
≤
≤
−
xi qi ∈
=
d eg ( v )
+
|Q v |c
(v )
(mod 2)
(∀
v ∈
V
)
(1)
Q v
In [4], Hoff mann and Kriegel showed t hat Equat ion (1) always has a solut ion, and hence proved T heorem 1. To obt ain all solut ions of Equat ion (1) (i.e. all even t riangulat ions of G ), [4] int roduced t he concept of straight walk . For a 2MBP graph G , it s dual graph G is 4-regular and connect ed. Consider a walk S in G . Since G is 4-regular, at every vert ex of S , we have four possible choices t o cont inue t he walk: go back, t urn left , go st raight , or t urn right . A closed walk of G consist ing of only st raight st eps at every vert ex is called a straight walk or an S -walk . T he edge set of G can be uniquely part it ioned int o S -walks. We use S ( G ) = { S 1 , . . . , S k } t o denot e t his part it ion, where each S i (1 ≤ i ≤ k ) is an S -walk of G . Each vert ex of G (i.e. each face of G ) occurs eit her twice on one S -walk or on two diff erent S -walks. If a face f occurs on one S -walk twice, it is called a 1-walk face . If f occurs on two diff erent S -walks, it is called a 2-walk face . Figure 1 shows a 2MBP graph and it s dual graph G . T he edges of G are represent ed by solid lines. T he edges of G are represent ed by dot t ed lines. T he vert ices of G (i.e. t he faces of G ) are represent ed by small circles. S ( G ) cont ains 3 S -walks S 1 , S 2 and S 3 . T he face q1 is a 1-walk face since it occurs on S 3 twice. T he face q2 is a 2-walk face since it occurs on bot h S 2 and S 3 . (T he S -walks in t his figure are direct ed. It s meaning will be discussed in t he next sect ion). T he following t heorem was proved in [3,4] by showing anot her linear equat ion syst em derived from G has a solut ion: ∗
∗
∗
∗
∗
∗
∗
∗
∗
∗
∗
T h e o r e m 3 . Let G be a 2M B P graph an d of G ∗ . T he followin g statem en ts hold:
∗
S
(G ) = ∗
{
S 1 , . . . , S k } be the S -walks
1. I f T is an even trian gu lation of G an d the diagon als of T are fl ipped alon g an S -walk S i , we obtain an other even trian gu lation of G . ( I f a face f occu rs on S twice, its diagon al is fl ipped twice an d hen ce rem ain s u n chan ged.) 2. I f T 1 an d T 2 are two even trian gu lation s of G , then there is a collection of S -walks su ch that by fl ippin g the diagon als of T 1 alon g these S -walks we obtain T 2 .
142
H. Zhang and X. He S3 u v
q3 q2
w z
S2 q1
F ig. 1 .
3
A 2MBP graph
G
, t he dual graph
S1
G
∗
and one of it s
S
-orient at ion
O
.
E v e n Tria n g u la t io n s o f 2 M B P G ra p h s
In t his sect ion, we provide new proofs of T heorems 1 and 3. First , we int roduce a few definit ions. An orien tation of an undirect ed graph is an assignment of direct ions t o it s edges. D e fi n i t i o n 1 .
Let
G
be a 2MBP graph.
1. A G -orien tation of G is an orient at ion of G such t hat every facial cycle of G is decomposed int o two direct ed pat hs, one in clockwise direct ion and anot her in count erclockwise direct ion, each of lengt h 2. 2. Let G 1 , G 2 be two G -orient at ions of G . If every edge of G has reverse direct ion in G 1 and G 2 , we say G 2 is t he reverse of G 1 . In t his case, G 1 and G 2 are called a G -orien tation pair of G . 3. Fix a G -orient at ion G of G . For each face q of G , t he st art ing and t he ending vert ices of t he two direct ed pat hs on t he boundary of q are called t he prim ary vert ices of q . T he diagonal of q connect ing t he two primary vert ices is called it s prim ary diagon al (wit h respect t o G ). T he ot her diagonal of q is called it s secon dary diagon al (wit h respect t o G ). Not e: for a G -orient at ion pair G 1 , G 2 and any face q of G , t he primary diagonal of q wit h respect t o G 1 is t he same as it s primary diagonal wit h respect t o G 2 . If G 1 , G 2 do not form a G -orient at ion pair, t hen for some faces q of G , t he primary diagonal of q wit h respect t o G 1 is diff erent from t hat wit h respect t o G 2 . D e fi n i t i o n 2 . {
S1, . . . , Sk }
Let
G
be a 2MBP graph and
G∗
be it s dual graph wit h
S
(G ) = ∗
.
1. An S -orien tation of G is an orient at ion of (1 ≤ i ≤ k ) is a direct ed closed walk. ∗
G∗
such t hat every
S -walk S i
On Even Triangulat ions of 2-Connect ed Embedded Graphs
143
2. Let O 1 , O 2 be two S -orient at ions of G . If every S i (1 ≤ i ≤ k ) has reverse direct ion in O 1 and O 2 , we say O 2 is t he reverse of O 1 . In t his case, O 1 and O 2 are called an S -orien tation pair of G . 3. Fix an S -orient at ion O of G . For each face q of G , if an S -walk S i of G st eps out of (int o, respect ively) q t hrough an edge e on t he boundary of q , t hen e is called an ou t-edge ( in -edge , respect ively) of q (wit h respect t o O ). ∗
∗
∗
∗
We can assign two diff erent direct ions t o each S -walk. So, if G has k S -walks, it has 2k dist inct S -orient at ions and 2k 1 dist inct S -orient at ion pairs. Consider an arbit rary S -orient at ion O of G . It is easy t o check t hat every face q of G has two out -edges and two in-edges wit h respect t o O , and t he two in-edges of q are always incident t o a common vert ex on t he boundary of q . T hus t here are always two non-adjacent vert ices on t he boundary of q t hat are incident t o bot h in-edges and out -edges of q . For example, consider t he face q3 in Fig. 1. An S -orient at ion O of G is shown in t he figure. Wit h respect t o O , t he edge ( u , v ) is an out -edge of q3 and t he edge ( w , z ) is an in-edge of q3 . T he vert ices u and w are incident t o bot h in-edges and out -edges of q3 . Next we show t hat t here exist s a nat ural one-t o-one mapping between t he set of S -orient at ions of G and t he set of G -orient at ions of G which preserves t he pair relat ion. ∗
−
∗
∗
∗
Let G be a 2MBP graph and O be an S -orient at ion of G . We define an orient at ion of G from O as follows. Let e be any edge of G and e be it s dual edge in G . Let q1 and q2 be t he two faces of G wit h e on t heir boundaries. Suppose t hat e is direct ed from q2 t o q1 in O . When t raveling e from q2 t o q1 , we direct e from right t o left . (In ot her words, e is direct ed count erclockwise on t he boundary of q2 and clockwise on t he boundary of q1 ). T his orient at ion of G will be called t he orien tation in du ced from O and denot ed by π ( O ). ∗
D e fi n i t i o n 3 .
∗
∗
∗
∗
An example of t he induced orient at ion is shown in Fig. 2 (a). T he S -walks pass t hrough t he faces q1 , q2 in t he shown direct ions. T he induced direct ions of t he edges on t he boundaries of q1 and q2 are also shown. We omit t he proof of t he following lemma: Si , Sj , Sm
L e m m a 1 . Let G be a 2M B P graph. I f O is an S -orien tation of G ∗ , then π
(O )
is a G -orien tation of G . I f O an d O ′ form an S -orien tation pair, then π ( O ) an d π ( O ′ ) form a G -orien tation pair of G .
Let O be an S -orient at ion of G and G = π ( O ). For any face q of G , t he primary diagonal d of q wit h respect t o G is t he diagonal connect ing t he two vert ices on t he boundary of q t hat are incident t o bot h t he in-edges and t he out -edges of q wit h respect t o O . We also call d t he primary diagonal of q wit h respect t o O . For example, consider t he face q1 in Fig. 2 (a). T he vert ices v 1 and v 3 are incident t o bot h in-edges and out -edges of q1 . T hus t he primary diagonal of q1 wit h respect t o O is ( v 1 , v 3 ). ∗
Let G be a 2MBP graph and G be a G -orient at ion of G . We define an orient at ion of G as follows. Consider any edge e in G . Let e be t he edge in G corresponding t o e . When t raveling e along it s direct ion in G , we
D e fi n i t i o n 4 .
∗
∗
∗
∗
144
H. Zhang and X. He
v1
Si
e
Si
Sm
q1
q2 v3
Sj
(a) (a) An S -orient at ion -orient at ion O .
F ig. 2 .
an
S
e1
q
e2
(b) induces a
O
G
-orient at ion G ; (b) A
G
-orient at ion
G
derives
direct e from t he face q2 on t he left t o t he face q1 on t he right . T his orient at ion of G will be called t he orient at ion derived from G , and denot ed by δ ( G ). ∗
∗
Let S ( G ) = { S 1 , S 2 , · · ·, S k } be S -walks of G . Let G be a G -orient at ion of G . Let e 1 and e 2 be t he two edges on t he boundary of a face q t hat are walked t hrough by S i . Not e t hat e 1 and e 2 are opposit e on t he boundary of q . Let e 1 and e 2 be t he dual edges corresponding t o e 1 and e 2 , respect ively. Because G is a G -orient at ion, e 1 and e 2 must have diff erent direct ion. T hus e 1 and e 2 on S i are assigned consist ent direct ions in δ ( G ). (see Fig. 2 (b)). So, we have: ∗
∗
∗
∗
∗
∗
L e m m a 2 . Let G be a 2M B P graph. I f G is a G -orien tation G , then δ ( G ) is an S -orien tation of G ∗ . I f G , G ′ form a G -orien tation pair, then δ ( G ) an d δ ( G ′ ) form an S -orien tation pair.
By Definit ions 3 and 4, it ’ s st raight forward t o verify t hat π and mappings t o each ot her. Hence we have: δ
are inverse
T h e o r e m 4 . For a 2M B P G , the m appin g π ( an d δ ) is a on e-to-on e correspon den ce between the set of G -orien tation s of G an d the set of S -orien tation s of G ∗ , which preserves the pair relation .
T he following t heorem describes how t o obt ain an even t riangulat ion from a of G .
G -orient at ion
T h e o r e m 5 . Let G be a 2M B P graph.
1. Let G be a G -orien tation of G . T hen addin g the prim ary diagon als in to each face of G resu lts an even trian gu lation of G , which is called the even trian gu lation det ermined by G , an d den oted by T ( G ) . 2. Let G an d G ′ be two G -orien tation s of G . I f G , G ′ form a G -orien tation pair of G , they determ in e the sam e even trian gu lation of G , i.e. T ( G ) = T ( G ′ ) . I f G , G ′ do n ot form a G -orien tation pair of G , they determ in e diff eren t even trian gu lation s of G , i.e. T ( G ) = T ( G ′ ) . P roof. St at ement 1: Let G ′ be t he graph result ing from adding t he primary
diagonals (wit h respect t o
G
) int o t he faces of
G.
Consider any vert ex
v
of
G.
On Even Triangulat ions of 2-Connect ed Embedded Graphs
Let
145
be t he edges in G incident t o v in clockwise direct ion. T hus = t . Let qi (1 ≤ i ≤ t ) be t he face incident t o v and wit h e i and e i + 1 on it s boundary (where e t + 1 = e 1 ). We call e j a go-in ( go-ou t , respect ively) edge of v if e j is direct ed int o (out of, respect ively) v in G . A face qi is called a gap face of v if one of t he two edges e i and e i + 1 is a go-in edge of v and anot her is a go-out edge of v . qi is called a good face of v if e i , e i + 1 are bot h go-in edges of v or bot h go-out edges of v . Denot e t he number of gap faces of v by g a p ( v ). Since a gap face is always between a block of consecut ive go-out edges and a block of consecut ive go-in edges around v , it is easy t o see t hat g a p ( v ) is always an even number. T he primary diagonal (wit h respect t o G ) of each face q is t he diagonal connect ing t he st art ing and t he ending vert ices of t he two direct ed pat hs on t he boundary of q . T hus v is incident t o t he primary diagonal of t he face qi iff qi is a good face of v . Hence d eg G ′ ( v ) = d eg G ( v ) + t − g a p ( v ) = 2t − g a p ( v ) is always even. T herefore G = T ( G ) is an even t riangulat ion of G . Figure 3 (a) shows an example of t his const ruct ion. T he solid lines are edges in G . T he dot t ed lines are primary diagonals which are added int o G . T he black dot s indicat e t he gap faces. We have d eg G ′ ( v ) = 2 × 6 − 4 = 8. St at ement 2: Suppose G and G form a G -orient at ion pair of G . For any face q of G , t he primary diagonal of q wit h respect t o G is t he same as t hat wit h respect t o G . So T ( G ) is t he same as T ( G ). Suppose G , G do not form a G -orient at ion pair. T hen t hey have diff erent set s of primary diagonals. So T ( G ) is diff erent from T ( G ). e 1 , e 2 , · · ·, e t
d eg G ( v )
′
′
′
′
′
′
′
If G is induced from an S -orient at ion O of G , we also call T ( G ) t he even t riangulat ion determ in ed by O , and denot e it by T ( O ). Figure 4 shows an even t riangulat ion const ruct ed for t he graph G in Fig. 1. Based on t he discussion above, we have t he following: N e w P r o o f o f T h e o r e m 1 : Let S ( G ) = { S 1 , S 2 , · · ·, S k } be t he S -walks of G . Arbit rarily assign a direct ion t o each S i . T his gives an S -orient at ion O of G . By Lemma 1, we get an G -orient at ion G = π ( O ). By T heorem 5, we get an even t riangulat ion T ( G ) of G . T heorem 5 st at es t hat every G -orient at ion pair det ermines an even t riangulat ion of G . Next we show t hat every even t riangulat ion of G is det ermined by a G -orient at ion pair of G . ∗
∗
∗
∗
T h e o r e m 6 . Let G be a 2M B P graph an d S ( G ∗
)=
{
S 1 , S 2 , · · ·, S k } be the S -
walks of G ∗ . 1. E very even trian gu lation G ′ of G is determ in ed by a G -orien tation pair. 2. G has exactly 2k − 1 distin ct even trian gu lation s. P roof. St at ement 1: Let G ′ be any even t riangulat ion of G . We want t o show
t here exist s a G -orient at ion G of G such t hat G = T ( G ). Let G be t he dual graph of G . For each face q of G , t he diagonal of q from G split s q int o two faces, which will be called t he su bfaces of G . So q cont ains two subfaces. ′
′
′ ∗
′
146
H. Zhang and X. He
r
q1 v
b
q1
q1
q2
b
r
q1
q2
(b)
(a)
(a) Adding primary diagonals wit h respect t o a G -orient at ion G result s even degree at vert ex v ; (b) An even t riangulat ion of G induces a G -orient at ion G on faces q 1 and q 2 . F ig. 3 .
Since each vert ex has even degree in G , each facial cycle of G is of even lengt h. T hus G is a bipart it e plane graph. So we can color it s vert ices by 2 colors. In ot her words, we can color t he subfaces of G by red and black so t hat no two red (black, respect ively) subfaces are adjacent . Not e t hat each face q of G cont ains one red and one black subface. Consider any edge e of G . Let q1 and q2 be t he two faces of G wit h e on t heir common boundary. Let q1r and q1b be t he red and t he black subfaces cont ained in q1 , respect ively. Let q2r and q2b be t he red and t he black subfaces cont ained in q2 , respect ively. Not e t hat exact ly one red subface and one black subface from t he four subfaces q1r , q1b , q2r , q2b have e on t heir boundaries. We direct e clockwise on it s neighboring red subface. (Hence, e is direct ed count erclockwise on it s black neighboring subface). T his way, each edge e of G is consist ent ly assigned a direct ion. Let G denot e t his orient at ion of G . Consider any face q of G . Let q r and q b be t he red and black subfaces cont ained in q , respect ively. T wo boundary edges of q are t he boundary edges of q r . Hence t hey are direct ed clockwise and form a direct ed pat h of lengt h 2 in G . T he ot her two boundary edges of q are t he boundary edges of q b . Hence t hey are direct ed count erclockwise and form anot her direct ed pat h of lengt h 2 in G . T hus G is indeed a G -orient at ion of G . Figure 3 (b) shows an example of t his const ruct ion. T wo faces q1 and q2 are shown in t he figure by black squares. Each of t hem cont ains two subfaces. T he red subfaces are indicat ed by empty circles. T he black subfaces are indicat ed by solid circles. T he edges of G are direct ed as described above. For each face q of G , t he diagonal d of q from t he even t riangulat ion G is t he diagonal which separat es t he red and t he black subfaces of q . So it is t he diagonal of q connect ing t he st art ing and t he ending vert ices of t he two direct ed pat hs on t he boundary of q . Hence d is t he primary diagonal of q wit h respect t o G . T herefore, t he even t riangulat ion T ( G ) det ermined by G is exact ly G . St at ement 2: It follows direct ly from t he st at ement 1 and T heorem 5. ′
′ ∗
′ ∗
′
′
In order t o provide a new proof of T heorem 3, we need t he following t echnical lemma, which can be easily proved:
On Even Triangulat ions of 2-Connect ed Embedded Graphs
(a)
147
(b)
F i g . 4 . (a) A G -orient at ion G of G corresponding t o t he An even t riangulat ion of G det ermined by G .
L e m m a 3 . Let G be a 2M B P an d S ( G ∗
)=
{
S
-orient at ion
O
in F ig. 1; (b)
S 1 , · · ·, S k } be the S -walks of G ∗ .
∗
Let O 1 be an S -orien tation of G . Let O 2 be the S -orien tation of G ∗ obtain ed from O 1 by reversin g the direction of an S -walk S i . T hen T ( O 2 ) can be obtain ed from T ( O 1 ) by fl ippin g the diagon als of all faces on S i . ( I f q occu rs on S i twice, its diagon al is fl ipped twice an d hen ce rem ain s u n chan ged) .
We are now ready t o give t he following: N ew P r o of of T h eor em 3 :
St at ement 1: Let T be an even t riangulat ion of a 2MBP G . T hen T is det ermined by an S -orient at ion O of G by T heorem 6, i.e. T = T ( O ). Let O be t he S -orient at ion obt ained from O by reversing t he direct ion of an S -walk S i . Let T be t he even t riangulat ion T ( O ) of G det ermined by O . By Lemma 3, T is obt ained from T be flipping t he diagonals of t he faces on S i . St at ement 2: Let T 1 and T 2 be any two even t riangulat ions of G . By T heorem 6, T 1 = T ( O 1 ) is det ermined by an S -orient at ion O 1 and T 2 = T ( O 2 ) is det ermined by anot her S -orient at ion O 2 . Let S i 1 , S i 2 , · · ·, S i t ( t ≤ k ) be t hose S -walks whose direct ions in O 1 and O 2 are reversed. By repeat ed applicat ions of Lemma 3, if we st art wit h T 1 and flip t he diagonals of t he faces on t he S -walks S i j (1 ≤ j ≤ t ) one by one, we get T 2 . Based on t he discussion above, we obt ain t he following: ∗
′
′
′
′
′
T h e o r e m 7 . G iven a 2-con n ected bipartite plan e graph G , an even trian gu lation
of G can be con stru cted in O ( n ) tim e.
4
E v e n Tria n g u la t io n s o f 2 -C o n n e c t e d G ra p h s o n H ig h G e n u s S u rfa c e s
Let F g be a closed, connect ed, orient able surface wit hout boundary, where g ( g ≥ 0) is t he gen u s of t he surface. A graph G is said t o be em bedded on F g if G is drawn on F g such t hat no two edges cross and each of it s faces is an open disc
148
H. Zhang and X. He
on F g . Let G be embeded on F g . If all of t he facial cycles of G are of lengt h 4, we call such a graph a 2-con n ected m axim al even face graph on F g (or 2MEFg graph for short ). T here is a crucial diff erence between graphs on t he plane and graphs on F g : If every face of a plane graph G is an even cycle, t hen G is bipart it e. In cont rast , even if every face of a graph G embedded on F g ( g > 0) is an even cycle, G is not necessarily bipart it e. T his means t hat a 2MEFg graph is not necessarily bipart it e, so Equat ion (1) does not make sense any more. However, our proof of T heorem 5 can be adopt ed wit hout much modificat ion, we have t he following: T h e o r e m 8 . Let G be a 2M E F g graph on F
g
.
1. Let G be a G -orien tation of G . T hen addin g the prim ary diagon als to each face of G resu lts an even trian gu lation of G , which is called the even trian gu lation determ in ed by G , an d den oted by T ( G ) . 2. Let G an d G ′ be two G -orien tation s of G . I f G , G ′ form a G -orien tation pair of G , they determ in e the sam e even trian gu lation of G , i.e. T ( G ) = T ( G ′ ) . I f G , G ′ do n ot form a G -orien tation pair of G , they determ in e diff eren t even trian gu lation s of G , i.e. T ( G ) = T ( G ′ ) .
Similarly, t he st at ement 1 of T heorem 3 is st ill t rue. However, t he st at ement 2 of T heorem 3 and T heorem 6 are false for 2MEFg graphs due t o t he diff erence ment ioned above. We have t he following weaker result : T h e o r e m 9 . Let G be a 2M E F g graph on F
walks of G . T hen G has at least max(2 ∗
k
−
1
g
an d
, 2
(G ) = ∗
{ S 1 , . . . , S k } be all S ) distin ct even trian gu lation s.
S
2g − 2
R e fe re n c e s 1. J . A. Bondy and U. S.R.Murty, G r aph t heor y w i t h appl i cat i on s, Nort h Holland, New York, 1979. 2. T . H. Cormen, C. E. Leiserson and R. L. Rivest , A n i n t r odu ct i on t o al gor i t hm s, McGraw-Hill, New York, 1990 3. F . Hoff mann and K. Kriegel, A graph-coloring result and it s consequences for polygon-guarding problems, Technical Report T R-B-93-08, Inst . f. Informat ik, Freie Universit ¨a t , Berlin, 1993. 4. F . Hoff mann and K. Kriegel, A graph-coloring result and it s consequences for polygon-guarding problems, SI A M J . D i scr et e M at h , Vol 9(2): 210–224, 1996. 5. N. J acobson, L ect u r es i n A bst r act A l gebr as, Springer-Verlag, New York, 1975. 6. R. J . Lipt on, J . Rose and R. E. Tarjan, Generalized Nest ed Dissect ion, SI A M J . N u m er . A n al . , 16: 346–358, 1979. 7. Huaming Zhang and Xin He, A si m pl e l i n ear t i m e al gor i t hm f or fi n di n g even t r i an gu l at i on s of 2- con n ect ed bi par t i t e pl an e gr aphs, in P roceedings of ESA’ 02, LNCS 2461, pp. 902–913.
P e t ri N e t s w it h S im p le C irc u it s Hsu-Chun Yen and Lien-Po Yu Dept . of Elect rical Eng., Nat ional Taiwan University, Taipei, Taiwan, R.O.C. [email protected]
We st udy t he complexity of t he reachability problem for a new subclass of P et ri net s called si m ple-ci rcui t P et r i n et s, which properly cont ains several well known subclasses such as con fl i ct -free, B P P , n or m al P et ri net s and more. A new decom posi t i on approach is applied t o developing an int eger linear programming formulat ion for charact erizing t he reachability set s of such P et ri net s. Consequent ly, t he reachability problem is shown t o be NP -complet e. T he model checking problem for some t emporal logics is also invest igat ed for simple-circuit P et ri net s. A b st r a c t .
1
In t ro d u c t io n
P etri n ets ( P N s , for short ) have been a popular model for reasoning about t he behaviors of concurrent syst ems [13]. T he reachability problem is among t he
most import ant problems in t he st udy of P Ns. Reachability analysis is key t o t he solut ions of such P N problems as liven ess , fairn ess , con trollability , m odel checkin g and more. In addit ion, ident ifying a t ight complexity bound for t he reachability problem remains a great challenge in t he community of t heoret ical comput er science. Alt hough known t o be decidable, t he exist ing algorit hm for t he problem remains not even primit ive recursive [11] (see also [9]), while t he problem is also known t o be exponent ial space hard [10]. In teger lin ear program m in g(ILP ) has long been a t ool for t he reachability analysis of P Ns. It is well known t hat in a P N P wit h init ial marking µ 0 , a marking µ is reachable from µ 0 on ly if t here exist s a column vect or x such t hat t he state equation µ 0 + A · x = µ holds, where A is t he addition m atrix of P . Alt hough t he converse does not necessarily hold, t here are rest rict ed classes of P Ns for which t he st at e equat ion is suffi cient and necessary t o capt ure reachability. Most not able is t he class of circuit-free P Ns as well as t he class of P Ns wit hout token -free circuit s in every reachable marking [15]. Ot her subclasses for which reachability has been t horoughly st udied and solved include con fl ict-free , n orm al [7,15], sin kless [7,15], B P P -n et [1,18], trap-circuit [8,17], and exten ded trap-circuit P N [17], et c. For each of t hem, deciding reachability can be equat ed wit h solving an ILP problem. A quest ion arises: Can we enlarge t he P N class while ret aining t he nice property of reachability being charact erizable by ILP ? Affi rmat ive answer t o t his quest ion is one of t he cont ribut ions of t his paper. Circuit s in BP P -net s are referred t o as ⊕ -circuit s wit h every t ransit ion in t he net having exact ly one input place, and t he firing of a t ransit ion removing
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 149–158, 2003. c Sp r in ger -Ver la g B er lin H eid elb er g 2003
150
H.-C. Yen and L.-P. Yu
exact ly one t oken from it ’ s sole input place. In normal P Ns, no t ransit ion is capable of decreasing t he t oken count of a minimal circuit , and such circuit s are called ⊙ -circuit s. Our new P N class, called sim ple-circuit P etri n ets ( sc-P N s , for short ), consist s of t hose in which each minimal circuit is eit her a ⊙ -circuit , or a ⊕ -circuit which is not properly included in any non-⊕ -circuit . By relaxing t he const raint s on circuit s, our sc-P Ns properly cont ain t hat of conflict -free, normal, t rap-circuit , ext ended t rap-circuit , and BP P -net s as Figure 1 indicat es. To analyze sc-P Ns, t he t echnique of t he so-called decom position approach is used. Given a comput at ion σ of a P N, t he basic idea is t o rearrange σ int o some canonical form σ 1 σ 2 · · · σ n wit h each of t hem being of some ‘ simpler form’ . By a ‘ simpler form’ we mean t he sub-P N induced by each of t he se gment s has it s reachability set charact erizable by cert ain well-underst ood and easily solvable formulat ions, such as ILP. For cases, we can also place a bound on t he number of segment s in t he above canonical comput at ion. Demonst rat ing t he applicability of t he decomposit ion approach t o sc-P Ns is anot her cont ribut ion of our work. It is wort hy of not ing t hat our analysis yields an ILP formulat ion for t he reachability problem in which t he init ial and final markings are regarded as param eters , as opposed t o being const ant s as in many of t he t radit ional reachability analysis of P Ns. T he complexity of model checking wit h respect t o a number of t emporal logics is also invest igat ed.
2
P re lim in a rie s
A P etri n et is a 3-t uple ( P , T , ϕ ), where P is a finit e set of places , T is a finit e set of tran sition s , and ϕ is a fl ow fun ction ϕ : ( P × T ) ∪ ( T × P ) → { 0, 1} . A m arkin g is a mapping µ : P → N . P ict orially, Pet ri net is a direct ed, bipart it e graph consist ing of two kinds of nodes: places (represent ed by circles wit hin which each small black dot denot es a token ) and tran sition s (represent ed by bars or boxes). See Figure 1 for an example.
General Petri Nets
Sinkless
Simple−circuit
Normal Trap− circuit Conflict− free
F ig. 1 .
Extended trap− circuit BPP
Cont ainment relat ionships among various P et ri net classes.
P et ri Net s wit h Simple Circuit s
151
A t ransit ion t ∈ T is en abled at a marking µ iff ∀ p ∈ P , ϕ ( p, t ) ≤ µ ( p ). If a t ransit ion t is enabled, it may fi re by removing a t oken from each input t place and put t ing a t oken in each out put place. We t hen writ e µ − → µ ′ , where µ ′ ( p ) = µ ( p ) − ϕ ( p, t ) + ϕ ( t , p ) ∀ p ∈ P . A sequence of t ransit ions σ = t 1 ...t n t t t is a fi rin g sequen ce from µ 0 iff µ 0 − → 1 µ 1 − → 2 · · · − → µ n for some markings σ µ 1 ,..., µ n . (We also writ e ‘µ 0 − → µ n ’ .) A m arked P N is a pair (( P , T , ϕ ) , µ 0 ), where ( P , T , ϕ ) is a P N, and µ 0 is called t he in itial m arkin g. T hroughout t he rest of t his paper, t he word ‘ marked’ will be omit t ed if it islear c from t he cont ext . By est ablishing an ordering on t he element s of P and T (i.e., P = { p 1 , ..., p k } and T = { r 1 , ..., r m } ), we can view a marking µ as a k -dimensional column vect or wit h it s i-th component being µ ( p i ), and # σ as an m -dimensional vect or wit h it s j t h ent ry denot ing t he number of occurrences of t ransit ion r j in σ . T he reachability set of P wit h respect t o µ 0 is t he set R ( P , µ 0 ) = { µ | ∃ σ ∈ σ µ } . T he reachability problem is t hat of, given a marked P N P (wit h T ∗ , µ 0 − → init ial marking µ 0 ) and a marking µ , deciding whet her µ ∈ R ( P , µ 0 ). For ease of expression, t he following not at ions will be used. Let σ , σ ′ be t ransit ion sequences, p a place, and t a t ransit ion. ∆ ( σ ) = [T ] · # σ defines t he displacem en t of σ . For p ∈ P , ∆ ( σ )( p ) denot es t he component of ∆ ( σ ) corresponding t o place p . T r ( σ ) = { t | t ∈ T , # σ ( t ) > 0} denot es t he set of t ransit ions used in σ . σ . σ ′ represent s t he sequence result ing from removing each t ransit ion of σ ′ from t he left most occurrence of such a t ransit ion in σ . For inst ance, if σ = t 1 t 2 t 3 t 4 t 5 and σ ′ = t 1 t 3 t 4 , t hen σ . σ ′ = t 2 t 5 . Int uit ively, σ . σ ′ p • = { t | ϕ ( p, t ) ≥ 1, t ∈ T } is t he set of out put t ransit ions of p ; t • = { p | ϕ ( t , p ) ≥ 1, p ∈ P } is t he set of out put places of t ; • p = { t | ϕ ( t , p ) ≥ 1, t ∈ T } is t he set of input t ransit ions of p ; • t = { p | ϕ ( p, t ) ≥ 1, p ∈ P } is t he set of input places of t . σ Given µ 0 − → µ , a sequence σ ′ is said t o be a rearran gem en t of σ if # σ = # σ and n
′
′
σ
µ . A circuit c of a P N is a sequence p 1 t 1 p 2 t 2 · · ·p n t n p 1 ( p i ∈ P , t i ∈ T , • ti , ti ∈ p i + 1 ), such t hat p i = p j , ∀ i = j . We writ e P c = { p 1 , p 2 , · · ·, p n } (resp., T c = { t 1 , t 2 , · · ·, t n } ) t o denot e t he set of places (resp., t ransit ions) in c, and t r ( c) t o represent t he sequence t 1 t 2 · · ·t n . We define t he t oken count of µ ( p ). A circuit c is said t o be token circuit c in marking µ t o be µ ( c) = p∈ P c free in µ iff µ ( c) = 0. Given two circuit s c and c′ , c is said t o be in cluded (resp., properly in cluded ) in c′ iff P c ⊆ P c (resp., P c ⊂ P c ). We say c is m in im al iff it does not properly include any ot her circuit . Circuit c is said t o be a µ 0 − pi ∈
→
•
′
′
– – ⊙
⊕
-circuit iff -circuit iff ∀
∀
i, 1
≤
t
T, ( ∈
i
≤
n, p∈
P
•
c
= { pi } ( ϕ ( t , p ) − ϕ ( p, t )))
ti
≥
0
A set of circuit s C = { c1 , c2 , ..., cn } is said t o be con n ected iff ∀ i , j , 1 ≤ i , j ≤ n , t here exist 1 ≤ h 1 , h 2 , ..., h r ≤ n , for some r , such t hat h 1 = i , h r = j , and ∀ l , 1 ≤ l < r , Pc ∩ Pc = ∅ . In words, every pair of neighboring circuit s in + 1 ch 1 , ch 2 , ..., ch share at least one place. σ is said t o cover circuit c if # t r ( c ) ≤ # σ . A P N P = ( P , T , ϕ ) is a sc-P N if ∀ minimal circuit c in P , (1) c is a ⊙ -circuit , or (2) c is a ⊕ -circuit and if c′ properly includes c, c′ must be a ⊕ -circuit as well. To t he best of our knowledge, t he class of sc-P Ns defined in t his paper is new. h l
r
h l
152
H.-C. Yen and L.-P. Yu
Not ice t hat being sim ple-circuit is a ‘ st ruct ural property’ which is independent of t he init ial marking. T he int erest ed reader is referred t o [13] for more about P Ns.
3
D e c o m p o s it io n A p p ro a ch fo r R e a ch a b ilit y
D ecom position is one of t he few useful t echniques for analyzing various subclasses
of P Ns, as demonst rat ed in [4,5,7,14,17,18] and more recent ly in [3]. Given a σ µ of a P N P = ( P , T , ϕ ), t he idea is t o rearrange σ int o comput at ion µ 0 − → σ 1 σ 2 σ σ 1 σ 2 · · ·σ n such t hat µ 0 − → µ 1 − → µ 2 · · ·µ n − 1 − → µ n = µ and each of σ 1 , ..., σ n is of some ‘ simpler form.’ What a ‘ simpler form’ means is t hat if we define P i = ( P , T i , ϕ | T ) (where T i = T r ( σ i )( ⊆ T ), and ϕ | T is t he rest rict ion of ϕ t o ( P × T i ) ∪ ( T i × P )) t o be a sub-P N induced by segment σ i (1 ≤ i ≤ n ), t hen reachability in P i is easily solvable. T wo not able examples are t he classes of n orm al P Ns and B P P n ets , for which t he decomposit ion approach gives rise t o an ILP formulat ion for reachability. Since sc-P Ns admit bot h circuit types found in n orm al and B P P P Ns, a det ailed descript ion of how t he decomposit ion is performed for t hese two sub-classes is in order. For simplicity, we writ e I L P ( P , µ 0 , µ ) t o denot e an inst ance of ILP for checking whet her µ is reachable from µ 0 in P . n
i
i
P
σ
µ
0
P
1
σ
1 µ
1
P
2
σ
2 µ
2
µ i
I L P
F ig. 2 .
t hat 3 .1
T i
P
i
−
σ
i µ i
1
(P
i , µ i
n
−
1,
µ i
µ n
−
1
n
µ n
=
µ
)
Decomposit ion of a normal P et ri net . (Not e t he number of dist inct t ransit ions cont ains is reflect ed by t he size of respect ive t riangle associat ed wit h P i )
D e c o m p o s i t i o n A p p r o a c h fo r N o r m a l P N s
T he idea behind t he decomposit ion analysis of normal P Ns is illust rat ed in Figure 2. T he rearrangement σ 1 σ 2 · · ·σ n of σ is such t hat if σ = t 1 σ 1′ t 2 σ 2′ · · ·t n σ n′ where t 1 , t 2 , ..., t n mark t he first occurrences of t he respect ive t ransit ions in σ (i.e., t i , 1 < i ≤ n , is not in t he prefix t 1 σ 1′ · · ·t i − 1 σ i′ − 1 ) t hen σ i is a permut at ion of t i σ i′ . Furt hermore, by let t ing (1) T 0 = Ø; (2) ∀ 1 ≤ i ≤ n , T i = T i − 1 ∪ { t i } , and ϕ i is t he rest rict ion of ϕ t o ( P × T i ) ∪ ( T i × P ), reachability in P i can be capt ured by an inst ance I L P ( P i , µ i − 1 , µ i ). T his, in conjunct ion wit h t he fact t hat n ≤ | T | allows t he reachability problem t o be solved by ILP. See [7] for more det ails. 3 .2
D e c o m p o s i t i o n A p p r o a c h fo r B P P - N e t s
T he idea of rearranging an arbit rary comput at ion in a BP P -net int o a canonical one is explained using Figure 3.
P et ri Net s wit h Simple Circuit s
153
( 1 ) Referring t o Figure 3(a), suppose t he let t ers a, b, d, e, f depict t hose t ransit ions t hat form a ⊕ -circuit c in t he P N wit h µ ( c) > 0. ( 2 ) We use c as a ‘ seed’ t o grow t he largest collect ion of connect ed circu it s t hat are covered by σ (In Figure 3(b), circuit c t oget her wit h c′ (consist ing of t ransit ions x , y , and z ) forms such a collect ion.) ( 3 ) We t hen follow a ‘ short est ’ circuit -free t ransit ion sequen ce of t he remaining
comput at ion (act ually, a rearrangement of σ . abdef x y z in Figure 3(b)) unt il reaching a marking (see marking µ ′ in Figure 3(c)) in which a non-t oken-free circuit (i.e., c′ ′ in Figure 3(c)) is covered by t he subsequent comput at ion. ( 4 ) Using t he above non-t oken-free circuit as a new seed and repeat ing t he above procedures unt il t he remaining comput at ion becomes null, we are able t o rearrange an arbit rary comput at ion of a BP P -net int o a canonical one.
σ
a
µ
f
d
x
C
f
C
b
d
e
y
a bd e f x y z σ
(b) Circuit−free
x
C
x
z
′
e y b
a
f
d
(a) b
a
µ
z
C
′
z
e y
µ
C
(c) µ
F ig. 3 .
′′
′
Decomposit ion of a BP P -net .
It was shown in [18] t hat t he above decomposit ion allows us t o formulat e reachability as ILP. A similar st rat egy has been applied t o t he so-called exten ded trap-circuit P N s which subsume BP P -net s [17].
4
C h a ra c t e riz in g s c -P N s C o m p u t a t io n s U s in g ILP
( 1 ) St emming from t he idea of Sect ion 3.1, t he decomposit ion is const ruct ed st age-by-st age (Figure 4) as a sequence of sub-P Ns P 1 , · · · , P n where P i = (( P , T i , ϕ | T i ) , µ i − 1 )), T 0 = ∅ , T i = T i − 1 ∪ { t i } , for some t i ∈ T i − 1 enabled at µ i − 1 , and σ i ∈ T i∗ . ( t 1 , ..., t n are chosen t he same way) Unlike normal P Ns
where reachability in P i can be complet ely capt ured by t he st at e equat ion, a more involved procedure t o furt her decompose σ i is needed. ( 2 ) For st age i , we carry out t he following st eps: ( 2 . 1 ) Apply a st rat egy similar t o t hat of Sect ion 3.2 t o rearrange σ i such t hat once a ⊕ -circuit c covered by σ i is enabled , t hen use c as a ‘ seed’ t o grow t he largest collect ion C of connect ed circuit s covered by σ i (see Figure 3 for a similar demonst rat ion). (Guarant eed by Lemma 2).
154
H.-C. Yen and L.-P. Yu ( 2 . 2 ) If t he set of t ransit ions in t he remaining comput at ion, t oget her wit h
it s associat ed places, forms a normal P N, it ’ s done; ot herwise, similar t o Sect ion 3.2, we follow a sequence along which all t he ⊕ -circuit s covered by t he comput at ion remain t oken-free ( α 1i in Figure 4) unt il reaching a marking where a ⊕ -circuit is not t oken-free. Due t o t he nat ure of t he decomposit ion (elaborat ed in Lemma 3), t he ( P , T r ( α ji ) , ϕ | T r ( α ) ) is guarant eed t o be a normal sub-P N. ( 2 . 3 ) Taking t he newly found ⊕ -circuit as a new ‘ seed,’ t he above procedures repeat anew unt il no more ⊕ -circuit is covered by t he remaining comput at ion of σ i (see α hi in Figure 4). i j
su b -P N ( ( P ,
Ti , ϕ
i
),
µ
i
1)
−
ci r cu i t col l ect i on C
t1
c
t2
µ0
...
µ1
µ
i
−
1
t
α
i
α
1
i
σ
i h
... µ
µ
i
i
St age
i
Rearranging an sc-P N comput at ion int o a canonical form.
F ig. 4 .
L e m m a 1 . ( from Lem m a 1 in [18]) Let C = { c1 , c2 , ..., cn } be a set of con n ected ⊕ -circuits in an sc-P N P an d µ be a m arkin g with µ ( c i ) > 0, for som e i . For
arbitrary in tegers a 1 , a 2 , ..., a n > 0, there exists a sequen ce σ such that µ
# σ
σ
an d
− →
n
=
aj j
(#
) . ( In words, from µ there exists a fi rable sequen ce σ
cj
utilizin g
=1
circuit cj exactly a j tim es, for every j .) τ
σ
µ 1 − → µ 2 in an sc-P N P = L e m m a 2 . C on sider a com putation µ 0 − → ( P , T , ϕ ) . Let C = { c1 , c2 , ..., cz } be a set of con n ected ⊕ -circuits an d a 1 , a 2 , ..., a z
be positive in tegers such that ( a ) (∃ i , 1 (b) σ ⊕
≤ i ≤ z ) ( µ 1 ( c i ) > 0) ( i.e., som e circuit c i is n ot token -free in µ 1 .) , . ( ca 1 · · · ca z ) does n ot cover an y ⊕ -circuit that shares som e place with z 1 -circuits in C ( i.e., C is a largest collection of con n ected circuits.) ,
z
aj
(c) (d)
j
=1
∀
t ∈
(#
cj
T r (σ
)
#
≤
σ
( i.e., all the circuits c1 , c2 , ..., cz are covered by σ .) , an d
) , t is en abled in som e m arkin g alon g µ 0
then there exist δ
1
an d δ
2
such that ( 1) #
δ 1
δ 1
− →
µ3
δ 2
− →
µ 1,
z
=
aj j
an d ( 3) µ 1
τ
− →
=1
µ 2 , for som e µ 3 . ( In words, σ
(#
cj
) , ( 2) #
δ 2
= # σ
.
, δ 1
can be rearran ged in to δ 1 δ
2
P et ri Net s wit h Simple Circuit s such that δ 1 con sists of the largest collection of con n ected on e of them m arked in µ 1 .) P roof. First not ice t hat µ 1
⊕
155
-circuits with at least
δ 1
µ 3 is guarant eed by Lemma 1; it suffi ces t o prove δ t hat µ 3 − → 2 µ 2 , for some δ 2 which is a rearrangement of σ . δ 1 . Suppose, t o t he cont rary, t hat none of t he permut at ions of σ . δ 1 is firable in µ 3 . We let α be α t he longest sequence such t hat # α < # . and µ 3 − → µ 4 , for some µ 4 . (By σ δ − →
1
α
′
’ longest ’ we mean t hat for allα ′ wit h # α < # . and µ 3 − → , it must be t he δ 1 σ case t hat | α ′ | ≤ | α | .) Let β = ( σ . δ 1 ) . α . We let X be { p | p ∈ • t , µ 4 ( p ) = 0, t ∈ T r ( β ) } . i.e., X consist s of t hose input places of t ransit ions in T r ( β ) t hat are t oken-free in µ 4 . We now make t he following observat ions: ′
1.
. (T his is because µ 4 ( p ) + ∆ ( β )( p ) = 0 2. T here must be some place r in X such t hat eit her (i) µ 1 ( r ) > 0, or (ii) ( ∃ t 1 ∈ T r ( δ 1 α )) ( r ∈ t •1 ). And for each such r , ∃ t 2 ∈ T r ( δ 1 α ) such t hat r ∈ • t 2 . (Assume, t o t he cont rary, t hat neit her (i) nor (ii) holds. In σ , let f be t he first t ransit ion deposit ing a t oken int o some place in X . Since f ∈ T r ( δ 1 α ), one of f ’ s input places, say g , must be in X . In t his case, place g could never have possessed a t oken along σ t o t he marking at which f is fired – a cont radict ion. T he exist ence of a t 2 result s from µ 4 ( r ) = 0.) ∀
p
∈
µ 2 (p)
T r ( β ) , such and µ 4 ( p ) = 0.)
X , ∃ t′ ≥
∈
t hat p
∈
t′ •
Let R be t he set of all places r sat isfying Observat ion 2(i) or (ii) above. We are t o show t hat at least one place in R must be along a circuit consist ing of some places in X and some t ransit ions in T r ( β ). Suppose, t o t he cont rary, t hat none of R is on a circuit ; t hen t here must be an s ∈ R such t hat s cannot be reached from t he remaining places in R t hrough places in X and t ransit ions in T r ( β ). For s , let t 3 be a t ransit ion guarant eed by Observat ion 1 above. Due t o t he select ion of s , t 3 could never have been fired in σ since • t 3 ∩ X would never possess a t oken (because none of t he input places of t 3 is in R , and due t o t he definit ion of s , none of R is capable of supplying a t oken t o • t 3 direct ly or indirect ly) – a cont radict ion. Int uit ively, one can t hink of R as places t hrough which t okens are ‘ pumped’ int o t he sub-P N consist ing of places inX and t ransit ions in T r ( β ). Let r ∈ R be a place on a circuit , say c, and t 2 (guarant eed by Observat ion 2) be a t ransit ion in δ 1 α removing a t oken from r . (Not e c is t oken-free in µ 4 .) Due t o Assumpt ion (d) of t he lemma, c is not a ⊙ -circuit ; ot herwise, c would not have become t oken-free in µ 4 . Now c is a ⊕ -circuit whet her it is a minimal circuit or not . (It clearly holds if c is minimal; ot herwise, due t o Condit ion (2) in t he definit ion of sc-P Ns, c again must be a ⊕ -circuit .) If t 2 is in δ 1 (which comprises only circuit s from C ), t hen c must have shared some place wit h one of t he circuit s in C – violat ing Assumpt ion (b) of t he lemma. If t 2 is in α , t hen r is marked during t he course of t he comput at ion α , which implies t hat c should have been added t o α – violat ing t he assumpt ion about α being longest . ⊓⊔
By repeat edly applying t he above cut -and-past e st rat egy, we can const ruct t he decomposit ion wit hin a st age (e.g., st age i in Figure 4) as t he following lemma
156
H.-C. Yen and L.-P. Yu
indicat es. One of t he keys in t his lemma lies in t hat t he sub-comput at ion linking two neighboring ⊕ -circuit collect ions (see α 1i in Figure 4, for inst ance) const it ut es a normal sub-P N. Due t o space limit at ions, t he proof det ails are omit t ed. S uppose
′
P
δ
= (( P , T , ϕ ) , µ 0 ) be an sc-P N an d µ 0 − → µ 1 for som e δ = (( P , T ′ , ϕ | T ) , µ 1 ) is a sub-P N such that each t ∈ T ′ ( ⊆
L e m m a 3 . Let
P
′
∈
T∗ . T ) is
δ
en abled at som e poin t alon g µ 0 − → µ 1 . T hen , µ is reachable from µ 1 in P ′ iff there exists a sequen ce σ = π 1 α 1 π 2 α 2 · · · π h α h ( α i , π i ∈ T ∗ , an d 1 ≤ h ≤ | T | ) σ which witn esses µ 1 − → µ an d satisfi es the followin g con dition s: 1.
i, 1 ∀
a)
i
≤
≤
a set ∃
h,
= { ci1 , ..., cir i } ( r i
Ci
∆ (π
i
r
≤
m ) of con n ected
i
i
a j ∆ ( cj
)=
) for som e in tegers a i1 , a i2 , ..., a ir > 0, i
=1
j
b) the rem ain in g sequen ce α i · · · π h α shares som e place with circuits in
|T |,
|Ci | ≤ i
∀
h
Ci
does n ot cover an y circuit which , an d
h
c)
2.
-circuits such that ⊕
i
i.e., the total n um ber of distin ct circuits con sidered above
=1
is boun ded by the n um ber of tran sition s of the P N . ≤ i ≤ h, α i ∈ T + , ( P , T r ( α i ) , ϕ | T r ( α i ) ) form s a n orm al sub-P N .
i, 1
σ
T h e o r e m 1 . E ach com putation µ 0 − → µ of an sc-P N P = ( P , T , ϕ ) can be σ 1 σ 2 σ n rearran ged in to a can on ical on e µ 0 − → µ 1 − → µ 2 · · · − → µ n (= µ ) , for som e n , 1 ≤ n ≤ m , such that ∀ i , 1 < i ≤ n
1. T r ( σ i ) − T r ( σ i − 1 ) = { t i } , for som e t i ∈ T , 2. σ i = π 1i α 1i π 2i α 2i · · · π hi i α hi i , where π ji an d α ji (1 tion s stated in Lem m a 3.
≤
j
≤
h i ) satisfy those con di-
P roof. Omit t ed. ⊓⊔
L e m m a 4 . ( From Lem m a 4.3 in [7]) G iven a n orm al P N P = ( P , T , ϕ ) an d a m arkin g µ 0 , we can con struct, in n on determ in istic polyn om ial tim e, a system of lin ear in equalities I L P ( P , µ 0 , µ ) ( of size boun ded by a polyn om ial in the size of P ) such that µ is reachable from µ 0 iff I L P ( P , µ 0 , µ ) has an in teger solution . P = ( P , T , ϕ ) an d a m arkin g µ 0 , we can con struct, in n on determ in istic polyn om ial tim e, a system of lin ear in equalities I L P ( P , µ 0 , µ ) ( of size boun ded by a polyn om ial in the size of P ) such that µ is reachable from µ 0 iff I L P ( P , µ 0 , µ ) has an in teger solution .
T h e o r e m 2 . G iven an sc-P N
σ
iff ∃ a comput at ion µ 0 − → 1 µ 1 − → µ 2 · · · − → µ n (= µ ) meet ing Condit ions (1) and (2) of t he t heorem. In addit ion, t hose sub-comput at ions π ji and α ji (1 ≤ j ≤ h i ) wit hin σ i P roof. (Sket ch) By T heorem 1, µ σ 2
σ
n
∈
R (P , µ 0 )
P et ri Net s wit h Simple Circuit s
157
( σ i = π 1i α 1i π 2i α 2i · · ·π hi α hi ) sat isfy t hose condit ions st at ed in Lemma 3. To set up t he I L P ( P , µ 0 , µ ), we begin by guessing t he sequence t 1 , · · ·, t n t o capt ure t i = h ead ( σ i ). T he associat ed inequalit ies are: µ i − 1 ( p ) ≥ ϕ ( p, t i ) , ∀ p ∈ P , ∀ i , 1 < σ i ≤ n . T he desired syst em of linear inequalit ies associat ed wit h µ i − 1 − → µ i is set up as follows. ( σ i uses t ransit ions t aken from { t 1 , ..., t i } .) i
i
i
1. For 1 ≤ j ≤ h i , guess t he set of connect ed ⊕ -circuit s C i , j (= { ci1, j , ..., cir , j } ) and verify t he condit ions as st at ed in (a), (b) and (c) of Condit ions 1 of Lemma 3; for 1 ≤ j ≤ h i − 1, guess t he t he sequence α ji and check t he sub-P N P i , j = ( P , T r ( α ji ) , ϕ | T r ( α ) ) forms a normal sub-P N. It is not hard t o see t hat checking each of t he above can be done in polynomial t ime. σ 2. As µ i − 1 − → µ i and σ i = π 1i α 1i π 2i α 2i · · · π hi α hi , t here shall be some markings, i ,j
i j
i
i
i
i
say µ i , j and µ i , j ( ≥ 0 ), ∀ j , 1 ′
i
π 2
α
i
2
π
i h i
≤
j
hi ,
≤ α
such t hat µ i −
1
= µ i ,1
π 1
− →
µ ′i , 1
α
− →
i
1
i h i
µ i . Now,we are able t o set up t he following linear inequalit ies t o capt ure t he above P N comput at ion: ′ − − − − − ( du e t o L em m a 1) I L P (C i , j , µ i , j , µ i , j ), ∀ j , 1 ≤ j ≤ h i ′ I L P ( P i , j , µ i , j , µ i , j + 1 ) , ∀ j , 1 ≤ j ≤ h i − − − − − ( du e t o L em m a 4) µ i ,2
− →
µ ′i , 2
− →
· · ·
µ i ,h i
− →
µ ′i , h i
− →
Due t o space limit at ions, t he remaining det ails are omit t ed. ⊓⊔
It is also known t hat t he reachability problem for eit her normal or BP P -net s is NP -hard, and hence t he following holds. T h e o r e m 3 . T he reachability problem for sc-P N s is N P -com plete.
5
M o d e l C h e ck in g
E F is t he fragment of un ifi ed system of bran chin g tim e allowing only EF operat ors (and t heir duals), but not EG operat ors. For labeled P Ns P = ( P , T , ϕ , l ), l is a labelin g fun ction l : T → Σ (a set of labels ), each formula φ in logic E F is
of t he form: φ ::= t r u e | ¬ φ | φ 1 ∧ φ 2 | E ( a ) φ | E F φ , where a ∈ Σ . A marking µ sat isfying a formula φ , denot ed by µ |= φ , is defined induct ively as follows. = = |= µ |= µ |=
µ µ µ
|
|
tr ue φ φ 1 ∧ φ 2
¬
E (a)φ EFφ
always holds iff ¬ ( µ |= φ ) iff µ |= φ 1 and µ |= φ 2 t iff ∃ µ ′ such t hat µ − → µ ′ and µ ′ |= φ , for some t wit h l ( t ) = a iff ∃ a pat h µ 1 − → µ 2 − → µ 3 · · · s.t . µ = µ 1 and ∃ i ≥ 1 µ i |= φ
A labeled P N P = (( P , T , ϕ , l ) , µ 0 ) is said t o sat isfy a formula φ iff µ 0 |= φ . In [2], E F has been augment ed wit h P resburger form ulas and is called E F + P res for which model checking is decidable for BP P -net s ([2]). For E F , model checking for BP P -net s is P SPACE-complet e ([12]). In what follows, we supplement t he result s of [2,12] by showing t hat for sc-P Ns, model checking a fragment of E F + P res can
158
H.-C. Yen and L.-P. Yu
be equat ed wit h solving a syst ems of linear inequalit ies, t hus yielding an NP algorit hm. Let E˜F + P r es be a fragment of E F + P res wit h t he ¬ operat or being applied only t o formulas wit hout E ( a ) and E F operat ors. T h e o r e m 4 . For E˜F + P r es , the m odel checkin g problem for sc-P N s is N P com plete. P roof. Omit t ed. ⊓⊔
Similar st rat egies can be used t o derive complexity of model checking for a linear-t ime t emporal logic defined in [6], and path form ulas defined in [16].
R e fe re n c e s 1. Esparza, J . P et ri net s, commut at ive cont ext -free grammars and basic parallel processes, Fun dam en t a I n for m at i cae 3 0 , 24–41, 1997. 2. Esparza, J . Decidability of model checking for infinit e-st at e concurrent syst ems, A ct a I n for m . 3 4 , 85–107, 1997. 3. Fribourg, L. P et ri net s, flat languages and linear arit hmet ic. 9t h I n t . W or kshop. on Fun ct i on al an d L ogi c P r ogr am m i n g, pp. 344–365, 2000. 4. Fribourg, L. and Ols´en, H. P roving safety propert ies of infinit e st at e syst ems by compilat ion int o P resburger arit hmet ic, L N C S 1 2 4 3 , 213–227, 1997. 5. Fribourg, L. and Ols´en, H. A decomposit ional approach for comput ing least fixedpoint s of dat alog programs wit h z-count ers, C on st r ai n t s, A n I n t er n at i on al J our n al 2 , 305–335, 1997. 6. Howell, R. and Rosier, L. On quest ions of fairness and t emporal logic for conflict free P et ri net s, In G. Rozenberg, edit or, Advances in P et ri Net s, L N C S 3 4 0 , 200–226, Springer-Verlag, Berlin, 1988. 7. Howell, R., Rosier, L. and Yen, H. Normal and sinkless P et ri net s, J . of C om put er an d Syst em Sci en ces 4 6 , 1–26, 1993. 8. Ichikawa, A. and Hiraishi, K. Analysis and cont rol of discret e event syst ems represent ed by P et ri net s, L N C I S 1 0 3 ,115–134, 1987. 9. Kosara ju, R. Decidability of reachability in vect or addit ion syst ems, P r oc. t he 14t h A n n ual A C M Sym posi um on T heor y of C om put i n g, 267–280, 1982. 10. Lipt on, R. T he r eachabi li t y pr oblem r equi r es expon en t i al space, Technical Report 62, Yale University, Dept . of CS., J an. 1976. 11. Mayr, E. An algorit hm for t he general P et ri net reachability problem, SI A M J . C om put . 1 3 , 441–460, 1984. 12. Mayr, R. Weak bisimulat ion and model checking for basic parallel processes, P r oc. F ST T C S’ 96, L N C S 1 1 8 0 , 88–99, 1996. 13. Murat a, T . P et ri net s: propert ies, analysis and applicat ions, P r oc. O f t he I E E E 7 7 ( 4 ) , 541–580, 1989. 14. Ols´en, H. Aut omat ic verificat ion of P et ri net s in a CLP framework, P h.D. T hesis, Dept . of Comput er and Informat ion Science, IDA, Link¨oping Univ., 1997. 15. Yamasaki, H. Normal P et ri net s, T heor et i cal C om put . Sci en ce 3 1 , 307–315, 1984. 16. Yen, H. A unified approach for deciding t he exist ence of cert ain P et ri net pat hs, I n for m . an d C om put ., 9 6 ( 1 ) , 119–137, 1992. 17. Yen, H. On t he regularity of P et ri net languages, I n for m . an d C om put ., 1 2 4 ( 2 ) , 168–181, 1996. 18. Yen, H. On reachability equivalence for BP P -net s, T heor et i cal C om put er Sci en ce, 1 7 9 , 301–317, 1997.
Automatic Verification of Multi-queue Discrete Timed Automata Pierluigi San Pietro1 ⋆ and Zhe Dang2 1
2
Dipartimento di Elettronica e Informazione Politecnico di Milano, Italia [email protected] School of Electrical Engineering and Computer Science Washington State University Pullman, WA 99164, USA [email protected]
Abstract. We propose a new infinite-state model, called the Multi-queue Discrete Timed Automaton MQDTA, which extends Timed Automata with queues, but only has integer-valued clocks. Due to careful restrictions on queue usage, the binary reachability (the set of all pairs of configurations (α , β ) of an MQDTA such that α can reach β through zero or more transitions) is effectively semilinear. We then prove the decidability of a class of Presburger formulae defined over the binary reachability, allowing the automatic verification of many interesting properties of a MQDTA. The MQDTA model can be used to specify and verify various systems with unbounded queues, such as a real-time scheduler. Keywords: Timed Automata, infinite-state model-checking, real-time systems.
1
Introduction
Real-time systems are widely regarded as a natural application area of formal methods, since the presence of the time variable makes them more difficult to specify, design and test. The limited expressiveness of finite automata has recently sparkled much research into the automated verification of infinite state systems. Most research in the field has concentrated on finding good abstractions or approximations that map infinite state systems into finite ones (e.g., parametrized model checking [19] and generalized model checking [15]). A complementary approach to abstraction is the definition and study of infinite-state models for which “interesting" properties are still decidable. Most of the works have concentrated on very few models, such as Petri Nets (PN), Pushdown Automata (PA) and Timed Automata (TA), and have studied the decidability and complexity of model-checking various temporal and modal logics. A TA [4] is basically a finite-state automaton with a certain number of unbounded clocks that can be tested and reset. Since their introduction and the definition of appropriate model checking algorithms [17], TA have become a useful model to investigate the verification of real-time systems and have been extensively studied. The expressive power of TA has many limitations in modeling, since many real-time systems are simply not finite-state, even when time is ignored. ⋆
Supported in part by MIUR grants FIRB RBAU01MCAC and COFIN 2001015271.
T. Warnow and B. Zhu (Eds.): COCOON 2003, LNCS 2697, pp. 159–171, 2003. c Springer-Verlag Berlin Heidelberg 2003
160
P. San Pietro and Z. Dang
Other infinite-state models for which forms of automatic verification are possible are based on PN (e.g., [16]), on various versions of counter machines (e.g., [10]), on PA (e.g., [5]), or on process calculi (e.g., [21]), but, at least in their basic versions, they do not consider timing requirements and are thus not amenable for modeling realtime systems. Among the infinite-state models that consider time, there are many timed extensions of Petri Nets but their binary reachability is typically undecidable if the net is unbounded (i.e., it is not finite state). A recent notable example of model checking a timed version of Petri Nets is [2], where it is shown that coverability properties are decidable, using well-quasi orderings techniques. A more general result holds for an extension of TA, Timed Networks [1], for which safety properties have been shown to be decidable. However, Timed Networks consist of an arbitrary set of identical timed automata, which is a very special case, although potentially useful in modeling infinitestate timed systems. Recently, Timed Pushdown Automata (TPA) [13,12] have been proposed, extending pushdown processes with unbounded discrete clocks. Considering that both the region techniques [4] and the flattening techniques [11] for TA can not be used for TPA, a totally different technique is proposed to show that safety and binary reachability analysis are still decidable [13,12]. Queues are a good model of many interesting systems, such as schedulers, for which automatic verification has rarely been attempted. Queues are usually regarded as hopeless for verification, since it is well known that a finite-state automaton equipped with one unbounded queue can simulate a Turing machine. However, there are restricted models with queues for which reachability is decidable (e.g., [9]). Here, we consider the Generalized Context-free Grammars (G C G ) of [8], which use both queues and stacks with suitable constraints to generate only semilinear languages, and which are well suited to modeling of scheduling policies. However, automatic verification of G C G has never been investigated, and G C G do not consider time. In this paper, we study how to couple a timed automaton with a multi-queue automaton (inspired by the G C G model) so that the resulting machine can be effectively used for modeling, while retaining the decidability of a class of Presburger formulae over the binary reachability set, with control-state variables, clock value variables and count variables. Hence, such machines are amenable for modeling and automatic verification of many infinite-state real-time systems, such as real-time process schedulers. The paper is structured as follows. Section 2 defines the MQDTA, introduces its untimed version (called Multi-queue-stack machine, MQSM) and proves the effective semilinearity of the model, by using a G C G . Section 3 proves the main result of the paper, i.e., the effective semilinearity of the binary reachability for MQDTA, by showing that clocks may be eliminated and an MQDTA may be translated into an equivalent MQSM. Section 4 proves the decidability of a class of Presburger formulae over the binary reachability, showing their applicability to an example.
2
Multi-queue Discrete Timed Automata
In this section we introduce the MQDTA model, which extends Discrete Timed Automata DTA by allowing a number of queues. The presentation is self-contained abd does not require previous knowledge of DTA. A clock constraint is a Boolean combination of
Automatic Verification of Multi-queue Discrete Timed Automata
161
atomic clock constraints in the following form: x # c, x − y # c where c is an integer, x , y are integer-valued clocks and # denotes ≤ , ≥ , < , > , or = . Let L X be the set of all clock constraints on clocks X . Let Z be the set of integers and Z + be the set of nonnegative integers. Definition 1 (MQDTA). A Multi-queue Discrete Timed Automaton (MQDTA) with is the queue ≥ 0 FIFO queues is a tuple S, X , Γ , s f , R , E , Q 1 , · · · , Q n where: Γ alphabet; Q 1 , · · · , Q n are queues; S is a finite set of (control) states; X is a finite set of clocks with values in Z + ; s f ∈ S is the final state; R ⊆ Γ × S is the restart set; E is a finite set of edges, such that each edge e ∈ E is in the form of s, λ , ( η 1 , · · · , η n ) , l , s ′ where s, s ′ ∈ S with s = s f (the final state s f does not have a successor); λ ⊆ X is the set of clock resets; l ∈ L X is the enabling condition. The queue operation is characterized by a tuple ( η 1 , · · · , η n ) with η 1 , · · · , η n ∈ Γ ∗ , to denote that each η i is put at the end of the queue Q i , 1 ≤ i ≤ n . n
Let A be an MQDTA with n queues. Intuitively, the queues are totally ordered from Q 1 to Q n and for a pair ( γ , s ) ∈ R , s will be the next start state of A if the head of the first nonempty queue is γ . Notice that, for n = 0 , the MQDTA reduces to a DTA. The semantics is defined as follows. A configuration α of A is a tuple s, π 1 , · · · , π n , c1 , · · · , ck where s ∈ S, c1 , · · · , ck ∈ Z + are the state and the clock values respectively. π 1 , · · · , π n ∈ Γ ∗ are the contents of each queue, with the leftmost character being the head and rightmost character being the tail. We use α Q i to denote each π i in α , with α q , α x 1 , · · · , α x k to denote s, c1 , . . . , ck respectively.
Let α η
n )
, l, s
s,λ ,(η
1 , · · ·, η
′
n
),l ,s′
denote a one-step transition along an edge s, λ , ( η 1 , · · · , in A satisfying the following conditions: − →
α
′
– The state s is set to a new location s ′ , i.e., α q = s, α q′ = s ′ . – Each clock changes according to λ . If there are no clock resets on the edge, i.e., λ = ∅ , then clocks progress by one time unit, i.e., for each x ∈ X , α x′ = α x + 1 . If λ = ∅ , then for each x ∈ λ , α x′ = 0 while for each x ∈ λ , α x′ = α x . – The enabling condition is satisfied, i.e., l ( α ) is true. – The content of each queue is updated: α Q′ = α Q η i for each 1 ≤ i ≤ n . i
i
Besides the above defined one-step transition, an MQDTA A can fire a restart transition r es t a r t when it is in the final state s f . Let α − → α ′ denote a restart transition in A satisfying the following four conditions: 1) α q = s f , i.e., this restart transition only fires at the final state. 2) Some queue in α is not empty. Let γ ∈ Γ be the head of the first (in the order from Q 1 to Q n ) nonempty queue. The next state should be indicated in the restart set R . That is, ( γ , α q′ ) ∈ R . 3) Let γ be the head of the j -th queue where 1 ≤ j ≤ n and α Q is not empty, and for all 1 ≤ i < j , α Q is empty. Assume α Q = γ π for some π ∈ Γ ∗ . Then, α Q′ = π , and for all 1 ≤ i ≤ n with i = j , α Q′ = α Q . That is, the head γ must be removed from the queue, while the other queues are not modified. 4) Clocks are reset, i.e., α x′ = 0 for all x ∈ X . From now on, A is a MQDTA specified as above. We simply write α → A α ′ if α can reach α ′ by either a one-step transition or a restart transition. The binary reachability j
j
i
i
i
j
162
❀
P. San Pietro and Z. Dang
is the reflexive and transitive closure of → A A configuration α = s, π 1 , · · · , , c n 1 , · · · , ck can be encoded as a string [ α ] by concatenating the symbol representation of s , the strings π 1 , · · · , π n , and the (unary) string representation of c1 , · · · , ck with a delimiter “$ ". The binary reachability ❀ A can be considered as the language: { [ α ] $ [ β ] : α ❀ A β }. An Example. Consider a LAN printer, which may accept two types of jobs: Large (L ) and Small (S ). When a job is being printed, no other job can interrupt it. However, if a A
π
job takes too long to be completed, then the printer preempts it and puts it into a special, lower priority queue, called the batch queue. The timeout for the L jobs is 200 seconds, while for the S jobs is only 100. The jobs in the batch queue (called batch jobs, B ) can be printed without time limits, but they are overridden (i.e., put at the end of the batch queue) whenever L or S job arrives. The arrival of new jobs is not completely random: if the printer is busy printing, then the interval between the arrival of new jobs is at least 50 seconds. The specification of the example is formalized with an MQDTA with two clocks (called t i m eou t and l ast respectively) and two queues. The set of states is: { st ar t , pr i n t L , pr i n t S, pr i n t B } . The alphabet of the queues is: { L , S, B } . The graph of the transition function is shown in Fig. 1. Multiple transitions from one state to another state are denoted by multiple labels instead of by multiple arcs. The labels used on the transitions have the following syntax: [clock condition] / [queue update] [clock assignment]. The notation for clock conditions and assignments is obvious. A queue update such as ( L ) 1 ( B ) 2 means that L and B are written on queue 1 and queue 2, respectively. The automaton starts the execution in the st ar t state. When either an S or an L job is put into queue 1, the automaton enters s f : it reads the queue content and executes a r est ar t transition (denoted by the dashed arrows). A r est ar t transition goes from s f to the next state depending on the queue content: if the front of the queue is S it enters state pr i n t S , if it is L it enters state pr i n t L , if it is B it enters state pr i n t B . When a r est ar t transition is executed, all the clocks are reset (i.e., t i m eou t : = 0 and l ast : = 0 are executed).
/(L)1 (B)2 /(S)1 (B)2 printB /(L)1 /(S)1
B
start
sf = 10
out>
time
printS
)2 0 /(B
last>50 /(S)1 last:=0 last>50 /(L)1 last:=0
time
out>
= 10
0 /(B
)2
printL S
L
last>50 /(S)1 last:=0 last>50 /(L)1 last:=0 timeout50 /(S)1 last:=0 last>50 /(L)1 last:=0 timeout m , a i j : = m ; if α x − α x < − m , a i j : = − m ; if α x ≤ m , bi : = α x ; if α x > m , bi : = m ; for each 1 ≤ i , j ≤ k . – Clock values and queue contents are the same in α and α 2 , and in β and β 2 . i
i
Theorem 3. If ❀
A
2
i
j
i
j
is semilinear, then so is ❀
A
i
j
i
j
i
.
Proof. From Theorem 2, the entry values in the extended states α q2 and β q2 can be dropped by applying a homomorphism. However, ❀ A is the homomorphic image not only of
166
❀
P. San Pietro and Z. Dang 2
2
, but of a proper subset of ❀ A . In fact, as stated in Theorem 2, the entry values in the extended state α q2 are the initial entry values constructed from α . This condition can be expressed as a clock constraint, since the entry values a i j and bi are bounded. The result is immediate by applying Lemma 2 on A 2 , and applying the homomorphism to L ′ as in the lemma. ⊓⊔ A
Theorem 4. The language ❀
2
A
is semilinear.
2
2
Proof. The language ❀ A is { [ α ] $ [ β ] : α ❀ A β } . An MQSM M to simulate A an input alphabet including all the following symbols:
2
has
– symbols s˙ and s¨ for each s in the state set of A 2 . s˙ is used to encode the state α q of α , and s¨ is used to encode the state β q of β . – symbols u˙ i and u¨ i , 1 ≤ i ≤ k . u˙ i is used to encode the unary string representation of the clock value α x , and u¨ i is for β x . – symbols γ ˙ and γ ¨ for each γ ∈ Γ . Letters γ ˙ are used to encode queue words α Q 1 , · · ·, α Q of α . Letters γ ¨ are for those of β . – 3 k + 2 n + 3 delimiters $ , &˙ , &¨ , &¨ i , #˙ i , ?˙ j , #¨ i , ¨? j , for 1 ≤ i ≤ k and 1 ≤ j ≤ n . – padding symbols @˙ and %¨ i for 1 ≤ i ≤ k . i
i
n
The format of the input to M is: α
q &˙ α ˙
˙ Q 1 ?1 ·
·
·
α x 1 #˙ ?˙ n u˙ α ˙ Q 1 · n 1
α ·
·
x
u˙ k
k
˙ t $β¨ #˙ k @
q &¨ β ¨
¨ Q 1 ?1 ·
·
·
β x 1 &¨ ¨ t 1 ¨ ¨? u¨ β¨ Q n 1 % 1 # 1 · n 1
β ·
·
x
u¨ k
k
¨ t k #¨ &¨ k % k k
The part before $ is the encoding for α , and the part after $ is for the encoding for β . The first part has four segments, from left to right: – α ˙ q is a symbol encoding the state α q , followed by a delimiter &˙ . – α ˙ Q 1 ?˙ 1 · · ·α ˙ Q ?˙ n is the concatenation of the queue words α Q , using the delimiters ?˙ 1 , · · ·, ?˙ n . Note that, instead of using α Q for a queue word, we use α ˙ Q by replacing each γ ∈ Γ with γ ˙ . α α α – u˙ 1 1 #˙ 1 · · ·u˙ k #˙ k is the unary string representations u˙ i of the clock value α x using the symbol u˙ i , concatenated by delimiters #˙ 1 , · · ·, #˙ k . – a padding word @˙ t is a unary string over character @˙ . The number t is used to indicate the number of transitions in A 2 that lead from α to β . n
i
i
i
x
x
x i
k
i
The second part has three segments from left to right, the first two being defined similarly, β β while the third one u¨ 1 1 &¨ 1 %¨ t11 #¨ 1 · · ·u¨ k &¨ k %¨ tk #¨ k is the unary string representation β u¨ i of the clock value β x using the symbol u¨ i , concatenated by delimiters #¨ 1 , · · ·, #˙ k . β But we do not simply use u¨ i : instead, there is a padding %¨ ti (a unary word of length t i β over the character %¨ i ) after each u¨ i , separated by a delimiter &¨ i . These clock padding words will be made clear later. Besides queues Q 1 , · · ·, Q n , M has stacks C 1 , · · ·, C k . Each stack C i is used to store the clock value of x i of A 2 . At start, M first pushes a new symbol Z i twice onto each stack C i – these symbols are used as indicate the bottom of each stack. M then reads the input tape up to the padding word @˙ t . During the process, M stores the queue x
x
k
k
x i
i
x i
i
x i
Automatic Verification of Multi-queue Discrete Timed Automata
167
contents and clock values into Q 1 , · · ·, Q n and C 1 , · · ·, C k respectively. Then, M starts to simulate A 2 from the state α q read from the input tape. Each move of A 2 causes M to read a symbol @ and to simulate the queue operations using its own queues. The clock changes in A 2 are simulated by using the stacks of M . Suppose that currently A 2 executes an edge with a set λ of clock resets. If λ = ∅ , then, after firing the transition, all clocks progress by one time unit. M simulates this by pushing the symbol u¨ i onto the stack C i for each 1 ≤ i ≤ k . Otherwise, if λ = ∅ , then, after the firing of the transition, the clocks in λ are reset and the others are left unchanged. M simulates this by pushing a special symbol Z i onto the stack C i for each x i ∈ λ , and by pushing nothing (ǫ ) on the other stacks. During the simulation of A 2 , M never pops the stacks, and in fact it need not, since all the enabling conditions in A 2 are simply true. After having read all the padding word @ t , when M reads the delimiter $ , it must make sure that the current state of A 2 corresponds to the symbol β ¨ q on the input tape. M also pushes a new symbol Yi onto each queue Q i , in order to use them later to decide whether a queue is empty. M then moves to the final state s f , which is also the final state of A 2 . There, M starts checking that the rest of the input tape is consistent with its current queue and stack contents. Such check requires M to pop repeatedly from its queues and stacks; these operations require, from the definition of an MQSM, that pop-queue-transitions and pop-stack-transitions occur in a final state and that the next state after a pop operation only depends on the current input character and the queue or stack symbol just read. But we use different sets of alphabets in the encoding of the rest of the input tape. Therefore, a pop-queuetransition executed now cannot be confused with a normal pop-queue-transition in M ’s simulating A 2 when reading the padding word @˙ t . M proceeds by emptying each i -th queue, from Q 1 to Q n , while checking the correspondence between the current top symbol of a queue and the symbol on the input tape. M can also check when the queue Q i becomes empty by checking that the current input character is the delimiter ¨? i and that the current top of the queue is Yi (the symbol M pushed before). After all the queues are successfully compared and emptied, M starts β to compare the clock values u¨ i on the input tape with the stack C i , from C 1 to C k . For β each C i , M reads the input u¨ i and pops a symbol from C i . Once the bottom symbol Z i becomes the current top symbol, the current input character must be the delimiter &¨ i . After this, M empties C i by reading through the clock padding word %¨ ti , but it makes sure that the delimiter #¨ i , right after the clock padding word, is correspondent to the last symbol Z i on the stack (remember that initially we pushed two Z i ’s onto the stack. Thus, t i is a guess of how many symbols there are between the first Z i and the last Z i in the stack. What if such a guess is wrong? In that case, since we use different u¨ i for each i to represent both the stack word and the clock values on the input tape, M always knows, assuming the guess is wrong, whether a stack symbol u¨ i hits an unexpected symbol like u¨ j – either the guess of t i is too small or it is too large. In this case, and in all the other cases where comparisons fail, M moves into a deadlock state – a special state where no further transition is possible. M accepts the input iff all comparisons are successful and the input head is at the end of the tape. Notice that M has no ǫ -moves. Denote with L ( M ) the language accepted by M . Thus, L ( M ) is a semilinear language from Theorem 1. Notice that M does not check whether the input is in a correct format. Let L ′ be the regular language composed x i
x i
i
168
P. San Pietro and Z. Dang
of all the strings in the correct format-it is a segmented language with 3 k + 2 n + 3 segments. It is easy to check that L ′ is also a semilinear, locally commutative language. Thus, L ′ ′ = L ( M ) ∩ L ′ , i.e., the set of all input strings accepted by M and in the correct format, is also a semilinear language from Lemma 1. L ′ ′ is different from the 2 2 language ❀ A , but not too much. From the previous construction, α ❀ A β iff there are t , t 1 , · · · , t k , such that the input word given as in the beginning of this proof can be accepted by M . Thus, define a homomorphism h such that, h ( @˙ ) = h ( %¨ i ) = ǫ , h ( $ ) = h ( #˙ i ) = h ( &˙ ) = h ( &¨ ) = h ( &¨ i ) = h ( ?˙ j ) = h ( #¨ i ) = h ( ¨? j ) = $ , h ( s˙ ) = h ( s¨ ) = s , h ( γ ˙ ) = h ( γ ¨ ) = γ , h ( u˙ i ) = h ( u¨ i ) = 1 , for all 1 ≤ i ≤ k and 1 ≤ j ≤ n , for all s 2 2 being a state of A 2 , for all γ ∈ Γ . Obviously, h ( L ′ ′ ) = ❀ A . Thus, ❀ A is a semilinear language (since the homomorphic image of a semilinear language is still semilinear). ⊓⊔
The following main theorem can be shown by combining Theorems 3 and 4. Theorem 5. ❀
A
is a semilinear language for any MQDTA A .
An MQDTA A has no input tape, i.e., there is no event label on edges. However, if each edge is labeled, we can extend the states of A by combining a state with a label. In this case, a configuration contains only the current event label instead of the whole input word consumed. This may make applications more convenient to be dealt with, though all results still hold.
4 Verification Results In this section, we formulate properties that can be verified for an MQDTA. Given an MQDTA A , let α , β · · · denote variables ranging over configurations, and let α q (state variables), α x (clock value variables) and α Q (queue content variables) denote, respectively, the state, the clock x i ’s value and the content of the queue Q j of α , 1 ≤ i ≤ k , 1 ≤ j ≤ n . We use a count variable # γ ( α Q ) to denote the number of occurrences of a character γ ∈ Γ in the content of the queue Q j in α , 1 ≤ j ≤ n . An MQDTAterm t is defined as follows: t : : = n | α x | # γ ( α Q ) | t − t | t + t , where n is an integer, γ ∈ Γ , 1 ≤ i ≤ k , 1 ≤ j ≤ n . An MQDTA-formula f is defined as follows: f : : = t > 0 | t mod n = 0 | ¬ f | f ∨ f | a q = q, where n = 0 is an integer and q is a state of A . Thus, f is a quantifier-free Presburger formula over control state variables, clock value variables and count variables. For m ≥ 1 , let F be a formula in the following format: 1≤ i ≤ m ( f i ∧ α i ❀ A β i ) , where each f i is a MQDTA-formula and all α i and β i are configuration variables. Let ∃ F be a closed formula such that each free variable in F is existentially quantified. Then, the property ∃ F can be verified. j
i
j
i
j
Theorem 6. The truth value of ∃ F with respect to an MQDTA A is decidable for any MQDTA-formula F . Proof. Let L ( E ) be the language of the string encodings of of all the config tuples the urations that satisfy a MQDTA-formula E . Thus, L ( F ) = L(α i ❀ A β i) ∩ L(fi) . i We will show that L ( F ) is a semilinear language. Since all the proofs are constructive,
Automatic Verification of Multi-queue Discrete Timed Automata
169
the semilinear set of L ( F ) can be effectively constructed from F and A . Thus, testing whether ∃ F = f al se, which is equivalent to testing the emptiness of L ( F ) , is decidable [14]. Since semilinearity is closed under union, without loss of generality we show that L 1 ∩ L 2 is a semilinear language, where L 1 = L ( α ❀ A β ) and L 2 = L ( f ) . From Theorem 5, L 1 is a semilinear language. Notice that L 2 is locally commutative – the reason is that the contents of the queues are used only by count variables. P ( L 2 ) , the result of applying the Parikh transform P , is a semilinear language. Thus, from Lemma 1, part (1), L 2 is a semilinear language. Hence, L 1 ∩ L 2 is a semilinear language from Lemma 1, part (2). ⊓⊔ For instance, the following property: “for all configurations α and β with α ❀ A β , clock x 2 in β is the sum of clocks x 1 and x 2 in α , and symbol γ 1 appears in the first queue Q 1 in β is twice as many as symbol γ 2 does in the second queue Q 2 in α ." can be expressed as, ∀ α ∀ β ( α ❀ A β → ( β x 2 = α x 1 + α x 2 ∧ # γ 1 ( β Q 1 ) = 2 # γ 2 ( α Q 2 ) ) ) . The negation of this property is equivalent to ∃ F for some MQDTA-formula F . Thus, it can be verified. Verification of an Example. Consider the LAN printer example of Section 2. A property verifiable with our model is that the first queue is actually bounded: it can never contain more than 4 elements. This can be formalized as follows: for every α , β , such that α ❀ A β : α s t a r t ∧ # S ( α Q 1) = # L ( α Q 1) = # B ( α Q 2) = 0 ∧ # S ( β Q 1) + # L ( β Q 2) ≤ 4 . Notice that the binary queue of A need not be bounded, but the boundedness is a decidable property of A . If this is the case, the implementation of the system might rely on a small buffer of size 4 to implement the queue. More sophisticated properties can also be verified, and the system itself could be made more complex.
5
Conclusions
We introduced a new version of Timed Automata augmented with queues (MQDTA), and we proved that its binary reachability is effectively semilinear, allowing the automatic verification of a class of Presburger formulae over control state variables, clock value variables and queue content. An MQDTA is more powerful than the other timed (finite-state or pushdown) models, and it can be used for modeling various systems where FIFO policies are used. Such models are based on discrete–rather than dense–time. This choice is perfectly adequate for synchronous real-time systems, where there is always an underlying discrete model of time, but it is also suitable for modeling various asynchronous systems where discrete time is a good approximation of a dense one. Since this is the first paper introducing and investigating the model, we did not develop explicitly a verification algorithm. Using an automata-theoretic approach, we reduced the problem of checking reachability properties to checking certain Presburger formulae over integer values. Hence, the the complexity of the verification has a very high upper bound (nondeterministic double exponential). This is not as hopeless as it may seem. For instance, the Omega-library of [20] could be used to implement a verification algorithm, since the library is usually reasonably efficient for formulae without alternating quantifiers (as in our case). Also, a very high upper bound is typical of the automata-theoretic approach, but often the upper bound may be reduced by using a (more complex) process algebra approach.
170
P. San Pietro and Z. Dang
The MQDTA has some limitations in expressivity: for instance, it cannot check how long a symbol has been stored in a queue before being consumed. Moreover, when a queue is read, all the clocks are reset. However, the model could be powerful enough to describe and verify useful, real-life infinite-state systems (such as the simple job scheduler with timeouts and a priority queue of Section 2) that, at the best of our knowledge, cannot be modeled and automatically verified by any other formalism. The model only considers queues, but in general stacks could be used instead or together with queues, since the G C G model (on which MQDTA are based) allows both kinds of rewriting policies. This can be useful, since for instance a stack can model recursive procedure calls, and the queues may model a process scheduler. Our results imply that it is decidable to verify whether the paths of the reachability satisfy constraints expressed in a fragment of Presburger arithmetic. This can be easily achieved by recording, in one additional queue of the automaton, the history of the moves. For instance, it is possible to verify that the total time a symbol has been waiting in a queue does not exceed a given threshold, even though, as remarked above, this control cannot be done by the MQDTA itself.
References 1. P. Abdulla and B. Jonsson. Model checking of systems with many identical timed processes. Theoretical Computer Science, 290(1):241–264, 2002. 2. P. Abdulla and A. Nylén. Timed petri nets and bqos. In ICATPN’2001, 22nd Int. Conf. on application and theory of Petri nets, 2001. 3. R. Alur, C. Courcoubetis, and D. Dill. Model-checking in dense real-time. Information and Computation, 104(1):2–34, May 1993. 4. R. Alur and D. L. Dill. A theory of timed automata. Theoretical Computer Science, 126(2):183–235, April 1994. 5. M. Benedikt P. Godefroid and T. Reps. Model checking of unrestricted hierarchical state machines. In ICALP 2001, of LNCS 2076, pp. 652–666. Springer, 2001. 6. L. Breveglieri, A. Cherubini, C. Citrini, and S. Crespi Reghizzi. Multiple pushdown languages and grammars. Int. Journal of Found. of Computer Science, 7:253–291, 1996. 7. L. Breveglieri,A. Cherubini, and S. Crespi Reghizzi. Real-time scheduling by queue automata. In FTRTFT’92, vol/ 571 of LNCS, pages 131–148. Springer, 1992. 8. L. Breveglieri, A. Cherubini, and S. Crespi Reghizzi. Modelling operating systems schedulers with multi-stack-queue grammars. In Fundamentals of Computation Theory, volume 1684 of LNCS, pages 161–172. Springer, 1999. 9. G. Cece and A. Finkel. Programs with quasi-stable channels are effectively recognizable. In CAV’97, volume 1254 of LNCS, pages 304–315. Springer, 1997. 10. H. Comon and Y. Jurski. Multiple counters automata, safety analysis and Presburger arithmetic. In CAV’98, volume 1427 of LNCS, pages 268–279. Springer, 1998. 11. H. Comon and Y. Jurski. Timed automata and the theory of real numbers. In CONCUR’99, volume 1664 of LNCS, pages 242–257. Springer, 1999. 12. Zhe Dang. Binary reachability analysis of pushdown timed automata with dense clocks. In CAV’01, volume 2102 of LNCS, pages 506–517. Springer, 2001. 13. Zhe Dang, O. H. Ibarra, T. Bultan, R. A. Kemmerer, and J. Su. Binary reachability analysis of discrete pushdown timed automata. In CAV’00, LNCS 1855, pages 69–84. Springer, 2000. 14. S. Ginsburg and E. Spanier. Semigroups, presburger formulas, and languages. Pacific J. of Mathematics, 16:285–296, 1966.
Automatic Verification of Multi-queue Discrete Timed Automata
171
15. P. Godefroid and R. Jagadeesan. Automatic abstraction using generalized model checking. In CAV’02, volume 2404 of LNCS, pages 137–150. Springer, 2002. 16. B. Grahlmann. The state of pep. In AMAST’98, LNCS 1548, pages 522–526. Springer, 1998. 17. T. A. Henzinger, X. Nicollin, J. Sifakis, and S.Yovine. Symbolic model checking for real-time systems. Information and Computation, 111(2):193–244, June 1994. 18. R. Parikh. On context-free languages. Journal of the ACM, 13:570–581, 1966. 19. A. Pnueli and E. Shahar. Livenss and acceleraiton in parameterized verification. In CAV’00, volume 1855 of LNCS. Springer, 2000. 20. W. Pugh. The omega test: a fast and practical integer programming algorithm for dependence analysis. Communications of the ACM, 35(8):102–114, 1992. 21. B. Steffen and O.Burkart. Model checking the full modal mu-calculus for infinite sequential processes. In ICALP’97, volume 1256 of LNCS, pages 419–429.
L is t T o t a l C o lo rin g s o f S e rie s - P a ra lle l G ra p h s Xiao Zhou, Yuki Mat suo, and Takao Nishizeki Graduat e School of Informat ion Sciences, Tohoku University Aoba-yama 05, Sendai 980-8579, J APAN { zhou,matsuo,nishi} @nishizeki.ecei.tohoku.ac.jp
A t ot al coloring of a graph G is a coloring of all element s of , i.e. vert ices and edges, in such a way t hat no two adjacent or incident element s receive t he same color. Let L ( x ) be a set of colors assigned t o each element x of G . T hen a list t ot al coloring of G is a t ot al coloring such t hat each element x receives a color cont ained in L ( x ). T he list t ot al coloring problem asks whet her G has a list t ot al coloring. In t his paper, we first show t hat t he list t ot al coloring problem is NP -complet e even for series-parallel graphs. We t hen give a suffi cient condit ion for a series-parallel graph t o have a list t ot al coloring, t hat is, we prove a t heorem t hat any series-parallel graph G has a list t ot al coloring if | L (v )| ≥ min { 5, ∆ + 1} for each vert ex v and | L ( e ) | ≥ max { 5, d ( v ) + 1, d ( w ) + 1} for each edge e = v w , where ∆ is t he maximum degree of G and d ( v ) and d ( w ) are t he degrees of t he ends v and w of e , respect ively. T he t heorem implies t hat any series-parallel graph G has a t ot al coloring wit h ∆ + 1 colors if ∆ ≥ 4. We finally present a linear-t ime algorit hm t o find a list t ot al coloring of a given series-parallel graph G if G sat isfies t he suffi cient condit ion.
A b st r a c t . G
1
I n t ro d u c t io n
In t his pap er a graph means a finit e “simple” graph wit hout mult iple edges and selfloops. We denot e by G = ( V , E ) a graph wit h a vert ex set V and an edge set E . We oft en denot e V by V ( G ), E by E ( G ), and V ( G ) ∪ E ( G ) by V E ( G ). An edge joining vert ices v and w is denot ed by v w . For each vert ex v ∈ V , we denot e by d ( v , G ) or simply d ( v ) t he d egree of v , t hat is, t he numb er of edges incident t o v . We denot e by ∆ ( G ) or simply ∆ t he m a x im u m d egree of G . A graph is se r ie s-pa ra lle l if it cont ains no subgraph isomorphic t o a sub division of a complet e graph K 4 of four vert ices [7,10]. T hus a series-parallel graph is a “part ial 2-t ree,” and it s “t ree-widt h” is b ounded by 2. A series-parallel graph represent s a network obt ained by rep eat ing “series connect ion” and “parallel connect ion.” T he graph in F ig. 1 is series-parallel. A t o t a l co lo r in g of a graph G is t o color all vert ices and edges in G so t hat any two adjacent vert ices and any two adjacent edges receive diff erent colors, and any vert ex receives a color diff erent from t he colors of all edges incident t o it [3,13]. F igure 1(b) depict s a t ot al coloring of a graph, where a color is at t ached t o each element . T he minimum numb er of colors necessary for a t ot al coloring of G is called t he t o t a l c h ro m a t ic n u m be r of G , and is denot ed by χ t ( G ). Clearly T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 172–181, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
List Tot al Colorings of Series-P arallel Graphs
χ
F ig. 1 .
173
(a) A series-parallel graph wit h list s, and (b) a list t ot al coloring.
t ( G ) ≥ ∆ ( G ) + 1. It is conject ured t hat χ t ( G ) ≤ ∆ ( G ) + 2 for any simple graph G . However, t his “t ot al coloring conject ure” has not b een verified [8,13].
In t his pap er we deal wit h a generalized typ e of a t ot al coloring called a “list t ot al coloring,” which has some applicat ions t o a scheduling problem such as t imet abling, rout ing in opt ical networks, and frequency assignment in cellular networks [9,13]. Supp ose t hat a set L ( x ) of colors, called a list o f x , is assigned t o each element x ∈ V E ( G ), as illust rat ed in F ig. 1(a). T hen a t ot al coloring ϕ of G is called a list t o t a l co lo r in g o f G fo r L if ϕ ( x ) ∈ L ( x ) for each element x ∈ V E ( G ), where ϕ ( x ) is t he color assigned t o x by ϕ . T he list t ot al coloring ϕ is simply called an L -t o t a l co lo r in g . T he coloring in F ig. 1(b) is indeed an L -t ot al coloring of t he graph in F ig. 1(a). An ordinary t ot al coloring is an L t ot al coloring for which all list s L ( x ) are same. T hus an L -t ot al coloring is a generalizat ion of a t ot al coloring. T he list t o t a l co lo r in g p ro ble m asks whet her a graph G has an L -t ot al coloring for given G and L . T he problem is NP -complet e in general, b ecause t he ordinary t ot al coloring problem is NP -complet e [12]. T he list vert ex-coloring problem and t he list edge-coloring problem are similarly defined. T he list vert ex-coloring problem can b e solved in p olynomial t ime for part ial k -t rees and hence for series-parallel graphs [6]. In t his pap er we first show t hat b ot h t he list edge-coloring problem and t he list t ot al coloring problem are NP -complet e even for series-parallel graphs. T hus it is unlikely t hat t here is a p olynomial-t ime algorit hm t o solve t he list t ot al coloring problem even for series-parallel graphs. We t hen obt ain a suffi cient condit ion for a series-parallel graph G t o have an L -t ot al coloring. T hat is, we prove a t heorem t hat a series-parallel graph G has an L -t ot al coloring if | L ( v ) | ≥ min { 5, ∆ + 1} for each vert ex v and | L ( e) | ≥ max { 5, d ( v ) + 1, d ( w ) + 1} for each edge e = v w . T he t heorem implies t hat t he t ot al chromat ic numb er χ t ( G ) of a series-parallel graph G sat isfies ≤ ∆ ( G ) + 2 if ∆ ( G ) ≤ 3; χ t (G ) = ∆ ( G ) + 1 if ∆ ( G ) ≥ 4. We finally present a linear-t ime algorit hm t o find an L -t ot al coloring of a given series-parallel graph if L sat isfies t he suffi cient condit ion ab ove. T he rest of t he pap er is organized as follows. Sect ion 2 present s a proof of t he NP -complet eness. Sect ion 3 present s a proof of our suffi cient condit ion. Sect ion
174
X. Zhou, Y. Mat suo, and T . Nishizeki
F ig. 2 .
Gadget
G xi
.
4 present s an algorit hm. F inally Sect ion 5 concludes wit h discussion and an op en problem.
2
N P - C o m p le t e n e s s
T he “edge-disjoint pat hs problem” is one of a few problems which are NP complet e even for series-parallel graphs [11]. We first show t hat t he list edgecoloring problem is anot her example of such problems alt hough t he list vert excoloring problem can solved in p olynomial t ime for series-parallel graphs [6]. T h e o r e m 1 . T h e list ed ge -co lo r in g p ro ble m is N P -co m p le t e fo r se r ie s-pa ra lle l
gra p h s. P roo f. 1 It suffi ces t o show t hat t he SAT problem can b e t ransformed in p olynomial t ime t o t he list edge-coloring problem for a series-parallel graph G . Let f b e a formula in conjunct ive normal form wit h n variables x 1 , x 1 , · · · , x n and m clauses C 1 , C 2 , · · · , C m . For each variable x i , 1 ≤ i ≤ n , we const ruct a gadget G x i as illust rat ed in F ig. 2. G x i consist s of a pat h u i 1 , v i 1 , u i 2 , v i 2 , · · · , u i m , v i m , u i ( m + 1) of lengt h 2m , a vert ex w i of degree m , and m − 1 vert ices t i j , 2 ≤ j ≤ m , of degree 1. T he list s of edges in G x i are assigned as follows: • • • •
for for for for
each each each each
edge edge edge edge
w i vi j , 1 ≤ u i j vi j , 1 ≤ v i j u i ( j + 1) , ui j ti j , 2 ≤
j
≤
j
≤
1
≤
j
≤
m , L ( w i v i j ) = { c i j , c ′i j } ; m , L ( u i j v i j ) = { a, c i j } ; j ≤ m , L ( v i j u i ( j + 1) ) = { a, c ′i j } ; and m , L ( w i t i j ) = { c ′i ( j − 1) , c i j } .
Clearly, if t he gadget G x i has a list edge-coloring ϕ , t hen eit her ϕ ( w i v i j ) = ci j for all j , 1 ≤ j ≤ m , or ϕ ( w i v i j ) = c′i j for all j , 1 ≤ j ≤ m . T he color ci j for edge w i v i j corresp onds t o x i = False, and t he color c ′i j for edge w i v i j corresp onds t o x i = True. Now a graph G is const ruct ed as follows (see F ig. 3): •
• 1
ident ify all t he vert ices w i for t he n gadget s G x i , 1 ≤ i ≤ n , as a single vert ex w ; add m new vert ices v C j , 1 ≤ j ≤ m , and m edges w v C j ; and We t hank D´a niel Mark for discussion on t he proof.
List Tot al Colorings of Series-P arallel Graphs
F ig. 3 . •
Series-parallel graph
G
175
.
let L ( v C j w ), 1 ≤ i ≤ m , b e a list ⊆ { c1 j , c′1 j , c2 j , c′2 j , · · · , cn j , c′n j c i j ∈ L ( v C j w ) iff t he p osit ive lit eral of x i is in clause C j and c ′i j iff t he negat ive lit eral of x i is in C j .
} ∈
such t hat L (vC j w )
It is clear t hat G is a series-parallel graph and b ot h t he numb er of vert ices in G and t he t ot al numb er of colors in list s are b ounded by a p olynomial in n and m , and t hat f is sat isfiable iff G has a list edge-coloring. ⊓ ⊔ A graph is o u t e r p la n a r if it cont ains no subgraph isomorphic t o a sub division of a complet e bipart it e graph K 2 , 3 . We t hen immediat ely have t he following corollary from T heorem 1. C o ro lla ry 1 .
(a) T h e list t o t a l co lo r in g p ro ble m is N P -co m p le t e fo r se r ie s-pa ra lle l gra p h s. (b) B o t h t h e list ed ge -co lo r in g p ro ble m a n d t h e list t o t a l co lo r in g p ro ble m a re N P -co m p le t e fo r 2-co n n ec t ed o u t e r p la n a r gra p h s. (a) T he list edge-coloring problem for a graph can b e easily t ransformed in p olynomial t ime t o t he list t ot al coloring problem for t he same graph, in which t he list of each vert ex is a set of a single new color. (b) One can add new edges t o t he graph G in t he proof of T heorem 1 so t hat t he result ing graph is a 2-connect ed out er planar graph; t he list of each new edge is a set of a single new color. ⊓ ⊔
P roo f.
3
Suffi
c ie n t C o n d it io n
Alt hough t he list edge-coloring problem is NP -complet e for series-parallel graphs, several suffi cient condit ions for a series-parallel graph t o have a list edge-coloring are known [4,7,14]. In t his sect ion we present a suffi cient condit ion for a seriesparallel graph t o have a list t ot al coloring, t hat is, we prove t he following t heorem. T h e o r e m 2 . L e t G be a se r ie s-pa ra lle l gra p h , a n d le t L be a list o f G su c h t h a t |L
fo r ea c h v e r t e x u ∈
(u )|
min { 5, ∆ ( G ) + 1}
(1)
max { 5, d ( v ) + 1, d ( w ) + 1}
(2)
≥
V (G ) a n d |L
fo r ea c h ed ge e = v w ∈
( e) |
≥
E ( G ) . T h e n G h a s a n L -t o t a l co lo r in g.
176
X. Zhou, Y. Mat suo, and T . Nishizeki
An odd cycle C n , n ≥ 3, has no L -t ot al coloring for some list L such t hat ( u ) | = ∆ ( C n ) = 2 for each vert ex u ∈ V ( C n ), and hence one cannot decrease t he second t erm ∆ ( G ) + 1 of t he right side of Eq. (1). A series-parallel graph G has no L -t ot al coloring if G has a vert ex v such t hat | L ( v ) | = d ( v ) = 5, and each neighb or w ∈ N ( v ) of v sat isfies d ( w ) ≤ d ( v ) and L ( v w ) = L ( v ). T hus one cannot decrease t he second t erm d ( v ) + 1 of t he right side of Eq. (2). Similarly one cannot decrease t he t hird t erm d ( w ) + 1. Considering t he case where each list consist s of t he same ∆ + 1 or ∆ + 2 colors, one can easily observe t hat T heorem 2 implies t he following corollary.
|L
C o r o l l a r y 2 . T h e t o t a l c h ro m a t ic n u m be r χ
t
( G ) o f a se r ie s-pa ra lle l gra p h G
sa t isfi e s
χ
∆ ( G ) + 2 if ∆ ( G ) = ∆ ( G ) + 1 if ∆ ( G )
≤
t (G )
3; 4.
≤ ≥
Any “ s -degenerat e” graph G , s ≥ 1, sat isfies χ t ( G ) = ∆ + 1 if eit her ∆ ( G ) ≥ 2s 2 [1] or ∆ ( G ) ≥ 4s + 3 [5]. Since a series-parallel graph G is 2-degenerat e, χ t ( G ) = ∆ ( G ) + 1 if ∆ ( G ) ≥ 8. T he corollary ab ove improves t his result . Before present ing a proof of T heorem 2, we present not at ions and lemmas which will b e used in t he proof. T he size of a graph G = ( V , E ) is | V | + | E | . We say t hat a graph G ′ is smaller t han a graph G if t he size of G ′ is smaller t han t hat of G . We denot e by G − e t he graph obt ained from G by delet ing an edge e, and by G − v t he graph obt ained from a graph G by delet ing a vert ex v and all edges incident t o v . We denot e by N ( v ) t he set of neighb ors of v in G . Since G is a simple graph, d ( v ) = | N ( v ) | for any vert ex v ∈ V . Let L b e a list of a graph G . Let G ′ b e a subgraph of G , and let L ′ b e a list of G ′ such t hat L ′ ( x ) = L ( x ) for each element x ∈ V E ( G ′ ). Supp ose t hat we have already obt ained an L ′ -t ot al coloring ϕ ′ of G ′ , and t hat we are going t o ext end ϕ ′ t o an L -t ot al coloring ϕ of G wit hout alt ering t he colors in G ′ . Let U b e t he set of all uncolored vert ices, t hat is, U = V ( G ) − V ( G ′ ). For a vert ex v ∈ V ( G ), we denot e by C ( v , ϕ ′ ) t he set of all colors t hat ϕ ′ have assigned t o v and t he edges incident t o v in G ′ , t hat is, C (v , ϕ
′
)=
{
T hen
′
ϕ
(v )}
|C
′
(v , ϕ )| =
∪
{
ϕ
′
(v x ) | v x
d ( v , G ′ ) + 1 if v 0 if v
′
E (G )} . ∈
V ( G ′ ); U.
∈ ∈
Let H b e a subgraph of G induced by t he set E ( G ) edges. For each uncolored edge v w ∈ E ( H ), let L av (v w , ϕ
′
−
(3)
E ( G ′ ) of all uncolored
) = L ( v w ) − ( C ( v , ϕ ′ ) ∪ C ( w , ϕ ′ )) .
(4)
ϕ
T hen L a v ( v w , ϕ ) is t he set of all colors in L ( v w ) t hat are a v a ila ble for v w when ′ is ext ended t o ϕ , and we have ′
| L av
(v w , ϕ ′ )|
≥
|L
(v w )|
−
|C
(v , ϕ ′ )|
−
|C
(w , ϕ ′ )| .
(5)
List Tot al Colorings of Series-P arallel Graphs
F ig. 4 .
F ive subst ruct ures in series-parallel graphs.
For each uncolored vert ex v L av (v , ϕ
177
′
U ∈
V ( H ), let ⊆
) = L (v ) −
{
ϕ
′
(u ) | u
N (v ) ∈
∩
′
V (G )} .
(6)
T hen L a v ( v , ϕ ′ ) is t he set of all colors t hat are a v a ila ble for v when ϕ ′ is ext ended t o ϕ . An L a v -co lo r in g ϕ H o f H is defined t o b e a coloring of all element s in U ∪ E ( H ) such t hat (a) (b) (c) (d)
ϕ ϕ
H H
ϕ
H
ϕ
H
(x ) ∈ ( v ) = ( e) = ( v ) =
L a v ( x , ϕ ′ ) for each element x ∈ U ∪ E ( H ); ϕ H ( w ) if v , w ∈ U and v w ∈ E ( H ); ϕ H ( e′ ) if edges e and e′ of H share a common end; and ϕ H ( e) if v ∈ U and e = v w ∈ E ( H ).
T he vert ices in V ( H ) following lemma.
−
U are not colored by ϕ
L e m m a 1 . I f H h a s a n L a v -co lo r in g ϕ a n L -t o t a l co lo r in g ϕ o f G a s fo llo w s:
ϕ (x ) =
ϕ
H
, then ϕ
( x ) if x ϕ H ( x ) if x ′
∈ ∈
. One can easily observe t he
H
′
an d ϕ
H
ca n be e x t e n d ed t o
V E (G ′ ); U ∪ E (H ).
T he following lemma proved by J uvan e t a l. [7] will b e used in t he proof of T heorem 2. L e m m a 2 . E v e r y n o n -e m p t y se r ie s-pa ra lle l gra p h G sa t isfi e s o n e o f t h e fo llo w -
in g fi v e co n d it io n s (a)–(e) (see F ig. 4):
(a) t h e re is a v e r t e x v o f d egree ze ro o r o n e ; (b) t h e re a re t w o d ist in c t v e r t ice s u a n d v w h ic h h a v e d egree t w o a n d a re a d ja ce n t t o ea c h o t h e r ;
(c) t h e re a re fi v e d ist in c t v e r t ice s u 1 , u 2 , v 1 , v 2 a n d w su c h t h a t N ( u i ) = { v i , w } , i = 1, 2, a n d N ( w ) = { u 1 , u 2 , v 1 , v 2 } ; (d) t h e re a re t w o d ist in c t v e r t ice s u a n d v o f d egree t w o su c h t h a t N ( u ) = N ( v ) ; an d
(e) t h e re a re fo u r d ist in c t v e r t ice s u , v , w a n d z su c h t h a t N ( u ) = N (v ) = { u , w } .
{
v, w , z} an d
In t he remainder of t his pap er, we denot e t he subst ruct ures describ ed in (a), (b), · · · , (e) of Lemma 2 simply by su bst r u c t u re s (a), (b), · · · , (e), resp ect ively. One can easily prove t he following Lemma 3 on L a v -colorings of t he graphs in F ig. 5.
178
X. Zhou, Y. Mat suo, and T . Nishizeki
F ig. 5 .
Graphs
H
and t he lower bounds on
|L av
(x )| .
L e m m a 3 . Let H
be a n y o f t h e fo u r gra p h s in F ig. 5 , w h e re a ll v e r t ice s in U a re d ra w n by so lid c irc le s a n d a ll v e r t ice s in V ( H ) − U by d o t t ed c irc le s. I f | L a v ( x ) | is n o sm a lle r t h a n t h e n u m be r a t t a c h ed t o x in F ig. 5 fo r ea c h e le m e n t x ∈ U ∪ E ( H ) , t h e n H h a s a n L a v -co lo r in g.
We are now ready t o give a proof of T heorem 2. ( P ro o f o f T h e o re m 2 )
Supp ose for a cont radict ion t hat t here exist s a series-parallel graph G which has no L -t ot al coloring for a list L sat isfying Eqs. (1) and (2). Assume t hat G is t he smallest one among all such series-parallel graphs. One can easily observe t hat G is connect ed and ∆ ( G ) ≥ 3. By Lemma 2 G has one of t he five subst ruct ures (a)–(e) in F ig. 4, and hence t here are t he following t hree cases t o consider. C a s e a : G has a subst ruct ure (a). In t his case, t here are two dist inct vert ices v and w in G such t hat d ( v ) = 1 and v w ∈ E ( G ), as illust rat ed in F ig. 4(a). Let G ′ = G − v , and let L ′ b e a list of G ′ such t hat L ′ ( x ) = L ( x ) for each element x ∈ V E ( G ′ ). T hen G ′ is a seriesparallel graph smaller t han G , and L ′ sat isfies Eqs. (1) and (2). T herefore G ′ has an L ′ -t ot al coloring ϕ ′ by t he induct ive assumpt ion. Let H b e a subgraph of G induced by t he uncolored edge v w . T he uncolored vert ex in H is v , and hence U = { v } . In F ig. 4(a) H is drawn by t hick lines, t he uncolored vert ex v by a t hick solid circle and t he colored vert ex u by a t hick dot t ed circle. By Eq. (2) | L ( v w ) | ≥ d ( w , G )+ 1, and by Eq. (3) | C ( v , ϕ ′ ) | = 0 and | C ( w , ϕ ′ ) | = d ( w , G ′ )+ 1 = d ( w , G ). T herefore, by Eq. (5), we have | L a v ( v w , ϕ ′ ) | ≥ | L ( v w ) | − | C ( w , ϕ ′ ) | ≥ 1, and hence t here is a color c1 ∈ L a v ( v w , ϕ ′ ). Since ∆ ( G ) ≥ 3, by Eq. (1) we have | L (v )| ≥ min { 5, ∆ ( G ) + 1} ≥ 4, and hence by Eq. (6) | L a v ( v , ϕ ′ ) | ≥ | L ( v ) − ′ { ϕ ( w ) } | ≥ 3. T herefore t here is a color c2 ∈ L a v ( v , ϕ ′ ) − { c1 } . T hus H has an L a v -coloring ϕ H such t hat ϕ H ( v w ) = c 1 and ϕ H ( v ) = c 2 . Hence by Lemma 1 ϕ ′ and ϕ H can b e ext ended t o an L -t ot al coloring ϕ of G : if x = v w ; c1 c2 if x = v ; ϕ (x ) = ϕ ′ ( x ) ot herwise. T his is a cont radict ion t o t he assumpt ion t hat G has no L -t ot al coloring. C a s e b : G has a subst ruct ure (b). In t his case t here are two adjacent vert ices u and v of degree 2 in G , as illust rat ed in F ig. 4(b). Let G ′ b e a graph obt ained from G by delet ing edge u v , and let L ′ ( x ) = L ( x ) for each element x ∈ V E ( G ′ ). T hen G ′ has an L ′ -t ot al coloring ϕ ′ similarly as in Case a. In t his case U = ∅ , and H is a subgraph of
List Tot al Colorings of Series-P arallel Graphs
179
G induced by t he uncolored edge u v . H is drawn by t hick solid and dot t ed lines in F ig. 4(b). By Eq. (2) we have | L ( u v ) | ≥ 5, and hence by Eqs. (3) and (5) we
have | L av
(u v , ϕ ′ )|
(u , ϕ ′ )|
(v , ϕ ′ )|
(u v )|
−
|C
= | L (u v )|
−
( d ( u , G ′ ) + 1) − ( d ( v , G ′ ) + 1)
= | L (u v )|
−
d(u , G )
≥
≥
|L
−
−
|C
d(v , G )
1.
T hus t here is a color c ∈ L a v ( u v , ϕ ′ ), and hence H has an L a v -coloring ϕ H : ϕ H ( u v ) = c . By Lemma 1 ϕ ′ and ϕ H can b e ext ended t o an L -t ot al coloring of G , a cont radict ion.
F ig. 6 .
Subgraphs
H
and t he lower bounds on
|L av
(x , ϕ ′ )| .
has one of subst ruct ures (c), (d) and (e). T he proof is omit t ed in t his ext ended abst ract due t o t he page limit at ion.
C ase c: G
4
⊓
L in e a r A lg o rit h m
Our proof of T heorem 2 is const ruct ive, and hence immediat ely yields t he following recursive algorit hm t o find an L -t ot al coloring of a given series-parallel graph G if L sat isfies Eqs. (1) and (2). One may assume wit hout loss of generality t hat b ot h Eqs. (1) and (2) hold in equality; ot herwise, delet e an appropriat e numb er of colors from each list . A lg o rit h m C o lo r( G , L )
St ep 1. F ind one of t he subst ruct ures (a)–(e) cont ained in G ; St ep 2. Const ruct appropriat e subgraphs G ′ and H according t o t he found subst ruct ure; St ep 3. F ind recursively an L ′ -t ot al coloring ϕ ′ of G ′ ; St ep 4. F ind an L a v -coloring ϕ H of H ; and St ep 5. Ext end ϕ ′ and ϕ H t o an L -t ot al coloring of G . In t he remainder of t his sect ion we show t he algorit hm t akes linear t ime. Since G = ( V , E ) is a series-parallel simple graph, | E | ≤ 2n − 2. Let l ( G ) =
⊔
180
X. Zhou, Y. Mat suo, and T . Nishizeki
( x ) | b e t he t o t a l list size . T hen t he input size is N = n + | E | + l ( G ), where n = | V | . Since Eq. (2) holds, 2 | L ( e) | ≤ 2l ( G ) = O ( N ) . (7) d (u ) ≤ 2 x
∈
V E
(G ) | L
u ∈
V
e∈
E
We show t hat t he algorit hm t akes t ime O ( N ), as follows. We represent a graph G by adjacency list s. One may assume t hat t he set L ( x ) of colors is t ot ally ordered. For each element x ∈ V E ( G ), we x ∈ V E (G ) st ore t he colors L ( x ) in a linked list in increasing order. T his can b e done in t ime O ( N ) by t he radix sort ing [2]. We next analyze t he comput at ion t ime of St eps 1–5. Clearly each of St eps 1–5 is execut ed at most n + | E | ≤ 3n − 2 = O ( n ) t imes. Each vert ex in t he subst ruct ures (a)–(e) is wit hin dist ance 2 from a vert ex of degree at most 2 t hrough a vert ex of degree at most 3. T herefore, all t he execut ions of St ep 1 can b e done t ot al in t ime O ( n ) by a st andard b ookkeeping met hod t o maint ain t he degrees of all vert ices t oget her wit h all pat hs of lengt h two wit h an int ermediat e vert ex of degree two. Since t he size of H is O (1), one execut ion of St ep 2 can b e done in t ime O (1). Since St ep 2 is execut ed O ( n ) t imes, t he t ot al execut ion t ime of St ep 2 is O ( n ). In St ep 3 t he algorit hm recursively calls A l g o r i t h m C o l o r for a smaller graph G ′ t o find an L ′ -t ot al coloring ϕ ′ of G ′ . Clearly t he t ot al execut ion t ime of St ep 3 ot her t han t he t ime reguired for recursive calls is O ( n ). For each each vert ex u in G ′ , we st ore t he colors in set C ( u , ϕ ′ ) in increasing order in a linked list . In St ep 4 t he algorit hm finds a set L a v ( e, ϕ ′ ) of colors available for each edge e = v w ∈ E ( H ). T his can b e done in t ime O ( | L ( e) | ) by simult aneously t raversing t hree linked list s C ( v , ϕ ′ ), C ( w , ϕ ′ ) and L ( e), b ecause ′ | C (v , ϕ ) | = d ( v , G ′ ) ≤ d ( v , G ) ≤ | L ( e) | and | C ( w , ϕ ′ ) | = d ( w , G ′ ) ≤ d ( w , G ) ≤ ′ | L ( e) | by Eq. (2). Hence one can find L a v ( e, ϕ ) for all edges e in H in t ime O ( e ∈ E ( H ) | L ( e) | ) = O ( l ( H )). Similarly, one can find L a v ( u , ϕ ′ ) for all vert ices u in H in t ime O ( u ∈ V ( H ) d ( u , G )), b ecause | C ( u , ϕ ′ ) | ≤ d ( u , G ), and Eq. (1) holds in equality and hence | L ( u ) | ≤ 5. For each vert ex u ∈ V ( H ) t here is an edge d ( u , G ) = O ( e ∈ E ( H ) | L ( e) | ) = e ∈ E ( H ) incident t o u , and hence u ∈ V (H ) O ( l ( H )). Clearly an L a v -coloring ϕ H of H can b e found in t ime O ( l ( H )). All subgraphs H ’ s are edge-disjoint , but are not always vert ex-disjoint wit h each ot her. However, t he same vert ex u is cont ained in at most d ( u , G ) of all subgraphs t he t ot al execut ion t ime of St ep 4 si b ounded by H ’ s. T herefore, by Eq. (7), 2 d ( u , G ) = O ( N ). l ( H ) ≤ l (G ) + u∈ V H In St ep 5 t he algorit hm ext ends ϕ ′ and ϕ H t o an L -t ot al coloring ϕ of G . For each vert ex u of G ′ t o which an edge of H is incident , t he ordered color list s C ( u , ϕ ′ ) and C ( u , ϕ H ) must b e merged t o a single ordered color list C ( u , ϕ ). T his can b e done t ot al in t ime O ( l ( H )). One can up dat e L a v ( u , ϕ ′ ) t o L a v ( u , ϕ ) in t ime O (1) for any vert ex u in H , b ecause | L ( u ) | ≤ 5. T hus one execut ion of St ep 5 can b e done in t ime O ( l ( H )), and hence t he t ot al execut ion t ime of St ep 5 is O ( N ). T hus t he algorit hm t akes t ime O ( N ).
List Tot al Colorings of Series-P arallel Graphs
5
181
C o n c lu s io n s
In t his pap er we first show t hat b ot h t he list edge-coloring problem and t he list t ot al coloring problem are NP -complet e for series-parallel graphs. We t hen obt ain a suffi cient condit ion for a series-parallel graph G t o have an L -t ot al coloring. We finally give a linear algorit hm t o find an L -t ot al coloring of G if L sat isfies t he condit ion. T he algorit hm finds an ordinary t ot al coloring of G using t he minimum numb er ∆ + 1 of colors in t ime O ( n ∆ ) if ∆ ≥ 4. It is remaining as an op en problem t o improve t he comput at ion t ime O ( n ∆ ).
R e fe re n c e s 1. O. V. Borodin, A. V. Kost ochka and D. R. Woodall, List edge and list t ot al colorings of mult igraphs, J. Combi nator i al T heor y, Ser i es B , 71, pp. 184–204, 1997. 2. T . H. Cormen, C. E. Leiserson and R. L. Rivest , I ntroducti on to A lgor i thms, MIT P ress, Cambridge, MA, 1990. 3. R. Diest el, Graph T heor y , Springer-verlag, New York, 1997. 4. T . Fujino, X. Zhou and T . Nishizeki, List edge-colorings of series-parallel graphs, I E I CE T rans. on Fundamentals, E86-A, 5, pp. 191–203, 2003. 5. S. Isobe, X. Zhou and T . Nishizeki, Tot al colorings of degenerat ed graphs, P roc. of I CA L P 2001, Lect. N otes i n Computer Sci ence, Spr i nger , 2076, pp. 506–517, 2001. 6. K. J ansen and P. Scheffl er, Generalized coloring for t ree-like graphs, D i screte A ppli ed M ath. , 75, pp. 135–155, 1997. 7. M. J uvan, B. Mohar and R. T homas, List edge-coloring of series-parallel graphs, T he E lectroni c Jour nal of Combi nator i cs, 6, pp. 1–6, 1999. 8. T . R. J ensen and B. Toft , Graph Color i ng P roblems, J ohn W iley & Sons, New York, 1995. 9. M. Kubale, Int roduct ion t o Comput at ional Complexity and Algorit hmic Graph Coloring, Gda´n ski e T owar zystwo N aukowe, Gda´n sk, P oland, 1998. 10. T . Nishizeki and N. Chiba, P lanar Graphs: T heor y and A lgor i thms, Nort h-Holland, Amst erdm, 1988. 11. T . Nishizeki, J . Vygen and X. Zhou, T he edge-disjoint pat hs problem is NP complet e for series-parallel graphs, D i screte A ppli ed M ath. , 115, pp. 177–186, 2001. 12. A. S´a nchez-Arroyo, Det ermining t he t ot al colouring number is NP -hard, D i screte M ath. , 78, pp. 315–319, 1989. 13. H. P. Yap, T otal Colour i ngs of Graphs, Lect . Not es in Mat h., 1623, Springer-verlag, Berlin, 1996. 14. J . L. Wu, List edge-coloring of series-parallel graphs, Shandong D axue X uebao K exue B an , 35, 2, pp. 144–149, 2000 (in Chinese).
F in d in g H id d e n I n d e p e n d e n t S e t s in I n t e rv a l G ra p h s T herese Biedl1 , Broˇn a Brejov´a 1 , Erik D. Demaine2 , Ang`ele M. Hamel3 , Alejandro L´opez-Ort iz1 , and Tom´aˇs Vinaˇr 1 1
3
School of Comput er Science, University of Wat erloo, Wat erloo, ON N2L 3G1, Canada, { biedl,bbrejova,alopez-ortiz,tvinar} @uwaterloo.ca 2 MIT Laborat ory for Comput er Science, 200 Technology Square, Cambridge, MA 02139, USA, [email protected] Depart ment of P hysics and Comput ing, W ilfrid Laurier University, Wat erloo, ON, N2L 3C5, Canada, [email protected]
Consider a game in a given set of int ervals (and t heir implied int erval graph G ) in which t he adversary chooses an independent set X in G . T he goal is t o discover t his hidden independent set X by making t he fewest queries of t he form “Is point p covered by an int erval in X ?” Our int erest in t his problem st ems from two applicat ions: experiment al gene discovery and t he game of Bat t leship (in a 1-dimensional set t ing). We provide adapt ive algorit hms for bot h t he verificat ion scenario (given an independent set , is it X ?) and t he discovery scenario (find X wit hout any informat ion). Under some assumpt ions, t hese algorit hms use an asympt ot ically opt imal number of queries in every inst ance. A b st ra ct .
1
I n t ro d u c t io n
An in t erval graph is an int ersect ion graph of int ervals on t he real line, i.e. vert ices are represent ed by int ervals and t here is an edge between two vert ices if and only if t heir corresponding int ervals int ersect . An in depen den t set in G is a set of vert ices such t hat no two vert ices share an edge. In t his paper we st udy how t o det ermine, given a set of int ervals (wit h t heir implied int erval graph G ), an unknown (hidden) independent set X in G chosen by an adversary. We det ermine X by playing an int eract ive game against an adversary using queries of t he following type: “Is a point p on t he real line covered by an int erval in X ?” T he adversary always answers t he query t rut hfully. T he goal is t o use t he smallest possible number of queries t o det ermine set X . T his problem is mot ivat ed by two applicat ions: recovering gene st ruct ure wit h experiment al t echniques and t he game of Bat t leship. We explain t he connect ions t o our problem aft er st at ing it precisely. While t here is a wide lit erat ure regarding games in graphs (e.g., [3,8,12]), our problem appears t o be new in t his area. Several games involving finding a hidden
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 182–191, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
F inding Hidden Independent Set s in Int erval Graphs
183
ob ject using queries have also been st udied in t he bioinformat ics lit erat ure. Xu et al. [20] discuss t he problem of locat ing hidden exon boundaries in cDNA. T his leads t o a game in which t he hidden ob ject is a subset A ⊆ { 1, . . . , n } and t he queries are of t he type “Given an int erval I , does it cont ain an element of A ?”. Beigel et al. [2] discuss t he problem of finding a hidden perfect mat ching in a complet e graph applied t o t he problem of closing gaps in DNA sequencing dat a. McConnell and Spinrad [13] consider t he t angent ially relat ed problem of reconst ruct ing an int erval graph given probes about t he neighbors of only a part ial set of vert ices. Term inology. An int erval graph may have a number of diff erent represent at ions by int ervals. In what follows, when we say “int erval graph,” we presume t hat one represent at ion has been fixed. Wit hout loss of generality, we may assume t hat in t his represent at ion all int ervals are closed, have lengt h at least one, and t heir end point s are int egers between 1 and 2n , where n is t he number of int ervals. We assume t hat t he input graph has no two ident ical int ervals, but int ervals are allowed t o have t he same st art point or t he same end point . We denot e t he int erval of t he i t h vert ex by I i = [s i , f i ], where s i < f i are int egers. An edge ( i , j ) t hus exist s if I i ∩ I j = ∅ . T he complement G of an int erval graph G has a special st ruct ure. Assume t hat ( i , j ) is not an edge in G , i.e., I i ∩ I j = ∅ . T hen eit her f i < s j or f j < s i , and t hus we can orient t he edge in G as i → j or j → i . T hus, G has a nat ural orient at ion of t he edges, and t his orient at ion is well-known t o be acyclic and t ransit ive. For t his and ot her result s about int erval graphs, see e.g. [11]. We refer t o t he init ially unknown independent set in G chosen by an adversary, and refer t o t his set as t he hidden in depen den t set . If V is an independent set in G , t hen it is a clique in t he complement graph G . If G is an int erval graph, t hen any clique in G has a unique t opological order consist ent wit h orient at ion of it s edges. We can t hus consider V as a (direct ed) pat h π in G , and will speak of a hidden ( direct ed) pat h inst ead of a hidden independent set . We will generally omit t he word “direct ed” as we will not be t alking about any ot her kind of pat h. We det ermine t he hidden independent set t hrough probes and qu eries . A probe is an int erval ( a , a + 1) where a is int eger. A qu ery is t he use of a probe t o det ermine informat ion about t he hidden independent set . Specifically, a query is a st at ement of t he form: “Is t here some vert ex in t he hidden independent set whose int erval int ersect s t he probe?” A query can be answered eit her “yes” or “no”. Our R esult s. We st udy two versions of t he problem. First , t he verificat ion problem consist s of verifying, via probe queries, t hat a purport ed independent set Y is t he hidden independent set . Second, t he discovery problem consist s of ident ifying t he set X . For t he verificat ion problem, we give a prot ocol t o det ermine whet her X = Y using t he exact opt imal number of queries for t hat specific inst ance. For t he discovery problem, we give a linear-t ime algorit hm for discovering X . Diff erent graphs may require diff erent number of queries t o discover t he hidden independent set . If at most a const ant number of int ervals st art at a common point , t hen our prot ocol is wit hin a const ant fact or of t he opt imal number of queries ′
′
184
T . Biedl et al.
for t hat specific graph. T hat is, our algorit hm is inst ance-opt imal in t he sense of [10] and opt imally adapt ive in t he sense of [6]. If t his assumpt ion is not sat isfied, t hen t he number of queries may be larger t han t he informat ion-t heoret ic lower bound; however, we also prove st ronger lower bounds for some of t hese cases. A pplicat ions t o G ene F inding. Recent advances in molecular biology have result ed in genomic sequences of several organisms. T hese sequences need t o be annot at ed, i.e., biological meaning needs t o be assigned t o part icular regions of t he sequence. An import ant st ep in t he annot at ion process is t he ident ificat ion of genes, which are t he port ions of t he genome producing t he organism’ s prot eins. A gene is a set of non-overlapping exons, each exon being an int erval of t he DNA sequence. T here are a number of comput at ional t ools for gene predict ion (e.g., [4,16]); however, experiment al st udies (e.g., [14,5]) show t hat t he best of t hem predict s, on average, only about 50% of t he ent ire genes correct ly. It is t herefore import ant t o have alt ernat ive met hods t hat can produce or verify such predict ions by using experiment al dat a. While genes cannot be reliably predict ed by purely comput at ional means, we can use t hese met hods t o provide us wit h a set of candidat e exons. Algorit hms for gene predict ion have t o balance sensit ivity (i.e., how many real exons t hey discover) wit h specificity (i.e., how many false exons t hey predict ), and usually it is possible t o increase sensit ivity at t he expense of a decrease in specificity. By using a highly sensit ive met hod, we may generat e a candidat e set t hat cont ains many false exons but has only a very small probability of excluding a real exon. To apply our algorit hms, we may view t he set of candidat e exons as t he set of int ervals defining an int erval graph. T he gene we want t o discover t hen corresponds t o a hidden independent set in t his int erval graph. Queries in our algorit hms correspond t o t he quest ion: “Is a given short region of DNA sequence cont ained in a real exon?” In order t o use our met hod for finding genes, we need t o answer t his quest ion by appropriat e biological experiment s. T housands of such queries can be answered simult aneously by an expression array experiment [18]. Shoemaker et al. [19] have used expression arrays t o verify gene predict ions in annot at ion of human chromosome 22 [7]. T hey probed DNA sequence at short regular int ervals (every 10 nucleot ides). Using our algorit hm for t he independent set verificat ion (Sect ion 2), we can design a smaller set of queries which can verify t he gene predict ion, t hus reducing t he cost . Queries similar t o ours can be also implement ed using polymerase chain react ion (P CR) t echnology [17]. T he P CR can answer t he query of t he following form: “Given two short regions of t he DNA sequence, do bot h of t hem occur in t he same gene (possibly in two diff erent exons)?” An answer t o our query can be obt ained by P CR provided t hat we already know at least one short region of DNA which occurs in our gene. Our algorit hm for t he independent set discovery (Sect ion 3) t hen yields an experiment al prot ocol for finding genes. However, many aspect s of t he real experiment al domain furt her rest rict t he set of possible queries and would need t o be addressed t o apply t his t echnique in pract ice (see e.g., [5]). T his applicat ion of P CR t echnology was inspired by open problem
F inding Hidden Independent Set s in Int erval Graphs
185
12.94 in [15]. P CR queries were also used in similar way t o det ermine t he exon boundaries in cDNA clones [20]. A pplicat ions t o 1-D im ensional B at t leship. T he game of Bat t leship (also known as Convoy and Sinking-Ships) is a well-known two-person game. Bot h players have an n × n grid and a fixed set of ships, where each ship is a 1 × k rect angle for some k ≤ n . Each player arranges t he ships on his/ her grid in such a way t hat no two ships int ersect . T hen players t ake t urns shoot ing at each ot her’ s ships by calling t he coordinat es of a grid posit ion. T he player t hat first sinks all ships (by hit t ing all grid posit ions t hat cont ain a ship) wins. T here are many variant s of Bat t leship (see e.g., [1]) involving ot her ship shapes or higher dimensions. Bat t leship becomes an int erval graph game in t he 1-dimensional version. Here t he ships are int ervals wit h int egral end point s, and, as before, no two int ersect ing ship posit ions may be t aken. T he allowed operat ions are now exact ly our queries: given an open unit int erval ( a , a + 1), does one ship overlap t his int erval?
2
I n d e p e n d e n t S e t V e rifi c a t io n
Let Y be t he candidat e set t o be verified. T here are two types of probes: t he ones for which t he probe int ersect s some int erval in Y (we call t his a posit ive probe ) and t he ones for which it does not (we call t his a n egat ive probe ). For a probe t he expect ed an sw er is t he answer t hat is consist ent wit h X = Y . T hus, a posit ive probe has expect ed answer “yes,” while a negat ive probe has expect ed answer “no.” Consider an algorit hm t o solve t he verificat ion problem. If for some query it does not get t he expect ed answer, t hen X = Y and t he algorit hm can t erminat e. Ot herwise t he algorit hm must cont inue unt il enough queries are made t o det ermine t hat X = Y . T hus t he worst case for any opt imal verificat ion algorit hm is when X = Y (i.e., all answers are as expect ed). T his implies t hat we can rephrase t he verificat ion problem as follows: given a graph G and an independent set Y , produce a set of queries U such t hat Y is t he only independent set in G consist ent wit h t he expect ed answers t o all queries in U . We say t hat a set of queries U verifi es t hat X = Y if every independent set Z = Y is inconsist ent wit h t he expect ed answer of at least one query in U ; we say t his query elim in at es Z . F inding a M inim um Set of P osit ive P rob es. We first st udy a special case in which only queries wit h posit ive probes are allowed. T his case is t hen used as a subrout ine for t he general case. Not e t hat for some input s it is impossible t o verify Y = X using only posit ive probes. Let G [a , b] denot e t he subgraph of G induced by int ervals complet ely cont ained in t he region [a , b] and for any independent set Z , let Z [a , b] denot e t he subset of Z of int ervals complet ely cont ained in [a , b]. T he minimum set of posit ive probes for a graph G will be comput ed using a direct ed acyclic graph H . Graph H cont ains one vert ex for every posit ive probe. Let a m i n be t he smallest st art point and a m a x be t he largest end point of an int erval in G . T wo addit ional
186
T . Biedl et al.
[2,6] [1,5]
[8,10]
s=(0,1) (2,3) (3,4) (4,5) (5,6) (8,9) (9,10) t=(10,11)
[7,9] [3,4]
An int erval graph and it s corresponding graph H for Y = { [2, 6], [8, 10]} . For example, edge (5, 6) → (9, 10) exist s because t he independent set { [7, 9]} ∈ G [6, 9] int ersect s all posit ive probes between 6 and 9. Edge (0, 1) → (2, 3) exist s because t here are no posit ive probes in G [1, 2] and t hus empty independent set sat isfies t he definit ion.
F ig . 1 .
vert ices s and t are added t o H , where s corresponds t o probe ( a m i n − 1, a m i n ) and t corresponds t o probe ( a m a x , a m a x + 1). Not e t hat t hese two probes are negat ive for G . Int uit ively, H cont ains a direct ed edge from one probe t o anot her if no posit ive probe between t hem can dist inguish Y from some ot her independent set . More precisely, for any a < b, graph H cont ains an edge ea , b from ( a , a + 1) t o ( b, b + 1) if and only if t here is an independent set Z a , b in G [a + 1, b] t hat int ersect s all posit ive probes ( c, c + 1) wit h a < c < b and t hat is diff erent from Y . See Figure 1 for an example of graph H . Graph H has O ( n ) vert ices and O ( n 2 ) edges, where n is t he number of int ervals. Using dynamic programming, it can be const ruct ed in O ( n 2 ) t ime. T he following lemma shows t he connect ion between graph H and t he opt imal set of posit ive queries. Lem m a 1. A set of posit ive probes U verifi es t hat X = Y if an d on ly if vert ices s an d t becom e discon n ect ed in graph H aft er rem oval of all vert ices in U .
P roof. (Sket ch.) T he crucial observat ion is t hat a pat h from s t o t in graph H
t hrough a set of posit ive probes U exist s if and only if t here is an independent set ot her t han Y which is consist ent wit h all posit ive probes except t he ones in U . For a given pat h π such independent set can be const ruct ed as a union of set s Z a , b over all edges ea , b ∈ π . On t he ot her hand, for a given independent set Z t here is always a pat h from s t o t in graph H using exact ly all posit ive probes inconsist ent wit h Z . ⊓⊔ T hus t he minimal set of posit ive probes t o verify X = Y corresponds t o t he smallest set of vert ices in H t hat disconnect s and t . T his vert ex-connect ivity problem can be solved in O ( n 8 / 3 ) t ime using network flows [9]. Since we want t o use t his as a subrout ine in t he general case, we expand t he result t o any subgraph G [a , b] of G . On such a subgraph we need t o verify t hat X [a , b] = Y [a , b]. Lem m a 2. L et A + [a , b] be t he sm allest n u m ber of posit ive probes n eeded t o verify t hat X [a , b] = Y [a , b] in G [a , b], or A + [a , b] = ∞ if t his is n ot possible. T hen A + [a , b] can be com pu t ed in O ( n 8 / 3 ) t im e. F inding a M inim um Set of P rob es in t he G eneral C ase. T he general case, in which bot h posit ive and negat ive probes are allowed, is solved by a dynamic programming algorit hm t hat has t he result of Lemma 2 as a base case.
F inding Hidden Independent Set s in Int erval Graphs (a)
I1 I2
In+1 In+2
In
I 2n
(b)
187
I1 I2 I3 I4 I5 I6 I7 I8
(probe)
f
i
consist s of 2n int ervals, wit h int erval I i = [0, 2i − 1] for = 1, . . . , n and I i = [2( i − n ) , 2n + 1] for i = n + 1, . . . , 2n . T he st aircase cont ains p = n ( n + 1) / 2 + 2n + 1 independent set s, t herefore T heorem 2 gives a lower bound of 2 log2 n + O (1) queries. However, a bet t er lower bound can be achieved. In t he worst case, each query eliminat es at most one pair { I i , I n + i } and t hus we need at least n − 1 queries. ( b ) P a t h s e l i m i n a t e d : p 1 + . . . + p 6 (“no”) or p 7 + p 8 + p r e s t (“yes”). F ig . 2 . ( a ) T h e s t a irc a s e i
Lem m a 3. L et A [a ] be t he sm allest n u m ber of qu eries n eeded t o verify t hat X [1, a ] = Y [1, a ] in t he in t erval graph G [1, a ]. T hen A + [1, a ], min b A [b]+ A + [b + 1, a ]+ 1, w here ( b, b+ 1) is a n egat ive probe A [a ] = min in t ersect in g [1, a ]
Not e, t hat we have at most obt ain t he overall result .
n2
subproblems
A + [a , b]
t o solve, and hence
T heorem 1. G iven an n -vert ex in t erval graph G an d an in depen den t set Y in G , w e can fi n d in O ( n 14 / 3 ) t im e t he m in im u m set of qu eries t hat verifi es w het her Y is t he hidden in depen den t set chosen by an adversary .
3
I n d e p e n d e n t S e t D is c o v e ry
In t his sect ion we give an int eract ive prot ocol t o find an independent set X . In t his case t he next query depends on t he out come of t he previous query. A simple informat ion-t heoret ic argument yields t he following lower bound. T heorem 2. A ssu m e t hat G is a graph t hat con t ain s p in depen den t set s. R egard less of t he t y pes of y es/ n o qu eries allow ed, w e n eed at least ⌈ log2 p ⌉ qu eries t o fi n d a hidden in depen den t set X in t he w orst case.
T his lower bound is not always t ight , even for an int erval graph (see t he so-called st aircase example in Figure 2a). However, we give an algorit hm which mat ches asympt ot ically t he lower bound of ⌈ log2 p ⌉ queries under t he assumpt ion t hat at most a const ant number of int ervals st art at t he same point . Overv iew of t he A lgorit hm . T he algorit hm t o det ect t he hidden pat h in t he complement graph G is recursive. T he crucial idea is t hat wit h a const ant number of queries we eliminat e at least a const ant fract ion of t he remaining
188
T . Biedl et al.
pat hs. T his would be st raight forward if t he set of pat hs always had a cent ral element allowing us t o eliminat e readily t he desired const ant fract ion of pat hs. However t here are configurat ions wit h no such element . Surprisingly, t hey appear infrequent ly. T herefore, aft er O (log p ) queries, we know t he correct pat h. For ease of not at ion, assume t hat t he int ervals I 1 , . . . , I n are sort ed by increasing st art point , breaking t ies arbit rarily. Let I i be t he int erval wit h t he left most right end point f i . T he int ervals t hat int ersect I i are called cliqu e in t ervals (t hey are t he int ervals I 1 , . . . , I k wit h k such t hat s k ≤ f i and s k + 1 > f i ). Not e t hat as t he name suggest s, t hey form a clique in G , and at most one of t hem is in any pat h. Our algorit hm operat es under two diff erent scenarios. Let a legal pat h be a pat h t hat could be t he solut ion even under t he following added rest rict ions. In t he u n rest rict ed scen ario , any pat h is a legal pat h; t his is t he scenario at t he beginning of t he algorit hm. In t he rest rict ed scen ario , only a pat h t hat int ersect s ( f i 1 , f i ) is legal (t his informat ion is obt ained t hrough previous queries). Any legal pat h t hus uses a clique int erval t hat st art s st rict ly before f i . Eff ect s of Queries. T he algorit hm always queries at ( a , a + 1) for some a ≤ f i . Only clique int ervals can int ersect t he probe. If t he answer t o t he query is “no”, t hen we eliminat e all clique int ervals t hat int ersect ( a , a + 1). If t he original scenario was unrest rict ed, t hen all remaining pat hs are consist ent wit h t his query and we can solve t he problem recursively. If t he original scenario was rest rict ed, we already know t hat one of t he clique int ervals I 1 , . . . , I k is in t he hidden pat h X . Eliminat ing some clique int ervals may increase t he value of f i and t herefore add some more int ervals t o t he clique int ervals. None of t hese new clique int ervals can be in X , and t hus t hey can also be eliminat ed. T hen we solve t he rest rict ed scenario recursively on t he new graph. Assume now t hat t he answer t o t he query is “yes”. Since X cont ains at most one clique int erval, all clique int ervals not int ersect ing ( a , a + 1) can be eliminat ed. One of t he remaining clique int ervals will be part of t he solut ion, so t he next scenario will be rest rict ed. We also can eliminat e all int ervals t hat become clique int ervals due t o an increase in f i . If in t he new sit uat ion we are now in t he rest rict ed scenario wit h only one clique int erval I 1 , t hen I 1 belongs t o X . T herefore, I 1 can be eliminat ed from t he graph and we solve t he unrest rict ed scenario on t he result ing graph recursively. Aft erwards we add I 1 t o get t he hidden pat h X . Som e D efinit ions and Observat ions. Consider a specific point in t ime when we want t o find t he next query. Let P l egal be t he set of all legal pat hs. Since every legal pat h cont ains at most one clique int erval, we can part it ion P l egal as P l egal = P 1 ∪ · · · ∪ P k ∪ P r est , where P j is t he set of legal pat hs t hat use clique int erval I j , and P r est denot es t he legal pat hs t hat do not use a clique int erval. ( P r est is empty in t he rest rict ed scenario.) Define p β = | P β | for all subscript s β . One can show t he following propert ies of t hese set s of pat hs: −
Lem m a 4. a) I n t he u n rest rict ed scen ario, p i = p r est . b) p r est ≤ 12 p l egal . c) I f I j 1 an d I j 2 are cliqu e in t ervals w it h f j 1 ≤ f j 2 t hen p j 1
≥
pj 2 .
T he following lemma summarizes t he eff ect s of a query (see Figure 2b for an illust rat ion):
F inding Hidden Independent Set s in Int erval Graphs
189
Lem m a 5. I f w e qu ery at ( s j , s j + 1) for som e j w it h s j < f i , t hen w e can elim in at e eit her p 1 + · · ·+ p j pat hs or p j + 1 + · · ·+ p k + p r est pat hs, w here j ′ ≥ j is t he largest in dex w it h s j = s j . ′
′
′
C ho osing Queries. In light of Lemma 5 we will t ry t o find a j such t hat bot h set s of possibly eliminat ed pat hs cont ain a const ant fract ion of t he pat hs. To find such a j , define 1 ≤ ℓ ≤ k t o be t he index such t hat p1
+
· · ·
+
pℓ
−
1
12 p l egal , −
an d a posit ive an sw er t o t he qu ery elim in at es at least p i
≥
1 pl e g a l 2θ
pat hs.
If t he query in (C3) yields a negat ive answer, t hen possibly less t han a const ant fract ion of pat hs is eliminat ed, but we account for t his query in a diff erent way. Lem m a 7. D u rin g all recu rsive calls, w e have at m ost log2 p t im es a n egat ive an sw er in case ( C 3) , w here p is t he n u m ber of pat hs in t he origin al graph. P roof. (Sket ch.) Let s be t he number of such queries. In case (C3) at least
one int erval int ersect s ( f i , f i + 1) (ot herwise Lemma 6 implies t hat we are in a rest rict ed scenario wit h only one clique int erval, which is a cont radict ion). T he negat ive answer eliminat es all int ervals int ersect ing ( f i , f i + 1) and t herefore we will not ret urn t o (C3) unt il t he value of f i has changed. T hus for each negat ive answer in case (C3), we have a diff erent value of f i . Let f i 1 < · · · < f i s be t hese values, and let I i j be a clique int erval t hat ends at f i j and was not eliminat ed when we queried at ( f i j , f i j + 1). T hen { I i 1 , . . . , I i s } is an independent set and so is every subset of t his set . T herefore p ≥ 2s as desired. ⊓⊔ T he above analysis of cases C1, C2, and C3 yields t he following result .
190
T . Biedl et al.
Lem m a 8. A ssu m e w e are given a set of n in t ervals t hat defi n e p pat hs, an d at m ost θ in t ervals st art at t he sam e poin t . T hen an y hidden pat h X can be fou n d w it h at m ost log2 p + max { log2 θ / ( 2 θ − 1) p, log4 / 3 p } qu eries.
Not e t hat as long as θ is a const ant , we use O (log2 p ) queries, which is asympt ot ically opt imal. Our algorit hm can easily be implement ed in polynomial t ime and indeed, wit h t he right dat a st ruct ure it s running t ime is O ( n + m ), where m is t he number of edges in t he complement of t he int erval graph. Det ails are omit t ed due t o space limit at ions. T heorem 3. G iven an n -vert ex in t erval graph G w it h m edges in it s com plem en t , w e can fi n d t he hidden in depen den t set in G u sin g q qu eries, w here q is asy m pt ot ically opt im al if at m ost a con st an t n u m ber of in t ervals st art in an y on e poin t . T he overall com pu t at ion t im e an d space is O ( n + m ) .
4
C o n c lu s io n s a n d F u t u re W o rk
In t his paper we st udied a problem mot ivat ed by applicat ions in bioinformat ics and game playing: given an int erval graph, how can we find an independent set chosen by an adversary wit h as few queries as possible? We gave polynomial-t ime algorit hms bot h for verifying whet her some independent set is t he one chosen by t he adversary, and for discovering what set t he adversary has chosen. T he algorit hm for verificat ion gives t he opt imal number of queries for all inst ances. T he algorit hm for independent set discovery gives a number of queries t hat is opt imal t o wit hin const ant fact or, provided t hat no more t han a const ant number of int ervals st art at t he same point . T his algorit hm is opt imal in t he adapt ive sense as well as in t he worst case sense. We also proved a st ronger lower bound t han t he one implied by a simple informat ion t heory argument . T he main open quest ion is whet her our adapt ive algorit hm can ext end t o inst ances in which many int ervals may st art at a common point , and st ill achieve a number of queries t hat is wit hin a const ant fact or of opt imal. Anot her open problem relat es t o t he mot ivat ion of t his work from gene finding using P CR t echniques. Here we need t o consider t hat obt aining probing mat erial is oft en done via an ext ernal provider, and t he t urnaround t ime between each request might dominat e t he t ot al t ime. We might t hus consider performing several probes in parallel rounds. What is t he minimum number of queries required if t he ent ire comput at ion must be done in a given number of rounds? In t he applicat ion t o gene finding, we might also be able t o eliminat e cert ain edges of G using biological background informat ion. Can we adapt our algorit hm t o t ake advant age of t his, i.e., use an opt imal number of queries sub ject t o knowing t his informat ion? (Not e t hat G is now no longer necessarily an int erval graph.) A cknow ledgm ent s. We t hank Dan Brown and t he part icipant s at t he Bioinformat ics problem sessions at t he University of Wat erloo for many useful comment s on t his problem. All aut hors were part ially support ed by NSERC.
F inding Hidden Independent Set s in Int erval Graphs
191
R e fe re n c e s 1. Bat t leships variat ions. Mount ain Vist a Software. Web page. See http://www.mountainvistasoft.com/variations.htm 2. R. Beigel, N. Alon, M. S. Apydin, and L. Fort now. An opt imal procedure for gap closing in whole genome shot gun sequencing. In 5t h A n n ual I n t er n at i on al C on fer en ce on C om put at i on al M olecular B i ology ( R E C O M B ) , pages 22–30, 2001. 3. H. L. Bodlaender and D. Krat sch. T he complexity of coloring games on perfect graphs. T heor et i cal C om put er Sci en ce, 106(2):309–326, 1992. 4. C. Burge and S. Karlin. P redict ion of complet e gene st ruct ures in human genomic DNA. J our n al of M olecular B i ology , 268(1):78–94, 1997. 5. M. Das, C. B. Burge, E. P ark, J . Colinas, and J . P ellet ier. Assessment of t he t ot al number of human t ranscript ion unit s. G en om i cs, 77(1-2):71–78, 2001. 6. E. D. Demaine, A. L´opez-Ort iz, and J . I. Munro. Adapt ive set int ersect ions, unions, and diff erences. In 11t h A n n ual A C M -SI A M Sym posi um on D i scr et e A lgor i t hm s ( SO D A ) , pages 743–752, 2000. 7. I. Dunham et al. T he DNA sequence of human chromosome 22. N at ur e, 402(6761):489–495, 1999. 8. P. Erd˝os and J . L. Selfridge. On a combinat orial game. J our n al of C om bi n at or i al T heor y – Ser i es A , 14:298–301, 1973. 9. S. Even and R. E. Tarjan. Network flow and t est ing graph connect ivity. SI A M J our n al on C om put i n g, 4:507–518, 1975. 10. R. Fagin, A. Lot em, and M. Naor. Opt imal aggregat ion algorit hms for middleware. In 20t h A C M Sym posi um on P r i n ci ple of D at abase Syst em s ( P O D S) , pages 102– 113, 2001. 11. M. C. Golumbic. A lgor i t hm i c gr aph t heor y an d per fect gr aphs. Academic P ress, New York, 1980. 12. L. M. Kirousis and C. H. P apadimit riou. Searching and pebbling. T heor et i cal C om put er Sci en ce, 47(2):205–218, 1986. 13. R. M. McConnell and J . P. Spinrad. Const ruct ion of probe int erval models. In 13t h A n n ual A C M -SI A M Sym posi um on D i scr et e A lgor i t hm s ( SO D A ) , pages 866–875, 2002. 14. N. P avy, S. Rombaut s, P. Dehais, C. Mat he, D. V. Ramana, P. Leroy, and P. Rouze. Evaluat ion of gene predict ion software using a genomic dat a set : applicat ion t o Arabidopsis t haliana sequences. B i oi n for m at i cs, 15(11):887–889, 1999. 15. P. A. P evzner. C om put at i on al m olecular bi ology: an algor i t hm i c appr oach . MIT P ress, 2000. 16. A. A. Salamov and V. V. Solovyev. Ab init io gene finding in Drosophila genomic DNA. G en om e Resear ch , 10(4):516–522, 2000. 17. S. J . Scharf, G. T . Horn, and H. A. Erlich. Direct cloning and sequence analysis of enzymat ically amplified genomic sequences. Sci en ce, 233(4768):1076–1078, 1986. 18. M. Schena, D. Shalon, R. W . Davis, and P. O. Brown. Quant it at ive monit oring of gene expression pat t erns wit h a complement ary DNA microarray. Sci en ce, 270(5235):467–470, 1995. 19. D. D. Shoemaker, E. E. Schadt , et al. Experiment al annot at ion of t he human genome using microarray t echnology. N at ur e, 409(6822):922–927, 2001. 20. G. Xu, S. H. Sze, C. P. Liu, P. A. P evzner, and N. Arnheim. Gene hunt ing wit hout sequencing genomic clones: finding exon boundaries in cDNAs. G en om i cs, 47(2):171–179, 1998.
M a t ro id R e p re s e n t a t io n o f C liq u e C o m p le x e s Kenji Kashiwabara 1 , Yoshio Okamot o2 ⋆ , and Takeaki Uno3 1
2
Depart ment of Syst ems Science, Graduat e School of Art s and Sciences, T he University of Tokyo, 3–8–1, Komaba, Meguro, Tokyo, 153–8902, J apan. [email protected] Inst it ut e of T heoret ical Comput er Science, Depart ment of Comput er Science, ET H Zurich, ET H Zent rum, CH-8092, Zurich, Swit zerland. [email protected] 3 Nat ional Inst it ut e of Informat ics, 2–1–2, Hit ot subashi, Chiyoda, Tokyo, 101-8430, J apan. [email protected]
In t his paper, we approach t he quality of a greedy algorit hm for t he maximum weight ed clique problem from t he viewpoint of mat roid t heory. More precisely, we consider t he clique complex of a graph (t he collect ion of all cliques of t he graph) and invest igat e t he minimum number k such t hat t he clique complex of a given graph can be represent ed as t he int ersect ion of k mat roids. T his number k can be regarded as a measure of “how complex a graph is wit h respect t o t he maximum weight ed clique problem” since a greedy algorit hm is a k -approximat ion algorit hm for t his problem. We charact erize graphs whose clique complexes can be represent ed as t he int ersect ion of k mat roids for any k > 0. Moreover, we det ermine t he necessary and suffi cient number of mat roids for t he represent at ion of all graphs wit h n vert ices. T his number t urns out t o be n − 1. Ot her relat ed invest igat ions are also given. A b st r a c t .
1
In t ro d u c t io n
A lot of combinat orial opt imizat ion problems can be seen as opt imizat ion problems on t he corresponding independence syst ems. For example, for t he minimum cost spanning t ree problem t he corresponding independence syst em is t he collect ion of all forest s of a given graph; for t he maximum weight ed mat ching problem t he corresponding independence syst em is t he collect ion of all mat chings of a given graph; for t he maximum weight ed clique problem t he corresponding independence syst em is t he collect ion of all cliques of a given graph, which is called t he clique complex of t he graph. More examples are provided by Kort e–Vygen [9]. It is known t hat any independence syst em can be represent ed as t he int ersect ion of some mat roids. J enkyns [7] and Kort e–Hausmann [8] showed t hat a greedy algorit hm is a k -approximat ion algorit hm for t he maximum weight ed base
⋆
Support ed by t he J oint Berlin/ Z¨u rich Graduat e P rogram “Combinat orics, Geomet ry, and Comput at ion” (CGC), financed by ET H Zurich and t he German Science Foundat ion (DFG).
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 192–201, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Mat roid Represent at ion of Clique Complexes
193
problem of an independence syst em which can be represent ed as t he int ersect ion of k mat roids. (T heir result can be seen as a generalizat ion of t he validity of t he greedy algorit hm for mat roids, shown by Rado [13] and Edmonds [3].) So t he minimum number of mat roids which we need t o represent an independence syst em as t heir int ersect ion is one of t he measures of “how complex an independence syst em is wit h respect t o t he corresponding opt imizat ion problem.” In t his paper, we invest igat e how many mat roids we need t o represent t he clique complex of a graph as t heir int ersect ion, while Feket e–Firla–Spille [5] invest igat ed t he same problem for mat ching complexes. We will show t hat t he clique complex of a given graph G is t he int ersect ion of k mat roids if and only if t here exist s a family of k st able-set part it ions of G such t hat every edge of G is cont ained in a st able set of some st able-set part it ion in t he family. T his t heorem implies t hat t he problem t o det ermine t he clique complex of a given graph have a represent at ion by k mat roids or not belongs t o NP (for any fixed k ). T his is not a t rivial fact since in general t he size of an independence syst em will be exponent ial when we t reat it comput at ionally. T he organizat ion of t his paper is as follows. In Sect . 2, we will int roduce some t erminology on independence syst ems. T he proof of t he main t heorem will be given in Sect . 3. In Sect . 4, we will consider an ext remal problem relat ed t o our t heorem. In Sect . 5, we will invest igat e t he case of two mat roids more t horoughly. T his case is significant ly import ant since t he maximum weight ed base problem can be solved exact ly in polynomial t ime for t he int ersect ion of two mat roids [6]. (Namely, in t his case, t he maximum weight ed clique problem can be solved in polynomial t ime for any non-negat ive weight vect or by Frank’ s algorit hm [6].) From t he observat ion in t hat sect ion, we can find t he algorit hm by P rot t i–Szwarcfit er [12] checks t hat a given clique complex has a represent at ion by two mat roids or not in polynomial t ime. We will conclude wit h Sect . 6.
2
P re lim in a rie s
We will assume t he basic concept s in graph t heory. If you find somet hing unfamiliar, see a t ext book of graph t heory (Diest el’ s book [2] or so). Here we will fix our not at ions. In t his paper, all graphs are finit e and simple unless st at ed ot herwise. For a graph G = ( V , E ) we denot e t he subgraph induced by V ′ ⊆ V by G [V ′ ]. T he complement of G is denot ed by G . T he vert ex set and t he edge set of a graph G = ( V , E ) are denot ed by V ( G ) and E ( G ), respect ively. A complet e graph and a cycle wit h n vert ices are denot ed by K n and C n , respect ively. T he maximum degree, t he chromat ic number and t he edge-chromat ic number (or t he chromat ic index) of a graph G are denot ed by ∆ ( G ), χ ( G ) and χ ′ ( G ), respect ively. A cliqu e of a graph G = ( V , E ) is a subset C ⊆ V such t hat t he induced subgraph G [C ] is complet e. A st able set of a graph G = ( V , E ) is a subset S ⊆ V such t hat t he induced subgraph G [S ] has no edge. Now we int roduce some not ions of independence syst ems and mat roids. For det ails of t hem, see Oxley’ s book [11]. Given a non-empty finit e set V , an in depen den ce sy st em on V is a non-empty family I of subset s of V sat isfying: X ∈ I
194
K. Kashiwabara, Y. Okamot o, and T . Uno
implies Y ∈ I for all Y ⊆ X ⊆ V . T he set V is called t he grou n d set of t his independence syst em. In t he lit erat ure, an independence syst em is also called an abst ract sim plicial com plex . A m at roid is an independence syst em I addit ionally sat isfying t he following au gm en t at ion axiom : for X , Y ∈ I wit h | X | > | Y | t here exist s z ∈ X \ Y such t hat Y ∪ { z } ∈ I . For an independence syst em I , a set X ∈ I is called in depen den t and a set X ∈ I is called depen den t . A base and a circu it of an independence syst em is a maximal independent set and a minimal dependent set , respect ively. We denot e t he family of bases of an independence syst em I and t he family of circuit s of I by B ( I ) and C ( I ), respect ively. Not e t hat we can reconst ruct an independence syst em I from B ( I ) or C ( I ) as I = { X ⊆ V : X ⊆ B for some B ∈ B ( I ) } and I = { X ⊆ V : C ⊆ X for all C ∈ C ( I ) } . In part icular, B ( I 1 ) = B ( I 2 ) if and only if I 1 = I 2 ; similarly C ( I 1 ) = C ( I 2 ) if and only if I 1 = I 2 . We can see t hat t he bases of a mat roid have t he same size from t he augment at ion axiom, but it is not t he case for a general independence syst em. Let I be a mat roid on V . An element x ∈ V is called a loop if { x } is a circuit of I . We say t hat x , y ∈ V are parallel if { x , y } is a circuit of t he mat roid I . T he next is well known. L e m m a 2 . 1 ( s e e [1 1 ]) . For a m at roid wit hou t a loop, t he relat ion t hat “ x is
parallel t o y ” is an equ ivalen ce relat ion .
Let
be independence syst ems on t he same ground set V . T he in t ersecand I 2 is just I 1 ∩ I 2 . T he int ersect ion of more independence syst ems is defined in a similar way. Not e t hat t he int ersect ion of independence syst ems is also an independence syst em. Also not e t hat t he family of circuit s of I 1 ∩ I 2 is t he family of t he minimal set s of C ( I 1 ) ∪ C ( I 2 ), i.e., C ( I 1 ∩ I 2 ) = min( C ( I 1 ) ∪ C ( I 2 )). T he following well-known observat ion is crucial in t his paper.
t ion of
I 1, I 2
I 1
L e m m a 2 . 2 ( s e e [4 , 5 , 9 ]) . E very in depen den ce sy st em can be represen t ed as
t he in t ersect ion of fi n it ely m an y m at roids on t he sam e grou n d set .
by C ( 1) , . . . , C ( m ) , and consider t he mat roid I i wit h a unique circuit C ( I i ) = { C ( i ) } for each m i ∈ { 1, . . . , m } . T hen, t he family of t he circuit s of I i is not hing but i = 1 m ( 1) { C , . . . , C ( m ) } . T herefore, we have I = I i. ⊓ ⊔ i = 1 P roof. Denot e t he circuit s of an independence syst em
I
Due t o Lemma 2.2, we are int erest ed in represent at ion of an independence syst em as t he int ersect ion of mat roids. From t he const ruct ion in t he proof of Lemma 2.2, we can see t hat t he number of mat roids which we need t o represent an independence syst em I by t he int ersect ion is at most | C ( I ) | . However, we might do bet t er. In t his paper, we invest igat e such a number for a clique complex.
3
C liq u e C o m p le x e s a n d t h e M a in T h e o re m
A graph gives rise t o various independence syst ems. Among t hem, we will invest igat e clique complexes.
Mat roid Represent at ion of Clique Complexes
195
T he cliqu e com plex of a graph G = ( V , E ) is t he collect ion of all cliques of G . We denot e t he clique complex of G by C( G ). Not e t hat t he empty set is a clique and { v } is also a clique for each v ∈ V . So we can see t hat t he clique complex is act ually an independence syst em on V . We also say t hat an independence syst em is a clique complex if it is isomorphic t o t he clique complex of some graph. Not ice t hat a clique complex is also called a fl ag com plex in t he lit erat ure. Here we give some subclasses of t he clique complexes. (We omit necessary definit ions.) (1) T he family of t he st able set s of a graph G is not hing but t he clique complex of G . (2) T he family of t he mat chings of a graph G is t he clique complex of t he complement of t he line graph of G , which is called t he m at chin g com plex of G . (3) T he family of t he chains of a poset P is t he clique complex of t he comparability graph of P , which is called t he order com plex of P . (4) T he family of t he ant ichains of a poset P is t he clique complex of t he complement of t he comparability graph of P . T he next lemma may be a folklore. L e m m a 3 . 1 . L et
I be an in depen den ce sy st em on a fi n it e set V . T hen , I is a cliqu e com plex if an d on ly if t he size of every circu it of I is t wo. I n part icu lar, t he circu it s of t he cliqu e com plex of G are t he edges of G .
P roof. Let I be t he clique complex of G = ( V , E ). Since a single vert ex v ∈ V forms a clique, t he size of each circuit is great er t han one. Each dependent set of size two is an edge of t he complement . Observe t hat t hey are minimal dependent set s since t he size of each dependent set is great er t han one. Suppose t hat t here exist s a circuit C of size more t han two. T hen each two element s in C form an edge of G . Hence C is a clique. T his is a cont radict ion. Conversely, assume t hat t he size of every circuit of I is two. T hen const ruct V a graph G ′ = ( V , E ′ ) wit h E ′ = { { u , v } ∈ : { u , v } ∈ C ( I ) } . Consider t he 2 clique complex C( G ′ ). By t he opposit e direct ion which we have just shown, we can see t hat C (C( G ′ )) = C ( I ). T herefore I is t he clique complex of G ′ . ⊓ ⊔
Now we st art st udying t he number of mat roids which we need for t he represent at ion of a clique complex as t heir int ersect ion. First we charact erize t he case in which we need only one mat roid. (namely t he case in which a clique complex is a mat roid). To do t his, we define a part it ion mat roid. A part it ion m at roid is a mat roid I ( P ) associat ed wit h a part it ion P = { P 1 , P 2 , . . . , P r } of V defined as I ( P ) = { I ⊆ V : | I ∩ P i | ≤ 1 for all i ∈ { 1, . . . , r } } . Observe t hat I ( P ) is a clique complex. Indeed if we const ruct a graph G P = ( V , E ) from P as u , v ∈ V are adjacent in G P if and only if u , v are element s of dist inct part it ion classes in P , t hen we can see t hat I ( P ) = C( G P ). Not e t hat V : { u , v } ⊆ P i for some i ∈ { 1, . . . , r } } . Also not e t hat C ( I ( P )) = { { u , v } ∈ 2 G P is a complet e r -part it e graph wit h t he part it ion P . In t he next lemma, t he equivalence of (1) and (3) is also not iced by Okamot o [10]. L e m m a 3 . 2 . L et G be a graph. T hen t he followin g are equ ivalen t . ( 1) T he cliqu e
com plex of G is a m at roid. ( 2) T he cliqu e com plex of G is a part it ion m at roid. ( 3) G is com plet e r -part it e for som e r .
196
K. Kashiwabara, Y. Okamot o, and T . Uno
P roof. “(2)
⇒ (1)” is clear, and “(3) ⇒ (2)” is immediat e from t he discussion above. So we only have t o show “(1) ⇒ (3).” Assume t hat t he clique complex C( G ) is a mat roid. By Lemma 3.1, every circuit of C( G ) is of size two, which corresponds t o an edge of G . So t he element s of each circuit are parallel. Lemma 2.1 says t hat t he parallel element s induce an equivalence relat ion on V ( G ), which yields a part it ion P = { P 1 , . . . , P r } of V ( G ). T hus, we can see t hat G is a complet e r -part it e graph wit h t he vert ex part it ion P . ⊓ ⊔
For t he case of more mat roids, we use a st able-set part it ion. A st able-set P = { P 1 , . . . , P r } of V such t hat each P i is a st able set of G . T he following t heorem is t he main result of t his paper. It t ells us how many mat roids we need t o represent a given clique complex. part it ion of a graph G = ( V , E ) is a part it ion
= ( V , E ) be a graph. T hen , t he cliqu e com plex C( G ) can be represen t ed as t he in t ersect ion of k m at roids if an d on ly if t here exist k st ableV set part it ion s P ( 1) , . . . , P ( k ) su ch t hat { u , v } ∈ is an edge of G if an d on ly 2 T h e o r e m 3 . 3 . L et G
if
{
u, v} ⊆
S for som e S
∈
k i
=1 P
(i )
( in part icu lar, C( G ) =
k i
=1 I
(P
(i )
)) .
To show t he t heorem, we use t he following lemmas. = ( V , E ) be a graph. I f t he cliqu e com plex C( G ) can be represen t ed as t he in t ersect ion of k m at roids, t hen t here exist k st able-set part it ion s k ( 1) (i ) P , . . . , P ( k ) su ch t hat C( G ) = I (P ). i = 1 L e m m a 3 . 4 . L et G
P roof. Assume t hat C( G ) is represent ed as t he int ersect ion of k mat roids
I 1, . Choose I i arbit rarily ( i ∈ { 1, . . . , k } ). T hen t he parallel element s of I i induce an equivalence relat ion on V . Let P ( i ) be t he part it ion of V arising from t his equivalence relat ion. T hen t he two-element circuit s of I i are t he circuit s of (i ) I (P ). Moreover, t here is no loop in I i (ot herwise I i cannot be a clique com k k plex). T herefore, we have t hat min( i = 1 C ( I i )) = min( i = 1 C ( I ( P ( i ) ))), which k k means t hat C( G ) = i = 1 I i = i = 1 I ( P ( i ) ). ⊓ ⊔
...,
I
k
L e m m a 3 . 5 . L et G I
( P ) if an d on ly if
P
P be a part it ion of V . T hen C( G ) is a st able-set part it ion of G .
= ( V , E ) be a graph an d
⊆
P is a st able-set part it ion of G . Take I ∈ C( G ) arbit rarily. T hen we have | I ∩ P | ≤ 1 for each P ∈ P by t he definit ions of cliques and st able set s. Hence I ∈ I ( P ), namely C( G ) ⊆ I ( P ). Conversely, assume t hat C( G ) ⊆ I ( P ). Take P ∈ P and a clique C of G arbit rarily. From our assumpt ion, we have C ∈ I ( P ). T herefore, it holds t hat | C ∩ P | ≤ 1. T his means t hat P is a st able set of G , namely P is a st able-set part it ion of G . ⊓ ⊔
P roof. Assume t hat
Now it is t ime t o prove T heorem 3.3. P roof ( of T heorem 3. 3) . Assume t hat a given clique complex C( G ) is represent ed
as t he int ersect ion of k mat roids I 1 , . . . , I k . From Lemma 3.4, C( G ) can be represent ed as t he int ersect ion of k mat roids associat ed wit h st able-set part it ions ( 1) P , . . . , P ( k ) of G . We will show t hat t hese part it ions P ( 1) , . . . , P ( k ) sat isfy t he
Mat roid Represent at ion of Clique Complexes
197
condit ion in t he st at ement of t he t heorem. By Lemma 3.1, { u , v } is an edge of G if and only if { u , v } is a circuit of t he clique complex C( G ), namely { u , v } ∈ C (C( G )) k k k = min( i = 1 C ( I i )) = min( i = 1 C ( I ( P ( i ) ))) = i = 1 C ( I ( P ( i ) )). So t his means (i ) t hat t here exist s at least one i ∈ { 1, . . . , k } such t hat { u , v } ∈ C (I (P )). (i ) Hence, { u , v } ⊆ S for some S ∈ P if and only if { u , v } is an edge of G . Conversely, assume t hat we are given a family of st able-set part it ions P ( 1) , . . . , P ( k ) of V sat isfying t he condit ion in t he st at ement of t he t heorem. We will k show t hat C( G ) = i = 1 I ( P ( i ) ). By Lemma 3.5, we can see t hat C( G ) ⊆ I ( P ( i ) ) k (i ) for all i ∈ { 1, . . . , k } . T his shows t hat C( G ) ⊆ I (P ). In order t o show t hat i = 1 k k (I ) (i ) C (I (P )). I (P ), we only have t o show t hat C (C( G )) ⊆ C( G ) ⊇ i = 1 i = 1 Take C ∈ C (C( G )) arbit rarily. By Lemma 3.1 we have | C | = 2. Set C = { u , v } ∈ k (i ) E ( G ). From our assumpt ion, it follows t hat { u , v } ⊆ S for some S ∈ P . i = 1 k (i ) C ( I ( P )). ⊓ ⊔ T his means t hat { u , v } ∈ i = 1
4
A n E x t re m a l P ro b le m fo r C liq u e C o m p le x e s
Let µ ( G ) be t he minimum number of mat roids which we need for t he represent at ion of t he clique complex of G as t heir int ersect ion, and µ ( n ) be t he maximum of k µ ( G ) over all graphs G wit h n vert ices. Namely, µ ( G ) = min { k : C( G ) = I i i = 1 where I 1 , . . . , I k are mat roids} , and µ ( n ) = max{ µ ( G ) : G has n vert ices} . In t his sect ion, we will det ermine µ ( n ). From Lemmas 2.2 and 3.1 we can immediat ely obt ain µ ( n ) ≤ n2 . However, t he following t heorem t ells us t his is far from t he t rut h. T h e o r e m 4 . 1 . For every n
First we will prove t hat
≥
2, it holds t hat
µ (n )
≥
n
L e m m a 4 . 2 . For n n
−
≥
2, we have
=
n
−
1.
1. Consider t he graph
−
K 1
µ (n )
∪
µ (K 1
K 1 ∪
K
n −
1.
K 5
∪
K
n −
1)
=
n
−
1, part icu larly
µ (n )
≥
1.
1 ∪ K n − 1 has n − 1 edges. From Lemma 3.1, t he number of t he circuit s of C( K 1 ∪ K n − 1 ) is n − 1. By t he argument below t he proof of Lemma 2.2, we have µ ( K 1 ∪ K n − 1 ) ≤ n − 1. Now, suppose t hat µ ( K 1 ∪ K n − 1 ) ≤ n − 2. By T heorem 3.3 and t he pigeon hole principle, t here exist s a st able-set part it ion P of K 1 ∪ K n − 1 such t hat some class P in P cont ains at least two edges of K 1 ∪ K n − 1 . However, t his is impossible since P is st able. Hence, we have µ ( K 1 ∪ K n − 1 ) = n − 1. ⊓ ⊔
P roof. K
Next we will prove t hat µ ( n ) ≤ n − 1. To do t hat , we will look at t he relat ionship of µ ( G ) wit h t he edge-chromat ic number.
198
K. Kashiwabara, Y. Okamot o, and T . Uno
L e m m a 4 . 3 . W e have µ ( G )
′ ≤ χ ( G ) for an y graph G wit h n vert ices. P art icu larly , if n is even we have µ ( G ) ≤ n − 1 an d if n is odd we have µ ( G ) ≤ n . M oreover, if µ ( G ) = n t hen n is odd an d t he m axim u m degree of G is n − 1 ( i. e. , G has an isolat ed vert ex) .
P roof. Consider a minimum edge-coloring of G , and we will const ruct χ
(G ) st able-set part it ions of a graph G wit h n vert ices from t his edge-coloring. We have t he color classes C ( 1) , . . . , C ( k ) of t he edges where k = χ ′ ( G ). Let us (i ) (i ) t ake a color class C ( i ) = { e1 , . . . , el i } ( i ∈ { 1, . . . , k } ) and const ruct a st ableset part it ion P ( i ) of G from C ( i ) as follows: S is a member of P ( i ) if and only if (i ) eit her (1) S is a two-element set belonging t o C ( i ) (i.e., S = ej for some j ∈ { 1, . . . , l i } ) or (2) S is a one-element set { v } which is not used in C ( i ) (i.e., (i ) v ∈ e j for all j ∈ { 1, . . . , l i } ). Not ice t hat P ( i ) is act ually a st able-set part it ion. T hen we collect all t he st able-set part it ions P ( 1) , . . . , P ( k ) const ruct ed by t he procedure above. Moreover, we can check t hat t hese st able-set part it ions sat isfy t he condit ion in T heorem 3.3. Hence, we have µ ( G ) ≤ k = χ ′ ( G ). Here, not ice t hat χ ′ ( G ) ≤ χ ′ ( K n ). So if n is even, t hen χ ′ ( K n ) is n − 1, which concludes µ ( G ) ≤ n − 1. If n is odd, t hen χ ′ ( K n ) is n , which concludes µ ( G ) ≤ n . Assume t hat µ ( G ) = n . From t he discussion above, n should be odd. Remark t hat Vizing’ s t heorem says for a graph H wit h maximum degree ∆ ( H ) we have χ ′ ( H ) = ∆ ( H ) or ∆ ( H ) + 1. If ∆ ( G ) ≤ n − 1, t hen we have t hat µ ( G ) ≤ χ ′ ( G ) ≤ ⊓ ⊔ ∆ ( G ) + 1 ≤ n . So µ ( G ) = n holds only if ∆ ( G ) + 1 = n . ′
Now, we will show t hat if a graph G wit h an odd number of vert ices has an isolat ed vert ex t hen µ ( G ) ≤ n − 1. T his complet es t he proof of T heorem 4.1. L e m m a 4 . 4 . L et n be odd an d G be a graph wit h n vert ices which has an isolat ed
vert ex. T hen µ ( G )
≤
n
−
1.
P roof. Let v ∗ be an isolat ed vert ex of G . Consider t he subgraph of G induced by V (G )
. Call t his induced subgraph G ′ . Since G ′ has n − 1 vert ices, which is even, we have µ ( G ′ ) ≤ n − 2 from Lemma 4.3. Now we will const ruct n − 1 st able-set part it ions of G which sat isfy t he condit ion in T heorem 3.3 from n − 2 st able-set part it ions of G ′ which also sat isfy t he condit ion in T heorem 3.3. Denot e t he vert ices of G ′ by 1, . . . , n − 1, and t he ( n − 2) ( 1) . T hen const ruct st able-set parst able-set part it ions of G ′ by P ′ , . . . , P ′ ( 1) ( n − 2) ( n − 1) t it ions P , . . . , P ,P of G as follows. For i = 1, . . . , n − 2, S ∈ P ( i ) (i ) (i ) if and only if eit her (1) S ∈ P ′ and i ∈ S or (2) v ∗ ∈ S , S \ { v ∗ } ∈ P ′ and i ∈ S . Also S ∈ P ( n − 1) if and only if eit her (1) S = { v ∗ , n − 1} or (2) S = { i } ( i = 1, . . . , n − 2). We can observe t hat t he st able-set part it ions P ( 1) , . . . , P ( n − 1) sat isfy t he condit ion in T heorem 3.3 since v ∗ is an isolat ed vert ex of G . ⊓ ⊔
5
\ {
v∗
}
C h a ra c t e riz a t io n fo r T w o M a t ro id s
In t his sect ion, we will look more closely at a clique complex which can be represent ed as t he int ersect ion of two mat roids. Not e t hat Feket e–Firla–Spille [5]
Mat roid Represent at ion of Clique Complexes
199
gave a charact erizat ion of t he graphs whose mat ching complexes can be represent ed as t he int ersect ions of two mat roids. So t he t heorem in t his sect ion is a generalizat ion of t heir result . To do t his, we int roduce anot her concept . T he st able-set graph of a graph G = ( V , E ) is a graph whose vert ices are t he maximal st able set s of G and two vert ices of which are adjacent if t he corresponding two maximal st able set s share a vert ex in G . We denot e t he st able-set graph of a graph G by S ( G ). L e m m a 5 . 1 . L et G be a graph. T hen t he cliqu e com plex C( G ) can be represen t ed as t he in t ersect ion of k m at roids if t he st able-set graph S ( G ) is k -colorable.
P roof. Assume t hat we are given a k -coloring c of
S ( G ). T hen gat her t he maximal st able set s of G which have t he same color wit h respect t o c , t hat is, put C i = { S ∈ V ( S ( G )) : c ( S ) = i } for all i = 1, . . . , k . We can see t hat t he members of C i are disjoint maximal st able set s of G for each i . Now we const ruct a graph G i from C i as follows. T he vert ex set of G i is t he same as t hat of G , and two vert ices of G i are adjacent if and only if eit her (1) one belongs t o a maximal st able set in C i and t he ot her belongs t o anot her maximal st able set in C i , or (2) one belongs t o a maximal st able set in C i and t he ot her belongs t o no maximal st able set in C i . Remark t hat G i is complet e r -part it e, where r is equal t o | C i | plus t he number of t he vert ices which do not belong t o any maximal st able set in C i . T hen consider C( G i ), t he clique complex of G i . By Lemma 3.2, we can see t hat C( G i ) is act ually a mat roid. Since an edge of G is also an edge of G i , we have t hat C( G ) ⊆ C( G i ). k Here we consider t he int ersect ion I = i = 1 C( G i ). Since C( G ) ⊆ C( G i ) for any i , we have C( G ) ⊆ I . Since each circuit of C( G ) is also a circuit of C( G i ) for some i (recall Lemma 3.1), we also have C (C( G )) ⊆ C ( I ), which implies C( G ) ⊇ I . T hus we have C( G ) = I . ⊓ ⊔
Not e t hat t he converse of Lemma 5.1 does not hold even if k = 3. A count erexample is t he graph G = ( V , E ) defined as V = { 1, 2, 3, 4, 5, 6} and E = { { 1, 2} , { 3, 4} , { 5, 6} } . Here C( G ) is represent ed as t he int ersect ion of t hree mat roids C ( I 1 ) = { { 1, 3, 5} , { 2, 4, 6} } , C ( I 2 ) = { { 1, 3, 6} , { 2, 4, 5} } and C ( I 3 ) = { { 1, 4, 5} , { 2, 3, 6} } while S ( G ) is not 3-colorable but 4-colorable. However, t he converse holds if k = 2. C( G ) can be represen t ed as t he in t ersect ion of t wo m at roids if an d on ly if t he st able-set graph S ( G ) is 2-colorable ( i. e. , bipart it e) .
T h e o r e m 5 . 2 . L et G be a graph. T he cliqu e com plex
P roof. T he if-part is st raight forward from Lemma 5.1. We will show t he only-
if-part . Assume t hat C( G ) is represent ed as t he int ersect ion of two mat roids. T hanks t o T heorem 3.3, we assume t hat t hese two mat roids are associat ed wit h st able-set part it ions P ( 1) , P ( 2) of G sat isfying t he condit ion in T heorem 3.3. Let S be a maximal st able set of G . Now we will see t hat S ∈ P ( 1) ∪ P ( 2) . From t he maximality of S , we only have t o show t hat S ⊆ P for some P ∈ P ( 1) ∪ P ( 2) . (T hen, t he maximality of S will t ell us t hat S = P .) T his claim clearly holds if | S | = 1. If | S | = 2, t he claim holds from t he condit ion in T heorem 3.3.
200
K. Kashiwabara, Y. Okamot o, and T . Uno
Assume t hat | S | ≥ 3. Consider t he following independence syst em I = { I ⊆ : I ⊆ P for some P ∈ P ( 1) ∪ P ( 2) } . Take a base B of I arbit rarily. Since B ⊆ S , B is a dependent set of C( G ). So B cont ains a circuit of C( G ). By Lemma 3.1, we have | B | ≥ 2. Suppose t hat S \ B = ∅ for a cont radict ion. P ick up u ∈ S \ B . Assume t hat B ⊆ P for some P ∈ P ( 1) , wit hout loss of generality. T hen { u , v } is a circuit of C( G ) for any v ∈ B since S is a st able set of G . Moreover, u and v belong t o diff erent set s of P ( 1) (ot herwise, it would violat e t he maximality of B ). From t he condit ion in T heorem 3.3, t here should exist some P ′ ∈ P ( 2) such t hat { u , v } ⊆ P ′ for all v ∈ B . By t he t ransit ivity of t he equivalence relat ion induced by P ( 2) , we have { u } ∪ B ⊆ P ′ . T his cont radict s t he maximality of B . T herefore, we have S = B , which means t hat S ∈ P ( 1) ∪ P ( 2) . Now we color t he vert ices of S ( G ), i.e., t he maximal st able set s of G . If a maximal st able set S belongs t o P ( 1) , t hen S is colored by 1. Similarly if S belongs t o P ( 2) , t hen S is colored by 2. (If S belongs t o bot h, t hen S is colored by eit her 1 or 2 arbit rarily.) T his coloring cert ainly provides a proper 2-coloring of S ( G ) since P ( 1) and P ( 2) are st able-set part it ions of G . ⊓ ⊔
S
Some researchers already not iced t hat t he bipart it eness of S ( G ) is charact erized by ot her propert ies. We gat her t hem in t he following proposit ion. P r o p o s i t i o n 5 . 3 . L et G be a graph. T hen t he followin g are equ ivalen t . ( 1) T he st able-set graph S ( G ) is bipart it e. ( 2) G is t he com plem en t of t he lin e graph of a bipart it e m u lt igraph. ( 3) G has n o in du ced su bgraph isom orphic t o K 1 ∪ K 3 , K 1 ∪ K 2 ∪ K 2 , K 1 ∪ P 3 or C 2 k + 3 ( k = 1, 2, . . . ) .
K 1
P roof. “(1)
Also “(1) ⇔
⇔
∪
K 3
K 1 ∪
K 2 ∪
K 2
K 1 ∪
P3
(2)” is immediat e from a result by Cai–Corneil–P roskurowski [1]. (3)” is immediat e from a result by P rot t i–Szwarcfit er [12]. ⊓ ⊔
Remark t hat we can decide whet her t he st able-set graph of a graph is bipart it e or not in polynomial t ime using t he algorit hm described by P rot t i– Szwarcfit er [12].
6
C o n c lu d in g R e m a rk s
In t his paper, mot ivat ed by t he quality of a nat ural greedy algorit hm for t he maximum weight ed clique problem, we charact erized t he number k such t hat t he clique complex of a graph can be represent ed as t he int ersect ion of k mat roids (T heorem 3.3). T his implies t hat t he problem t o det ermine t he clique complex of a given graph has a represent at ion by k mat roids or not belongs t o NP. Also, in Sect . 5 we observed t hat t he corresponding problem for two mat roids can be solved in polynomial t ime. However, t he problem for t hree or more mat roids is not known t o be solved in polynomial t ime. We leave t he furt her issue on comput at ional complexity of t his problem as an open problem.
Mat roid Represent at ion of Clique Complexes
201
Moreover, we showed t hat n − 1 mat roids are necessary and suffi cient for t he represent at ion of t he clique complexes of all graphs wit h n vert ices (T heorem 4.1). T his implies t hat t he approximat ion rat io of t he greedy algorit hm for t he maximum weight ed clique problems is at most n − 1. Furt hermore, we can show t he following t heorem. In t his t heorem, we see a graph it self as an independence syst em: namely a subset of t he vert ex set is independent if and only if it is (1) t he empty set , (2) a one-element set , or (3) a two-element set which forms an edge of t he graph. A proof is omit t ed due t o t he page limit at ion. T h e o r e m 6 . 1 . A graph G can be represen t ed as t he in t ersect ion of k m at roids if an d on ly if t he cliqu e com plex C( G ) can be represen t ed as t he in t ersect ion of k m at roids.
In t his paper, we approached t he quality of a greedy algorit hm for t he maximum weight ed clique problem from t he viewpoint of mat roid t heory. T his approach must be useful for ot her combinat orial opt imizat ion problems. T he aut hors t hank Emo Welzl for suggest ing t he problem discussed in Sect . 4 and anonymous referees for useful comment s. A ck n o w le d g e m e n t s .
R e fe re n c e s 1. L. Cai, D. Corneil and A. P roskurowski: A generalizat ion of line graphs: ( X , Y )int ersect ion graphs. J ournal of Graph T heory 2 1 (1996) 267–287. 2. R. Diest el: Graph T heory (2nd Edit ion). Springer Verlag, New York, 2000. 3. J . Edmonds: Mat roids and t he greedy algorit hm. Mat hemat ical P rogramming 1 (1971) 127–136. 4. U. Faigle: Mat roids in combinat orial opt imizat ion. In: Combinat orial Geomet ries (N. W hit e, ed.), Cambridge University P ress, Cambridge, 1987, pp. 161–210. 5. S.P. Feket e, R.T . F irla and B. Spille: Charact erizing mat chings as t he int ersect ion of mat roids. P reprint , December 2002, arXiv:mat h.CO/ 0212235. 6. A. Frank: A weight ed mat roid int ersect ion algorit hm. J ournal of Algorit hms 2 (1981) 328–336. 7. T .A. J enkyns: T he effi cacy of t he “greedy” algorit hm. P roceedings of t he 7t h Sout heast ern Conference on Combinat orics, Graph T heory, and Comput ing, Ut ilit as Mat hemat ica, W innipeg, 1976, pp. 341–350. 8. B. Kort e and D. Hausmann: An analysis of t he greedy algorit hm for independence syst ems. In: Algorit hmic Aspect s of Combinat orics; Annals of Discret e Mat hemat ic 2 (B. Alspach et al., eds.), Nort h-Holland, Amst erdam, 1978, pp. 65–74. 9. B. Kort e and J . Vygen: Combinat orial Opt imizat ion (2nd Edit ion). Springer Verlag, Berlin Heidelberg, 2002. 10. Y. Okamot o: Submodularity of some classes of t he combinat orial opt imizat ion games. Mat hemat ical Met hods of Operat ions Research 5 8 (2003), t o appear. 11. J . Oxley: Mat roid T heory. Oxford University P ress, New York, 1992. 12. F . P rot t i and J .L. Szwarcfit er: Clique-inverse graphs of bipart it e graphs. J ournal of Combinat orial Mat hemat ics and Combinat orial Comput ing 4 0 (2002) 193–203. 13. R. Rado: Not e on independence funct ions. P roceedings of t he London Mat hemat ical Society 7 (1957) 300–320.
O n P ro v in g C irc u it L o w e r B o u n d s a g a in s t t h e P o ly n o m ia l- T im e H ie ra rc h y : P o s it iv e a n d N e g a t iv e R e s u lt s ⋆ J in-Yi Cai and Osamu Wat anabe 1
Comput er Sci. Dept ., Univ. of W isconsin, Madison, W I 53706, USA [email protected] 2 Dept . of Mat h. and Comp. Sci., Tokyo Inst . of Technology [email protected]
A b s t r a c t . We consider t he problem of proving circuit lower bounds against t he polynomial-t ime hierarchy. We give bot h posit ive and negat ive result s. For t he posit ive side, for any fixed int eger k > 0, we give an explicit Σ p2 language, accept able by a Σ p2 -machine wit h running t ime 2 + ), t hat requires circuit size > n . For t he negat ive side, we proO (n pose a new st ringent not ion of relat ivizat ion, and prove under t his st ringent relat ivizat ion t hat every language in t he polynomial-t ime hierarchy has polynomial circuit size. (For t echnical det ails, see also [CW 03].) k
1
k
k
In t ro d u c t io n
P roving circuit lower bounds is a most basic problem in complexity t heory. T he class P has polynomial size circuit s. It is also widely believed t hat NP does not share t his property, i.e., t hat some specific set requires super polynomial circuit size. While t his remains t he most concret e approach t o t he NP vs. P problem, we cannot even prove t his for any fixed k > 1 t hat any set L ∈ NP requires circuit size > n k . If we relax t he rest rict ion from NP t o t he second level of t he polynomial-t ime hierarchy Σ p2 , Kannan [Kan82] did prove t hat for any fixed polynomial n k , t here is some set L in Σ p2 which requires circuit size > n k . Kannan in fact proved t he exist ence t heorem for some set in Σ p2 ∩ Π p2 . T his result has been improved by K¨obler and Wat anabe [KW98] who showed, based on t he t echnique developed in [BCGKT ], t hat such a set exist s in ZP P N P . T he work in [Cai01] implies t hat a yet lower class Sp2 cont ains such a set . (See [BFT 98,MVW99] for relat ed t opics.) However, Kannan’s proof for Σ p2 , and all t he subsequent improvement s ment ioned above, are not “const ruct ive” in t he sense t hat it does not ident ify a single Σ p2 machine whose language requires circuit size > n k . At t he t op level, all t hese
⋆
T he first aut hor is support ed in part by NSF grant s CCR-0208013 and CCR-0196197 and U.S.-J apan Collaborat ive Research NSF SBE-INT 9726724. T he second aut hor is support ed in part by by t he J SP S/ NSF Collaborat ive Research 1999 and by t he Minist ry for Educat ion, Grant -in-Aid for Scient ific Research (C), 2001.
T . W a r n ow a n d B . Zh u ( E d s.) : C O C O O N 2003, LN C S 2697, p p . 202–211, 2003. c Sp r in ger -Ver la g B er lin H eid elb er g 2003
On P roving Circuit Lower Bounds against t he P olynomial-T ime Hierarchy
203
proofs are of t he following type: E ither SAT does not have n k size circuit , in which case we are done, or SAT has n k size circuit , t hen we can define some ot her set , which by t he exist ence of t he hypot het ical circuit for SAT can be shown in Σ p2 , and it requires circuit size > n k . Const ruct ively, Kannan gave a set in Σ p4 ∩ Π p4 . In [MVW99] a set in ∆ p3 was const ruct ively given. In t his paper we improve t his t o Σ p2 . O (n k
2
p
For an y in teger k > 0, we can con struct a Σ 2 -m achin e with k+ 1 log n ) run n in g tim e that accepts a set with n o n k size circuits.
T h e o re m 1 .
A similar const ruct ive proof is st ill open for t he st ronger st at ement s on such set s in Σ p2 ∩ Π p2 (resp., ZP P N P , and Sp2 ). Our main result in t his paper deals wit h t he diffi culty in proving super polynomial circuit size lower bound for any set in t he polynomial-t ime hierarchy, P H. While it is possible t o prove lower bound above any fixed polynomial, at least for some set s in Σ p2 , t he real challenge is t o prove super polynomial circuit size lower bound for a single language. Not only have we not been able t o do t his for any set in NP , but also no super polynomial lower bound is known for any set in P H. In t his paper we propose a new not ion of relat ivizat ion, which is more st ringent t han t he usual not ion of relat ivizat ion. Under t his st ringent relat ivizat ion we prove t hat every language in t he polynomial-t ime hierarchy has polynomial circuit size. T hus, in a st rong sense, one cannot prove relat ivizable super polynomial lower bound for any set in t he polynomial-t ime hierarchy. We not e t hat a relat ivizat ion where EXP (t hus, P H) has polynomial size circuit s is known [He84]. Relat ivizat ion result s can be generally classified as eit her separat ion or collapsing/ cont ainment result s. We deal wit h relat ivized collapsing result s here since we are int erest ed in demonst rat ing t he diffi culty of proving uncondit ional circuit lower bound for P H. By surveying exist ing relat ivized collapsing result s, we found t he following asymmet ry is oft en present . In almost all of t hese relat ivized collapsing result s, t he proof is achieved by allowing st ronger access of oracles t o t he simulat ing comput at ion t han t he simulat ed comput at ion. For example, in t he usual proof of P A = NP A or P A = P SPACE A , we encode QBF in t he oracle. In t erms of t he simulat ion by t he P Q B F machine M simulat ing an NP Q B F or P SPACE Q B F comput at ion M ′ on an input x , M will access an oracle locat ion polynomially longer t han where t he corresponding access M ′ makes. T hat is, P A machines are given more powerful oracle access. T he simulat ed machine is denied access t o cert ain segment s of t he oracle where t he simulat ing machine can access. In t he result of Heller [He84] for EXP A ⊆ P A / poly, an EXP machine is supposed t o have running t ime 2n for some const ant k , and t hus “most ” of t he segment of A at lengt h n k + 1 is unt ouched for comput at ion at lengt h n . T hen one can simply code t his EXP A comput at ion at a suit able locat ion at lengt h n k + 1 , where t he poly-size circuit can access. We would like t o disallow t his type of “hiding” of comput at ion aff orded by unequal oracle access. In t his paper, we propose t he following more “st ringent ” oracle comput at ion model. Essent ially, we require t hat , for any n , t he simulat ing and simulat ed machine or circuit should have t he same access t o oracle. k
204
J .-Y. Cai and O. Wat anabe
We can formalize t his as follows. We generalize t he definit ion of C / poly by Karp and Lipt on [KL80] t o allow t he underlying machines t o have random access t o an advice st ring. Fix any “lengt h funct ion” ℓ , t hen a funct ion s : n → { 0, 1} ℓ ( n ) is called an advice fun ction of size ℓ ( n ). Given any advice funct ion s, we say a language L is in t he class C / s via ran dom access to advice if t here is some machine M represent ing t he class C , such t hat x ∈ L iff M ( x ; s( | x | )) accept s, where we denot e t he comput at ion M on x wit h random access t o s( | x | ) by M ( x ; s( | x | )). (T he not ion of ran dom access is t he usual one: A machine M can writ e down an index t o a bit of s( | x | ) on a special t ape and t hen it get s t hat bit in unit t ime.) We denot e t his language as L ( M ; s). Roughly speaking t he st ring s( n ) represent s t hat segment of t he oracle accessible for bot h sides at lengt h n . T his not ion is ext ended t o circuit s as follows. We consider a circuit for input lengt h n consist s of st andard AND, OR, and NOT gat es and oracle query gat es. An oracle query gat e t akes m input bit s z = b1 b2 . . . bm as an index t o s( n ) and get s out put s( n )[z ]. When we compare two classes, we insist t he respect ive machines (or circuit s) have access t o t he same advice st ring s. We say a relat ivized cont ainment is “st ringent ” (w.r.t . s), if for every machine M 1 represent ing C 1 , t here is a machine M 2 (or circuit family) represent ing C 2 , such t hat L ( M 1 ; s) = L ( M 2 ; s). Not e t hat s is fixed for all machines (or circuit s) from t he classes C 1 and C 2 . T here is a strin gen t relativization such that P H is con tain ed in P / poly . M ore specifi cally, there is an advice fun ction s of len gth 2c n , for som e con stan t c > 2, such that for an y in teger d > 0 an d an y p real k ≥ 1, if M is an oracle Σ d -m achin e with run n in g tim e O ( n k ) , then there is a sequen ce of B oolean circuits { C n } n ≥ 0 , such that L ( C n ; s( n )) = L ( M ; s) = n . For all suffi cien tly large n , the size of C n is boun ded by n c d k , for som e un iversal con stan t c > 0. T h e o re m 2 ( M a in T h e o re m ) .
Our proof t echnique for t he main t heorem is based on t he decision t ree version of t he Swit ching Lemma for const ant dept h circuit s and Nisan-Wigderson pseudorandom generat or.
2
P ro o f o f T h e o re m 1
Kannan [Kan82] proved t hat for any fixed polynomial n k , t here is some set L in Σ p2 ∩ Π p2 wit h circuit size > n k . However, in t erms of explicit const ruct ion, he only gave a set in Σ p4 ∩ Π p4 . An improvement t o ∆ p3 was st at ed in [MVW99]. In t his sect ion we give a const ruct ive proof of Kannan’s t heorem for Σ p2 . T hat is, we give a descript ion of a Σ p2 machine M accept ing a set wit h t he n k circuit size lower bound. For any n ≥ 0, a binary sequence χ of lengt h l ≤ 2n is called a partial characteristic sequen ce , which will specify t he membership of lexicographically t he first l st rings of { 0, 1} n . We denot e t his subset of { 0, 1} n by L ( χ ). We say t hat χ is consist ent wit h a circuit C wit h n input gat es, iff ∀ i , 1 ≤ i ≤ l , C ( x i ) out put s t he i t h bit of χ , where x i is t he i t h st ring of { 0, 1} n .
On P roving Circuit Lower Bounds against t he P olynomial-T ime Hierarchy
205
We can encode every circuit C of size ≤ s as a st ring u of lengt h len( s), where len( s) is defined as len( s) = ccir c ⌊ s log s⌋ wit h some const ant ccir c . We may consider every u wit h | u | = len( s) encodes some circuit of size ≤ s; if a st ring u is not a proper code or t he encoded circuit has size > s, we assume t hat t his u encodes t he const ant 0 circuit . T he following is immediat e by count ing. C l a i m 1 For an y s > 1, there exists a partial characteristic sequen ce of len gth l = len( s) + 1 that is n ot con sisten t with an y circuit of size ≤ s.
Our goal is t o define a set L t hat has no n k size circuit but t hat is recognized by some explicit ly defined Σ p2 machine M . Our const ruct ion follows essent ially t he same out line as t he one given in [MVW99], which in t urn uses ideas given in Kannan’s original proof. T he furt her improvement is mainly an even more effi cient use of alt ernat ion. For a given n , denot e by ℓ = len( n k ) + 1, and we t ry t o const ruct a part ial charact erist ic sequence χ of lengt h ℓ t hat is consist ent wit h n o circuit of size ≤ n k . We will int roduce an auxiliary set P reCIRC t hat is in NP . Wit h t his P reCIRC, some Σ p2 machine can un iquely det ermine t he desired charact erist ic sequence χ n on (on it s accept ing pat h). We would like t o define our set L (part ially) consist ent wit h t his sequence χ n on . But Σ p2 comput at ion using some auxiliary NP set cannot be implement ed, in general, by any Σ p2 machine. Suppose here t hat P reCIRC has n k size circuit s; t hen some Σ p2 machine can guess such circuit s, verify t hem, and use t hem for comput ing χ n on and recognizing st rings according t o χ n on . What if t here are no such circuit s for P reCIRC? We will define L so t hat one part of L is consist ent wit h P reCIRC (while t he ot her part is consist ent wit h χ n on if P reCIRC is comput able by some n k size circuit s). If P reCIRC has no n k size circuit , t hen t he part of L t hat is consist ent wit h P reCIRC can guarant ee t he desired hardness of L . Now we describe our const ruct ion in det ail. Denot e by ℓ = len( n k ) + 1. By “ v ≻ u ” we mean t hat u is a prefix of v . To comput e t he “hard” charact erist ic sequence χ n on , we want t o det ermine, for a given pair of a part ial charact erist ic sequence χ and a st ring u , whet her u can be ext ended t o some descript ion v of a circuit t hat is consist ent wit h χ . T he set P reCIRC is defined for t his t ask. More precisely, for any n > 0, and for any st rings χ of lengt h ℓ and u of lengt h k ≤ len( n ), we define P reCIRC as follows. k
1n 0χ u 01len ( n ) − | u | ∈ P reCIRC ⇔ ( ∃ v ≻ u ) [ | v | = len( n k ) & t he circuit encoded by v is consist ent wit h χ ]. St rings of any ot her form are not cont ained in P reCIRC. For simplifying our not at ion, we will simply writ e ( χ , u ) for 1n 0χ u 01len ( n ) − | u | . Since n det ermines ℓ , and t he lengt h of χ is ℓ , χ and u are uniquely det ermined from 0n 1χ u 10len ( n ) − | u | . T he lengt h of ( χ , u ) is n = n + 2ℓ + 1. Not e t hat n is O ( n k log n ). Finally define our machine M . Informally we want M t o accept an input x if and only if eit her x ∈ 1{ 0, 1} n − 1 and x ∈ P reCIRC, or x ∈ 0{ 0, 1} n − 1 and x ∈ L , where L = n is a set wit h no n k size circuit s, for all suffi cient ly large n , if P reCIRC = n has n k size circuit s for all suffi cient ly large n . More formally, for any k
k
206
J .-Y. Cai and O. Wat anabe
given input x of lengt h n , if x st art s wit h 1, t hen M accept s it iff x ∈ P reCIRC. Suppose ot herwise; t hat is, x st art s wit h 0. T hen first M exist ent ially guesses a part ial charact erist ic sequence χ n on of lengt h ℓ an d a circuit of size n k , more precisely, a st ring v p r e of lengt h len(n k ) encoding a circuit for P reCIRC = n˜ of size ≤ n k . Aft er t hat , M ent ers t he universal st age, where it checks t he following it ems: (Here we ident ify a circuit wit h a st ring coding it .) (1) ∀ χ , | χ | = ℓ , and ∀ u , | u | ≤ len( n k ), check t hat v p r e is “locally consist ent ” on ( χ , u ) as follows: v p r e ( χ , u ) = 1 & | u | = len( n k ) v p r e ( χ , u ) = 1 & | u | < len( n k )
=⇒ =⇒
circuit u is consist ent wit h χ , and v p r e ( χ , u 0) = 1 ∨ v p r e ( χ , u 1) = 1.
u , | u | = len( n k ), comput e t he χ u of lengt h ℓ defined by circuit u , and verify t hat v p r e works for χ u and all prefix u ′ of u , i.e., v p r e ( χ u , u ′ ) = 1. (3) T he guessed χ n on is lexicographically t he first st ring of lengt h ℓ such t hat no circuit of size s is consist ent wit h it , accordin g to v p r e . T hat is, check v p r e ( χ n on , ǫ ) = 0, where ǫ is t he empty st ring, and ∀ χ if | χ | = ℓ and χ is lexicographically smaller t han χ n on t hen v p r e ( χ , ǫ ) = 1 holds.
(2)
∀
Finally on each universal branch, if M passes t he part icular t est of t his branch, t hen M accept s t he input x ∈ 0{ 0, 1} n − 1 iff χ n on has bit 1 for t he st ring x . From our discussion, it is not hard t o show t hat t his machine M accept s a set wit h t he n k circuit size lower bound.
3
P ro o f o f T h e o re m 2
Consider any Σ pd oracle alt ernat ing Turing machine M wit h t ime bound n k . Let m = n k and I ≥ (2 + δ ) n , for const ant δ > 0, and denot e N = 2n and M = 2m . We want t o define s( n ) of lengt h 2I such t hat a polynomial size circuit C M simulat es M at lengt h n wit h random access t o s( n ). For not at ional convenience we will prove only for I = m , and we will assume k > 2 and d ≥ 7. It can be easily adapt ed from [FSS81] t hat t he comput at ion of a Σ pd machine M ( x , s( | x | ) when t he input x is of lengt h n , gives rise t o a bounded dept h Boolean circuit C x of t he following type: T he input s are Boolean variables represent ing t he bit s s( n )[z ]. Wit h a slight abuse of not at ion we denot e t hem by z and z as well. T he Boolean circuit C x st art s wit h an OR gat e at t he t op, and alt ernat e wit h AND’s and OR’s wit h dept h d + 1, where t he bot t om level gat es have bounded fan-in at most m , and all ot her AND and OR gat es are unbounded fan-in, except by t he overall circuit size, which is bounded by m 2m . Wit hout loss of generality we may assume t he circuit is t ree like, except for t he input level. Our first idea is t o use random rest rict ions t o “kill” t he circuit . For any Boolean funct ion f over variables x 1 , . . . , x n , a ran dom restriction ρ (for some specified paramet er p) is a random funct ion t hat assigns each x i eit her 0, 1, or ∗ , wit h probability P r[ρ ( x i ) = ∗ ] = p and P r[ρ ( x i ) = 0] = P r[ρ ( x i ) = 1] = (1 − p) / 2, for each i independent ly. Assigning ∗ means t o leave it as a variable. Let f | ρ denot e a funct ion obt ained by t his random rest rict ion. It is known t hat aft er a random rest rict ion ρ (for a suit ably chosen paramet er p), a const ant dept h
On P roving Circuit Lower Bounds against t he P olynomial-T ime Hierarchy
207
circuit of suit able size is suffi cient ly weakened so as t o have small min-t erms and max-t erms. Result s of t his type are generally known as Swit ching Lemmas, and t he st rongest form known is due t o H˚ast ad [H˚as86a]. However it t urns out t hat we need a diff erent form, namely a decision t ree type Swit ching Lemma (see, e.g., [Cai86]), which is sat ed as follows. For an y depth d + 1 B oolean circuit C on M in puts z1 , z2 , . . . , zM , of size at m ost s an d bottom fan -in at m ost t , we have
Lem m a 1.
P r ρ [DC( C
|ρ
)
≥
t]
≤
s2− t ,
where the ran dom restriction ρ is defi n ed for p = 1/ (10t ) d , an d DC stan ds for decision tree com plexity.
To reduce all circuit s C x , x ∈ { 0, 1} n , t o small dept h decision t rees, we apply a random rest rict ion wit h p0 = 1/ (20m ) d t o t hese circuit s. T hen, C l a i m 2 P r ρ [ x ∈ { 0 , 1 } [DC( C x | ρ ) ≥ 2m ] ] ≤ 2n · ( m M )2− 2 m = m / 2m − n . n
Assume some random rest rict ion ρ t hat reduces all circuit s C x , x ∈ { 0, 1} n , t o dept h ≤ 2m decision t rees. T hen by assigning 0 every t ime t o t he “next variable” asked by each decision t ree, we can fix t he values of all decision t rees, which are in fact t he result s of M on all lengt h n input s. T he all-0 answers maint ain consist ency (t his is one place why we need decision t ree type Swit ching Lemma, rat her t han min/ max t erm bounds.) Since random rest rict ions assign ∗ t o p0 M variables on average , we may assume t hat t he rest rict ion ρ assigns ∗ t o at least p0 M / 2 variables. Hence, aft er t he random rest rict ion and t he decision t ree assignment s, we st ill have p0 M / 2 − 2m N ≫ N = 2n unassigned variables, which we want t o use t o encode t he (already fixed) values of C x , i.e., t he result of M on input x , for every x in { 0, 1} n . T he problem wit h t his idea is t hat aft er we have coded t he values of all t he N = 2n circuit s, t here does not seem t o be any easy way t o recover t his informat ion. We have N comput at ions t o code, and it is infeasible for t he final polynomial-size oracle circuit t o “remember” more t han a polynomial number of bit s as t he address of t he coding region. To overcome t his diffi culty, our next idea is t o use not t rue random rest rict ions, but pseudorandom rest rict ions via t he Nisan-Wigderson generat or (see, e.g., [NW94]). T he NW generat or generat es pseudorandom bit s provably indist inguishable from t rue random bit s by polynomial size const ant dept h circuit s. While our circuit s are not of polynomial size, t his can be scaled up easily. Our idea is t hen t o use t he out put of some NW generat or t o perform t he “random” rest rict ion, and t o argue t hat all N = 2n circuit s are “killed” wit h high probability, just as before wit h t rue random rest rict ions. T he basic argument is t hat no const ant dept h circuit s of an appropriat e size can t ell t he diff erence under eit her a t rue random assignment or a pseudorandom assignment coming from t he NW generat or. However, for our purpose in t his paper, we wish t o say t hat a cert ain behavior of t hese N const ant dept h circuit s — namely t hey are likely t o possess small dept h decision t rees aft er a “random” rest rict ion wit h 0, 1 and ∗ ’ s
208
J .-Y. Cai and O. Wat anabe
— is preserved when “pseudorandom rest rict ions” are subst it ut ed for “random rest rict ions”. In order t o use t he NW generat or, it is vit ally import ant t hat t he property t o be preserved be expressible it self by a const ant dept h circuit of an appropriat e size. T he idea t hen is t o design such a circuit D t hat “expresses” t his. However, t he property of having small dept h decision t rees is not easy t o express in const ant dept h. So t he next idea is t o use a con sequen ce of t his property, namely all C x | ρ are det ermined, by set t ing a subset of ∗ ’ s of cardinality ≤ 2m N all t o 0. T his property in t urn is suffi cient t o t he const ruct ion of s ( n ). More specifically, we design t he following circuit D : (a) Let L = ⌈ log2 p10 ⌉ ≈ dk log2 (20n ). D t akes Boolean input s ( a z , 1 , . . . , a z , L , bz ), for z ∈ { 0, 1} m ; t hat is, D has ( L + 1) M input variables. (b) For each z ∈ { 0, 1} m , a t uple ( a z , 1 , . . . , a z , L , bz ) is used t o simulat e a random rest rict ion ρ . T hat is, we define ρ ( z ) = ∗ if all a z , 1 , . . . , a z , L are 0; ot herwise, define ρ ( z ) = bz . (c) For given input bit s (which define ρ as explained above), D = 1 iff ∃ σ assigning ≤ 2m N many ∗ ’ s t o 0, such t hat ∀ x ∈ { 0, 1} n , C x | ρ | σ ≡ 0 or 1. We can const ruct such a circuit wit h reasonable size and dept h. T here exists a circuit D satisfyin g the above ( a) ∼ ( c) with size( D ) < 2 an d dept h( D ) ≤ 2d + 6 ≤ 3d − 1. Furtherm ore, from our con struction an d Claim 2, we have P r[ D = 1 ] ≥ 1 − m / 2m − n , where the probability is over un iform in put bits for D . ( B elow we will use d to den ote 3d − 1.) C la im 3 3m
2
Now we apply a NW generat or t o t his circuit D . First we recall some basic not ions on NW generat ors from [NW94]. Let U , M , m and q be posit ive int egers. Let [U ] be some set of cardinality U , e.g., { 1, 2, . . . , U } . A collect ion of subset s S = { S1 , . . . , SM } of some domain [U ] is called a ( m , q) -design if it sat isfies t he following condit ions: (i) ∀ i , 1 ≤ i ≤ M [ | Si | = q ], and (ii) ∀ i , ∀ j , 1 ≤ i = j ≤ M [ | Si ∩ Sj | ≤ m ]. Based on a given ( m , q)-design S = { S1 , . . . , SM } wit h domain [U ], we define t he following funct ion gS : { 0, 1} U → { 0, 1} M , which we call a (parity based) N W gen erator . gS ( x 1 ·
· · x U ) = y1 · · · yM , where each y i , 1 ≤ i ≤ M , is defined by y i = x s 1 ⊕ · · · ⊕ x s (where Si = q
{
s1 , . . . , sq }
[U ]). ⊆
For t he pseudorandomness of t his generat or, we have t he following lemma [NW94]. For an y positive in tegers U, M , m , q, s an d e, an d positive real ǫ , let gS be the N W gen erator defi n ed as above. S uppose for an y depth e + 1 circuit C on q in put bits an d of size at m ost s + cn w 2m M ( where cn w is som e con stan t) , the q bit parity fun ction u 1 ⊕ · · · ⊕ u q has the followin g bias: Lem m a 2.
P r( u , . . . , u 1
q
)∈
{
0, 1}
q
[C ( u 1 , . . . , u q ) = u 1 ⊕
· · · ⊕
uq ] −
1 2
ǫ ≤
M
.
On P roving Circuit Lower Bounds against t he P olynomial-T ime Hierarchy
209
T hen gS has the followin g pseudoran dom n ess again st an y depth e circuit E on M in put bits an d of size at m ost s.
P ry ∈
{
0, 1}
M
[E ( y ) = 1] − P r x ∈
{
0, 1}
U
[E ( gS ( x )) = 1]
≤
ǫ .
To apply t he NW generat or t o our dept h d circuit D const ruct ed above, we set t he paramet ers and define an ( m , q)-design as follows. We t ake a finit e field F , and set q = | F | and U = q2 . More specifically, t he finit e field we use is F = Z 2 [X ]/ ( X 2 · 3 + X 3 + 1) [vL91], where each element α ∈ F t akes K = 2 · 3u bit s, and q = | F | = 2K . We choose u so t hat q ≥ (3m 2 + 1) d + 2 . T hen 2 q1 / ( d + 2) ≥ log2 (23 m + cn w 2m M ), where cn w is t he const ant in t he above lemma. Clearly q ≤ n c k d will do, for some universal const ant c, for example c = 7. T hen K = O ( dk log n ). T hus, t his field has polynomial size and each element is represent ed by O (log n ) bit s. All arit hmet ic operat ions in t his field F are easy. We consider precisely M = 2m polynomials f z ( ξ ) ∈ F [ξ ], each of degree at most m , where each f z is indexed by it s coeffi cient s, concat enat ed as a bit sequence of lengt h exact ly m . T he precise manner in which t his is done is not very import ant , but for definit eness, we can t ake t he following. We t ake polynomials of degree δ = ⌊ m / K ⌋ wit h exact ly δ + 1 coeffi cient s, u
u
δ
f z ( ξ ) = cδ ξ
+ . . . + c1 ξ + c0 ,
where all cj varies over F , except cδ is rest rict ed t o exact ly 2m − K · δ many values. Not e t hat 0 ≤ m − K · δ < K . T he concat enat ion z = cδ · · ·c0 has exact ly m bit s. Each f z defines a subset of F × F of cardinality q, { ( α , f z ( α )) | α ∈ F } , which we denot e by Sz . A ( m , q)-design t hat we use is defined as S = { S1 , . . . , SM } , indexed by z ∈ { 0, 1} m , which is ident ified wit h { 1, . . . , M } . Not e t hat F × F is a domain [U ] wit h U = q2 . It is easy t o see t hat t his ( m , q)-design sat isfies t he condit ions (i) and (ii). T hen by a st andard argument we can prove t he following Our N W gen erator gS has the followin g pseudoran dom n ess again st 2 an y circuit E of size at m ost 23 m an d depth d :
C la im 4
P ry ∈
{
0, 1}
M
[E ( y ) = 1] − P r x ∈
{
0, 1}
U
[E ( gS ( x )) = 1]
≤
2m −
3m
2
.
Not e t hat our NW generat or gS generat es a pseudo random sequence of lengt h M = 2m from a seed of lengt h U = q2 . On t he ot her hand, recall t hat t he circuit D t akes ( L + 1) M Boolean input s, i.e., ( a z , 1 , . . . , a z , L , bz ), for z ∈ { 0, 1} m , where M = 2m and L = ⌈ log2 p10 ⌉ . Hence, t o provide t hese input values by our NW generat or, we run t he generat or for L + 1 t imes, using ( L + 1) q2 bit s, a ( 0) ( 1) (L ) sequence of independent ly and uniformly dist ribut ed bit s { u α , β , u α , β , . . . , u α , β } , (j )
for each α , β ∈ F . T hat is, for each j = 1, . . . , L , we use q2 bit s { u α , β | α , β ∈ F } t o generat e t he M Boolean values of a z , j , for z ∈ { 0, 1} m . Similarly, t he set ( 0) { uα ,β | α ,β ∈ F } of q2 bit s is used t o generat e t he M Boolean values of bz , for m z ∈ { 0, 1} . More specifically, for each z ∈ { 0, 1} m and j = 1, . . . , L , we define
210
J .-Y. Cai and O. Wat anabe
(j ) uα ,f = α ∈ F Claim 2 and Claim 4, we have
a z , j and bz by a z , j
Let
C la im 5
seed bits
1]
≥
{
1−
(i )
g
S
z
(α ) ,
and bz =
( 0)
α ∈
F
uα
,f
z
(α ) .
T hen from
den ote the pseudoran dom output sequen ce of gS on ran dom
(i )
( 1)
(L )
( 0)
u α , β | α , β ∈ F } , for 0 ≤ i ≤ L . T hen P r[D ( g S , . . . , g S , g S ) = o(1) , where the probability is over in depen den tly an d un iform ly dis( 0)
tributed bits { u α
,β
( 1)
, uα
,β
(L )
, . . . , uα
,β
}
, for α , β ∈
F
.
T his claim st at es t hat wit h high probability, a pseudorandom sequence sat isfies D , meaning t hat t he random rest rict ion induced from t he pseudorandom sequence reduces all C x t o simple funct ions (e.g., small decision t rees); more precisely, aft er t he rest rict ion, all t heir values can be det ermined by assigning at most 2m N addit ional variables t o 0. Next we will argue t hat , for such a pseudorandom rest rict ion, one can find some space t o encode t he det ermined value of each C x . Consider a rest rict ion induced by a pseudorandom sequence sat isfying D . Apply t his rest rict ion t o all variables z of circuit s C x , and fix furt her t he value of some set Y of variables t o 0 in order t o det ermine t he value of circuit s C x for all x ∈ { 0, 1} n . We may assume t hat t he size of Y is at most 2m 2n , which is guarant eed by t he fact t hat D = 1 wit h our pseudorandom sequence. T hen t here exist s y 0 of lengt h (1 + ǫ ) n < m / 2 such t hat a segment T y 0 = { z ∈ { 0, 1} m | y 0 is a prefix of z } has no int ersect ion wit h Y ; t hat is, all variables in T y 0 are free from any variables used t o fix t he value of circuit s C x . T his is simply because 2m 2n ≪ 2( 1+ ǫ ) n . Our plan is t o code t he result s of C x by Boolean variables z of t he form z = y 0 x w , for some “padding” w , where t he pseudorandom ρ had assigned a ∗ . T hese z are assigned ∗ by t he pseudorandom rest rict ion, and unlike t rue random rest rict ions, we can act ually comput e t heir locat ion in polynomial t ime from t he polynomially many seed bit s. W ith high probability a sequen ce of ran dom source bits u α , β satisfi es the followin g: for all cδ , . . . , c1 ∈ F , there exists c0 ∈ F such that z ∗ is assign ed ∗ by the pseudoran dom restriction in duced from the source bits, where z ∗ is a strin g in { 0, 1} m that represen ts cδ · · ·c1 c0 . Furtherm ore, this c0 can be com puted in polyn om ial tim e from u α , β an d cδ , . . . , c1 .
C la im 6
We now summarize our const ruct ion of t he advice st ring s( n ). Choose any set t ing of t he random bit s ω = u α , β , such t hat it generat es ( L + 1) M pseudorandom bit s Ω sat isfying bot h D = 1 and t he condit ion of Claim 6. Let ρ Ω be t he rest rict ion induced by t his pseudorandom sequence. We set s( n )[z ] = 0 or 1 if ρ Ω ( z ) = 0 or 1, respect ively. Next , choose a set Y ⊆ { 0, 1} m , where ρ Ω ( z ) = ∗ and | Y | ≤ 2m N , such t hat set t ing all t hese s( n )[z ] = 0 det ermines t he value of circuit s C x for all x ∈ { 0, 1} n . T his set Y is guarant eed by D = 1. T hen we set t hese s( n )[z ] = 0. T hen, fix one y 0 such t hat T y 0 ∩ Y = ∅ . T his y 0 exist s by t he pigeonhole principle. T hen for any x ∈ { 0, 1} n , set s( n )[z ] = 0 (resp. 1), for any z of t he form y 0 x w for some w , and ρ Ω ( z ) = ∗ , if and only if t he (already det ermined) value of C x is 0 (resp., 1). Set all remaining s( n )[z ] = 0.
On P roving Circuit Lower Bounds against t he P olynomial-T ime Hierarchy
211
Finally we explain how t o design a polynomial-size circuit C M simulat ing ( x ; s( | x | ). We may assume t hat t he informat ion on t he seed ω (of lengt h ( L + 1) q2 = n O ( k d ) ) and y 0 are hardwired int o t he circuit and t hey can be used in t he comput at ion. For a given input x , t he circuit comput es a locat ion z ∗ represent ed by cδ , . . . , c0 corresponding t o y 0 x w sat isfying t he condit ion of Claim 6. When z ∗ is obt ained, t he circuit queries t he bit s( | x | )[z ∗ ] and accept s t he input if and only if s( | x | )[z ∗ ] = 1. T herefore, t he whole comput at ion can be implement ed by some circuit of size n c k d for some const ant c > 0. M
R e fe re n c e s [BCGKT ] N. Bshouty, R. Cleve, R. Gavald`a , S. Kannan, and C. Tamon, Oracles and queries t hat are suffi cient for exact learning, J . C om pu t . an d Sy st em Sci . 52(3), 421–433, 1996. [BF T 98] H. Buhrman, L. Fort now, and T . T hierauf, Nonrelat ivizing separat ions, in P r oc. t he 13t h I E E E C on f er en ce on C om pu t at i on al C om pl exi t y (CCC’ 98), IEEE, 8–12, 1998. [Cai86] J -Y. Cai, W it h probability one, a random oracle separat es P SPACE from t he polynomial-t ime hierarchy, in P r oc. 18t h A C M Sy m posi u m on T heor y of C om pu t i n g (ST OC’ 86), ACM, 21–29, 1986. See also t he journal version appeared in J . C om pu t . an d Sy st em Sci . 38(1): 68–85 (1989). [Cai01] J -Y. Cai, SP2 ⊆ ZP P N P , in P r oc. 42t h I E E E Sy m posi u m on F ou n dat i on s of C om pu t er Sci en ce (FOCS’ 01), IEEE, 620–628, 2001. [CW 03] J -Y. Cai and O. Wat anabe, Research Report C-167, Dept . of Mat h. Comput . Sci., Tokyo Inst . of Tech., 2003. Available from www.is.titech.ac.jp/research/research-report/C/index.html. [F SS81] M. Furst , J . Saxe, and M. Sipser, P arity, circuit s, and t he polynomial t ime hierarchy, in P r oc. 22n d I E E E Sy m posi u m on F ou n dat i on s of C om pu t er Sci en ce (FOCS’ 81), IEEE, 260–270, 1981. [H˚as86a] J . H˚ast ad, Almost opt imal lower bounds for small dept h circuit s, in P r oc. 18t h A C M Sy m posi u m on T heor y of C om pu t i n g (ST OC’ 86), ACM, 6–20, 1986. [He84] H. Heller, On relat ivized polynomial and exponent ial comput at ions, SI A M J . C om pu t . 13(4), 717–725, 1984. [Kan82] R. Kannan, Circuit -size lower bounds and non-reducibility t o sparse set s, I n f or m at i on an d C on t r ol , 55, 40–56, 1982. [KL80] R.M. Karp and R.J . Lipt on, Some connect ions between nonuniform and uniform complexity classes, in P r oc. 12t h A C M Sy m posi u m on T heor y of C om pu t i n g (ST OC’ 80), ACM, 302–309, 1980. [KW 98] J . K¨obler and O. Wat anabe, New collapse consequences of NP having small circuit s, SI A M J . C om pu t . , 28, 311–324, 1998. [MVW 99] P.B. Milt ersen, N.V. Vinodchandran, and O. Wat anabe, Super-P olynomial versus half-exponent ial circuit size in t he exponent ial hierarchy, in P r oc. 5t h A n n u al I n t er n at i on al C on f er en ce on C om pu t i n g an d C om bi n at or i cs (COCOON’ 99), Lect ure Not es in Comput er Science 1627, 210–220,1999. [NW 94] N. Nisan and A. W igderson, Hardness vs randomness, J . C om pu t . Sy st . Sci . 49, 149–167, 1994. [vL91] J . van Lint , I n t r odu ct i on t o C odi n g T heor y , Springer-Verlag, 1991.
T h e C o m p le x it y o f B o o le a n M a t rix R o o t C o m p u t a t io n Mart in Kut z⋆ Freie Universit ¨a t Berlin, Germany [email protected]
A b s t r a c t . We show t hat finding root s of Boolean mat rices is an N P hard problem. T his answers a twenty year old quest ion from semigroup t heory. Int erpret ing Boolean mat rices as direct ed graphs, we furt her reveal a connect ion between Boolean mat rix root s and graph isomorphism, which leads t o a proof t hat for a cert ain subclass of Boolean mat rices relat ed t o subdivision digraphs, root finding is of t he same complexity as t he graph-isomorphism problem.
1
In t ro d u c t io n
Mult iplicat ion of Boolean zero-one mat rices is defined as ordinary mat rix mult iplicat ion wit h + and · replaced by t he Boolean operat ions ∨ and ∧ . So t he mat rix product C = A B is given by
ci j
n
= h
=1
ai h ∧
bh j ,
and as wit h mat rices over fields, t he k t h power A k of a Boolean n × n mat rix A is simply t he k -fold product of A wit h it self. Besides it s t heoret ical relevance for semigroup t heory, Boolean mat rix algebra serves as a fundament al t ool in algorit hmic graph t heory. Effi cient algorit hms for t ransit ive-closure or short est -pat h comput at ions rely on t he int erpret at ion of direct ed graphs as Boolean mat rices [16,1,3]. In t his work, we invest igat e t he comput at ional complexity of finding root s of a given Boolean mat rix. A k t h root of a square Boolean mat rix B is some ot her mat rix A whose k t h power A k equals B . T wenty years ago, in t he open problems sect ion of his book [9], Kim asked if given a mat rix B , such a root A can be comput ed in polynomial t ime or whet her t his problem is perhaps N P complet e. (Act ually, he inquired for t he case k = 2 only.) We give an answer t o t hat quest ion. T h eor em 1 . Deciding whether a square B oolean m atrix has a com plete for each single param eter k ≥ 2. ⋆
k th
root is N P -
Member of t he European graduat e school “Combinat orics, Geomet ry, and Comput at ion” support ed by t he Deut sche Forschungsgemeinschaft , grant GRK 588/ 2.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 212–221, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
T he Complexity of Boolean Mat rix Root Comput at ion
213
Wit h t he “right ” comput at ional problem for t he reduct ion, t he proof of t his result t urns out surprisingly simple. T his is quit e remarkable since it t hus relat es Boolean mat rix root s t o a well-known N P -complet e problem, which yields insight in t he local st ruct ure of Boolean mat rices. In t he second, t echnically more challenging part of our work, we reveal furt her propert ies of mat rix root s which show a close relat ion t o graph isomorphism. T his event ually leads t o a proof t hat for a cert ain subclass of Boolean mat rices k t h root comput at ion is graph-isomorphism complet e. Before we can st at e t his result precisely, we have t o swit ch from mat rices t o t he graph t heoret ic point of view. Act ually, t hroughout t his whole exposit ion we shall int erpret Boolean mat rices as adjacency mat rices of direct ed graphs. B oolean M atrices and Graph T heory. Any Boolean
n × n mat rix A = ( a i j ) can be int erpret ed as a direct ed graph D on t he vert ex set { 1, . . . , n } wit h an arc from j t o i iff a i j = 1. So D may have loops but no mult iple arcs. T he k t h power of D , k ∈ N, is t he direct ed graph D k defined on t he same vert ex set and wit h an arc from a t o b if and only if t here is a direct ed walk of lengt h exact ly k from a t o b in D (possibly visit ing some vert ices several t imes); compare t he figure. It is easy t o see t hat t he adjacency mat rix of D k is in fact t he k t h power of t he adjacency mat rix of D (see, for example, [18]).1
So t aking t he graph t heoret ic point of view, we invest igat e t he k t h-root problem for digraphs: g i v en a d i r ec t ed g r a p h D , d o es t h er e ex i st a n o t h er d i g r a p h R k ( o n t h e sa m e v er t ex set ) su c h t h a t R = D . Our answer t o t he guiding quest ion t hen reads as follows. T h eor em 1 ( d igr a p h v er sion ) . Deciding whether a digraph has a k t h root is N P -com plete
for each single param eter
k
≥
2.
Our second main result , which relat es root s t o isomorphisms, is based on subdivisions, defined as follows. D efi n it ion 1 . T he complet e subdivision of a digraph D is the digraph obtained
by replacing each arc a → b of D by a new vertex x a b and the two arcs → b . W e call a digraph a subdivision digraph if it is (isom orphic to) the com plete subdivision of som e digraph.
from
D
a
xab
1
→
Alt ernat ively, one might view a Boolean mat rix as a binary relat ion. T hen t he k t h mat rix power is simply t he k -fold composit ion of t his relat ion.
214
M. Kut z
Subdivisions are a fundament al not ion in graph t heory. But opposed t o t heir common usage in relat ion wit h t opological minors, we employ t hem here t o equip our graphs wit h a cert ain st iff ness t hat makes root finding comput at ionally simpler. In fact , under an addit ional minor degree condit ion on which we shall comment lat er, we can show t hat finding root s of such graphs is of t he same complexity as t he graph-isomorphism problem. T h eor em 2 . Deciding whether a subdivision digraph with positive m inim al in-
degree and outdegree has a param eter k ≥ 2.
k th
root, is graph-isom orphism com plete for each
Graph Isom orphism . T he graph-isomorphism problem asks: 2
a r e t w o g i v en ( d i ) -
It is neit her known t o have a polynomial-t ime solut ion nor is it known t o be N P -complet e. On t he cont rary, it is a prime candidat e for a problem st rict ly between P and N P -complet eness (cf. [10] and [12]). A comput at ional problem of t he same complexity as t he graph-isomorphism problem is called graph-isom orphism com plete , or simply isom orphism com plete because isomorphism problems for several algebraic or combinat orial st ruct ures fall int o t his class. For example, isomorphism of semigroups and finit e aut omat a [2], finit ely represent ed algebras, or convex polyt opes [8]. Ot her problems ask for propert ies of t he aut omorphism group of a graph, for example, comput ing t he size of t he aut omorphism group or it s orbit s [14].3 Finally, several rest rict ions of t he graph-isomorphism problem are known t o remain isomorphism complet e, as for example isomorphism of regular graphs [2]. As t he above list indicat es, act ually all problems known t o be isomorphism complet e are more or less obviously isomorphism problems of various combinat orial st ruct ures. Hence, t he relat ion between digraph root s and graphs isomorphism est ablished t hrough T heorem 2 may come quit e as surprise. T heorem 2 rest s on a st ruct ural result which st at es t hat any k t h root of a subdivision digraph D essent ially est ablishes a one-t o-one correspondence between k isomorphic subgraphs of D (T heorem 3). Due t o space const raint s, we shall only sket ch t he proofs of T heorems 1, 2, and 3, st at ing some of t he cent ral lemmas t hat pave t he way. gr ap h s
2
i so m o r p h i c o r n o t ?
R e la t e d W o rk — R e la t e d Q u e s t io n s
Over t he field of complex numbers or t he reals, mat rix root s are a well-st udied and st ill up-t o-dat e t opic of linear algebra [11,7,17]. But result s from t hat field of research do generally not apply t o Boolean mat rices. While it is known, for example, t hat every regular mat rix over t he complex numbers has a k t h root for 2
3
One usually considers undirect ed graphs but it is well-known and easily seen t hat wit h respect t o t heir comput at ional complexity t he undirect ed and direct ed version of t he problem are equivalent . T he lat t er two problems are known t o be isomorphism complet e only in t he weaker sense of Turing reduct ion, as opposed t o t he concept of many-one reduct ion.
T he Complexity of Boolean Mat rix Root Comput at ion
215
any k ≥ 2 [17], t his is not t rue for Boolean mat rices, as t he invert ible mat rix 01 10 shows. Furt her, complex or real mat rices are amenable t o numerical met hods like Newt on it erat ion [6], whereas such t echniques clearly do not apply t o Boolean mat rices. When it comes t o root s, Boolean mat rices don’ t seem t o have much in common wit h mat rices over C since t he former behave much more rigidly t han t he lat t er. T he sit uat ion is, however, slight ly diff erent if we ask for powers of a mat rix inst ead of root s. T here are t heoret ical result s on Boolean mat rix powers [4] and in pract ice we can of course comput e t he k t h power of a Boolean mat rix A by t reat ing it as a mat rix over t he reals. We calculat e A k over R and aft erwards replace each posit ive ent ry wit h 1. T his simple reformulat ion allows us, for example, t o apply fast mat rix mult iplicat ion met hods such as St rassen’ s t o pat h problems in graphs [16,1]. But t his simulat ion t hrough mat rices over t he reals clearly only works because t here cannot happen cancellat ion between posit ive and negat ive ent ries. For root finding, such simulat ion over R or C would lead int o ma jor problems. A lternative N otions of Graph P owers. A problem similar t o t he one at hand
has been discussed by Motwani and Sudan. In [15] t hey showed t hat comput ing square root s of undirect ed graphs is N P -hard. But t heir not ion of graph powers diff ers from ours in two import ant point s. T hey consider undirect ed graphs only, which corresponds t o having bidirect ional edges in our set t ing. T his not only rest rict s t he set of possible input s but also—and t his is t he decisive diff erence—t he solut ions. For example, t he fourvert ex graph consist ing of two disjoint bidirect ional arcs has t he direct ed 4-cycle as a square root , but no undirect ed graph can be a root . Furt her, Motwani and Sudan define squaring t o maint ain exist ing edges, which in our set t ing would corresponds t o at t aching loops t o all vert ices. T his monot onicity ensures t hat much informat ion of t he underlying graph can be read off from it s square and t he hardness proof of [15] makes essent ial use of t his property. In cont rast t o t his, squaring a digraph under t he rules derived from Boolean mat rix mult iplicat ion can almost complet ely dest roy t he neighborhood informat ion and may even decompose t he digraph. Act ually, most of our argument s depend crucially on such “vanishing edges.” So apparent ly, t he squares in [15] and our not ion of powers are essent ially diff erent concept s.
3
N P - C o m p le t e n e s s
We now sket ch t he proof of T heorem 1, present ing t he two main ingredient s for our N P -complet eness result : a suit able N P -complet e problem and a many-one reduct ion from t hat problem t o digraph root s. Surprisingly, t he reduct ion is very st raight forward, it goes wit hout any sophist icat ed gadget s. T his simplicity indicat es t hat t he two problems are act ually very closely relat ed. While skipping t he det ails of t he correct ness proof here, we elaborat e a bit on t he reduct ion t o visualize and endorse t his claim. T he appropriat e problem for our reduct ion is t he set-basis problem :
216
M. Kut z
Let C be a collect ion of subset s of some finit e set S . A set basis of C is anot her collect ion B of subset s of S such t hat each C ∈ C can be writ t en as a union of set s from B. Given a finit e set S t oget her wit h such a collect ion C of subset s of S and an int eger r ≤ | S | , t he set-basis problem asks whet her t here exist s a set basis B for C consist ing of at most r set s. T his problem is known t o be N P -complet e [19]. T he R eduction. T he key idea for t he reduct ion st ems from t he following general observat ions about digraph square root s. Consider some set X of vert ices of a digraph D and let Z denot e all out neighbors of vert ices in X . Let us assume for simplicity t hat X and Z are disjoint , so in part icular, t here are no loops or cycles. T hen in a square root of t he digraph D , any of t he arcs from X t o Z must be realized as walks of lengt h two and since t here are no loops, t hese walks are act ually pat hs. Hence, in t he root t here must exist a set Y of “int ermediat e vert ices” t hrough which all t hese pat hs can pass. If now—for what ever reason—t here is only a small number of such int ermediat e vert ices available, | Y | ≤ r , say, wit h r a lit t le smaller t han | Z | , t hese pat hs have t o int eract in order t o ship all t heir informat ion from X t o Z . We claim t hat t he t he square-root problem for t hese set s X , Y , and Z is not hing but a set -basis inst ance. T his is easily seen by int erpret ing Z as t he ground set S and X as a collect ion of subset s of S , defined t rough cont ainment relat ions given by t he original D -arcs. T he vert ices in Y represent t he set basis where t he root arcs from Y t o Z define t he subset s and t he arcs from X t o Y t ell us how t o represent set s in X as unions of Y -set s. In order t o t urn a set -basis inst ance int o a digraph, we simply draw t he cont ainment graph of t he set syst em C on S and provide t he right number of int ermediat e vert ices. In t he general case of k t h root s t hat would be k − 1 t imes r vert ices, which we leave almost isolat ed except for some framework arcs t o ensure t hat any root uses t hem as int ended. Interpretation. We emphasize t hat t he given set -basis inst ance is complet ely maint ained by our reduct ion. It s cont ainment relat ions are encoded one-t o-one by arcs of t he digraph. Moreover, t he preceding discussion shows t hat an inst ance of t he digraph-root problem can be seen as a large collect ion of int eract ing set basis problems. One might well argue t hat finding digraph root s is act ually a generalized set -basis problem. As a corroborat ion for t his point of view we ment ion t hat t he set -basis problem already appeared before in connect ion wit h Boolean mat rix algebra. Markowsky [13] used it in a very economic proof for t he N P -complet eness of Schein-rank comput at ion.4
4
Analogous t o t he mat rix rank over fields, t he Schei n r an k of a Boolean mat rix A is t he minimal int eger ρ such t hat A can be represent ed as a Boolean sum A = = 1c r , where t he c are column and t he r row vect ors wit h zero-one ent ries [9, Sec. 1.4]. ρ
i
i
i
i
i
T he Complexity of Boolean Mat rix Root Comput at ion
4
217
R o o t s a n d Is o m o rp h is m
In t his second part , we est ablish t he isomorphism-complet eness result of T heorem 2. Our considerat ions are guided by t he following fundament al connect ion between digraph root s and digraph isomorphism. P r op osit ion 1 . Let D = D
digraphs
D 1, . . . , D
k . T hen
1∪˙D 2∪˙· · ·∪˙D
D
has a
k th
k be the disjoint union of root.
k
isom orphic
Because t he proof is short , inst ruct ive, and of import ance for t he general underst anding of T heorem 2, we briefly sket ch t he ideas. We const ruct t he sought aft er root R on t he vert ices of D from t he isomorphisms ϕ i : D 1 → D i , 1 ≤ i ≤ k ( ϕ 1 being simply t he ident ity). For each vert ex a of D 1 , we let R cont ain t he pat h ϕ 1 ( a ) → ϕ 2 ( a ) → · · · → ϕ k ( a ) and addit ionally t he arcs ϕ k ( a ) → b for all D -out neighbors b of a . T he following figure shows a local pict ure of t his const ruct ion. (T he cont inuous lines form t he root , t he dashed lines t he given D .) One easily verifies t hat in fact , R k = D .
Obviously it was essent ial t o swit ch from mat rices t o digraphs. While it might be possible t o carry out our N P -complet eness proof in t erms of mat rices, t he st at ement and proof of P roposit ion 1 clearly belong t o t he realm of graph t heory. I d en t ify in g Su b d iv ision V er t ices
T he crucial st ep t owards our isomorphism-complet eness result is t o show t hat subdivision digraphs almost sat isfy a converse of P roposit ion 1. T hat is, any root of such a digraph carries an isomorphism st ruct ure of it s component s. However, we have t o t ake care of some degenerat e cases t hat do not fit int o t his pict ure. Usually in a subdivision digraph, one can easily dist inguish t he original vert ices, commonly called t he branching vertices , from t he subdivision vertices . In fact , a subdivision digraph is obviously bipart it e and as soon as every weakly connect ed component cont ains at least one vert ex whose indegree or out degree diff ers from 1, t he two classes can be uniquely ident ified. A problem arises wit h subdivision digraphs t hat cont ain isolat ed cycles (of even lengt h). In such component s, all vert ices look like subdivision vert ices and t his absence of clearly ident ifiable branching vert ices leads t o untypical behavior wit h respect t o root finding. Fort unat ely, isolat ed cycles are simple ob ject s and we can complet ely describe t heir powers.
218
M. Kut z
L em m a 1 . T he k t h power of a directed cycle of length r is the disjoint union
of gcd( r , k ) cycles of length
r/
gcd( r , k ) .
As a consequence, isolat ed cycles clearly cannot have t he isomorphism property we are looking for. But t his is no problem. It t urns out t hat a vert ex t hat lies on an isolat ed cycle of a subdivision digraph D must also lie on an isolat ed cycle in any root of D . T hus, wit h respect t o root s, cycle vert ices do not int eract wit h t he ot her vert ices of a subdivision digraph and so we may in t he following rest rict our at t ent ion t o subdivision digraphs wit hout cycles. T hen each vert ex can really be uniquely ident ified as subdivision or branching vert ex. F r om R o ot s t o I som or p h ism s
Wit h all isolat ed cycles removed, subdivision digraphs now bear t he desired isomorphism st ruct ure, under t he unfort unat ely indispensable addit ional condit ion t hat each vert ex has at least one inneighbor and one out neighbor. T h eor em 3 . A subdivision digraph without isolated cycles and with positive m inim al indegree and outdegree has a k t h root if and only if it is the disjoint union of k isom orphic digraphs.
T he proof of T heorem 3 is lengt hy and rat her t echnical and we have t o omit t he det ails due t o space const raint s, but t he key ideas are easily explained: Recall t he long root pat hs in t he proof of P roposit ion 1. Each inner vert ex had indegree and out degree exact ly 1 in R . T heorem 3 rest s on t he fact t hat conversely, any root of a subdivision digraph sat isfying t he precondit ions has exact ly t his st ruct ure, i.e., it consist s mainly of pat hs of lengt h k − 1 on which no ot her pat hs ent er or leave. From t hose pat hs one can read off t he desired isomorphisms. Let us subst ant iat e t hese ideas by st at ing some of t he cent ral lemmas. Long P aths. Our aim is t o assign each vert ex of R t o a pat h of exact ly k vert ices, t he beginning and end of which shall be uniquely det ermined. L em m a 2 . Let R be a k t h root of a subdivision digraph D without isolated cycles. T hen any subdivision vertex of D lies on an R -path a 1 → a 2 → · · · → a k of length k − 1 where each a i , 1 ≤ i ≤ k , is a subdivision vertex of D . M oreover, such a path is m axim al in the sense that the inneighbors of a 1 and the outneighbors of a k are branching vertices of D .
T here exist s an analog of Lemma 2 for branching vert ices, which looks almost t he same, wit h t he except ion t hat we have t o forbid isolat ed vert ices. So here t he degree condit ion of T heorem 3 ent ers t he first t ime, in a weakened form. An at t empt t o prove Lemma 2 direct ly, faces a principal problem: subdivision vertex and branching vertex are global not ions. A branching vert ex wit h indegree and out degree 1 is locally indist inguishable from a subdivision vert ex. We resolve t his ambiguity by ignoring t he global pict ure for a moment , calling a vert ex thin if it looks like a subdivision vert ex, i.e., if it has indegree and out degree 1 in D . For such vert ices, we can prove a preliminary version of Lemma 2.
T he Complexity of Boolean Mat rix Root Comput at ion L em m a 3 . Let R be a k t h root of a subdivision digraph D and let a 0
be an T hen all a i , 1 ≤ · · · →
al
-walk of length l ≤ k between two D -thin vertices i < l , are also thin (with respect to D ).
R
a0
→
219 a1
and
→
al .
T he argument s employed in t he proof of Lemma 3 are typical for most of our int ermediat e result s on t he way t o T heorem 3. T hinness in D t ells us t hat all R -walks st art ing from a 0 and a l have t o meet again aft er exact ly k st eps. We use t hese confluent walks t o “sandwich” R -walks t hat st art from one of t he int ermediat e vert ices a i , showing t hat t hose walks also meet again aft er a cert ain number of st eps. T hinness of a i in D finally follows from t he simple but import ant observat ion t hat in a subdivision digraph, two diff erent vert ices cannot have common inneighbors and common out neighbors at t he same t ime. Combining Lemma 3 wit h it s analog for non-t hin vert ices event ually leads t o a proof of Lemma 2 and it s count erpart for branching vert ices. Unique A rcs. In order t o use t he pat hs from t he preceding paragraph for isomorphism const ruct ion, we have t o make sure t hat t hey indeed est ablish one-t o-one correspondences. T herefore we show t hat t hose pat hs do not int erfere, i.e., t hey must only t ouch at t heir end vert ices. As above, we resort t o t he t echnical not ion of t hinness. L em m a 4 . Let R be a k t h root of a subdivision digraph D and let a , b be two thin vertices of D with a → b in R . T hen there are no further R -arcs leaving a or entering b.
Again, we have an analog of t his lemma for pairs of non-t hin vert ices but once more we have t o be careful about t he exist ence of neighbors, which was t rivially guarant eed for t hin vert ices. In t he next lemma, t he addit ional degree condit ion of T heorem 3 is indispensable. L em m a 5 . Let R be a k t h root of a subdivision digraph D . Let a , b be two nonthin vertices of D with a → b in R such that a has an outneighbor and b has an inneighbor in D . T hen there are no further R -arcs leaving a or entering b.
T he two preceding lemmas nat urally lift t o st at ement s about subdivision and branching vert ices, t he only problem being t o show t hat of two adjacent branching vert ices eit her bot h are t hin or neit her is, which is not t oo diffi cult . Concluding the P roofs. T he st at ement of T heorem 3 is now obt ained by “in-
vert ing” t he proof of P roposit ion 1. T he pat hs provided by Lemma 2 est ablish correspondences between k disjoint subgraphs of t he digraph D and wit h t he help of Lemmas 4 and 5 t his can be done in a unique and consist ent way. T heorem 2 t hen comes as a direct consequence. Isolat ed cycles are comput at ionally easy t o deal wit h, as we already argued. We should specify t hat t he reduct ion from root finding t o isomorphism finding is act ually a Turing reduct ion, which means t hat we can find root s in polynomial t ime on a Turing machine t hat may call an isomorphism oracle several t imes at unit cost . Not e t hat we cannot t urn it int o a st ronger many-one reduct ion (Karp reduct ion) by
220
M. Kut z
simply checking whet her k copies of one component of t he given digraph D are isomorphic t o D it self because t he k isomorphic subgraphs of D need not be connect ed. T he ot her reduct ion, from isomorphisms t o root s, however, can be done in a many-one fashion as P roposit ion 1 shows. D r op p in g t h e D egr ee C on d it ion
Let us indicat e what can happen in a subdivision digraph t hat cont ains vert ices wit hout in– or out neighbors. T he following figure shows such a digraph D t oget her wit h a square root R .
T he two t opmost root arcs can t ouch since t he precondit ion of Lemma 5 does not hold. Observe t hat inst ead of being t he disjoint union of two isomorphic subgraphs, t he left component can be decomposed int o two part s, A and B (t he former consist ing of t he two pat hs on t he left , t he lat t er cont aining t he remaining five vert ices) such t hat t here exist s a surject ive hom om orphism from A ont o B (i.e., an arc-preserving map). T his homomorphism corresponds exact ly t o t hose arcs of R t hat go from A t o B . T his example is only meant t o indicat e t he phenomena t hat might show up. T he general sit uat ion is more diffi cult t o analyze and it is not clear whet her t he digraph root problem remains isomorphism complet e under t hese relaxed condit ions since t he general homomorphism problem for graphs is N P -complet e [5].
5
O u t lo o k
While t he original problem, t he open complexity st at us of Boolean mat rix root comput at ion is now set t led, t he discovered relat ion t o graph isomorphism raises new quest ions. First of all, it would be desirable t o get rid of t he degree condit ion of T heorem 2. T hough t his rest rict ion t urned out indispensable for underlying st ruct ural st at ement of T heorem 3, it is not clear whet her it might be possible t o eliminat e it from t he complexity result since t hat would lead t o special homomorphism problems which t ake us closer t o t he world of N P -hardness. More generally, we may ask for relaxat ions of t he concept of subdivisions t hat st ill serve t he t ask of “deact ivat ing” comput at ionally hard aspect s of root finding, t hus keeping t he problem isomorphism complet e. If one t races t he det ails of our proofs, not ions like bounded t ree widt h appear promising and might lead
T he Complexity of Boolean Mat rix Root Comput at ion
221
t o weaker condit ions for isomorphism complet eness. Event ually, t he problem of Boolean mat rix root comput at ion could t urn out t o be a suit able ob ject for analyzing t he “boundary” between isomorphism complet eness and N P -hardness.
R e fe re n c e s 1. A. V. Aho, M. R. Garey, and J . D. Ullman. T he t ransit ive reduct ion of a direct ed graph. SI A M J our n al on C om put i n g, 1(2):131–137, 1972. 2. Kellogg S. Boot h. Isomorphism t est ing for graphs, semigroups, and finit e aut omat a are polynomially equivalent problems. SI A M J our n al on C om put i n g, 7(3):273–279, 1978. 3. T homas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest . I n t r oduct i on t o A lgor i t hm s, chapt er 26. MIT P ress, 1990. 4. Bart de Schut t er and Bart de Moor. On t he sequence of consecut ive powers of a mat rix in a Boolean algebra. SI A M J our n al on M at r i x A n alysi s an d A ppli cat i on s, 21(1):328–354, 1999. 5. P avol Hell and J aroslav Neˇsetˇr il. On t he complexity of H -coloring. J our n al of C om bi n at or i al T heor y, Ser i es B , 48:92–110, 1990. 6. Nicholas J . Higham. Newt on’ s met hod for t he mat rix squareroot . M at hem at i cs of C om put at i on , 46(174):537–549, 1986. 7. C. R. J ohnson, K. Okubo, and R. Reams. Uniqueness of mat rix square root s and an applicat ion. L i n ear A lgebr a an d A ppli cat i on s, 323:52–60, 2001. 8. Volker Kaibel and Alexander Schwart z. On t he complexity of isomorphism problems relat ed t o polyt opes. To appear in G r aphs an d C om bi n at or i cs. 9. Ki Hang Kim. B oolean m at r i x t heor y an d appli cat i on s. Marcel Dekker, Inc., 1982. 10. J ohannes K¨obler, Uwe Sch¨oning, and J acobo Tor´a n. T he gr aph i som or phi sm pr oblem . Birkh¨a user, 1993. 11. Ya Yan Lu. A P ad´e approximat ion met hod for square root s of symmet ric posit ive definit e mat rices. SI A M J our n al on M at r i x A n alysi s an d A ppli cat i on s, 19(3):833– 845, 1998. 12. Anna Lubiw. Some NP -complet e problems similar t o graph isomorphism. SI A M J our n al on C om put i n g, 1981. 13. George Markowsky. Ordering D-classes and comput ing Shein rank is hard. Sem i gr oup For um , 44:373–375, 1992. 14. Rudolph Mat hon. A not e on t he graph isomorphism count ing problem. I n for m at i on P r ocessi n g L et t er s, 8(3):131–132, 1979. 15. Ra jeev Motwani and Madhu Sudan. Comput ing root s of graphs is hard. D i scr et e A ppli ed M at hem at i cs, 54(1):81–88, 1994. 16. Ian Munro. Effi cient det erminat ion of t he t ransit ive closure of a direct ed graph. I n for m at i on P r ocessi n g L et t er s, 1:56–58, 1971. 17. P anayiot is J . P sarrakos. On t he m t h root s of a complex mat rix. T he E lect r on i c J our n al of L i n ear A lgebr a , 9:32–41, 2002. 18. Kennet h A. Ross and Charles R. B. Wright . D i scr et e m at hem at i cs, chapt er 7.5. P rent ice-Hall, second edit ion, 1988. 19. Larry L. St ockmeyer. T he minimal set basis problem is NP -complet e. IBM Research Report No. RC-5431, IBM T homas J . Wat son Research Cent er, 1975.
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended R egular Expressions⋆ Hiroaki Yamamot o1 and Takashi Miyazaki 2 1
Depart ment of Informat ion Engineering, Shinshu University, 4-17-1 Wakasat o, Nagano-shi, 380-8553 Japan. [email protected] 2 Nagano Nat ional College of Technology, 716 Tokuma, Nagano-shi, 381-8550 Japan. [email protected]
A bst ract . T his paper addresses t he ext ended regular expression mat ching problem: given an ext ended regular expression (a regular expression wit h int ersect ion and complement ) r of lengt h m and a t ext st ring x = a1 · · · an of lengt h n, find all occurrences of subst rings which mat ch r . We will present a new bit -parallel pat t ern mat ching algorit hm which runs in O((mn 2 + ex(r )n 3 )/ W ) t ime and O((mn + ex(r )n 2 )/ W ) space, where ex(r ) is t he number of ext ended operat ors (int ersect ion and complement ) occurring in r , and W is word-lengt h of a comput er. In addit ion, we act ually implement t he proposed algorit hm and evaluat e t he performance.
1
I nt roduct ion
Regular expression mat ching algorit hms have been ext ensively st udied and implement ed in many applicat ion softwares [1,3,4,5,8,9,10,11]. Ext ended regular expressions (EREs) are REs wit h int ersect ion and complement operat ors, and seem t o off er a more flexible searching syst em. We here consider t he ERE mat ching problem as follows: Given an ERE r of lengt h m and a t ext st ring x = a1 · · · an of lengt h n , find all occurrences of subst rings which mat ch r . Namely, we are searching for t he set F = { ( i , j ) | ai · · · aj ∈ L ( r ) } , where L ( r ) denot es t he language denot ed by r . For example, given r = (( a∨ b) ∗ aa( a∨ b) ∗ ) ∧ ( ¬ (( a∨ b) ∗ bb( a∨ b) ∗ )) and x = aabbaabb, t he desired set F becomes { (1, 2) , (1, 3) , (4, 6) , (4, 7) , (5, 6) , (5, 7) } because r denot es t he set of st rings over { a, b} such t hat aa appears but not bb. It is widely known t hat such a pat t ern mat ching problem can be solved by using a recognit ion algorit hm. T he st andard recognit ion algorit hm for REs runs in O( mn ) t ime and O( m ) space, based on nondet erminist ic finit e aut omat a (NFAs for short ) [1,2,7]. Myers [8] has improved t his algorit hm so t hat it runs in O( mn/ log n ) t ime and space. T hus, for REs, effi cient algorit hms based on NFAs have been present ed, and have been used for t he RE mat ching problem. As for EREs, Hopcroft and Ullman [7] first gave a recognit ion algorit hm based on t he induct ive definit ion of EREs, which runs in O( mn 3 ) t ime and ⋆
T his research has been support ed by t he REFEC
T . W ar now and B . Zhu ( E ds.) : COCOON 2003, L N CS 2697, pp. 222–231, 2003. c Spr i nger -Ver l ag B er l i n H ei del b er g 2003
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended Regular Expressions
223
O( mn 2 ) space. K night and Myers [5] and Hirst [6] gave ot her recognit ion algorit hms, which run fast er t han Hopcroft ’s one for some kinds of EREs. Recent ly, Yamamot o [12] has given a new recognit ion algorit hm for EREs which runs in O( mn 2 + kn 3 ) t ime and O( mn + kn 2 ) space in t he worst case, where k is a number less t han t he number of ext ended operat ors (t hat is, int ersect ion and complement ) in r . His algorit hm is a nat ural ext ension of t he NFA-based algorit hm for REs. It is obvious t hat we can easily solve t he ERE mat ching problem by applying such recognit ion algorit hms t o all t he suffi xes ai · · · an of x = a1 · · · an , alt hough t his causes an n -fold slowdown comparing t o recognit ion algorit hms. In t his paper, we will ext end Yamamot o’s algorit hm t o t he ERE mat ching problem and design a fast er algorit hm by int roducing bit -parallelism. Many pat t ern mat ching algorit hms employ bit parallelism t o improve t he running t ime because t his t echnique can achieve a speed-up depending on word-lengt h. Our algorit hm is as follows. As in [12], we first part it ion t he parse t ree of a given ERE int o modules, t ranslat e each module int o augment ed NFAs (A-NFAs), and t hen simulat e t he obt ained A-NFAs on all t he suffi xes of x using a dat a st ruct ure called a directed computation graph (DCG). T his t ime, Yamamot o’s algorit hm must comput e a t ransit ion from a st at e many t imes at a t ime. We improve t he algorit hm by int roducing bit parallelism so t hat such a t ransit ion is comput ed in parallel. Furt hermore, since DCGs can share t he common part s, we can simulat e A-NFAs using DCGs wit h almost same size as a DCG generat ed by simulat ing A-NFAs on just one st ring x . Finally, our algorit hm can achieve an almost W -fold speed-up of Yamamot o’s recognit ion algorit hm by using W -bit parallel operat ions in t he best case. T he main result is as follows: Let r be an ERE of lengt h m over an alphabet Σ , and let x be a t ext st ring of lengt h n in Σ ∗ . T hen we can design an ERE mat ching algorit hm which runs in O(( mn 2 + ex ( r ) n 3 ) / W ) t ime and O(( mn + ex ( r ) n 2 ) / W ) space, where ex ( r ) is t he number of ext ended operat ors in r . In addit ion, we act ually implement t he proposed algorit hm and evaluat e t he performance.
2
Ext ended R egular Expressions
Let Σ be an alphabet . T he ext ended regular expressions (EREs) over Σ are recursively defined by five operat ors, union ( ∨ ), concat enat ion ( ·), closure (st ar ∗ ), int ersect ion ( ∧ ) and complement ( ¬ ). T hus EREs are REs wit h int ersect ion and complement . By ex ( r ), we denot e t he number of ext ended operat ors (t hat is, ∧ and ¬ ) occurring in an ERE r . Furt hermore, we int roduce t he parse t ree Tr of r , which is t he t ree such t hat each leaf is labeled wit h a symbol in Σ and each of t he ot her nodes is labeled wit h an operat or. See [12] for t he det ail.
3
M odules and A ugment ed N FA s
As in [12], we define modules and augment ed NFAs for EREs. Let r be an ERE over an alphabet Σ and let Tr be t he parse t ree of r . T hen, we part it ion Tr by
224
H. Yamamot o and T . M iyazaki
nodes labeled wit h int ersect ion ∧ and complement ¬ int o subt rees such t hat (1) t he root of each subt ree is eit her a child of a node labeled wit h ∧ or ¬ in Tr or t he root of Tr , (2) each subt ree does not cont ain any int erior nodes labeled by ∧ or ¬ , (3) each leaf is labeled by ∅ , ǫ , a ∈ Σ , ∧ or ¬ . If it is labeled by ∧ ( ¬ , respect ively), t hen it is called a universal leaf ( a negating leaf, respect ively). T hese leaves are also called a modular leaf. We call such a subt ree a module. Let R and R ′ be modules in t he parse t ree Tr . If a modular leaf u of R becomes t he parent of t he root of R ′ in Tr , t hen R is called a parent of R ′ , and conversely R ′ is called a child of R or a child of R at u. T hus t here are two children, called a universal pair , at each universal leaf, while one child, called a negating module, at each negat ing leaf . If t he root of a module R is t he root of Tr , t hen R is called a root module. If a module R does not have any children, t hen R is called a leaf module. It is clear t hat such a parent -child relat ionship induces a modular tree Tr = ( R , E) such t hat (1) R is a set of modules, (2) ( R, R ′ ) ∈ E if and only if R is t he parent of R ′ . T he dept h of each module and t he height of a modular t ree Tr is defined in t he st andard way. Now, for each module R , we relabel every modular leaf u of R wit h a new symbol σ u called a modular symbol . By t his relabeling, R can be viewed as an RE over Σ ∪ { σ u | u is a modular leaf of R } . T hen, by t he st andard linear t ranslat ion from REs int o NFAs (for example, see [7]), we can const ruct an NFA M R for a module R . Let us call t his M R an augmented NFA (A-NFA for short ). It is clear t hat we can define a parent -child relat ionship among A-NFAs according t o t he corresponding modules. We call a t ransit ion back t o a previous st at e generat ed by a st ar operat or a back transition. By removing such back t ransit ions, we number each st at e of M R from t he init ial st at e in t he t opological order. By t he t opological order, we mean t hat for any st at es q and p, q ≤ p if and only if t here is a pat h from q t o p. T his order is used t o effi cient ly simulat e A-NFAs. In addit ion, we call a st at e q in M R a universal state if t here is δ ( q, σ u ) = q′ for a universal leaf u, and call a st at e q in M R a negating state if t here is δ ( q, σ u ) = q′ for a negat ing leaf u. T he ot her st at es are called an existential state. Furt hermore, if a module R ′ is a child of R at u, t hen A-NFA M R ′ is said t o be associated with σ u (or associated with q). It is clear t hat t he following t heorem holds.
T heorem 1. Let r be an ERE of length m, let R 0 , . . . , R l be modules produced by partitioning Tr , and let m j be the length of the subexpression of r corresponding to the module R j . T hen we can construct an A-NFA M j for each module R j such that the number of states of M j is at most 2m j .
4
D irect ed Comput at ion G raphs
We will give t he definit ion of a directed computation graph ( DCG for short ), and t hen give an implement at ion by bit -vect or arrays.
4.1
D efinit ion of a D C G
Let r be an ERE over an alphabet Σ and let x = a1 · · · an be an input st ring in Σ ∗ . We first part it ion Tr int o modules R 0 , . . . , R l and const ruct A-NFAs
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended Regular Expressions
225
M 0 , . . . , M l for each module as described in T heorem 1. Here R 0 is t he root module. Aft er t hat , t o det ermine if x ∈ L ( r ), we simulat e t he set { M 0 , . . . , M l } of A-NFAs on x . T his t ime, for each A-NFA M j (0 ≤ j ≤ l ), we int roduce variables, called an existential-element set ( an EE-set for short ), which t ake a subset of st at es of M j . To simulat e each module M j (0 ≤ j ≤ l ), we use at most n + 1 EE-set s Uji (0 ≤ i ≤ n ). An EE-set Uji is used t o simulat e M j on ai · · · an using a simple st at e-t ransit ion simulat ion. Namely, Uji always maint ains st at es reachable from t he init ial st at e qj of M j aft er M j has read ai · · · ai ′ for any i ≤ i ′ ≤ n . To simulat e t he set { M 0 , . . . , M l } , we will const ruct a DCG G = ( U, E) such t hat (1) U is t he set of nodes, which consist s of EE-set s, and E is t he set of edges, which consist s of pairs ( U, U ′ ) of nodes, (2) a node U0i is called the i-th source node, which has no incoming edges, (3) Nodes wit h no out going ′ ′ edges are called a sink node, (4) let Uji 1 , Uji 2 and Uji 3 be nodes of U for A-NFAs ′ M j 1 , M j 2 and M j 3 , respect ively. T hen t here exist direct ed edges ( Uji 1 , Uji 2 ) and ′ ( Uji 1 , Uji 3 ) in E if and only if R j 2 and R j 3 are two children of R j 1 at a universal leaf u and M j 1 reaches t he universal st at e corresponding t o u while processing ′ ai ′ , (5) let Uji 1 and Uji 2 be nodes of U for A-NFAs M j 1 and M j 2 , respect ively. ′ T hen t here exist s a direct ed edge ( Uji 1 , Uji 2 ) in E if and only if R j 2 is t he child of R j 1 at a negat ing leaf u and M j 1 reaches t he negat ing st at e corresponding t o u while processing ai ′ . 4.2
I mplement at ion of D C G s by Bit -V ect or A rrays
For each A-NFA M j , n + 1 EE-set s Uj0 , . . . , Ujn are used t o simulat e M j . Hence t hese EE-set s cont ain only st at es of M j . If st at es in t hese EE-set s can be processed in parallel, t hen we have a possibility t o achieve a speed-up and a spacesaving. We will achieve a speed-up by t aking advant age of W -bit parallel boolean operat ions. For t his purpose, we int roduce bit -vect or arrays Vj [q, Z ] for each ANFA M j and bit -vect or arrays P( j 0 ,j 1 ) [t, Z ] for each pair ( M j 0 , M j 1 ) of A-NFAs such t hat M j 1 is a child of M j 0 . For each A-NFA M j , Vj [q, Z ] is defined as follows, where q is a st at e of M j and 0 ≤ Z ≤ ⌊ n/ W ⌋ , where ⌊ n/ W ⌋ denot es t he maximum int eger less t han or equal t o n/ W . An array Vj [q, Z ] = v, where v is a W -bit vect or, if and only if for any i ∈ B I T ( v), q ∈ UjZ W + i . We assume t hat bit s of v are numbered from 0, and we define B I T ( v) = { i | t he i t h bit of v is 1} . Not e t hat t he t ot al size of arrays V0 , . . . , Vn is O( mn/ W ) because by T heorem 1, t he t ot al number of st at es over all A-NFAs t ranslat ed from r is O( m ). Next , for each pair ( M j 0 , M j 1 ) of A-NFAs such t hat M j 1 is a child of M j 0 , P( j 0 ,j 1 ) [t, Z ] is defined as follows, where 0 ≤ t ≤ n and 0 ≤ Z ≤ ⌊ n/ W ⌋ . An array P( j 0 ,j 1 ) [t, Z ] = v, where v is a W -bit vect or, if and only if for any i ∈ B I T ( v), Ujt1 is a child of UjZ0 W + i . T hese arrays express t he parent -child relat ionship of a DCG. Not e t hat if a pair ( R j 1 , R j 2 ) is a universal pair, t hen it suffi ces t hat eit her P( j 0 ,j 1 ) [t, Z ] or P( j 0 ,j 2 ) [t, Z ] is defined. Furt hermore not e t hat t he t ot al size of arrays P( j 0 ,j 1 )
226
H. Yamamot o and T . M iyazaki
is O( ex ( r ) n 2 / W ) because t he t ot al number of pairs ( R j 1 , R j 0 ) is at most t he number of ext ended operat ors, t hat is, ex ( r ).
5
Bit -Parallel ER E M at ching A lgorit hm
In an algorit hm, t he operat ions |, & and ˜ denot e boolean operat ions bit -wise OR, bit -wise AND, and bit -wise NOT , respect ively. Furt hermore, we use two operat ions BitSet and BitCheck. BitSet ( v, i ) set s t he i t h bit of v t o 1. BitCheck( v, i ) checks if t he i t h bit of v is equal t o 1, and if equal, it ret urns 1; ot herwise ret urns 0. Since t hese operat ions can simply be implement ed so t hat t hey run in O(1) t ime, t heir det ails are here omit t ed. T he main algorit hm is t he algorit hm MAT CHI NG given in Fig. 1, which consist s of two main part s. In t he first part (St ep 1 and St ep 2), we t ranslat e a given ERE int o A-NFAs. In t he second part (St ep 3), we simulat e A-NFAs by using a DCG and bit -parallelism. In what follows, let r be an ERE of lengt h m and let x = a1 · · · an be an input st ring of lengt h n .
5.1
Translat ion an ER E int o A -N FA s
T he t ranslat ion from ERE r int o A-NFAs can be done by st andard parsing algorit hms, such as L L (1) and L R (1). Hence t he det ail of t he t ranslat ion is here omit t ed. In fact , we have implement ed t he t ranslat ion by using an SL R (1) parsing algorit hm. T herefore, for any ERE r of lengt h m , we can t ranslat e r int o A-NFAs in O( m ) t ime and space.
5.2
M at ching A lgorit hm U sing A -N FA s
In order t o find all subst rings of x which mat ch r , for each posit ion i of x , we generat e a DCG t o simulat e t he comput at ion of A-NFAs on t he suffi x ai · · · an . Hence we have n DCGs during t he comput at ion. Since t here are many common part s among t hese DCGs, we will simulat e A-NFAs in parallel by sharing t hem. T he basic idea of t he simulat ion is similar t o t hat of Yamamot o [12], alt hough we need several new ideas due t o comput e n DCGs in parallel by using bit -parallel operat ions. Let M 0 be an A-NFA for t he root module. T hen MAT CHI NG checks if DCGs includes t he final st at e of M 0 each t ime it processes input symbols. If, aft er processing t he i t h symbol, t he DCG simulat ing ai 1 · · · an includes t he final st at e, t hen MAT CHI NG out put s a pair ( i 1 , i ) of posit ions because subst ring ai 1 · · · ai mat ches r . T he procedure for t he simulat ion is FindMatch given in Fig. 2. T he procedure FindMatch simulat es A-NFAs on all t he suffi xes ai · · · an in parallel. T he simulat ion for each suffi x is invoked by BitSet in St ep 1-1 and St ep 2-2. T he simulat ion by FindMatch is an ext ension of t he st andard st at e-t ransit ion simulat ion of NFAs, and consist s of two procedures, t he procedure EClosure which comput es ǫ -moves and t he procedure GoTo which comput es t he t ransit ion by a
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended Regular Expressions
227
A lgor it h m M A T C H I N G ( r , x ) I nput : an E R E r , a t ex t st r i ng x = a 1 · · · a n . Out put : al l pai r s ( i , j ) such t hat a i · · · a j ∈ L ( r ) . St ep 1. Par t i t i on T r i nt o m odul es R 0 , . . . , R l . St ep 2. T r ansl at e each m odul e R j ( 0 ≤ j ≤ l ) t o an A -N FA M j . St ep 3. L et M 0 b e an A -N FA for t he r oot m odul e R 0 and l et q0 and qf b e t he i ni t i al st at e and t he fi nal st at e of M 0 , r esp ect i vel y. T hen, for i = 0 t o n , do t he fol l owi ng: 1. do F i n dM at ch( M 0 ,x ,q0 ,qf ,i ) , 2. / * T he fol l owi ng code out put s ( Z W + i ′ + 1, i ) such t hat i ′ ∈ B I T ( V0 [qf , Z ]) . T hi s m eans a Z W + i ′ + 1 · · · a i ∈ L ( r ) . N ot e t hat i < Z W + i ′ + 1 m eans t hat t he em pt y st r i ng m at ches r. */ for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat V0 [qf , Z ] = 0do i f Z < ⌊ i / W ⌋ t hen M A X = W − 1; el se set M A X = i m od W ; for i ′ = 0 t o M A X do i f B i t C heck( V0 [qf , Z ], i ′ ) = 1, t hen out put ( Z W + i ′ + 1, i ) .
F ig. 1. T he algorit hm MAT CHI NG P r oced u r e F in d M at ch ( M ,x ,q0 ,qf ,i ) M : an A -N FA M ; x : a t ex t st r i ng; q0 : t he i ni t i al st at e q0 of M ; qf : t he fi nal st at e of M ; i : a p osi t i on of x ; St ep 1. 1. 2. St ep 2. 1. 2. 3.
I f i = 0, t hen do t he fol l owi ng: B i t Set ( V0 [q0 , 0], 0) . / * St ar t up t he si mul at i on on a 1 · · · a n . * / R ′ = { R 0 } and t hen E C losur e( R ′ , 0) . I f i ≥ 1, t hen do t he fol l owi ng: G oT o( R , i ) . B i t Set ( V0 [q0 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) . / * St ar t up t he si mul at i on on a i + E C losur e( R , i ) .
1
· · · an . * /
F ig. 2. T he procedure FindMatch P r oced u r e E C losu r e( R ′ , i ) R ′ : a subset of R ; i : a p osi t i on of x ; St ep 1. For h = h m a x t o h m i n , do t he fol l owi ng: 1. E psi lon M ove( R h , i ) . 2. M odC heck( R h , i ) .
F ig. 3. T he procedure EClosure
symbol a. T he diff erent point from t he st andard st at e-t ransit ion simulat ion is in t he processing of int ersect ion and complement in EClosure. Now we explain t he process for int ersect ion and complement . For t he simplicity, let us consider an expression r 1 ∧ r 2 , where r 1 and r 2 are REs. T hen we have t hree A-NFAs, t hat is, M j 0 for ∧ , M j 1 for r 1 and M j 2 for r 2 , and M j 1 and M j 2 are children of M j 0 . In t his case, M j 0 has two st at es q and q′ wit h t he t ransit ion from q t o q′ by a modular symbol σ . We invoke M j 1 and M j 2 when M j 0 reaches st at e q, and t hen move M j 0 from q t o q′ when M j 1 and M j 2 bot h reach t he final st at es at same t ime. T his guarant ees t hat M j 0 can move from q t o q′ by a st ring if and only if t he st ring is in L ( r 1 ∧ r 2 ). T hus we need t o perform a t ransit ion by a modular symbol when t he children reach t heir final
228
H. Yamamot o and T . M iyazaki
P r oced u r e E p silon M ove( R ′ , i ) R ′ : a subset of R ; i : an i nput p osi t i on; 1. r ep eat t he fol l owi ng t wi ce: 2. for al l R j ∈ R ′ do 3. for al l q ∈ M j i n t he t op ol ogi cal or der do C ase 1: i f q i s an ex i st ent i al st at e, t hen for al l q′ ∈ δ ( q, ǫ ) do for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do Vj [q′ , Z ] := Vj [q, Z ] | Vj [q′ , Z ], C ase 2: i f q i s a uni ver sal st at e, t hen do t he fol l owi ng: H er e, l et M j 1 and M j 2 b e A -N FA s whi ch ar e associ at ed wi t h q, and l et qj 1 and qj 2 b e i ni t i al st at es of t hese A -N FA s, r esp ect i vel y, a) i f B i t C heck( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) = 1, t hen for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do P ( j , j 1 ) [i , Z ] := P ( j , j 1 ) [i , Z ] | Vj [q, Z ], b) i f B i t C heck( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ ) = 0, t hen i . B i t Set ( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) and B i t Set ( Vj 2 [qj 2 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) , i i . for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do P ( j , j 1 ) [i , Z ] := Vj [q, Z ], i i i . do E C losur e( { R j 1 , R j 2 } , i ) , C ase 3: i f q i s a negat i ng st at e, t hen do t he fol l owi ng: H er e, l et M j 1 b e t he A -N FA whi ch i s associ at ed wi t h q, and l et qj 1 b e t he i ni t i al st at e of M j 1 . a) i f B i t C heck( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) = 1, t hen for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do P ( j , j 1 ) [i , Z ] := P ( j , j 1 ) [i , Z ] | Vj [q, Z ], b) i f B i t C heck( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) = 0, t hen i . B i t Set ( Vj 1 [qj 1 , ⌊ i / W ⌋ ], i − ⌊ i / W ⌋ W ) , i i . for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do P ( j , j 1 ) [i , Z ] := Vj [q, Z ], i i i . do E C losur e( { R j 1 } , i ) .
F ig. 4. T he procedure EpsilonMove P r oced u r e G oT o( R ′ , i ) R ′ : a subset of R ; i : an i nput p osi t i on; 1. for al l R j ∈ R ′ , do t he fol l owi ng: a) for al l st at es q of M j i n t he r ever se t op ol ogi cal or der do i . i f t her e i s a st at e q′ such t hat δ ( q, a i ) = { q′ } , t hen for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do Vj [q′ , Z ] := Vj [q, Z ], i i . ot her wi se for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj [q, Z ] = 0 do Vj [q′ , Z ] := 0.
F ig. 5. T he procedure GoTo
st at es at same t ime. Similarly, for complement , we need t o perform a t ransit ion by a modular symbol when t he child does not reach t he final st at e. T he procedure EClosure cont ains such a processing as well as comput es t ransit ions by ǫ . Namely, EClosure comput es t ransit ions by ǫ by t he procedure EpsilonMove and checks t he condit ions for int ersect ion and complement by t he procedures ModCheck. T he det ail of EClosure is given in Fig. 3. We must pay at t ent ion t o t he order in which A-NFAs are simulat ed. As seen above, t ransit ions of an A-NFA depend on t ransit ions of children A-NFAs of t he A-NFA. T herefore, t o simulat e effi cient ly, EClosure proceeds in order from leaves t o t he root in t he modular t ree. Now let hm ax and hm i n be t he maximum dept h and t he minimum dept h over R = { R 0 , . . . , R l } , respect ively. We can part it ion R int o some subset s R h m i n , · · ·, R h m a x by t he dept h of each module R such t hat
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended Regular Expressions
229
P r oced u r e M od C h eck ( R ′ , i ) R ′ : a subset of R ; i : an i nput p osi t i on; 1. for al l uni ver sal pai r s ( R j 1 , R j 2 ) i n R ′ do for al l Z ∈ [0, ⌊ i / W ⌋ ] such t hat Vj 1 [p 1 , Z ] = 0 do a) v := Vj 1 [p 1 , Z ] & Vj 2 [p 2 , Z ], wher e M j 1 and M j 2 ar e associ at ed wi t h a m odul ar symb ol σ , and p 1 and p 2 ar e t he fi nal st at es of t hem , r esp ect i vel y, b) i f Z < ⌊ i / W ⌋ t hen M A X = W − 1; el se set M A X = i m od W ; for i ′ = 0 t o M A X do i f B i t C heck( v , i ′ ) = 1, t hen for al l Z ′ ∈ [0, ⌊ i / W ⌋ ] such t hat P ( j 0 , j 1 ) [i ′ + Z W, Z ′ ] = 0 do Vj 0 [q, Z ′ ] := Vj 0 [q, Z ′ ] | P ( j 0 , j 1 ) [i ′ + Z W, Z ′ ], wher e q i s a st at e such t hat δ ( q′ , σ ) = q for a uni ver sal st at e q′ . 2. for al l negat i ng m odul es R j 1 i n R ′ do for Z = 0 t o ⌊ i / W ⌋ do / * N ot e t hat , i n t hi s case, we cannot l i m i t t he r ange t o Z such t hat Vj 1 [p 1 , Z ] = 0. * / a) v := ˜ Vj 1 [p 1 , Z ], wher e p 1 i s t he fi nal st at e of M j 1 , b) i f Z < ⌊ i / W ⌋ t hen M A X = W − 1; el se M A X = i m od W ; for i ′ = 0 t o M A X do i f B i t C heck( v , i ′ ) = 1, t hen for al l Z ′ ∈ [0, ⌊ i / W ⌋ ] such t hat P ( j 0 , j 1 ) [i ′ + Z W, Z ′ ] = 0 do Vj 0 [q, Z ′ ] := Vj 0 [q, Z ′ ] | P ( j 0 , j 1 ) [i ′ + Z W, Z ′ ], wher e q i s a st at e such t hat δ ( q′ , σ ) = q for a negat i ng st at e q′ .
F ig. 6. T he procedure ModCheck
R h consist s of modules wit h t he dept h h. T hen EClosure simulat es ǫ -moves in t he order from R h m a x t o R h m i n . T he procedure EpsilonMove, given in Fig. 4, performs t ransit ions by ǫ . T he job of EpsilonMove is classified int o t hree cases according t o kinds of st at es. Let M j , q and i be an A-NFA, a st at e and an input posit ion current ly processed, respect ively. If q is exist ent ial, t hen EpsilonMove simply comput es t he next st at es reachable by ǫ . If q is universal, t hen EpsilonMove performs as follows. Let M j 1 and M j 2 be children associat ed wit h q. EpsilonMove generat es Uji 1 and Uji 2 , which include only t he init ial st at es of M j 1 and M j 2 , respect ively, t o simulat e M j 1 and ′ M j 2 on ai + 1 · · · an . In addit ion, for Uji (0 ≤ i ′ ≤ i ) which includes q, it generat es ′ ′ two direct ed edges from Uji t o Uji 1 and from Uji t o Uji 2 . T hese jobs are performed on bit -vect or arrays in parallel. In case of a negat ing st at e, t he similar process is performed. In order t o comput e a st at e included in several EE-set s Uji 1 , . . . , Uji l in parallel, EpsilonMove comput es t he st at es of M j in t he t opological order. T his t ime, if t here is a back t ransit ion in M j , t hen t he comput at ion in t he t opological order may not be able t o comput e all reachable st at es. However, as in [11], we can overcome t his diffi culty by comput ing t he st at es of M j twice in t he t opological order. As ment ioned before, t he procedure ModCheck, given in Fig. 6, checks if t ransit ions from universal and negat ing st at es are possible, and if possible, t hen it performs t he t ransit ions. Finally we have t he following t heorem. T heorem 2. Given an ERE r of length m and a text string x = a1 · · · an of length n, the algorithm MAT CHI NG can find the set F = { ( i , j ) | ai · · · aj ∈ L ( r ) } in O(( mn 2 + ex ( r ) n 3 ) / W ) time and O(( mn + ex ( r ) n 2 ) / W ) space.
230
H. Yamamot o and T . M iyazaki T able 1. Comput at ion t ime (in seconds) for st rings over { 0, 1, a, b}
ERE lengt h of st ring t ranslat ion t ime init ial 200 0.0004 ERE1 2000 0.0004 8000 0.0004 200 0.0005 ERE2 2000 0.0005 8000 0.0005 200 0.0009 ERE3 2000 0.0009 8000 0.0009 200 0.0009 ERE4 2000 0.0009 8000 0.0009
set t ing t ime mat ching t ime t ot al t ime 0.013 0.056 0.0694 0.391 3.452 3.8434 5.096 55.591 60.6874 0.013 0.012 0.0255 0.383 0.152 0.5355 5.175 1.078 6.2535 0.023 0.086 0.1099 0.625 3.899 4.5249 8.208 55.887 64.0959 0.014 0.075 0.0899 0.383 1.246 1.6299 5.097 4.96 10.0579
T able 2. Comput at ion t ime (in seconds) for a st ring from a log file ERE lengt h of st ring t ranslat ion t ime init ial ERE1 8000 0.0004 ERE2 8000 0.0005 ERE3 8000 0.0009 ERE4 8000 0.0009
6
set t ing t ime mat ching t ime t ot al t ime 5.069 54.429 59.4984 5.093 2.908 8.0015 8.129 54.443 62.5729 5.096 1.292 6.3889
Experiment al R esult s
We have implement ed t he proposed algorit hm using C+ + and evaluat ed t he performance. Our machine is a LINUX PC wit h 32-bit Pent ium-4 of 1.7GHz and 256MB main memory. Hence we have fixed t he paramet er W = 32. We measure t he running t ime in seconds. Table 1 and Table 2 show experiment al result s for a st ring over { 0, 1, a, b} which we have appropriat ely chosen and a st ring from a log file of our machine, respect ively. Not e t hat t he st ring from a log file cont ains many kinds of charact ers. In t ables, translation time shows t he t ime t o t ranslat e an ERE int o A-NFAs, initial setting time shows t he t ime t o init ialize bit -vect or arrays, and matching time shows t he t ime t o find all subst rings which mat ch a given ERE. We use t he following EREs.
– ERE1 : ((0∗ ∧ (0 ∨ 1∗ )) ∗ 0) ∧ (0∗ ∧ ( ¬ ((00) ∗ ))) T his denot es st rings over { 0} such t hat t he number of 0’s is odd. – ERE2 : 0(((0∗ ∧ (0 ∨ 1∗ )) ∗ 0) ∧ (0∗ ∧ ( ¬ ((00) ∗ )))) T his denot es st rings over { 0} such t hat t he number of 0’s is even. – ERE3 : ((( a ∨ b) ∗ aa( a ∨ b) ∗ ) ∧ ( ¬ (( a ∨ b) ∗ bb( a ∨ b) ∗ )))1(((0∗ ∧ (0 ∨ 1∗ )) ∗ 0) ∧ (0∗ ∧ ( ¬ ((00) ∗ )))) T his is a concat enat ion of t he ERE discussed in Int roduct ion, a 1, and ERE1.
A Fast Bit -Parallel A lgorit hm for M at ching Ext ended Regular Expressions
231
– ERE4 : ((( a ∨ b) ∗ aa( a ∨ b) ∗ ) ∧ ((( a ∨ b) ∗ bb( a ∨ b) ∗ )))1(((0∗ ∧ (0 ∨ 1∗ )) ∗ 0) ∧ (0∗ ∧ (((00) ∗ )))) T his is an ERE obt ained by delet ing complement ¬ from ERE3. We can see t he following observat ions from experiment s
– T he running t ime of our algorit hm does not t heoret ically depend on t he size of an alphabet . In fact , t he mat ching t ime for t he same ERE in Table 1 and Table 2 is almost same. – Alt hough t he diff erence between ERE1 and ERE2 is small (only t he leading 0 of ERE2), t he mat ching t ime for ERE2 is much fast er t han t hat for ERE1. T his is because t he size of a DCG generat ed by ERE2 becomes smaller. On t he ot her hand, sizes of DCGs for ERE1 and ERE3 become larger. T hus matching time heavily depends on t he form of a given ERE. – Processing complement seems t o require more t ime t han int ersect ion. T his is because t here is a possibility t hat a negat ing module t akes more t ime in ModCheck. In fact , by removing complement from ERE3, t he mat ching t ime is much improved. – T he t ranslat ion t ime of each ERE can be almost ignored, compared wit h t he mat ching t ime. T herefor, we can expect a furt her speed-up by t ranslat ing an A-NFA wit h a small size int o a det erminist ic finit e aut omat on, as in [8, 10].
R eferences 1. A .V . A ho, A lgorit hms for finding pat t erns in st rings, In J.V . Leeuwen, ed. Handbook of t heoret ical comput er science, Elsevier Science Pub., 1990. 2. A . A post olico, Z. Galil ed., Pat t ern M at ching A lgorit hms, Oxford University Press, 1997. 3. R. Baeza-Yat es and G. Gonnet , Fast Text Searching for Regular Expressions or A ut omat on Searching on Tries, J. of t he ACM , 43,6, 915–936, 1996. 4. R. Baeza-Yat es and B. Ribeiro-Net o, M odern Informat ion Ret rieval, A ddison Wesley, 1999. 5. J.R. K night and E.W . M yers, Super-Pat t ern mat ching, A lgorit hmica, 13, 1–2, 211– 243, 1995. 6. S.C. Hirst , A New A lgorit hm Solving M embership of Ext ended Regular Expressions, Tech. Report , T he University of Sydney, 1989. 7. J.E. Hopcroft and J.D. Ullman, Int roduct ion t o aut omat a t heory language and comput at ion, A ddison Wesley, Reading M ass, 1979. 8. G. M yers, A Four Russians A lgorit hm for Regular Expression Pat t ern M at ching, J. of t he ACM , 39,4, 430–448, 1992. 9. E. M yers and W . M iller, A pproximat e M at ching of Regular Expressions, Bull. of M at hemat ical Biology, 51, 1, 5–37, 1989. 10. G. Navarro and M . Raffi not , Compact DFA Represent at ion for Fast Regular Expression Search, Proc. WA E2001, LNCS 2141, 1–12, 2001. 11. S. Wu, U. M anber and E. M yers, A Sub-Quadrat ic A lgorit hm for A pproximat e Regular Expression M at ching, J. of A lgorit hm, 19, 346–360, 1995. 12. H. Yamamot o, A New Recognit ion A lgorit hm for Ext ended Regular Expressions, Proc. ISA AC2001, LNCS 2223, 267–277, 2001.
G ro u p M u t u al E x c lu sio n A lg o rit h m s B ase d o n T icke t O rd e rs Masat aka Takamura and Yoshihide Igarashi Depart ment of Comput er Science, Gunma University, Kiryu, J apan 376-8515 { takamura,igarashi} @comp.cs.gunma-u.ac.jp
Group mut ual exclusion is an int erest ing generalizat ion of t he mut ual exclusion problem. T his problem was int roduced by J oung, and some algorit hms for t he problem have been proposed by incorporat ing mut ual exclusion algorit hms. Group mut ual exclusion occurs nat urally in a sit uat ion where a resource can be shared by processes of t he same group, but not by processes of diff erent groups. It is also called t he congenial t alking philosophers problem. In t his paper we propose t hree algorit hms based on t icket orders for t he group mut ual exclusion problem in t he asynchronous shared memory model. T he first algorit hm is a simple modificat ion of t he Bakery algorit hm. It sat isfies group mut ual exclusion, but does not sat isfy lockout freedom. T he second and t he t hird algorit hms are furt her modificat ions from t he first one in order t o sat isfy lockout freedom and t o improve t he concurrency performance. T hey use single-writ er shared variables, t oget her wit h two mult i-writ er shared variables t hat are never concurrent ly writ t en. T he t hird algorit hm has anot her desirable property, called smoot h admission. By t his property, during t he period t hat t he resource is occupied by t he leader, a process wishing t o join t he same group as t he leader’ s group can be grant ed use of t he resource in const ant t ime. A b st r a c t .
1
Int ro d u c t io n
Mut ual exclusion is a problem of managing access t o a single indivisible resource t hat can only support one user at a t ime. An early algorit hm for t he mut ual exclusion problem was proposed by Dijkst ra [4]. Since t hen it has been widely st udied [1,2,3,7,11,13,15,16,17]. T he k -exclusion problem is a nat ural generalizat ion of t he mut ual exclusion problem. In k -exclusion, some number of users, specified by paramet er k , are allowed t o use t he resource concurrent ly [3,5,14]. Group mut ual exclusion is anot her nat ural generalizat ion of t he mut ual exclusion problem. T his problem was int roduced by J oung in [8], and some algorit hms for t he problem have been proposed [6,8,9,10]. Group mut ual exclusion is required in a sit uat ion where a resource can be shared by processes of t he same group, but not by processes of diff erent groups. A combinat ion of k -exclusion and group mut ual exclusion was also st udied [18,19]. T he algorit hm by J oung in [8] uses mult i-writ er/ mult i-reader shared variables in t he asynchronous shared memory model. J oung also gave solut ions for t he group mut ual exclusion problem in t he message passing model [9]. T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 232–241, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Group Mut ual Exclusion Algorit hms Based on T icket Orders
233
As described in [8], group mut ual exclusion can be described as t he con gen ial t alkin g philosophers problem. We assume t hat t here are n philosophers. T hey spend t heir t ime t hinking alone. W hen a philosopher is t ired of t hinking, he/ she at t empt s t o at t end a forum and t o t alk at t he forum. We assume t hat t here is only one meet ing room. A philosopher wishing t o at t end a forum can do so if t he meet ing room is empty, or if some philosophers int erest ed in t he same forum as t he philosopher in quest ion are already in t he meet ing room. T he con gen ial t alkin g philosophers problem is t o design an algorit hm such t hat a philosopher wishing t o at t end a forum will event ually succeed in doing so. P hilosophers int erest ed in t he same forum as t he current forum in t he meet ing room should be encouraged t o at t end it . T his type of performance is measured as concurrency of at t ending a forum. It is undesirable t hat t he maximum wait ing t ime for a philosopher wishing t o ent er a forum is t oo long. If we request t hat t he maximum wait ing t ime for a philosopher should be as short as possible, t hen it is usually diffi cult t o achieve a high degree of concurrency. In t his paper, we propose t hree algorit hms based on t icket orders for t he group mut ual exclusion problem in t he asynchronous shared memory model. T he first algorit hm is a simple modificat ion of t he Bakery algorit hm, but it s concurrency performance is poor. Furt hermore, it does not sat isfy lockout freedom alt hough it sat isfies progress for t he t rying region. T he second and t hird algorit hms are furt her modificat ions of t he first algorit hm in order t o sat isfy lockout freedom and t o improve t he concurrency performance. T he t hird algorit hm has anot her desirable feat ure, called smoot h admission, i.e., while t he resource is occupied by t he leader of a group, a process wishing t o join t he same group can smoot hly ent er it in const ant t ime.
2
P re lim in arie s
T he comput at ional model used in t his paper is t he asynchronous shared memory model. It is a collect ion of processes and shared variables. P rocesses t ake st eps at arbit rary speeds, and t here is no global clock. Int eract ions between a process and it s corresponding philosopher are by input act ions from t he philosopher t o t he process and by out put act ions from t he process t o t he philosopher. Each process is considered t o be a st at e machine wit h arrows ent ering and leaving t he process, represent ing it s input and out put act ions. All communicat ion among t he processes is via shared memory. Lamport [12] defined t hree cat egories, saf e, r egu l ar , and at om i c, for shared variables according t o possible assumpt ions about what can happen in t he concurrent case of read operat ions and writ e operat ions. A shared variable is said t o be regular if every read operat ion ret urns eit her t he last value writ t en t o t he shared variable before t he st art of t he read operat ion or a value writ t en by one of t he overlapping writ e operat ions. A shared variable is said t o be at omic if it is regular and has t he addit ional property t hat read operat ions and writ e operat ions behave as if t hey occur in some t ot al order. In t his paper, we assume t hat all shared variables are at omic. T he first algorit hm in t his paper uses only single-writ er/ mult i-reader shared
234
M. Takamura and Y. Igarashi
variables. T he second and t he t hird algorit hms use single-writ er/ mult i-reader shared variables, t oget her wit h two mult i-writ er/ mult i-reader shared variables t hat are never concurrent ly writ t en. A philosopher wit h access t o a forum is modeled as being in t he t alking region. W hen a philosopher is not involved in any forum, he/ she is said t o be in t he t hinking region. In order t o gain admit t ance t o t he t alking region, his/ her corresponding process execut es a t rying prot ocol. T he durat ion from t he st art of execut ion of t he t rying prot ocol t o t he ent rance t o t he t alking region is called t he t rying region. Aft er t he end of t alking by a philosopher at a forum in t he meet ing room, his/ her corresponding process execut es an exit prot ocol. T he durat ion of execut ion of t he exit prot ocol is called t he exit region. T hese regions are followed in cyclic order, from t he t hinking region t o t he t rying region, t o t he t alking region, t o t he exit region, and t hen back again t o t he t hinking region. T he congenial t alking philosophers problem is t o devise prot ocols for t he philosophers t o effi cient ly and fairly at t end a forum when t hey wish t o t alk under t he condit ions t hat t here is only one meet ing room and t hat only a single forum can be held in t he meet ing room at t he same t ime. We assume n philosophers, P 1 , ..., P n , who spend t heir t ime eit her t hinking alone or t alking in a forum. We also assume t hat t here are m diff erent fora. Each philosopher P i (1 ≤ i ≤ n ) corresponds t o process i . T he input s t o process i from philosopher P i are t r y i ( f ) which means a request by P i for access t o forum f ∈ { 1, ..., m } t o t alk t here, and ex i t i which means an announcement of t he end of t alking by P i . T he out put s from process i t o philosopher P i are t al k i which means grant ing at t endance at t he meet ing room t o P i , and t h i n k i which means t hat P i can cont inue wit h his/ her t hinking alone. T hese are ext ernal act ions of t he shared memory syst em. We assume t hat a philosopher in a forum spends an unpredict able but finit e amount of t ime in t he forum. T he syst em t o solve t he congenial t alking philosophers problem should sat isfy t he following condit ions: (1) g r o u p m u t u a l e x c l u s i o n : If some philosopher is in a forum, t hen no ot her philosopher can be in a diff erent forum at t he same t ime . (2) l o c k o u t f r e e d o m : Any philosopher wishing t o at t end a forum event ually does so if any philosopher in any forum always leaves t he forum aft er he/ she spends a finit e amount t ime in t he forum. (3) p r o g r e s s f o r t h e e x i t r e g i o n : If a philosopher is in t he exit region, t hen at some lat er point he/ she ent ers t he t hinking region. Wait ing t ime and occupancy are import ant crit eria t o evaluat e solut ions t o t he congenial t alking philosophers problem. Wait ing t ime is t he amount of t ime from when a philosopher wishes t o at t end a forum unt il he/ she at t ends t he forum. Concurrency is import ant t o increase syst em performance concerning t he resource. It is desirable for a solut ion t o t he congenial t alking philosophers problem t o sat isfy t he following property called con cu r r en t occu pan cy [6,9,10]. (4) c o n c u r r e n t o c c u p a n c y : If some philosopher P request s t o at t end a forum and no philosopher is current ly at t ending or request ing a diff erent forum, t hen P can smoot hly at t end t he forum wit hout wait ing for ot her philosophers t o leave t he forum.
Group Mut ual Exclusion Algorit hms Based on T icket Orders
3
235
A S im p le M o d ifi c at io n o f t h e B ake ry A lg o rit h m
T he following procedure ( n , m )-S G B ak er y is a simple modificat ion of t he Bakery algorit hm, where n is t he number of philosophers, m is t he number of diff erent fora, and N is t he set of nat ural numbers. If n = m and each philosopher i is int erest ed in just forum i (1 ≤ i ≤ n ), t hen t he procedure is t he same as t he Bakery algorit hm for t he mut ual exclusion problem. Relat ion ( a, b) ≤ ( a ′ , b′ ) in t he procedure means a < a ′ , or a = a ′ and b ≤ b′ . p r o c e d u r e ( n , m ) -S G B akery s h a re d v a ria b le s
for every i ∈ { 1, ..., n } : t r an si t ( i ) ∈ { 0, 1} , init ially 0, writ able by process i and readable by all processes j = i ; t i ck et ( i ) ∈ N , init ially 0, writ able by process i and readable by all processes j = i ; f or u m ( i ) ∈ { 0, 1, 2, ..., m } , init ially 0, writ able by process i and readable by all processes j = i ; p ro c e ss i in p u t a c t io n s
input s t o process i from philosopher P i } : ≤ f ≤ m , ex i t i ; o u t p u t a c t i o n s { out put s from process i t o philosopher P i } : t al k i n gi , t h i n k i n gi ; {
t r y i ( f ) for every 1
** t hinking region ** 01: 02: 03: 04: 05: 06: 07: 08: 09:
t r y i ( f ): t r an si t ( i ) := 1; t i ck et ( i ) := 1 + m ax j = i t i ck et ( j ); f or u m ( i ) := f ; t r an si t ( i ) := 0; f o r each j = i d o w a i t f o r t r an si t ( j ) = 0; w a i t f o r ([t i ck et ( j ) = 0] o r [( t i ck et ( i ) , f ) ≤ ( t i ck et ( j ) , f or u m ( j ))] o r [t i ck et ( i ) ≥ t i ck et ( j ) a n d f or u m ( j ) = f ]); t al k i n gi ;
** t alking region ** 10: 11: 12: 13:
ex i t i : t i ck et ( i ) := 0; f or u m ( i ) := 0; t h i n k i n gi ;
( n , m ) - S G B ak er y gu aran t ees grou p m u t u al exclu sion , progress for t he t ry in g region , an d progress for t he exit region .
T h e o r e m 1 . P rocedu re
P roof. For process i (1 ≤ i ≤ n ), just aft er receiving an input signal t r y i ( f ) from P i , it ent ers t he ent rance part called doorway (line 02 t o line 05), where
236
M. Takamura and Y. Igarashi
shared variable t i ck et ( i ) is set t o be larger by 1 t han t he maximum t icket number observed by process i at line 03 and shared variable f or u m ( i ) is set t o be f at line 04. From t he condit ion in t he w a i t f o r st at ement at line 08, if process i is allowed t o move t o t he t alking region, any ot her process who wishes t o at t end a diff erent forum must have a larger pair of (t icket , forum) t han t he pair held by process i . Hence, such a process wishing t o at t end a diff erent forum cannot move t o t he t alking region unless process i leaves t he t alking region and reset s t he cont ent s of t i ck et ( i ) and f or u m ( i ) in t he exit region. T herefore, group mut ual exclusion is guarant eed. Since we assume t hat each philosopher spends only a finit e amount of t ime in a forum and any t icket obt ained in t he doorway is always larger t han t icket s issued before, some philosopher wishing t o at t end a forum will event ually be able t o do so. Hence, progress for t he t rying region is guarant eed. For each i (1 ≤ i ≤ n ), t he exit region consist s of two reset st at ement s, t i ck et ( i ) := 0 and f or u m ( i ) := 0, and a sending out put signal t o P i , t h i n k i n gi . Hence, progress for t he exit region is also guarant eed. ⊓⊔ If many philosophers wish simult aneously t o at t end t he same forum, high concurrency can be achieved. However, concurrency of ( n , m )-S G B ak er y is, in general, poor. Furt hermore, it does not sat isfy lockout freedom alt hough it sat isfies progress for t he t rying region and for t he exit region. T his fact can be easily shown by a scenario such t hat lockout freedom is not sat isfied.
4
A H ig h ly C o n c u rre nt A lg o rit h m
A capt uring t echnique is used t o improve t he concurrency performance of t he algorit hms for t he group mut ual exclusion problem in [8,9,10]. By t his t echnique, a philosopher at t ending a forum sends a message t o all philosophers int erest ed in t he same forum, asking t hem t o join t he forum. T he algorit hm proposed in t his sect ion, ( n , m )-H C G M E , uses a door in t he doorway. A chair is chosen in each current forum. W hen t he chair wishes t o leave t he forum, he/ she closes t he door t o prevent ot her philosophers from ent ering t he same forum. W hile t he door is open, philosophers wishing t o ent er t he same forum as t he current forum held in t he meet ing room are allowed t o ent er it . In t his way, concurrency can be improved. All shared variables, except for door and ch ai r , are single-writ er/ mult i-reader shared variables. Bot h door and ch ai r are mult iwrit er/ mult i-reader shared variables, but no concurrent writ ing operat ions t ake place for eit her of t hese two shared variables. p r o c e d u r e ( n , m ) -H C G M E s h a re d v a ria b le s
for every i ∈ { 1, ..., n } : t r an si t ( i ) ∈ { 0, 1} , init ially 0, writ able by process i and readable by all processes j = i ; ch eck dw ( i ) ∈ { 0, 1} , init ially 0, writ able by process i and readable by all processes j = i ; t i ck et ( i ) ∈ N , init ially 0, writ able by process i and readable by all processes j = i ;
Group Mut ual Exclusion Algorit hms Based on T icket Orders f or u m ( i )
∈ { 0, 1, ..., m } , init ially 0, writ able by process i and readable by all processes j = i ; f or u m (0), always 0, readable by all processes; door ∈ { open , cl ose} , init ially open , writ able and readable by all processes (but never concurrent ly writ t en); ch ai r ∈ { 0, 1, ..., n } , init ially 0, writ able and readable by all processes (but never concurrent ly writ t en);
p ro c e ss i in p u t / o u t p u t a c t io n s :
t he same as t he input / out put act ions of ( n , m )-S G B ak er y ;
** t hinking region ** 01: 02: 03: 04: 05: 06: 07: 08: 09: 10: 11: 12: 13: 14:
t r y i ( f ): t r an si t ( i ) := 1; i f door = cl ose t h e n b e g i n ch eck dw ( i ) := 1; w a i t f o r door = open ; ch eck dw ( i ) := 0 e n d ; t i ck et ( i ) := 1 + m ax j = i t i ck et ( j ); f or u m ( i ) := f ; t r an si t ( i ) := 0; f o r each j = i d o b e g i n w a i t f o r t r an si t ( j ) = 0 o r ch eck dw ( j ) = 1 o r f = f or u m ( ch ai r ); w a i t f o r t i ck et ( j ) = 0 o r ( t i ck et ( i ) , f , i ) < ( t i ck et ( j ) , f or u m ( j ) , j ) o r f = f or u m ( ch ai r ) e n d ; i f f o r e a c h j = i , t i ck et ( j ) = 0 o r ( t i ck et ( i ) , f , i ) < ( t i ck et ( j ) , f or u m ( j ) , j ) t h e n ch ai r := i ; t al k i n gi ;
** t alking region ** 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
ex i t i : i f ch ai r = i t h e n b e g i n door := cl ose; f o r e a c h j = i d o b e g i n w a i t f o r t r an si t ( j ) = 0 o r ch eck dw ( j ) = 1; w a i t f o r f = f or u m ( j ) o r t i ck et ( j ) = 0 e n d ; ch ai r := 0; door := open ; f o r e a c h j = i d o w a i t f o r ch eck dw ( j ) = 0 e n d ; f or u m ( i ) := 0; t i ck et ( i ) := 0 ; t h i n k i n gi ;
237
238
M. Takamura and Y. Igarashi
In t he procedure above, t he order among t riples is also lexicographical. T he process wit h t he smallest t riple comprising non-zero t icket number, forum, and process ident ifier is chosen as t he chair of t he forum held in t he meet ing room. If P i in a forum is not t he chair, P i can smoot hly leave t he t alking region by reset t ing t i ck et ( i ) and f or u m ( i ). However, when t he chair wishes t o leave t he forum, he/ she must close t he door in t he doorway and wait for all philosophers in t he same forum t o leave. Aft er t he chair observes t hat all philosophers in t he forum have left , he/ she resigns t he chair and opens t he door. T hen aft er confirming t hat all philosophers wait ing at line 05 have not iced t hat t he door has opened, he/ she who resigned t he chair leaves t he forum. ( n , m ) - H C G M E , shared variable ch ai r is n ever con cu rren t ly writ t en , an d on ce ch ai r is set t o be i (1 ≤ i ≤ n ) , t he con t en t s of ch ai r rem ain s i u n t il it is reset t o be 0 by process i at lin e 21 of t he program . I n an y execu t ion by ( n , m ) - H C G M E , shared variable door is also n ever con cu rren t ly writ t en . T h e o r e m 2 . I n an y execu t ion by
P roof. For each process i (1
≤ i ≤ n ) in t he t rying region, t here are two ways of set t ing it s t icket number. One way is t hat it observes door t o be open at line 03 and t hen set s t i ck et ( i ) at line 07. T he ot her way is t hat it observes door t o be cl ose at line 03 and wait s unt il door is opened at line 05. Once it observes door t o be open at line 05, it set s t i ck et ( i ) at line 07. P rocess i at line 12 is wait ing unt il t he t riple of it s t icket , forum and ident ifier becomes t he smallest among t he t riples of processes in t he t rying region or in t he t alking region. During t he j t h loop (1 ≤ j ≤ n ) of t he w a i t f o r st at ement at line 12 of t he execut ion by process i , if process i observes t hat t he second condit ion (i.e., ch eck dw ( j ) = 1) is sat isfied t hen t i ck et ( j ) is 0 or great er t han t i ck et ( i ) at line 12 of t he execut ion by process i , because t he execut ion at line 07 by process j is aft er t he cont ent s of t i ck et ( i ) was set by process i . T he mechanism for choosing smallest t riple among t he t riples of t he processes including process i it self such t hat process i observes t he first condit ion (i.e., t r an si t ( j ) = 0) of t he w a i t f o r st at ement at line 12 is t he same as t he mechanism for choosing t he smallest one by t he Bakery algorit hm for t he mut ual exclusion problem. Hence, ch ai r is never concurrent ly writ t en, and once ch ai r is set t o be t he ident ifier of a process, it remains unt il it is reset by t he process at line 21. Since door can be writ t en by a chair process, it is also never concurrent ly writ t en. ⊓⊔
( n , m ) - H C G M E gu aran t ees grou p m u t u al exclu sion , lockou t freedom , an d progress for t he exit region .
T h e o re m 3 .
P roof. T he chair philosopher is uniquely det ermined by ch ai r . W hile a philosopher is t he chair, only philosophers wishing t o at t end t he same forum as t he chair’ s forum are allowed t o ent er t he forum. W hen t he chair philosopher wishes t o leave t he forum, he/ she closes door in his/ her exit region t o prevent a newcomer t o t he t rying region from get t ing a t icket . Aft er observing t hat all ot her philosophers in t he forum have left , t he chair philosopher resigns t he chair and opens door . Hence, group mut ual exclusion is guarant eed. T he t ime from when
Group Mut ual Exclusion Algorit hms Based on T icket Orders
239
a philosopher ent ers his/ her t rying region unt il he/ she ent ers t he t alking region is bounded by 2t c + O ( n t ) l , where t = m i n { n , m } , c is an upper bound on t he t ime t hat any philosopher spends in t he t alking region, and l is an upper bound on t he t ime between two successive at omic st eps by a process. Hence, lockout freedom is guarant eed. P rogress for t he exit region is obvious. ⊓⊔
5
A Te ch n iqu e fo r S m o o t h A d m issio n
Here, we show a t echnique t o reduce t he wait ing t ime for processes wishing t o at t end t he forum of t he chair philosopher. A modified algorit hm, ( n , m )S A H C G M E , using t his t echnique is given below. In an execut ion by ( n , m )S A H C G M E , when t he chair philosopher is chosen, t he forum number is st ored in sh ar ed variable door . T his shared variable is never concurrent ly writ t en. At t he beginning of t he t rying region each philosopher checks whet her his/ her forum of int erest is t he same as t he forum indicat ed in door . If a philosopher not ices t hat he/ she wishes t o at t end t he same forum as t he forum shown in door , t he philosopher set s his/ her t icket number as well as forum number t o be t he same as t he t icket number and forum number of t he chair philosopher, and t hen he/ she is grant ed at t endance t o t he forum. In t his way, such philosophers can at t end t he forum in O (1) at omic st eps aft er t he ent rance t o t he t rying region. p r o c e d u r e ( n , m ) -S A H C G M E s h a r e d v a r i a b l e s : t he same as
t he shared variables of ( n , m )-H C G M E except for door , t he domain of door is { cl ose, 0, 1, ..., m } , and it is init ially 0;
p ro c e ss i in p u t / o u t p u t a c t io n s :
t he same as t he input / out put act ions of ( n , m )-S G B ak er y ;
** t hinking region ** 01: 02: 03: 04: 05: 06: 07: 08: 09: 10: 11: 12: 13: 14:
t r y i ( f ): t r an si t ( i ) := 1; i f f = door t h e n b e g i n i f door = cl ose t h e n b e g i n ch eck dw ( i ) := 1; w a i t f o r door = cl ose; ch eck dw ( i ) := 0 e n d ; t i ck et ( i ) := 1 + m ax j = i t i ck et ( j ); f or u m ( i ) := f ; t r an si t ( i ) := 0; f o r each j = i d o b e g i n w a i t f o r t r an si t ( j ) = 0 o r ch eck dw ( j ) = 1 o r f = f or u m ( ch ai r ); w a i t f o r t i ck et ( j ) = 0 o r ( t i ck et ( i ) , f , i ) < ( t i ck et ( j ) , f or u m ( j ) , j ) o r f = f or u m ( ch ai r ) e n d ; i f f o r e a c h j = i , t i ck et ( j ) = 0 o r ( t i ck et ( i ) , f , i ) < ( t i ck et ( j ) , f or u m ( j ) , j )
240
M. Takamura and Y. Igarashi
15: 16: 17: 18: 19: 20: 21: 22:
t h e n b e g in
ch ai r := i ; door := f e n d e n d e ls e t h e n b e g in
t i ck et ( i ) := t i ck et ( ch ai r ); f or u m ( i ) := f ; t r an si t ( i ) := 0 e n d ; t al k i n gi ;
** t alking region ** 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
ex i t i : i f ch ai r = i t h e n b e g i n door := cl ose; f o r e a c h j = i d o b e g i n w a i t f o r t r an si t ( j ) = 0 o r ch eck dw ( j ) = 1; w a i t f o r f = f or u m ( j ) o r t i ck et ( j ) = 0 e n d ; ch ai r := 0; door := 0; f o r e a c h j = i d o w a i t f o r ch eck dw ( j ) = 0 e n d ; f or u m ( i ) := 0; t i ck et ( i ) := 0 ; t h i n k i n gi ;
Except for t he met hod of smoot h admission for philosophers wishing t o at t end t he current forum, in an execut ion by ( n , m )-S A H C G M E , t he mechanism for sat isfying group mut ual exclusion and lockout freedom is essent ially t he same as t he mechanism in an execut ion by ( n , m )-H C G M E . We t herefore omit t he proof of t he correct ness of t he algorit hm here. ( n , m ) - S A H C G M E gu aran t ees grou p m u t u al exclu sion , lockou t freedom , an d progress for t he exit region .
T h e o re m 4 .
6
C o n c lu d in g R e m arks
We have proposed two lockout -free algorit hms, ( n , m )-H C G M E and ( n , m )S A H C G M E , for t he group mut ual exclusion problem on t he asynchronous shared memory model. T he algorit hms given in [8,18,19] use mult i-writ er/ mult ireader shared variables t hat may be concurrent ly writ t en. T he algorit hms given in [6,10] use n 2 and n mult i-writ er/ mult i-reader shared variables, respect ively t hat are never concurrent ly writ t en. On t he ot her hand, ( n , m )-H C G M E and ( n , m )-S A H C G M E use single-writ er/ mult i-reader shared variables wit h only two mult i-writ er/ mult i-reader shared variables t hat are never concurrent ly writ t en. T he concurrency performances of t hese algorit hms are superior t o t he algorit hms in [6,10]. T he t icket domain of each of our algorit hms is unbounded, as in t he Bakery algorit hm. At present we do not know whet her we can simply modify our algorit hms by using similar t echniques given in [1,7,17] so t hat t he t he t icket domain is bounded. T his problem is wort hy of furt her invest igat ion.
Group Mut ual Exclusion Algorit hms Based on T icket Orders
241
R e fe re n c e s 1. U. Abraham, “Bakery algorit hms”, Technical Report , Dept . of Mat hemat ics, Ben Gurion University, Beer-Sheva, Israel, 2001. 2. J . H. Anderson, “Lamport on mut ual exclusion: 27 years of plant ing seeds”, P roceed in gs of t h e 27t h A n nu al A C M S y m p osiu m on P rin cip les of D ist rib u t ed C om p u t in g , Newport , Rhode Island, pp.3–12, 2001.
3. H. At t iya and J . Welch, “Dist ribut ed Comput ing: Fundament als, Simulat ions and Advanced Topics”, McGraw-Hill, New York, 1998. 4. E. W . Dijkst ra, “Solut ion of a problem in concurrent programming cont rol”, C om m u n icat ion s of t h e A C M , vol.8, p.569, 1965. 5. M. J . F ischer, N. A. Lynch, J . E. Burns, and A. Borodi, “Resource allocat ion wit h immunity t o limit ed process failure”, 20t h A n nu al S y m p osiu m on Fou n d at ion s of C om p u t er S cien ce , San J uan, P uert o Rico: 234–254, 1979. 6. V. Hadzilacos, “A not e on group mut ual exclusion”, P roceed in gs of 12t h A n nu al A C M S y m p osiu m on P rin cip les of D ist rib u t ed C om p u t in g , Newport , Rhode Island, pp.100–106, 2001. 7. P. J ayant i, K. Tan, G. Friedland, and A. Kat z, “Bounded Lamport ’ s bakery algorit hm”, P roceed in gs of S O F S E M ’2001 , L ect u re N ot es in C om p u t er S cien ce , vol.2234, Springer-Verlag, Berlin, pp.261–270, 2001. 8. Yuh-J zer J oung, “Asynchronous group mut ual exclusion”, D ist rib u t ed C om p u t in g , vol.13, pp.189–206, 2000. 9. Yuh-J zer J oung, “T he congenial t alking philosophers problem in comput er net works”, D ist rib u t ed C om p u t in g , vol.15, pp.155–175, 2002. 10. P. Keane and M. Moir, “A simple local-spin group mut ual exclusion algorit hm”, IE E E T ran sact ion s on P arallel an d D ist rib u t ed S y st em s , vol.12, 2001. 11. L. Lamport , “A new solut ion of Dijkst ra’ s concurrent programming problem”, C om m u n icat ion s of t h e A C M , vol.17, pp.453–455, 1974. 12. L. Lamport , “T he mut ual exclusion problem. P art II : St at ement and solut ions”, J . of t h e A C M , vol. 33, pp.327–348, 1986. 13. N. A. Lynch, “Dist ribut ed Algorit hms”, Morgan Kaufmann, San Francisco, California, 1996. 14. M. Omori, K. Obokat a, K. Mot egi and Y. Igarashi, “Analysis of some lockout avoidance algorit hms for t he k-exclusion problem”, Int erd iscip lin ary In form at ion S cien ces , vol.8, pp.187–192, 2002. 15. G. L. P et erson, “Myt hs about t he mut ual exclusion problem”, I n f o r m a t i o n P r o c e s s i n g L e t t e r s , vol.12, pp.115–116, 1981. 16. G. L. P et erson and M. J . F ischer, “Economical solut ions for t he crit ical sect ion problem in a dist ribut ed syst em”, P roceed in gs of t h e 9t h A n nu al A C M S y m p osiu m on T h eory of C om p u t in g , Boulder, Colorado, pp.91–97, 1977. 17. M. Takamura and Y. Igarashi, “Simple mut ual exclusion algorit hms based on bounded t icket s on t he asynchronous shared memory model”, IE IC E T ran sact ion s on In form at ion an d S y st em s , vol.E86-D, pp.246–254, 2003. 18. K. Vidyasankar, “A highly concurrent group mut ual l -exclusion algorit hm”, P roceed in gs of t h e 12t h A n nu al A C M S y m p osiu m on P rin cip les of D ist rib u t ed C om p u t in g , Mont erey, California, p.130, 2002. 19. K. Vidyasankar, “A simple group mut ual l -exclusion algorit hm”, In form at ion P rocessin g L et t ers , vol.85, pp.79–85, 2003.
D ist ribut ed A lgorit hm for Bet t er A pproximat ion of t he M aximum M at ching⋆ A . C zy gr i n ow 1 an d M . H a n ´ ´c k ow i ak 2 1
D ep ar t m ent of M at h em at i cs an d St at i st i cs A r i zon a St at e U n i ver si t y T em p e, A Z 85287-1804, U SA
[email protected] 2
Facu l t y of M at h em at i cs an d C om p u t er Sci en ce A d am M i ck i ew i cz U n i ver si t y, P ozn a´n , P ol an d
[email protected]
A bst ract . L et G b e a gr ap h on n ver t i ces t h at d oes n ot h ave od d cy cl es of l en gt h s 3 , . . . , 2 k − 1. W e p r esent an effi ci ent d i st r i b u t ed al gor i t h m t h at fi n d s i n O ( l og D n ) st ep s ( D = D ( k ) ) m at ch i n g M , su ch t h at |M | ≥ ( 1 − α ) |M ∗ |, w h er e M ∗ i s a m ax i m u m m at ch i n g i n G , α = k +1 1 .
1
I nt roduct ion
W e st u d y t h e p r ob l em of fi n d i n g an ap p r ox i m at i on t o a m ax i m u m m at ch i n g b y a d i st r i b u t ed al gor i t h m . W e con si d er t h e d i st r i b u t ed n et w or k m o d el i n t r o d u ced b y L i n i al i n [L i 92]. I n t h i s m o d el a d i st r i b u t ed n et w or k i s r ep r esen t ed b y an u n d i r ect ed gr ap h . V er t i ces of t h e gr ap h cor r esp on d t o p r o cessor s an d ed ges t o com m u n i cat i on l i n k s b et w een p r o cessor s. T h e n et w or k i s sy n ch r on i zed an d i n a si n gl e st ep each v er t ex can sen d m essages t o i t s n ei gh b or s, can r ecei v e t h e m essages f r om i t s n ei gh b or s, an d can p er f or m som e l o cal com p u t at i on s. W e m ak e n o ex p l i ci t assu m p t i on s ab ou t t h e am ou n t of l o cal com p u t at i on s an d t h e
G
l en gt h s of m essages. T h e gen er al p r ob l em i n t h i s set t i n g i s t h e f ol l ow i n g. L et b e a d i st r i b u t ed n et w or k d escr i b ed ab ov e. C an v er t i ces of f u n ct i on of
G in
G
com p u t e a gl ob al
a r el at i v el y sh or t t i m e? I n p ar t i cu l ar , t h e gl ob al f u n ct i on t h at w e
con si d er i s a “ l ar ge” m at ch i n g, w h i ch w e w an t t o fi n d i n t h e p ol y -l ogar i t h m i c ( i n
|V ( G) |)
n u m b er of st ep s. R ecen t r esu l t of H a n ´ ´c k ow i ak , K ar o n ´ sk i , an d P an con esi
[H K P 99] p r ov i d es a b r eak t h r ou gh i n t h i s ar ea. I n [H K P 99], au t h or s p r esen t ed an effi
ci en t d i st r i b u t ed al gor i t h m t h at fi n d s a m ax i m al m at ch i n g. N ot e t h at , w h en
M
i s a m ax i m al m at ch i n g, an d
M∗
a m ax i m u m m at ch i n g t h en
|M | ≥
1 ∗ 2 |M
|.
U si n g t h e t ech n i q u es f r om [H K P 99], C zy gr i n ow , H a n ´ ´c k ow i ak , an d Szy m a n ´ sk a [C H S02] d esi gn ed an effi su ch t h at
|M | ≥
2 ∗ 3 |M
|.
ci en t d i st r i b u t ed al gor i t h m t h at fi n d s a m at ch i n g
M
I n t h i s p ap er , w e p r op ose a d i st r i b u t ed al gor i t h m , t h at
fi n d s a b et t er ap p r ox i m at i on of t h e m ax i m u m m at ch i n g i n case t h e gr ap h d o es n ot h av e “ sh or t ” o d d cy cl es. ⋆
R esear ch su p p or t ed by K B N gr ant n o. 7 T 11C 032 20
T . W ar now and B . Zhu ( E ds.) : COCOON 2003, L N CS 2697, pp. 242–251, 2003. c Spr i nger -Ver l ag B er l i n H ei del b er g 2003
D i st r i b u t ed A l gor i t h m for B et t er A p p r ox i m at i on of t h e M ax i m u m M at ch i n g
243
T heorem 1. Let k be an integer larger than one and let G be a graph on n vertices that does not have odd cycles of lengths 3 , . . . , 2 k − 1 . T hen there is a constant D = D ( k ) and distributed algorithm, that finds in l og D n steps matching M such that k |M ∗ |, |M | ≥ k+ 1 where M ∗ is a maximum matching in G. If
M
G, t h en a p at h of l en gt h 2 l − 1 i s cal l ed M -au gm en t i n g − 1, ed ges al t er n at e b et w een M an d E ( G) \ M , an d b ot h M -sat u r at ed ( see t h e n ex t sect i on f or n ecessar y d efi n i t i on s) .
i s a m at ch i n g i n gr ap h
i f i t h as l en gt h 2 l en d p oi n t s ar e n ot
P r o of of T h eor em 1 i s b ased on t h e f ol l ow i n g f act ( see [F G H P 93]) .
T heorem 2. Let M ∗ be a maximum matching in graph G and let M be a matching such that there are no M -augmenting paths of lengths 1 , 3 , 5 , . . . , 2 k − 1 . T hen |M | ≥
k k+
1
|M ∗ |. M -au gm en t i n g
I n p ar t i cu l ar , t h e assu m p t i on t h at t h er e ar e n o on e m ean s t h at
M
l ow s. F i st , w e fi n d a m ax i m al m at ch i n g T h en w e i t er at e w i t h m al set of
p at h s of l en gt h
i s m ax i m al . T h e al gor i t h m f r om T h eor em 1 p r o ceed s as f ol -
l
M
u si n g t h e al gor i t h m f r om [H K P 99].
= 2 , . . . , k an d “ i m p r ov e” m at ch i n g
M -au gm en t i n g
p at h s of l en gt h s 2 l
i s f ou n d , t h e ed ges i n p at h s t h at b el on g t o
− M
M
b y fi n d i n g a m ax i -
1. O n ce t h e m ax i m al set of p at h s an d t h ose t h at ar e n ot i n
M
ar e
ex ch an ged . I t i s easy t o see t h at af t er t h i s ex ch an ge “ n ew ” m at ch i n g d o es n ot h av e au gm en t i n g p at h s of l en gt h s at m ost 2 l
−
1. C on seq u en t l y i t s si ze i s at
l
l east l + 1 |M ∗ |. F i n d i n g t h e m ax i m al set of M -au gm en t i n g p at h s i s h ow ev er n ot t r i v i al an d i n f act i t o ccu p i es t h e cen t r al p ar t of t h e p ap er . T h e set i s f ou n d b y
G an d m at ch i n g M . I t M -au gm en t i n g p at h s can b e f ou n d i n t h i s v i r t u al gr ap h ( p r o ced u r e Maximal-Paths-In-LayeredGraph) . O n ce f ou n d , i t i s t r an sl at ed t o a m ax i m al set of M -au gm en t i n g p at h s i n t h e or i gi n al gr ap h G. T o b e ab l e t o cl ai m t h at p at h s i n t h e v i r t u al gr ap h cor r esp on d t o p at h s ( n ot cy cl es) i n t h e or i gi n al gr ap h G t h e assu m p t i on ab ou t t h e cy cl e-st r u ct u r e of G i s u sed . F i n al l y, n ot e t h at al t h ou gh t h er e i s a r i ch l i t er at u r e
con si d er i n g an au x i l i ar y, v i r t u al , gr ap h con st r u ct ed f r om
t u r n s ou t t h at u si n g, so-cal l ed sp an n er s, a m ax i m al set of
on d i st r i b u t ed al gor i t h m s f or m at ch i n g p r ob l em s m ost of t h e p ap er s ar e f o cu sed on a d i ff er en t com p u t at i on al m o d el t h an t h e on e con si d er ed i n t h i s p ap er . T h e r est of t h e p ap er i s st r u ct u r ed as f ol l ow s. I n t h e n ex t sect i on , w e i n t r o d u ce n ecessar y n ot at i on an d au x i l i ar y f act s. Sect i on 3 con t ai n s p r o ced u r e t h at fi n d s a m ax i m al set of au gm en t i n g p at h s i n t h e v i r t u al gr ap h . I n Sect i on 4, w e d escr i b e t h e t r an sl at i on m et h o d an d t h e m ai n al gor i t h m .
2
D efinit ions and N ot at ion
I n t h i s sect i on , w e i n t r o d u ce n ecessar y d efi n i t i on s an d n ot at i on . L et m at ch i n g i n gr ap h
G.
W e say t h at a v er t ex
v
is
M -saturated i f v
M
be a
i s an en d p oi n t
244
A . C zy gr i n ow an d M . H a´n ´ckow i ak
of som e ed ge f r om
M -sat u r at ed . L et P b e a
M.
A n ed ge
e
=
{ u, v}
is
M -saturated
i f ei t h er
u
or
v
is
G an d l et M 1 an d M 2 b e t w o m ax i m al m at ch i n gs i n P t h at P , i .e. E ( P ) = M 1 ∪ M 2 . W e say t h at P i s M -alternating i f ei t h er M 1 ⊂ M or M 2 ⊂ M . P at h P of l en gt h 2 k − 1, k ≥ 1, augments M i f P i s M -al t er n at i n g an d b ot h en d s of P ar e n ot M -sat u r at ed . T h ese M -al t er n at i n g p at h s t h at au gm en t M w i l l p l ay a cr u ci al r ol e i n ou r ap p r oach . p at h i n
p ar t i t i on t h e ed ges of
D efinit ion 1. Let M be a matching and let k be a positive integer. A path is called an ( M , 2 k − 1) -path if it augments M and has length 2 k − 1 . P at h s ar e cal l ed
disjoint
i f t h ey ar e p ai r w i se v er t ex -d i sj oi n t . N ex t w e d efi n e t h e
n ot i on of a su b st an t i al m at ch i n g an d a su b st an t i al set of p at h s.
D efinit ion 2. A matching M is γ -substantial in graph G = ( V, E ) if the number of M -saturated edges in G is at least γ |E |. U si n g an al gor i t h m f r om [H K P 99] w e can fi n d a con st an t
γ
γ
-su b st an t i al m at ch i n g f or an y
.
Lemma 1. Let n be the number of vertices of a graph. For any γ > 0 there is a distributed algorithm that finds in O( l og 3 n ) steps a γ -substantial matching. T h e n ot i on of a su b st an t i al m at ch i n g ex t en d s i n a n at u r al w ay t o a su b st an t i al set of p at h s.
D efinit ion 3. For matching M and positive integer k let M be the set of all ( M , 2 k − 1) -paths in graph G. A set P of ( M , 2 k − 1) -paths is γ -path-substantial if the number of ( M , 2 k − 1) -paths that have at least one common vertex with some path from P is at least γ |M |. N ex t , w e d efi n e t h e
P.
modificat ion of G w i t h
r esp ect t o a set of ( M , 2 k − 1) -p at h s
T h e m o d i fi cat i on i s com p osed of 2 st ep s:
A ) r em ov e al l ed ges of
G
t h at ar e i n ci d en t t o som e p at h f r om
P,
B ) r em ov e al l ed ges t h at d o n ot b el on g t o som e au gm en t i n g p at h s of l en gt h 2k
−
1; ( “ n ew ” ed ges of t h i s sor t can ap p ear af t er st ep A ) .
O u r al gor i t h m u ses t h e so cal l ed sp an n er s i n b i p ar t i t e gr ap h s. A b i p ar t i t e gr ap h
H
= ( A, B , E ) i s cal l ed a
D -block i f D 2
f or ev er y v er t ex
a ∈ A,
< degH ( a) ≤ D .
A k ey i n gr ed i en t u sed i n r en d er i n g a “ su b st an t i al ” set of d i sj oi n t p at h s w i l l b e a sp an n er .
D efinit ion 4. An ( α , β ) -spanner of a D -block H = ( A, B , E ) (from A to B ) is a subgraph S = ( A ′ , B , E ′ ) of H such that the following conditions are satisfied. 1. |A ′ | ≥ α |A|. 2. For every vertex a ∈ A ′ , degS ( a) = 3. For every vertex b ∈ B , degS ( b)
1. Output : a su b st an t i al set of d i sj oi n t p at h s con n ect i n g X 1 an d X 2L
i n b l o ck
G.
1
1. F i n d a ( 2 , 16) -sp an n er S i n Gr i gh t . 2. C on st r u ct an au x i l i ar y ( 2 L − 2) -l ay er ed m u l t i -gr ap h
3.
G′l ef t
= ( X 1, . . . , X 2L − 3 , X ) as f ol l ow s. – F or ev er y st ar i n t h e sp an n er S l et x ( 1) , . . . , x ( l ) b e t h e v er t i ces i n X 2L − 1 t h at h av e d egr ee on e i n S an d l et x ′ ( 1) , . . . , x ′ ( l ) b e t h e v er t i ces i n X 2L − 2 t h at ar e m at ch ed w i t h x ( 1) , . . . , x ( l ) b y t h e m at ch i n g M b et w een X 2L − 2 an d X 2L − 1 . C r eat e a super-vertex s = s( x ′ ( 1) , . . . , x ′ ( l ) ) = { x ′ ( 1) , . . . , x ′ ( l ) } . T h e v er t ex set X ′ con t ai n s al l su p er -v er t i ces. – F or ev er y v er t ex x ∈ X 2L − 3 an d ev er y x ′ ( j ) ∈ s( x ′ ( 1) , . . . , x ′ ( l ) ) p u t an ed ge b et w een x an d t h e su p er -v er t ex s = s( x ′ ( 1) , . . . , x ′ ( l ) ) i n G′l ef t i f x an d x ′ ( j ) ar e con n ect ed i n G2L − 3 . – E v er y ed ge of G t h at i s p r esen t i n Gi f or som e i ∈ { 1 , . . . , 2 L − 4 } i s al so p r esen t i n G′l ef t C on si d er a m ax i m al si m p l e su b gr ap h of G′l ef t ( i .e. d i scar d p ar al l el ed ges) . – I f L > 2 t h en i n v ok e Maximal-Paths-In-Layered-Graph t o fi n d a m ax i m al set of ( M , 2 L − 3) -p at h s i n t h e su b gr ap h of G′l ef t . – I f L = 2 t h en fi n d a m ax i m al m at ch i n g ( m ax i m al set of ( M , 1) -p at h s) i n ′
t h e su b gr ap h u si n g t h e p r o ced u r e f r om [H K P 99]. 4. E x t en d p at h s f ou n d i n ( 3) t o ( M , 2 L m at ch i n g ed ges of
G2L − 2
an d sp an n er
− 1) -p at h s S.
i n t h e b l o ck
G
u si n g t h e
T h er e i s a sm al l t ech n i cal p oi n t t h at m u st b e ad d r essed at t h i s m om en t . I n t h e t h i r d st ep of t h e al gor i t h m , p ar al l el ed ges ar e d i scar d ed an d t h en a m ax i m al set of p at h s i s f ou n d . N ot e t h at p ar al l el ed ges on l y ad d t h e r ep et i t i on s of ( M , 2 L − 3) p at h s. C on seq u en t l y t h e set of p at h s f ou n d i n st ep 3 i s al so m ax i m al i n
G′l ef t .
D i st r i b u t ed A l gor i t h m for B et t er A p p r ox i m at i on of t h e M ax i m u m M at ch i n g
247
Substantial-Pathsin-Block i s su b st an t i al i n G. L et P b e t h e set of p at h s f ou n d b y t h e p r o ced u r e, Pl ef t b e t h e set of p at h s i n Gl ef t ob t ai n ed f r om P b y r est r i ct i n g t o Gl ef t , an d Pr i gh t set of p at h s ( of l en gt h on e) i n Gr i gh t ob t ai n ed f r om P b y r est r i ct i n g t o Gr i gh t .
N ex t w e sh al l sh ow t h at t h e set of p at h s ob t ai n ed f r om
Lemma 3. For every 0 < κ < 14 either Pl ef t is Gl ef t or Pr i gh t is κ / 16 -substantial in Gr i gh t .
(1
− 4 κ ) / 4 -path-substantial in
P r o of of L em m a 3 i s r at h er l on g an d i t m i m i cs t h e p r o of of a si m i l ar f act f r om [C H S02]. I t i s an easy con seq u en ce of L em m a 3 t h at t h e set of p at h s f ou n d b y
Substantial-Paths-in-Block
i s su b st an t i al i n
G.
Lemma 4. I f Pl ef t is γ -path-substantial in Gl ef t or Pr i gh t is γ -substantial in Gr i gh t then P is γ / 2 -path-substantial in G. W e om i t a r ou t i n e p r o of .
Procedure Maximal-Paths-In-Layered-Graph I nput : a l ay er ed gr ap h G w i t h 2 L -l ay er s ( X 1 , . . . X 2L ) . Output : a m ax i m al set of d i sj oi n t au gm en t i n g p at h s con n ect i n g X 1 G. 1. f or f or a) b)
i := 1 , . . . , ( L − 1) ⌈ l og n⌉ d o: j := 1 , . . . , ⌈ l og n⌉ d o: L− 1 D 1 := n 2i ; D 2 := 2nj ; i t er at e O( l og n ) -t i m es: – i n v ok e Substantial-Paths-in-Block( D 1 , D 2 )
an d
X 2L
in
i n or d er t o fi n d a
su b st an t i al set of p at h s i n t h e b l o ck an d m o d i f y t h e gr ap h
G
w it h
r esp ect t o t h at set .
Lemma 5. Procedure Maximal-Paths-In-Layered-Graph finds a maximal set of disjoint paths in G in l og O ( L ) n steps. Proof.
F i r st n ot e t h at d u e t o t h e m o d i fi cat i on d on e i n each st ep of t h e p r o-
ced u r e t h e r esu l t i n g p at h s ar e d i sj oi n t . W e sh al l sh ow t h at t h e set of p at h s i s al so m ax i m al . F i r st , fi x a ( D 1 , D 2 ) -b l o ck . B y L em m a 4,
in-Block( D 1 , D 2 )
Substantial-Pathsα -p at h -su b st an t i al t h e m o d i fi cat i on st ep , at l east α
fi n d s, f or som e fi x ed con st an t
set of d i sj oi n t p at h s i n a ( D 1 , D 2 ) -b l o ck . T h u s i n
α >
0, an
f r act i on of al l p at h s i n t h e b l o ck w i l l b e d el et ed f r om i t . H ow ev er t h e t ot al n u m b er of t h e p at h s i n w h ol e
G
i s at m ost
nO ( L )
an d so af t er
O( l og n )
i t er at i on s al l t h e
p at h s w i l l b e d el et ed f r om t h e b l o ck . I n ot h er w or d s, set of p at h s ob t ai n ed af t er
O( l og 2 n ) d i sof G b el on gs t o
i t er at i on s i n ( b ) w i l l b e m ax i m al i n t h e b l o ck . N ot e t h at t h er e ar e j oi n t b l o ck s , d efi n ed b y p ar am et er s
D 1, D 2
i n ( a) , an d each p at h
ex act l y on e of t h em . T h u s af t er i t er at i on s i n st ep 1 t h e set f ou n d b y t h e p r o ced u r e w i l l b e m ax i m al i n ev er y b l o ck an d con seq u en t l y m ax i m al i n
G.
F i n al l y l et u s es-
t i m at e t h e r u n n i n g t i m e of t h e p r o ced u r e. F i r st n ot e t h at t h e or d er of t h e v i r t u al gr ap h i s
O( n )
an d each st ep i n t h e v i r t u al gr ap h can b e si m u l at ed i n gr ap h
G
in
248
A . C zy gr i n ow an d M . H a´n ´ckow i ak
O( 1)
st ep s. F or
i >
1, l et
Ri
b e t h e r u n n i n g t i m e of t h e p r o ced u r e i n v ok ed i n t h e
l ay er ed gr ap h w i t h 2 i b l o ck s an d l et
R1
=
O( l og 4 n )
b e t h e t i m e n eed ed t o fi n d
t h e m ax i m al m at ch i n g u si n g t h e al gor i t h m f r om [H K P 99]. T o est i m at e t i ce t h at t h er e ar e
O( l og 2 n )
Ri
n o-
i t er at i on s ov er al l p ossi b l e b l o ck s an d i n each b l o ck
O( l og n ) i t er at i on s ar e n eed ed . I n each i t er at i on i n a b l o ck Substantial-Pathsin-Block( D 1 , D 2 ) i s i n v ok ed . T h i s p r o ced u r e fi n d s a sp an n er i n O( l og 3 n ) st ep s ( L em m a 2) an d t h en i n v ok es Maximal-Paths-In-Layered-Graph i n a l ay er ed gr ap h w i t h 2 i − 2 l ay er s ( or fi n d s a m ax i m al m at ch i n g i n t h e b i p ar t i t e gr ap h w h en i = 2) . T h u s, R i = O( l og 3 n ( l og 3 n + R i − 1 ) ) . C on seq u en t l y, R L = l og O ( L ) n .
4
G raphs wit hout Odd Cycles of Lengt h Less t han or Equal t o c
I n t h i s sect i on , w e sh al l p r esen t ou r m ai n p r o ced u r e f or com p u t i n g a m at ch i n g
M
f r om T h eor em 1. A s ex p l ai n ed i n t h e i n t r o d u ct i on ou r ap p r oach i s b ased on
fi n d i n g
M -au gm en t i n g
p at h s. F i n d i n g a su b st an t i al set of d i sj oi n t
p at h s i n t h e i n p u t gr ap h
G
seem s t o b e d i ffi
M -au gm en t i n g
cu l t . H ow ev er , as w e saw i n t h e l ast
sect i on , i f a gr ap h h as a l ay er ed st r u ct u r e, au gm en t i n g p at h s can b e f ou n d b y
Maximal-Paths-In-Layered-Graph. T h e d r ess i s h ow t o r ed u ce gr ap h G t o a l ay er ed
m ai n p r ob l em t h at w e m u st ad -
Reduce) an d G p r eser v i n g t h e p r op er t y t h at t h e set of p at h s i s su b st an t i al ( P r o ced u r e Translate) . N ex t p r o ced u r e con st r u ct s a v i r t u al , l ay er ed gr ap h f r om G. gr ap h ( P r o ced u r e
h ow t o t r an sl at e d i sj oi n t p at h s i n t h e l ay er ed gr ap h t o t h e or i gi n al gr ap h
Procedure Reduce I nput : a gr ap h G, a m at ch i n g M i n G, a n u m b er L . Output : a l ay er ed gr ap h L ay( G) = ( X 1 , . . . , X 2L ) . N v er t i ces of G n ot sat u r at ed b y M . N ; X i := e∈ M e, f or i = 2 , . . . , 2 L − 1; X 2L := N . F or k = 1 , . . . , 2 L − 1 d efi n e Gk = L ay ( G) [ X k , X k + 1 ] as f ol l ow s. F or i = 1 , . . . , L : e ∈ G2i − 1 i f an d on l y i f t h er e ex i st an au gm en t i n g p at h i n G t h at h as an ed ge e on t h e 2 i − 1 p osi t i on ( cou n t i n g f r om w h at ev er en d ) . F or i = 1 , . . . , L − 1: e ∈ G2i i f an d on l y i f e ∈ M .
1. L et s d en ot e b y
X1
2.
:=
X 2 , . . . X 2L − 1 M . T h u s ev er y
L ay( G) con t ai n al l v er t i ces t h at ar e con { a1 , a2 } ∈ M ap p ear s t w i ce i n G2i ( see F i gu r e 1) . O n e i m p or t an t p r op er t y of L ay ( G) i s t h at ev er y ( M , 2 L − 1) -p at h i n G i s p r esen t ( h as a cor r esp on d i n g ( M , 2 L − 1) -p at h ) i n L ay ( G) . U si n g assu m p t i on s ab ou t G, w e can sh ow t h at t h e op p osi t e d i r ect i on i s al so t r u e. N am el y t h at ev er y ( M , 2 L − 1) -p at h i n L ay ( G) cor r esp on d s t o a ( M , 2 L − 1) -p at h i n G.
N ot i ce, t h at l ay er s
in
t ai n ed i n ed ges of
ed ge
Lemma 6. Let G be a graph without odd cycles of lengths 3 , 5 , . . . , 2 L − 1 and let M be such that there are no augmenting paths in G of lengths 1 , 3 , 5 , . . . , 2 L − 3 . T hen every augmenting path connecting X 1 with X 2L in the layered graph corresponds to an augmenting path in graph G of length 2 L − 1 .
D i st r i b u t ed A l gor i t h m for B et t er A p p r ox i m at i on of t h e M ax i m u m M at ch i n g
249
∈ M
v1 v2 v3
an i n p u t gr ap h
a1
a2
b1
b2
c1
c2
a1
a2
a1
a2
a2 b1
a1 b2
a2 b1
a1 b2
b2 c1
b1 c2
b2 c1
b1 c2
c2
c1
c2
c1
X3
X4
X5
G
a l ay er ed gr ap h ( X 1 , . . . , X 2L )
v4
v1 v2 v3 v4
X1
X2 G1
v1 v2 v3 v4
X6
G2
F ig. 1. T h e r ed u ct i on ( au gm ent i n g p at h s of l en gt h 5) .
W e om i t t h e p r o of . N ot e t h at assu m p t i on s i n L em m a 6 w i l l b e sat i sfi ed d u r i n g t h e ex ecu t i on of ou r al gor i t h m . F i r st , m ost 2 L
−
G
d o es n ot h av e o d d cy cl es of l en gt h s at
1 b y t h e assu m p t i on . Secon d ,
p at h s as w e w i l l i t er at e w i t h
k
=
G
w i l l n ot h av e sh or t er au gm en t i n g
3, 5, . . . , 2L
−
1 an d i n t h e
kt h
i t er at i on ,
w e sh al l el i m i n at e al l ( M , k ) -au gm en t i n g p at h s. F i n al l y, t h e i n i t i al m at ch i n g
M P
w i l l b e m ax i m al an d so n o ( M , 1) -au gm en t i n g p at h s w i l l b e p r esen t . L et b e a set of d i sj oi n t ( M , 2 L
− 1) -p at h s i n L ay( G) . B y L em m a 6 P i s al so a G. H ow ev er t h e p at h s d o n ot n eed t o b e d i sj oi n t i n G. D efi n e t h e pat h graph GP b y V ( GP ) = P an d p u t an ed ge b et w een t w o v er t i ces of GP w h en t h e cor r esp on d i n g p at h s i n t er sect i n G. I n ad d i t i on , w e d efi n e t h e i d en t i fi er s of v er t i ces of V ( GP ) . L et I d( v) d en ot e t h e i d en t i fi er of v er t ex v i n G. I f p = v1 , v2 , . . . , v2L i s a p at h i n G w h i ch i s a v er t ex i n V ( GP ) an d i f I d( v1 ) < I d( v2L ) t h en t h e i d en t i fi er of p i n GP i s t h e v ect or [ I d( v1 ) , I d( v2 ) , . . . , I d( v2L ) ]. A l t h ou gh p at h s f r om P d on ’ t n eed t o b e d i sj oi n t i n G t h e m ax i m u m d egr ee of GP w i l l b e a con st an t t h at d ep en d s on l y on L .
set of ( M , 2 L
−
1) -p at h s i n
Lemma 7. Let P be a set of paths obtained by Maximal-Paths-In-LayeredGraph. T he maximum degree of GP is a constant independent of n. B ef or e w e d escr i b e t h e p r o ced u r e t h at t r an sl at es d i sj oi n t p at h s i n d i sj oi n t p at h s i n
G
L ay( G)
to
w e n eed t o i n t r o d u ce t h e n ot i on of a h eav y M ax i m al I n d e-
p en d en t Set ( M I S) . L et
H
= ( W, F ) b e a gr ap h w i t h w ei gh t s on v er t i ces, i .e.
250
w ∈
A . C zy gr i n ow an d M . H a´n ´ckow i ak
W
h as a w ei gh t wei ght ( w) . T h e w ei gh t of a set of v er t i ces A i s t h en d e wei ght ( A ) := w ∈ A wei ght ( w) . Si m i l ar l y t h e w ei gh t of a su b gr ap h Q i s d efi n ed as wei ght ( Q) := wei ght ( V ( Q) ) . T h e α -heavy M I S i n H i s a m ax i m al i n d ep en d en t set A of v er t i ces su ch t h at wei ght ( A ) ≥ α wei ght ( H ) . W e n ot e h er e, 1 t h at f or a con st an t d a 2( d+ 1) 2 -h eav y M I S can b e f ou n d b y a d i st r i b u t ed al go-
fi n ed as
r i t h m i n a gr ap h
G
w it h
∆ ( G)
=
d,
in t im e
O( l og 2 n ) .
D et ai l s of t h i s p r o ced u r e
w i l l ap p ear i n t h e j ou r n al v er si on of t h e p ap er . N ow w e can d escr i b e p r o ced u r e
Translate:
Procedure Translate I nput : a set P of d i sj oi n t , au gm en t i n g p at h s con n ect i n g set s X 1 an d X 2L i n t h e l ay er ed gr ap h ; P i s m ax i m al i n t h e l ay er ed gr ap h . Output : a set P ′ of d i sj oi n t , au gm en t i n g p at h s of l en gt h s 2 L − 1 i n t h e i n p u t gr ap h G; P ′ i s p at h -su b st an t i al i n G. 1. F or each v er t ex
v
of t h e p at h gr ap h
GP
v
( or i n ot h er w or d s “ t ou ch ”
2. C om p u t e a h eav y M I S,
P′
3. T h e set
X
in
wei ght ( v)
assi gn t h e v al u e
t h e n u m b er of au gm en t i n g p at h s of l en gt h 2 L
−
1 in
G
eq u al t o
t h at ar e i n ci d en t t o
v) . GP . X.
con t ai n s p at h s t h at cor r esp on d t o v er t i ces of
T heorem 3. Let G be as in Lemma 6 and let L ay( G) be the layered graph with 2 L layers obtained from G by procedure Reduce. Let P be the set of paths in L ay( G) obtained by Maximal-Paths-In-Layered-Graph. T hen the set P ′ obtained from P by Translate is a β -path-substantial set of disjoint paths in G for certain constant β . I n addition, Translate runs O( L l og 2 n ) steps. Maximal-Paths t h at fi n d s shor test . N ot e t h at G an d M ar e as i n L em m a 6 w i t h shor test = 2 L − 1. I n t h e fi n al p r o ced u r e Main w e i t er at e w i t h shor test = 3 , 5 , . . . , c t o ob t ai n a m ax i m al set of ( M , c) -p at h s i n G.
W e om i t t h e p r o of . N ex t , w e d escr i b e t h e p r o ced u r e a m ax i m al , set of ( M , shor test ) -p at h s i n
G f or
an o d d , p osi t i v e i n t eger ,
Procedure Maximal-Paths I nput : an i n p u t gr ap h G; a m at ch i n g M ; a n u m b er shor test . Output : a m ax i m al , set of ( M , shor test ) -p at h s i n G. – –
L et
P
∅ . O( l og n )
:=
R ep eat 1. C al l
t i m es:
Reduce t o b u i l d a l ay er ed L := ( shor test + 1) / 2. Maximal-Paths-In-Layered-Graph on p r o ced u r e
gr ap h
w it h
2 L -l ay er s
( X 1 , . . . , X 2L ) , w h er e 2. C al l
l ay er ed gr ap h t o fi n d
m ax i m al set of d i sj oi n t , au gm en t i n g p at h s con n ect i n g set s
Translate t o p at h s i n G.
3. C al l
get a p at h -su b st an t i al set
4. M o d i f y t h e cu r r en t gr ap h w i t h r esp ect t o
–
T h e set
P
i s t h e r esu l t of t h at p r o ced u r e.
P′ .
P′ L et
X1
an d
X 2L .
of d i sj oi n t , au gm en t i n g
P
:=
P ∪ P′
D i st r i b u t ed A l gor i t h m for B et t er A p p r ox i m at i on of t h e M ax i m u m M at ch i n g
251
T heorem 4. Let G be a graph without odd cycles of lengths 3 , 5 , . . . , shor test and let M be such that there are no M -augmenting paths in G of lengths at most shor test − 2 . T hen procedure Maximal-Paths finds a maximal set of disjoint O ( sh or t est ) ( M , shor test ) -paths in G. I n addition, Maximal-Paths runs in l og n steps. Procedure Main I nput : an o d d n u m b er c ≥ 3; gr ap h G w i t h ou t o d d cy cl es of eq u al t o c. Output : a m at ch i n g i n G su ch t h at t h er e i s n o au gm en t i n g t h an or eq u al t o c.
l en gt h l ess t h an or p at h of l en gt h l ess
G u si n g t h e p r o ced u r e f r om [H K P 99]. shor test := 3 t o c st ep 2 d o: C al l Maximal-Paths t o fi n d a m ax i m al set of d i sj oi n t , au gm en t i n g p at h s of l en gt h shor test .
1. C om p u t e a m ax i m al m at ch i n g i n 2. F or a)
b ) A u gm en t al l au gm en t i n g p at h s. N ot e t h at d u r i n g t h e ex ecu t i on of t h e al gor i t h m w e t r y t o “ i m p r ov e” t h e m at ch i n g com p u t ed i n st ep 1: som e of t h e ed ges of t h e m at ch i n g w i l l b e d el et ed , an d som e w i l l b e ad d ed t o i t as w e au gm en t p at h s i n 2( b ) . W e can su m m ar i ze t h e d i scu ssi on i n t h e f ol l ow i n g t h eor em .
T heorem 5. Let c be an integer larger than two and let G be a graph on n vertices that does not have odd cycles of lengths less than or equal to c. T hen procedure Main finds a matching M in G such that there are no M -augmenting paths in G of lengths less than or equal to c. I n addition, Main runs in l og O ( c) n steps. Proof of T heorem 1. B y T h eor em 5, Procedure Main fi n d s M -au gm en t i n g p at h s of l en gt h s 1 , 3 , 5 , . . . , c, k T h u s, b y T h eor em 2, |M | ≥ k + 1 |M ∗ |. t h at t h er e ar e n o
a m at ch i n g w h er e
c=
M
so
2 k − 1.
R eferences [C H S02] [F G H P 93] [H K P 99]
[L i 92]
A . C zy gr i n ow , M . H a´n ´ckow i ak , E . Szy m a´n ska, Distributed algor ithm for approximating the maximum matching, su b m i t t ed , 2002. T . F i sch er , A . V . G ol d b er g, D . J . H agl i n , S. P l ot k i n , Approximating matchings in parallel , I n for m at i on P r ocessi n g L et t er s, 1993, 46, p p . 115–118. M . H a´n ´ckow i ak , M . K ar o´n sk i , A . P an con esi , A faster distributed algor ithm for computing maximal matching deter ministically, P r oceed i n gs of P O D C 99, t h e E i ght een A n nu al A C M SI G A C T -SI G O P S Sy m p osi u m on P r i n ci p l es of D i st r i b u t ed C om p u t i n g, p p . 219–228. N . L i n i al , Locality in distributed graph algorithms, SI A M J ou r n al on C om p u t i n g, 1992, 21( 1) , p p . 193–201.
Effi
c ie n t M a p p in g s fo r P a rit y -D e c lu s t e re d D a t a Lay o u t s Eric J . Schwabe⋆ and Ian M. Sut herland DeP aul University [email protected], sans [email protected]
T he joint demands of high performance and fault t olerance in a large array of disks can be sat isfied by a parity-declust ered dat a layout . Such a dat a layout is generat ed by part it ioning t he dat a on t he disks int o st ripes and choosing a part of each st ripe t o hold redundant informat ion. T hus t he dat a layout can be represent ed as a t able of st ripes. T he dat a mapping problem is t he problem of t ranslat ing a dat a address int o a disk ident ifier and an off set on t hat disk. Recent work has yielded mappings t hat comput e disks and off set s direct ly from dat a addresses wit hout t he need t o st ore t ables. In t his paper, we show t hat paritydeclust ered dat a layout s based on commut at ive rings yield mappings wit h improved comput at ional effi ciency and wider applicability. A b st r a c t .
1
In t ro d u c t io n
1 .1
D a t a Lay o u t s fo r D is k A rray s
Disk arrays provide increased I/ O t hroughput for large dat a set s by dist ribut ing t he dat a over a collect ion of smaller disks (inst ead of a single larger disk) and allowing parallel access [7]. Since each disk in t he array may fail independent ly wit h some probability per unit t ime, t he probability t hat some disk in a large array will fail in unit t ime is great ly increased. T hus, t he ability t o reconst ruct t he cont ent s of a failed disk is import ant t o t he feasibility of large disk arrays. One t echnique t o achieve fault t olerance in an array of v disks is called RAID5 (t hus named by Pat t erson, Gibson, and Kat z [7]). T his t echnique is illust rat ed in Figure 1. Each disk is divided int o u n i t s , and in each row, one of t he unit s holds t he bitwise exclusive “or” (i.e., parity) of t he remaining v − 1 unit s. T his allows t he disk array t o recover from a single disk failure, as t he cont ent s of each unit on t he failed disk can be reconst ruct ed by t aking t he bitwise exclusive “or” of t he v − 1 surviving unit s from t hat row. T hus, by dedicat ing 1/ v of t he t ot al space in t he array t o redundant informat ion, t he array can recover from any single disk failure by reading t he ent ire cont ent s of each of t he surviving disks. In general, we can achieve fault t olerance by const ruct ing a d a t a la y o u t — an arrangement of dat a and redundant informat ion t hat allows t he array t o reconst ruct t he cont ent s of one or more failed disks. A dat a layout is creat ed by
⋆
Support ed in part by NSF Grant CCR-9996375.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 252–261, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Effi cient Mappings for P arity-Declust ered Dat a Layout s
D0.0
D0.1
D0.2
P0
D1.1
D1.2
P1
D1.0
D2.2
P2
D2.0
D2.1
P3
D3.0
D3.1
D3.2
RAID5 on a four-disk array. In each row i , t he parity unit exclusive “or” of t he t hree dat a unit s D i . 0 , D i . 1 , and D i . 2 .
F ig. 1 .
Pi
253
is t he bitwise
part it ioning t he unit s in t he array int o a collect ion of non-overlapping s t r i p e s . (In t he RAID5 example, t he st ripes used are precisely t he rows.) T he number of unit s in each st ripe is called t he s t r i p e s i z e . Some subset of t he unit s in each st ripe will hold users’ dat a; however, one or more unit s per st ripe will inst ead hold redundant informat ion comput ed from t he dat a st ored in t he ot her unit s of t he st ripe. (In t he RAID5 example, t he st ripe size is v , and one unit per st ripe st ores t he parity of t he remaining unit s.) T his redundant informat ion st ored for each st ripe enables t he array t o recover from disk failures. If an array must remain available during t he reconst ruct ion of lost dat a, or must be t aken off -line for as lit t le t ime as possible for failure recovery, we may wish t o reduce t he t ime spent on failure recovery at t he cost of dedicat ing more space t o redundant informat ion. T his t radeoff of addit ional redundant space for reduced recovery t ime can be achieved using a t echnique called p a r i t y d ec lu s t e r i n g , in which t he st ripe size k is smaller t han t he array size v . Paritydeclust ered dat a layout s have been considered by, among ot hers, Holland and Gibson [4], Munt z and Lui [6], Schwabe and Sut herland [8], St ockmeyer [9], and Alvarez, Burkhard, and Crist ian [1]. Many const ruct ions of parity-declust ered layout s use ba la n ced i n co m p le t e b lo c k d e s i g n s (BIBDs). A BIBD is a collect ion of b subset s (called t u p le s ) of k element s, each drawn from a set of v element s, t hat sat isfies t he following two propert ies (see, e.g., Hanani [3]): First , each element appears t he same number of t imes (called r ) among t he b t uples. Second, each pair of element s appears t he same number of t imes (called λ ) among t he b t uples. (In fact , as long as k ≥ 2, t he second property implies t he first , since r = λ · kv 11 .) In order t o const ruct a dat a layout from a BIBD, we consider t he v element s t o be t he disks in t he array. Each t uple in t he BIBD corresponds t o a st ripe cont aining one unit from each of t he disks t hat appear in t hat t uple. T herefore each st ripe will cont ain unit s from exact ly k disks, and each disk will cont ain exact ly r unit s. (We call r t he s i z e of t he layout .) For each pair of disks, t here are exact ly λ st ripes t hat cont ain a unit from bot h disks. If each st ripe cont ains k − 1 unit s of dat a and one of redundant informat ion, t hen when one disk fails, exact ly λ unit s from each of t he remaining disks (i.e., a kv 11 fract ion of t heir cont ent s) will have t o be read t o reconst ruct t he lost dat a. −
−
−
−
254
1 .2
E.J . Schwabe and I.M. Sut herland
T h e D a t a M a p p in g P ro b le m
A disk array appears t o it s client s as a single logical disk wit h a linear address space. Dat a addresses in t his space are mapped t o disks and off set s on t hose disks. One way t o do t his is t o use a t able derived from a BIBD. T he t uples of t he BIBD make up t he rows of t he t able, and each ent ry in a row is an element of t hat t uple. In t his t able, each row will represent one st ripe in t he layout , and each ent ry in a row will represent a disk from which t hat st ripe cont ains a unit . Addresses from t he linear address space can be assigned in row-ma jor order t o t he ent ries of t he t able, ignoring t he last ent ry in each row, which is a redundancy unit . (T hus k − 1 dat a unit s are assigned t o each row in t he t able.) T his associat es a disk ident ifier wit h each address. T he off set for an address is t he number of t imes t he corresponding disk ident ifier appears in rows above t he row where t hat address appears. T his mapping is due t o Holland and Gibson [4], and is illust rat ed in Figure 2 for t he complet e block design wit h v = 5 and k = 4. To comput e a disk and off set from a given address, we first map it t o a row and column in t he t able, set t ing ro w = a d d re s s / ( k − 1) and co lu m n = a d d re s s mod k − 1. Next , we use t he cont ent s of t he t able t o det ermine t he disk and off set where t hat address is locat ed. T he disk number can be obt ained wit h a single lookup in t he t able of st ripes, since it is t he value st ored in t he comput ed row and column. T he off set is a bit more diffi cult t o comput e, as it depends on t he number of occurrences of t he discovered disk number t hat appear in rows above t he comput ed row. Off set s can be precomput ed while t he t able is being const ruct ed (requiring addit ional work proport ional t o t he size of t he t able), and if t his is done t hen t he off set can also be det ermined wit h a single t able lookup. However, t he result ing t able could be quit e large. For inst ance, in t he case of a dat a layout derived from a co m p le t e block design, which consist s of all subset s of size k of t he set of v disks, t he t able will have kv rows and k columns. 1 .3
O u r R e s u lt s
T his paper considers ways t o reduce t his space requirement by using dat a layout s t hat do not require t he st orage of t ables of st ripes. Alvarez, Burkhard, and Crist ian [1] proposed t he DAT UM layout s for t his purpose, but did not consider t he comput at ional complexity of t heir dat a mappings nor t he usability of t he layout s for large arrays. We review t hese layout s in Sect ion 2. We present an alt ernat ive in Sect ion 3: ring-based dat a layout s. Bot h DAT UM layout s and ring-based layout s t ake advant age of t heir mat hemat ical st ruct ure t o comput e disks and off set s direct ly. We analyze t he comput at ional complexity of t he dat a mappings of ring-based layout s as well as t hose of DAT UM, and show in Sect ion 4 t hat ring-based layout s have smaller t ime complexity t han DAT UM layout s ( O ( k log v ) versus O ( k v )). Ring-based layout s are also applicable t o a wider range of array configurat ions t han DAT UM layout s.
Effi cient Mappings for P arity-Declust ered Dat a Layout s
A: B: C: D: E:
1 0 0 0 1
(0) (0) (1) (3) (2) (6) (3) (9) (3) (12)
0
1
A
A
B
3
C
6
D
9
2 2 1 3 2
(0) (1) (2) (2) (3)
(1) (4) (7) (10) (13)
3 4 3 4 4
2 0
B
(0) (0) (1) (2) (3)
(2) (5) (8) (11) (14)
0 1 4 2 3
255
(0) (1) (1) (2) (3)
3
4
A
1
A
2
B
B
4
C
8
C
D
10
D
11
E
14
C
7
D
E
12
E
13
E
5
F i g . 2 . A t able of st ripes derived from t he complet e block design wit h v = 5 and k = 4, and t he parity-declust ered dat a layout derived from it . Each t able ent ry shows “ d i sk ( a d d r ess) n u m b e r (off set ) ” for one unit . Shaded unit s st ore redundant informat ion, and so have no dat a addresses assigned t o t hem.
2
D A T U M Lay o u t s
Alvarez, Burkhard, and Crist ian [1] developed t he first parity-declust ered dat a layout s, called DAT UM layout s, for which mappings of dat a addresses t o disks and off set s are not comput ed using t able lookup. Inst ead, disks and off set s are comput ed direct ly from addresses. In t he following, we describe t heir const ruct ion and analyze t he complexity of t heir dat a mappings. 2 .1
Lay o u t C o n s t ru c t io n a n d D a t a M a p p in g C o m p le x it y
DAT UM layout s are based on complet e block designs, wit h a part icular ordering of t heir t uples. T he set of t uples in t he complet e block design is t he set of all subset s of k of t he v disks (we assume t hat t he v disks are labeled { 0, 1, . . . , v − 1} ). Wit hin each t uple, disks appear in increasing order. T he ordering of t he t uples is as follows: ( X 1 , . . . , X k ) precedes ( Y 1 , . . . , Y k ) if and only if for some j ≤ k , X j < Y j and for all i sat isfying j < i ≤ k , X i = Y i . T he number of t uples t hat precede a given t uple in t his ordering is called t he ra n k of t hat t uple. Given t his order, Alvarez et al. defined two funct ions: loc(X 1 , . . . , X k ), which comput es t he rank of an input t uple, and it s inverse, invloc(ra n k ), which generat es t he k element s of t he t uple wit h a part icular rank. If we are given a row ra n k and column co l in t he t able, we can comput e t he disk number st ored at t hat locat ion by t aking X c o l , t he co l t h element in t he t uple ret urned by invloc(ra n k ). Once t he t uple ( X 1 , X 2 , . . . , X k ) in row ra n k has been found, t he off set of t he unit from t hat st ripe on disk X c o l can also be comput ed.
256
E.J . Schwabe and I.M. Sut herland
Alvarez et al. est ablished t he correct ness of t heir funct ions and formulas, but did not analyze t heir comput at ional complexity. In fact , t he ent ire process of comput ing t he disk and off set in a DAT UM layout t akes O ( k v ) st eps.
2 .2
U s a b ilit y o f Lay o u t s fo r La rg e D is k A rray s
DAT UM layout s eliminat e t he need t o st ore a t able of size polynomial in v in exchange for enough space t o st ore t he t uple ( X 1 , X 2 , . . . , X k ) and O ( k v ) t ime t o comput e disks and off set s. T hese layout s can be const ruct ed for all possible values v 1 s cont ain v of v and k , but t hey may be t oo large t o use. DAT UM layout b = k st ripes, so each disk in t he array must cont ain, bk / v = k 1 unit s in order for t he layout t o be used. Consider an array of 10GB disks wit h a unit size of 4KB. T he number of unit s on each disk is 2,621,440, so any layout wit h size great er t han t his amount cannot be used. We are only looking for a rough guideline for usability, so we will consider any layout wit h size at most 10 million t o be usable. Even for moderat ely sized arrays t hat are commercially available (e.g., v = 64 disks), DAT UM layout s are t oo large t o be usable for more t han 80% of t he values of k . For arrays of 128 and 256 disks, t he percent age of k values t hat are ruled out rises t o more t han 93% and 96% respect ively. T his is admit t edly a very rough guideline for usability, but t he same pat t ern of rapidly decreasing usability applies even for much more generous usability guidelines. Even if t he disks in an array are suffi cient ly large t o use a part icular layout , using a smaller layout may st ill improve performance by leading t o bet t er local load balancing across t he array and a smaller amount of wast ed space when t he disk size is not an int egral mult iple of t he layout size. −
−
3
R in g -B a s e d Lay o u t s
In t his sect ion, we ext end t he ring-based dat a layout s of Schwabe and Sut herland [8] t o eliminat e t he need t o st ore t ables t o describe t heir st ripes. We use t he algebraic st ruct ure of a ring-based block design t o develop funct ions t o map dat a addresses t o t he corresponding disks and off set s. T hese ring-based dat a layout s have two advant ages over DAT UM layout s: 1. T hey are smaller, and t herefore applicable t o a wider range of arrays – t hey cont ain only v ( v − 1) st ripes rat her t han kv ; 2. T he funct ions t o comput e disks and off set s from dat a addresses are more efficient ly comput able – t hey have worst -case running t ime O ( k log v log log v ) rat her t han O ( k v ). In t he following, we review t he ring-based dat a layout const ruct ion of Schwabe and Sut herland [8], and present algorit hms t o comput e disks and off set s wit hout explicit ly st oring t ables of st ripes.
Effi cient Mappings for P arity-Declust ered Dat a Layout s
3 .1
257
Lay o u t C o n s t ru c t io n
Ring-based dat a layout s are derived from a class of block designs called r i n g ba s ed b lo c k d e s i g n s . T he element s of a ring-based block design are t aken from a co m m u t a t i v e r i n g w i t h a u n i t (hereaft er referred t o as simply a “ring”). A ring is an algebraic ob ject consist ing of a set of element s, an addit ion operat ion (associat ive, commut at ive, and having an ident ity element 0 and addit ive inverses), and a mult iplicat ion operat ion (associat ive, commut at ive, and having an ident ity element 1 = 0) t hat dist ribut es over addit ion. T he o rd e r of a ring R is t he number of element s in R . A set of element s { g 0 , . . . , g k 1 } of a ring R are called g e n e ra t o r s of a ringbased block design if, whenever i = j , g i − g j has a mult iplicat ive inverse. T he t uples of a ring-based block design are indexed by pairs ( y , x ), where x is an arbit rary ring element and y is an arbit rary non-zero ring element . Given a ring R of order v and a set of generat ors as above, t he t uple indexed by ( y , x ) is t he set T ( y , x ) = { y ( g i − g 0 ) + x | i = 0, . . . , k − 1} . T he ring-based block design for R and a set of k generat ors is T ( y , x ) | x ∈ R , y ∈ R − { 0} . T his set of t uples is a BIBD wit h v ( v − 1) t uples [8]. m If v = i = 1 p ni i , where p 1 , p 2 , . . . , p m are dist inct primes, t here exist s a ring n R of order v and a set of k generat ors in R if and only if k ≤ min { p i i | i = 1, . . . , m } [8]. Schwabe and Sut herland showed t hat R can be t aken t o be t he cross product of finit e fields GF( p n1 1 ) × GF( p n2 2 ) × . . . × GF( p nm m ), wit h operat ions defined component -wise. T he ring will cont ain k generat ors for every k t hat sat isfies t he above condit ion. From t his point forward, R will denot e such a ring. A ring-based dat a layout is obt ained from a ring-based block design by ordering t he t uples of t he block design from 0 t o b − 1. To do t his, we will first define a biject ion f from t he ring R t o t he set { 0, 1, . . . , v − 1} t hat will ident ify each ring element wit h a unique int eger. T his will allow us t o associat e t he index ( y , x ) of a t uple wit h t he pair of int egers ( f ( y ) , f ( x )), so we can regard t he t uples as being indexed by int egers ( j , i ) where i ∈ { 0, 1, . . . , v − 1} and j ∈ { 1, 2, . . . , v − 1} . To avoid confusion, when we are using such a pair of int egers as a t uple index, we will writ e t he pair as j , i rat her t han ( j , i ). We t hen order t he t uples by t heir indices 1, 0 , 1, 1 , . . . , 1, v − 1 , 2, 0 , 2, 1 , . . . , 2, v − 1 , . . . , v − 1, 0 , v − 1, 1 , . . . , v − 1, v − 1 . T he biject ion f will use t he following represent at ion of t he ring element s. T he element s of t he field GF( p n ) can be represent ed as polynomials of degree at most n − 1 in a variable x wit h coeffi cient s being int egers mod p . T hus, a ring element is represent ed as an m –t uple of polynomials ( P 1 ( x) , . . . , P m ( x)), where P i ( x) has degree at most n i and coeffi cient s t hat are int egers mod p i . T he biject ion f is defined as follows: Evaluat e each polynomial P i at p i , t o obt ain an m -t uple ( P 1 ( p 1 ) , . . . , P m ( p m )) of non-negat ive int egers. T he value of f ( P 1 ( x) , . . . , P m ( x)) will be t he rank of ( P 1 ( p 1 ) , . . . , P m ( p m )) in t he lexicographic order. (Clearly, t his yields a biject ive mapping f between t he ring element s and t he int egers from 0 t o v − 1). T his rank can be comput ed by t he following algorit hm f: −
258
E.J . Schwabe and I.M. Sut herland
f(P 1 ( x), ..., P m ( x)) total = 0 for i = 1 to m total = total * total = total + return total
n i
pi
P i (p i
)
Each it erat ion of t he “for” loop t akes O ( n i ) st eps m(for t he polynomial evaluat ion), so t he t ot al t ime for t he m loop it erat ions is i = 1 O ( n i ) = O (log v ). T herefore t he t ime t o comput e f is O (log v ). To comput e t he inverse of f , we must t ake an int eger x and det ermine t he m –t uple of polynomials ( P 1 ( x) , . . . , P m ( x)) for which ( P 1 ( p 1 ) , . . . , P m ( p m )) will have rank x in t he lexicographic order. T he out er loop of t he following algorit hm invf comput es t he values P m ( p m ), P m 1 ( p m 1 ), . . . , P 1 ( p 1 ), and t he inner loop comput es t he coeffi cient s of each P i from P i ( p i ): −
invf(x ) for
−
= m = x x = x for j
to 1 mod p ni i div p ni i = 0 to n i − 2 j + 1 a ( i , j ) = x i mod p i j + 1 x i = x i div p i a ( i , n i − 1) = x i return a i
xi
T he i t h it erat ion of t he out er loop t akes const ant t ime, plus t he t ime required m for t he inner loop, which is Θ ( n i ). T his yields a t ot al of i = 1 Θ ( n i ) = O (log v ) st eps t o comput e t he inverse of f . T herefore we can convert ring element s int o int egers in { 0, 1, . . . , v − 1} and vice versa in O (log v ) st eps. T he ordering of t he t uples in t he ring-based block design by t heir indices 1, 0 , 1, 1 , . . . , 1, v − 1 , 2, 0 , 2, 1 , . . . , 2, v − 1 , . . . , v − 1, 0 , v − 1, 1 , . . . , v − 1, v − 1 defines t he ring-based dat a layout . A t able of t hese t uples would consist of v ( v − 1) rows and k columns. We now describe how t o use t his order t o comput e disks and off set s wit hout using t able lookups. 3 .2
C o m p u t a t io n a l C o m p le x it y o f D a t a M a p p in g s
In order t o comput e a disk and off set for a part icular dat a address, we must : 1. Convert t he address t o a rank (row) and posit ion (column) in t he t able; 2. Comput e t he numerical values of f ( y ) and f ( x ) corresponding t o t hat rank; 3. Comput e t he ring element s y and x t hat index t he t uple of t hat rank;
Effi cient Mappings for P arity-Declust ered Dat a Layout s
259
4. Comput e t he ring element in t he desired posit ion of t hat t uple; 5. Convert t hat ring element (which represent s t he disk ident ifier) t o it s numerical label; 6. Comput e t he off set of t he desired address on t hat disk. St eps 1 and 2 can be done in const ant t ime wit h simple arit hmet ic operat ions. T he conversion t o ring element s in St ep 3 and back t o numerical values in St ep 5 bot h require a const ant number of applicat ions of t he funct ion f and it s inverse, which t ake a t ot al of O (log v ) st eps. St ep 4 must comput e t he element in t he given posit ion of t he t uple indexed by ring element s y and x . T his element is given by y ( g j − g 0 ) + x , where j is t he given posit ion. Comput ing t his element from y , x , and t he two generat ors g j and g 0 requires one subt ract ion, one mult iplicat ion, and one addit ion of ring element s. Addit ion in t he field is polynomial addit ion, wit h coeffi cient s added mod p i . Clearly, adding or subt ract ing two field element s will t ake O ( n i ) st eps. Mult iplicat ion in t he field is polynomial mult iplicat ion, where t he product is t aken modulo some fixed irreducible polynomial of degree n i (which must be st ored), and all coeffi cient s are comput ed mod p i . Mult iplying two field element s will t herefore t ake O ( n i log n i ) st eps for t he init ial mult iplicat ion (using, e.g., a Discret e Fourier Transform); evaluat ing t he result ing product modulo an irreducible polynomial adds only O ( n i log n i ) more st eps (see, e.g., von zur Gat hen and Gerhard [10]). m T herefore, addit ion and subt ract ion of ring element s t ake mO ( i = 1 n i ) = O (log v ) st eps, and mult iplicat ion of ring element s t akes O ( i = 1 n i log n i ) = O (log v log log v ) st eps. T hus, St ep 4 t akes a t ot al of O (log v log log v ) st eps. T he off set comput ed in St ep 6 is given by t he number of occurrences of t he disk in t uples wit h rank lower t han t he rank comput ed in St ep 1. First we not e t hat given t he ordering of t he t uples, each set S y = { T ( y , x ) | x ∈ R } of t uples cont ains exact ly k occurrences of each disk (once in each possible posit ion in a t uple), so t hat t he number of occurrences of disk d in t uples of rank lower t han r is k ⌊ r / v ⌋ (which is k · f ( y )), plus t he number of occurrences of d in t uples of t he form T ( y , x ′ ) , where f ( x ) < f ( x ). To comput e t his last t erm, we not e t hat t here are at most k − 1 possible posit ions in which d can appear: i ∈ { 0, . . . , j − 1, j + 1, . . . , k − 1} . In each case, we must have d = y ( g i − g 0 ) + x , or solving for x , x = d − y ( g i − g 0 ). If f ( x ) < f ( x ), t hen T ( y , x ′ ) cont ains disk d and has rank lower t han t hat of T ( y , x ) . So we comput e x for each of t he k − 1 posit ions ot her t han j , and compare f ( x ) t o f ( x ), keeping t rack of t he number of posit ions for which t he result is smaller t han f ( x ). T his amount is added t o k · f ( y ) t o obt ain t he off set . T his t akes a t ot al of O ( k log v log log v ) st eps. T herefore, comput ing t he disk and off set for a part icular dat a address t akes a t ot al of O ( k log v log log v ) st eps. Since a polynomial of degree n i can be st ored in O ( n i ) space, t he space m required t o st ore t he m polynomials t hat make up a ring element is O ( i = 1 n i ) = O (log v ). T he comput at ion of t he disk and off set requires O (log v ) space for t he various ring element s involved. In addit ion, O ( k log v ) space is needed t o st ore t he ′
′
′
′
′
′
′
260
E.J . Schwabe and I.M. Sut herland
generat ors, and O (log v ) space is needed t o st ore t he m irreducible polynomials, ’ s, and p i ’ s. T his yields a t ot al ofO ( k log v ) space. T he space required can be reduced t o O (log v ) wit h no increase in t he running t ime if we use a part icular canonical set of generat ors t hat can be const ruct ed as needed rat her t han st ored.
k
ni
3 .3
R e d u c in g t h e T im e C o m p le x it y
We can improve t he O ( k log v log log v ) running t ime t hat we obt ained using a polynomial represent at ion of ring element s by using a diff erent represent at ion of ring element s and st oring at most an addit ional v − 1 int egers. As before, each ring element is an m –t uple of field element s, wit h addit ion and mult iplicat ion defined component –wise. However, t he individual field element s are represent ed diff erent ly. By definit ion, t he non-zero element s of a field form a group under mult iplicat ion. In a finit e field GF( p n ), t his group is act ually a c y c li c group of order n 2 p n − 1. T hat is, t he element s of t he group are exact ly { 1, α , α 2 , . . . , α p } for some non-zero field element α . (See Koblit z [5] for furt her discussion of t hese concept s.) We can define a biject ion i → i from { 0, . . . , p n − 1} ont o GF( p n ) as follows: i = 0 if i = 0, and α i 1 ot herwise. T his biject ion allows us t o represent field element s as int egers from 0 t o p n − 1; we will call t his represent at ion t he e x p o n e n t represent at ion. Using t he exponent represent at ion of field element s, addit ion, subt ract ion and mult iplicat ion in t he field can be performed in const ant t ime. Addit ion and subt ract ion also require t hat a list of p n − 1 precomput ed int egers be st ored. Using t his represent at ion, t he t ime and space requirement s are O ( k log v ) and O ( v ), respect ively. −
−
4
C o m p a ris o n s b e t w e e n D A T U M a n d R in g -B a s e d Lay o u t s
DAT UM layout s require O ( k v ) t ime t o comput e disk numbers and off set s wit h space requirement s of Θ ( k ). T he implement at ion of ring-based layout s using t he polynomial represent at ion of ring element s requires less t ime – only O ( k log v log log v ) – t o comput e disk numbers and off set s, and t he space requirement s are O (log v ). If k = Ω (log v ), t hen t he space requirement s for ring-based layout s are no great er t han t hose of DAT UM layout s. T he implement at ion of ring-based layout s using t he exponent represent at ion of ring element s requires even less t ime, O ( k log v ), but more space, O ( v ). Here, we must have k = Ω ( v ) for t he space requirement s not t o exceed t hose of DAT UM layout s. Recall t hat a DAT UM layout has size kv 11 for an array of v disks and st ripe size k . T his pot ent ially large size rules out t he use of t hese layout s for many values of v and k t hat include commercially available array configurat ions. As arrays grow larger and/ or t heir const it uent disks smaller, DAT UM layout s will work for even fewer values of v and k . On t he ot her hand, when t hey exist for a part icular√ v and k , ring-based layout s have size k ( v − 1). T hus, for any v smaller t han 10, 000, 000 (roughly −
−
Effi cient Mappings for P arity-Declust ered Dat a Layout s
261
3,000), all exist ing ring-based layout s are usable (using t he rough definit ion of usability discussed earlier). For larger v , t he layout s are usable as long as k is at most 10, 000, 000/ ( v − 1). T hus, t he usability of ring-based layout s will not be limit ed by disk sizes unt il array sizes grow by more t han an order of magnit ude. It is also more effi cient t o comput e disks and off set s from dat a addresses in ring-based layout s t han in DAT UM layout s.
R e fe re n c e s 1. Alvarez, G.A., Burkhard, W .A., Crist ian, F .: Tolerat ing Mult iple Failures in RAID Archit ect ures wit h Opt imal St orage and Uniform Declust ering. P roceedings of t he 24t h ACM/ IEEE Int ernat ional Symposium on Comput er Archit ect ure (1997) 62– 71 2. Alvarez, G.A., Burkhard, W .A., St ockmeyer, L.J ., Crist ian, F .: Declust ered Disk Array Archit ect ures wit h Opt imal and Near-Opt imal P arallelism. P roceedings of t he 25t h ACM/ IEEE Int ernat ional Symposium on Comput er Archit ect ure (1998) 109–120 3. Hanani, H.: Balanced Incomplet e Block Designs and Relat ed Designs. Discret e Mat hemat ics 11 (1975) 255–369 4. Holland, M., Gibson, G.A.: P arity Declust ering for Cont inuous Operat ion in Redundant Disk Arrays. P roceedings of t he 5t h Int ernat ional Conference on Archit ect ural Support for P rogramming Languages and Operat ing Syst ems (1992) 23–35 5. Koblit z, N.: A Course in Number T heory and Crypt ography. Springer-Verlag (1987) 6. Munt z, R.R., Lui, J .C.S.: P erformance Analysis of Disk Arrays Under Failure. P roceedings of t he 16t h Conference on Very Large Dat a Bases (1990) 162–173 7. P at t erson, D.A., Gibson, G.A., Kat z, R.H.: A Case for Redundant Arrays of Inexpensive Disks (RAID). P roceedings of t he Conference on Management of Dat a (1988) 109–116 8. Schwabe, E.J ., Sut herland, I.M.: Improved P arity-Declust ered Dat a Layout s for Disk Arrays. J ournal of Comput er and Syst em Sciences 53 (No. 3) (1996) 328–343 9. St ockmeyer, L.: P arallelism in P arity-Declust ered Layout s for Disk Arrays. Technical Report RJ 9915, IBM Almaden Research Cent er (1994) 10. von zur Gat hen, J ., Gerhard, J .: Modern Comput er Algebra. Cambridge University P ress (1999)
A p p rox im a t e R a n k A g g re g a t io n ( P re lim in a ry V e rs io n ) Xiaot ie Deng1 , Qizhi Fang2 , and Shanfeng Zhu 1 1
Depart ment of Comput er Science, City University of Hong Kong, Hong Kong, P. R. China { deng,zhusf} @cs.cityu.edu.hk 2 Depart ment of Mat hemat ics, Ocean University of Qingdao, Qingdao 266071, Shandong, P. R. China [email protected]
In t his paper, we consider algorit hmic issues of t he rank aggregat ion problem for informat ion ret rieval on t he Web. We int roduce a weight ed version of t he met ric of t he normalized Kendall-τ dist ance, originally proposed for t he problem by Dwork, et al.,[7] and show t hat it sat isfies t he ext ended Condorcet crit erion. Our main t echnical cont ribut ion is a polynomial t ime approximat ion scheme, in addit ion t o a pract ical heurist ic algorit hm wit h rat io 2 for t he NP -hard problem. A b st r a c t .
K e y w o r d s:
Rank aggregat ion, Kendall-τ dist ance, coherence, weight ed
ECC.
1
In t ro d u c t io n
How t o comput e a “consensus” ranking of t he alt ernat ives based on preferences of individual vot ers is called t he “rank aggregat ion problem”. It is widely discussed in t he lit erat ures of social choice t heory and finds it s applicat ion t o elect ion, and most recent ly, met a-search over t he Web. Dwork, et al., [7] pioneered t he st udy of t he rank aggregat ion problem in t he cont ext of Web searching wit h an eye t oward reducing spam in met a-search. Comparing wit h t radit ional vot ing problem, t he rank aggregat ion problem on t he web has some dist inct feat ures. First ly, t he number of vot ers is much less t han t he number of alt ernat ives. Secondly, each vot er ranks a diff erent set of alt ernat ives, det ermined by t he diff erent coverage of web search engines. Dwork, et al., made use of Kendall-τ dist ance as a crit erion: Given a collect ion of part ial rankings τ 1 , · · ·, τ k of alt ernat ive web pages, t hey want t o find a complet e ranking π which minimize t he average of t he Kendall-τ dist ance between π and τ i ( i = 1, · · ·, k ). T he Kendall-τ dist ance between two ranking list s is t he t ot al number of pairs of alt ernat ives t hat are assigned t o diff erent relat ive orders in t he two ranking list s. T hey showed t hat t his problem, t he Kemeny aggregat ion problem, is NP -hard for fixed even k ≥ 4 and developed an eff ect ive procedure “local Kemenizat ion” t o obt ain a local Kemeny opt imal ranking which T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 262–271, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Approximat e Rank Aggregat ion
263
sat isfies t he ext ended Condorcet crit erion. A 2-approximat ion algorit hm was obt ained for full list rank aggregat ion but no proven approximat ion algorit hm was known for part ial list rank aggregat ion [7]. In fact , t he met ric of Kendall-τ dist ance may not be t he best for part ial rankings. If two part ial rankings overlap over a small number of alt ernat ives (and t hus t heir Kendall-τ dist ance is small), one may not have full confidence t o conclude t hat t he two rankings diff er a lit t le. We propose t o consider bot h Kendall-τ dist ance and size of overlap of t he part ial ranking list s for an alt ernat ive measure for part ial ranking aggregat ion. For a given collect ion of part ial rankings τ 1 , · · ·, τ k wit h diff erent ranking lengt hs, we are int erest ed in finding a final ranking π such t hat t he sum of | N τ ∩ N π | (1 − C D2 ( τ , π ) ) is maximized, i
i
|
N τ ∩ i
N π
|
where N τ is t he set of alt ernat ives in τ i , N π is t he set of alt ernat ives in π , D ( τ i , π ) is t he Kendall-τ dist ance between π and τ i ( i = 1, 2, · · · , k ). We not e t hat t his problem is equivalent t o Kemeny aggregat ion problem [7] in a weight ed version. Here, t he weight of each part ial ranking is det ermined by it s overlap wit h t he final ranking. In t his paper, we focus on t he new aggregat ion met hod (we call it t he Coherence aggregat ion problem) and relat ed issues, as well as t heir complexity and algorit hmic problems. In sect ion 2, we int roduce t he formal definit ions. We generalize t he ext ended Condorcet crit erion (ECC) t o t he weight ed case, and show t hat t he Coherence opt imal ranking for part ial ranking aggregat ion sat isfies t he weight ed ECC. In sect ion 3, we discuss t he NP -hardness of t he Coherence aggregat ion problem and present a heurist ic algorit hm wit h performance rat io 2, and wit h a proof t hat t he heurist ic solut ion sat isfies t he weight ed ECC. We not e t hat alt hough t he Kemeny aggregat ion problem and t he Coherence aggregat ion problem are equivalent in t he weight ed case, t here is no any approximat ion algorit hm wit h const ant rat io for Kemeny aggregat ion for part ial rankings. In Sect ion 4, we derive a P TAS for t he Coherence aggregat ion problem. Our approach is mot ivat ed by t echniques developed by Arora, et . al, [1,2]. Our solut ion furt her ext ends and exploit s t heir general met hodology and provides new insight int o design and analysis of polynomial t ime approximat ion scheme. In Sect ion 5, we conclude wit h remarks. i
2
D e fi n it io n s
Given a set of alt ernat ives N = { 1, 2, · · · , n } , a ranking π wit h respect t o N is a permut at ion of some element s of N which represent s a vot er’ s or a judge’ s preference on t hese alt ernat ives. If π orders all t he element s in N , it is called a complet e ranking; ot herwise, a part ial ranking. For a ranking π , let N π denot e t he set of element s present ed in π , | π | = | N π | denot e t he number of element s in π , or t he lengt h of π . For each i ∈ N π , π ( i ) denot e t he posit ion of t he element i in π , and for any two element s i , j ∈ N π , π ( i ) < π ( j ) implies t hat i is ranked higher t han j by π . T he rank aggregat ion problem is t o combine a number of diff erent rank orderings on a set of alt ernat ives, in order t o obt ain a ‘ bet t er’ ranking. T he not ion
264
X. Deng, Q. Fang, and S. Zhu
of ‘ bet t er’ depends on what ob ject ive we st rive t o opt imize. Among numerous ranking crit eria, t he met hods based on K en dall- τ distan ce are accept ed and st udied ext ensively [10,3,4,5,6]. T he Kendall-τ dist ance between two rankings π and σ is defined as D (π , σ
)=
|{
( i , j ) : π ( i ) < π ( j ) , but σ ( i ) > σ ( j ) , ∀ i , j ∈
Nπ
Nσ ∩
} |.
Given a collect ion of part ial rankings τ 1 , τ 2 , · · · , τ k , t he Kemeny opt imal aggregat ion is a complet e ranking π wit h respect t o t he union of t he element s of τ 1 , τ 2 , · · · , τ k which minimizes t he t ot al Kendall-τ dist ance D ( π ; τ 1 , · · · , τ k ) = k D ( π , τ i ). i= 1 In t he definit ion of Kendall-τ dist ance, if it is not t he case t hat t he element s i and j appear in bot h rankings, t he pair ( i , j ) cont ribut es not hing t o t heir Kendall-τ dist ance. Kendall-τ dist ance ignores t he eff ect of t he size of “overlap” in t he measure of t he discrepancy of two rankings. Based on t his point , we will define anot her measurement , called coheren ce , t o furt her charact erize t he relat ionship of two rankings. T his measurement will be used as a crit erion in our rank aggregat ion model. D e fi n it io n 2 . 1 For two partial ran kin gs τ an d σ with | N τ ∩ N σ | ≥ 2, the coheren ce of τ
an d σ
is defi n ed as
Φ
(τ , σ ) = | N τ
Nσ ∩
|
D (τ , σ
1−
C |2N τ
N ∩
) σ
. |
W hen | N τ ∩ N σ | ≤ 1, we defi n e the coheren ce Φ ( τ , σ ) = 0. D e fi n it io n 2 . 2 For a collection of partial ran kin gs τ 1 , τ 2 , · · ·, τ K an d a com plete ran kin g π with respect to N = N τ 1 ∪ · · · ∪ N τ , | τ i | = n i ≥ 2 ( i = 1, 2, · · ·, K ) , we den ote the total coheren ce by K
Φ
(π ; τ 1 , τ 2 , ·
· ·,
τ
K
K
)= Φ i
=1
K
(π , τ i ) =
ni i
=1
1−
D (π , τ C n2 i
i
)
.
T he C oheren ce optim al aggregation is a com plete ran kin g σ of the elem en ts in N which m axim izes the total coheren ce Φ ( π ; τ 1 , τ 2 , · · ·, τ K ) over all com plete ran kin gs π . T he problem of fi n din g the C oheren ce optim al aggregation s is called C oheren ce aggregation problem .
From t he definit ion of coherence, t he cont ribut ion of part ial ranking τ 1, 2, · · ·, K ) t o t he t ot al coherence Φ ( π ; τ 1 , τ 2 , · · ·, τ K ) is D (τ i , π ) 2 2 ni 1 − C n − D (τ i , π ) . = 2 Cn ni − 1
i
(i =
i
i
Let
2
, i = 1, 2, · · ·, K . 1 If ω i is considered as t he weight of t he corresponding ranking, t he Coherence aggregat ion problem is equivalent t o t he Kemeny aggregat ion problem in t he ω
i
=
ni
−
Approximat e Rank Aggregat ion
265
weight ed version, where t he weight of each part ial ranking is det ermined by it s overlap wit h t he final ranking. When t he lengt hs of all part ial rankings are equal, t he Coherence aggregat ion problem is equivalent t o t he Kemeny aggregat ion problem proposed by Dwork et al., [7]. Kemeny opt imal rankings are of part icular int erest because t hey sat isfy t he ext ended Condorcet crit erion (ECC): if t here is a part it ion ( P , P¯ ) of t he element s in N such t hat for any i ∈ P and j ∈ P¯ , t he ma jority prefers i t o j , t hen i must be ranked higher t han j . Recent ly, Dwork, et al.,[7] st udied t he Kemeny opt imal aggregat ion problem in t he cont ext of t he Web and showed t hat ECC has excellent “spam-fight ing” propert ies in t he cont ext of met a-search. When t he weight s are imposed upon t he rankings, we can generalize t he ECC t o t he following weight ed version. W e ig h t e d E x t e n d e d C o n d o rc e t C rit e rio n ( W e ig h t e d E C C ) :
Given part ial rankings τ 1 , · · ·, τ K and t he corresponding weight s α 1 , · · ·, α K . ¯ Let π be a complet e ranking of t heir aggregat ion. For any part it ion ( P , P ) of t he element s of N , and for all i ∈ P and j ∈ P¯ , if we have l : τ ( i ) < τ ( j ) α l > α l , t hen in t he aggregat ion π , i is ranked higher t han j . We call π l :τ ( i ) > τ ( j ) sat isfying t he weight ed ext ended Condorcet crit erion (weight ed ECC). l
l
l
l
P ro p o s it io n 2 . 1 Let π be a coheren ce optim al aggregation for partial ran kin gs τ 1 , · · ·, τ K . T hen π satisfi es the weighted exten ded C on dorcet criterion with respect to τ 1 , · · ·, τ K an d their weights ω 1 , · · ·, ω K .
P roof. Suppose t hat t here is a part it ion ( P , P¯ ) of N such t hat for all i ∈ P and j ∈ P¯ we have t hat ω l , but t here exist two ω l > l :τ ( i ) > τ ( j ) l :τ ( i ) < τ ( j ) element s i ∈ P and j ∈ P¯ such t hat π ( j ) < π ( i ). Let ( i , j ) be an adjacent such pair in π . Let π be t he ranking obt ained by t ransposing t he posit ions of i and j . T hen we have t hat Φ ( π ; τ 1 , · · ·, τ K ) − Φ ( π ; τ 1 , · · ·, τ K ) = ω l − ω l > 0, l
∗
l
l
∗
∗
l
∗
∗
∗
′
∗
∗
′
l :τ
l
(i ∗ )< τ l (j ∗
)
which cont radict s t o t he opt imality of π .
3
l :τ
l
(j ∗
)< τ l (i ∗ ) ⊓⊔
C o m p le x it y a n d H e u ris t ic A lg o rit h m
For part ial rankings of lengt h 2, finding Coherence opt imal aggregat ion is exact ly t he same problem as finding an acyclic subgraph wit h maximum weight in a weight ed digraph, and hence is NP -hard [9]. Dwork, et al.,[7] discussed t he hardness in t he set t ing of int erest in met a-search: many alt ernat ives and very few vot ers. T hey showed t hat comput ing a Kemeny opt imal ranking is st ill NP hard for any fixed even K ≥ 4. T heir result derives direct ly t he NP -hardness of t he Coherence aggregat ion problem for all int eger K ≥ 4, since odd number of part ial rankings can be obt ained from even number of complet e rankings by split t ing one complet e ranking int o two part ial rankings. T h e o re m 3 . 1 T he C oheren ce aggregation problem for a given collection of K partial ran kin gs, for in teger K ≥ 4, is N P -hard.
T he diffi culty of comput ing t he Coherence opt imal ranking arises from it s NP -hardness. Since for any aggregat ion π and it s reversal π r wit h respect t o
266
X. Deng, Q. Fang, and S. Zhu
K , t he sum of t heir t ot al coherence is a const ant Φ ( π ) + Φ ( π r ) = nl, l= 1 a simple 2-approximat ion algorit hm can be obt ained by comparing t he values of π and π r . In t his sect ion, we invest igat e heurist ic procedures t hat const ruct a bet t er aggregat ion while t aking int o account t he dat a of t he given inst ance of t he problem. T he algorit hm consist s of two part s: Init ial Aggregat ion and Adjust ment . When t he given collect ion of rankings is clear from t he cont ext , we will denot e Φ ( π ; τ 1 , · · ·, τ K ) by Φ ( π ). Given a collect ion of part ial rankings τ 1 , · · ·, τ K , wit h | τ l | = n l ≥ 2 ( l = 1, 2, · · ·, K ) and N = N τ 1 ∪ · · · ∪ N τ = { 1, 2, · · ·, n } . T he weight of each part ial 2 , l = 1, 2, · · ·, K . For each ordered pair ( i , j ) ranking is defined as ω l = nl − 1 ( i , j ∈ N ), we define t he preference value r i j as t he sum of weight s of t he part ial rankings which rank i higher t han j , t hat is, rij = ω l. τ 1, ·
· ·,
τ
K
K
l :τ
l
(i )< τ l (j )
T he Coherence aggregat ion problem is t o find a ranking π of N which maximizes r . t he t ot al Coherence Φ ( π ) = i , j :π ( i ) < π ( j ) i j For each element i ∈ N , denot e P (i ) = r j i and Q ( i ) = rij . j
=i
=i
j
We not e t hat P ( i ) and Q ( i ) are t he corresponding cont ribut ions t o t he t ot al Coherence by assigning element i in t he lowest posit ion and t he highest posit ion of t he ranking, respect ively. T he main idea of Init ial Ranking procedure is, in every it erat ion, t o arrange an element t o t he lowest or highest posit ion, according t o t heir cont ribut ions P ( i ) and Q ( i ). In Adjust ment procedure, if t here are two adjacent ordered element s i k and i k + 1 such t hat r i i + 1 < r i + 1 i in t he ranking obt ained already, we t ranspose t he posit ions of i k and i k + 1 t o get a bet t er ranking. k
k
k
k
In it ia l R a n k in g P ro c e d u re
1. Set S = N , u = 1 and v = n . 2. Comput e γ = maxi S { | P ( i ) − Q ( i ) | } , and denot e i t he element wit h t he largest γ . If P ( i ) ≤ Q ( i ), set π ( i ) = u , u ← u + 1; if P ( i ) > Q ( i ), set π ( i ) = v , v ← v − 1. For each element j ∈ S \ { i } , let ∗
∈
∗
∗
∗
∗
∗
∗
∗
P (j
)
P (j ←
) − ri ∗
j
and Q ( j )
Q (j ←
) − rj i . ∗
And set S ← S \ { i } . 3. If v > u , go t o St ep 2; else, st op and out put t he ranking π . A d ju s t m e n t P ro c e d u re . Given a ranking π = i 1 , i 2 , · · ·, i n . 1. Set π = j 1 , j 1 = i 1 and l = 1. 0 ∀ 1 ≤ k ≤ l, r j i + 1 ≤ r i + 1j 2. Comput e k = max{ k : 1 ≤ k ≤ l , r j i + 1 > r i + 1 j } ot herwise For i ≤ k , set j i ← j i (when k = 0, t here is no element being arranged); ∗
∗
∗
k
l
l
∗
k
∗
l
k
l
k
Approximat e Rank Aggregat ion
For i = k + 1, set j i ← i l + 1 ; For k + 1 < i ≤ l + 1, set j i ← j i 1 . Set π ← j 1 , · · ·, j l + 1 , and l ← l + 1. 3. If l < n , go t o St ep 2; else, st op and out put t he ranking π
267
∗
∗
−
∗
∗
.
T he coherence preserved by t he Init ial Ranking procedure is at least one half of t he t ot al value l n l , since t his property holds in every it erat ion wit h respect t o t he coherence incurred by t he element i . We remark t hat t here may be some ot her rules for choosing t he element i in t he Init ial Ranking procedure, such as, according t o t he value (1) γ = maxi S { P ( i ) } = P ( i ); or (2) γ = maxi S { Q ( i ) } = Q ( i ) for choosing and ranking t he corresponding element . From t he definit ion of weight ed ECC and P roposit ion 2.1, we have ∗
∗
∗
∈
∗
∈
P ro p o s it io n 3 . 2 Let π ∗ be a ran kin g obtain ed from A djustm en t procedure with respect to τ 1 , · · ·, τ K an d their weights ω 1 , · · ·, ω K . T hen π ∗ satisfi es the weighted ECC.
4
P o ly n o m ia l T im e A p p rox im a t io n S ch e m e s
Arora, et al., [2] present ed a unified framework for developing int o polynomial t ime approximat ion schemes (P TASs) for “dense” inst ances of many NP -hard opt imizat ion problems, such as, maximum cut , graph bisect ion and maximum 3-sat isfiability. T heir unified framework begins wit h t he idea of exhaust ive sampling: picking a small random set of element s, guessing where t hey go on t he opt imum solut ion, and t hen using t heir placement t o det ermine t he placement of ot her element s. Arora, et al., [1] applied t his t echnique t o assignment problems by shrinking t he space of possible placement s of t he random sample. T hey designed P TASs for some ‘ smoot h’ dense subcases of many well known NP -hard arrangement problems, including minimum linear arrangement , d -dimensional arrangement , betweenness, maximum acyclic subgraph, et c. In t his sect ion, we show t hat t he same t echniques in [1] can also derive a P TAS for t he Coherence aggregat ion problem, t hough t he coeffi cient s do not sat isfy t he ‘ smoot hness’ condit ion. In t his sect ion, we consider t he Coherence aggregat ion problem for K part ial rankings τ 1 , · · ·, τ K , where K is an int eger indiff erence of n = | N | = | N τ 1 ∪ · · · ∪ N τ | , | τ s | = n s ≥ 3 ( s = 1, 2, · · ·, K ). T he weight of each part ial ranking ω s and t he preference value r i j are defined as in Sect ion 3. Since for any complet e K ranking π and it s reversal π r , Φ ( π ) + Φ ( π r ) = n s ≥ n , t he opt imal value of s= 1 t his problem is no less t han n / 2. T herefore t o obt ain an opt imal ranking wit h at least t he value (1 − γ ) t imes t he opt imum, where γ > 0 is arbit rary, it suffi ces t o find a ranking whose value is wit hin an addit ional fact or of ǫ n from t he opt imal value of t he opt imal ranking for a suit able ǫ > 0. We present our result in t he following t heorem. K
T h e o re m 4 . 1 S uppose the ran kin g π ∗ is the optim al solution of the C oheren ce 2 aggregation problem . T hen for an y fi xed ǫ > 0, in tim e n O ( 1 / ǫ ) we can fi n d a ran kin g π of N such that Φ
(π )
≥
Φ
(π
∗
) − ǫ n.
268
X. Deng, Q. Fang, and S. Zhu
Several Chernoff -style t ail bounds are import ant in t he analysis of randomized procedure. T he following result is needed repeat edly in t his paper, which we present as a lemma for complet eness. L e m m a 4 . 2 Let X 1 , X 2 , · · ·, X n be n in depen den t ran dom variables such that n ≤ 1. T hen for X = X i , µ = E [X ] an d λ ≥ 0, i= 1
0≤ Xi
P r[| X
µ| > λ
−
] ≤ 2e
−
2λ
2
/ n
.
Let ǫ be a given small posit ive, and t = c/ ǫ for some suit able large const ant 0. Here we assume for simplicity t hat n is a mult iple of t . Const ruct t sequent ial groups I 1 , I 2 , · · ·, I t . A placem en t is a mapping g : N → { 1, 2, · · ·, t } from t he set N t o t he set of groups { I 1 , I 2 , · · ·, I t } . It is proper if it maps n / t element s of N t o each group, t hat is, for every 1 ≤ j ≤ t , | { i ∈ N | g ( i ) = j } | = n / t . T he value of a placement g , denot ed by φ ( g ), is defined as c >
φ
(g) =
rij ∀
i ,j
N ,g (i )< g (j ∈
L e m m a 4 . 3 If π
ǫ
′
= (1 −
∗
ω s=
)
s|{
( i , j ) : τ s ( i ) < τ s ( j ) and g ( i ) < g ( j ) } | .
1
is a ran kin g an d g is its in duced proper placem en t, then
(g) φ
Let π
K
=
Φ
≤
(π )
≤
(g) + φ
3K n t
.
be an opt imal ranking and let g be it s induced placement , and let 3K ) ǫ . Assume t hat g is a proper placement such t hat ∗
c
φ
(g)
φ
≥
∗
′
(g ) − ǫ n ,
and π is an arbit rary ranking such t hat g is t he placement induced by π . By Lemma 4.3, we have t hat Φ
(π )
≥
φ
(g)
φ
≥
∗
′
(g ) − ǫ n
≥
Φ
(π
∗
)−
3K n t
−
′
ǫ n
= Φ (π
∗
) − ǫ n.
T herefore, finding an opt imal ranking t o our problem can be reduced t o t he problem of finding a proper placement wit hin an addit ive fact or of ǫ n from t he opt imal placement . T he opt imal placement problem can be formulat ed as t he quadrat ic arrangement problem: K Max s = 1 [ i j k l csij k l x i k x j l ] n i = 1 x i k = n / t k = 1, 2, · · ·, t t s.t . x i k = 1 i = 1, 2, · · ·, n k= 1 x i k = 0, 1 i = 1, · · ·, n ; k = 1, · · ·, t ω s if τ s ( i ) < τ s ( j ) and 0 < k < l . Let g be t he opt imal placeHere, csij k l = 0 ot herwise ment , and let
s c i j k l g j l = ω s { j ∈ N τ : τ s ( i ) < τ s ( j ) and g ( j ) > k } . e ˆ sik = ′
∗
∗
∗
s
j l
Approximat e Rank Aggregat ion
T hen g is an int egral solut ion t o t he linear program K n t Max s = 1 [ i = 1 k = 1 eˆ sik x i k ] n i = 1 x i k = n / t k = 1, 2, · · ·, t t k = 1s x i k = 1 s i = 1, 2, · · ·, n s.t . c x = e ˆ i k s = 1, · · ·, K ; i ∈ N τ ; k = 1, · j l ij kl j l 0 ≤ xik ≤ 1 i = 1, · · ·, n ; k = 1, · · ·, t
269
∗
s
· ·,
t
We will use t he met hod of exhaust ively sampling [1,2] t o est imat e eˆ sik ’ s. However, since t he lengt hs of K given part ial rankings may be quit e diff erent from each ot her, t he coeffi cient s of above quadrat ic arrangement problem do not sat isfy t he “smoot h” condit ion. To make a more accurat e est imat e, we make randomly sampling and est imat ion for each given part ial ranking separat ely. Randomly picking wit h replacement a mult i-set T s of O (log n s / δ 2 ) element s (where δ is a suffi cient ly small fract ion of ǫ which we will det ermine lat er) from t he set N τ ( s = 1, · · ·, K ) respect ively, we est imat e eˆ sik by t he sum ( n s / | T s | ) ω s | { j ∈ T s : τ s ( i ) < τ s ( j ) and g ( j ) > k } | . T hus, we chose randomly a mult i-set T = T 1 ∪ · · · ∪ T K wit h size | T | = O (log n ). Since t he opt imal placement g is not known in advance, we enumerat e all possible funct ion h :T → { 1, 2, · · ·, t } t hat assign element s in T t o groups I 1 , · · ·, I t . For each such funct ion, we solve a linear program M h described below and round t he (fract ional) opt imal solut ion t o const ruct a proper placement . Among all t hese placement s, we pick up one wit h maximum value. When t he funct ion h we considered is t he same as h which is t he rest rict ion of an opt imal placement g t o T , t he placement g we get from t he linear program M h will sat isfy φ ( g ) ≥ φ ( g ) − ǫ n wit h high probability, over t he random choice of T . Let h be a given funct ion h : T → { 1, 2, · · ·, t } . For simplicity, we will ident ify h wit h it s rest rict ions on T s ’ s (s = 1, 2, · · ·, K ) in t he rest of t his sect ion. For t he given part ial ranking τ s , each element i ∈ N τ and group I k ( k = 1, 2, · · ·, t ), we comput e an est imat e esik of t he value (derived from τ s ) of assigning i t o I k in any placement g whose rest rict ion t o T s is h :
ns s ω s { j ∈ T s : τ s ( i ) < τ s ( j ) and h ( j ) > k } . ei k = ′
s
∗
∗
∗
∗
∗
′
s
| Ts |
L e m m a 4 . 4 P ick un iform ly at ran dom with replacem en t a m ulti-set T s of O (log n s / δ 2 ) elem en ts from N τ s . Let g be a placem en t an d h be the restriction s of g on T s . T hen with high probability ( over the choice of sam ple T s ) ,
esik
−
ω
s
{
j ∈
Nτ
: τ s ( i ) < τ s ( j ) and g ( j ) > k }
Consider t he following linear program M h : t K es x ) Max Z ( x ) = ( i N k= 1 ik ik s= 1 n i = 1 x i k = n / t t h :
k= 1 xik = 1 s.t .
ω s x j l − esik j :τ ( i ) < τ ( j ) l> k 0 ≤ xik ≤ 1 ∈
M
s
s
s
≤
3δ .
(4. 1)
τ s
= 1, 2, · · ·, t i = 1, 2, · · ·, n
k
≤
3δ
= 1, · i = 1, ·
s
;i
· ·,
K
· ·,
n;k
∈
Nτ
= 1, ·
s
; · ·,
t
270
X. Deng, Q. Fang, and S. Zhu
Let x h be t he opt imal solut ion for M h . We round x hik using randomized rounding t echniques of Raghavan and T hompson [12] t o obt ain a placement r˜ and corresponding proper placement r h as follows: (1) for each element i , independent ly t ake r˜ ( i ) = k wit h probability x hik ; (2) const ruct a proper placement r h from r˜ by moving element s from groups wit h more t han n / t element s assigned t o t hem t o groups wit h less t han n / t element s assigned t o t hem arbit rarily. We will discuss t he relat ion between t he opt imal value Z ( x h ) of M h and t he value of corresponding placement r h , φ ( r h ). Let t K Z s (x h ) = es x h , Z (x h ) = Z s ( x h ); k= 1 ik ik i N K s= 1 φ s ( r˜ ) = ω s | { ( i , j ) : τ s ( i ) < τ s ( j ) and r˜ ( i ) < r˜ ( j ) } | , φ ( r˜ ) = φ s ( r˜ ) . s= 1 ∈
τ s
L e m m a 4 . 5 Let h be a fun ction that assign s elem en ts of T to groups I 1 , · · ·, I t , an d r h be the proper placem en t con structed from the optim al fraction al solution x h of M h . T hen φ
(r h )
Z (x
≥
h
) − 4K δ n .
∗
(4. 2)
∗
∗
L e m m a 4 . 6 Let g be the optim al placem en t, h be the restriction of g to the sam ple T an d r ∗ be the proper placem en t con structed from the optim al solution x ∗ of M h . T hen ∗
φ
∗
(r )
≥
φ
∗
′
(g ) − ǫ n .
In t his procedure, we enumerat e all possible funct ion h : T → { 1, 2, · · ·, t } and choose a placement wit h maximum value among all placement r h const ruct ed. Since r is a candidat e for our chosen placement r h , and we choose t he placement wit h maximum value which is no less t han t he value of r , t herefore, we obt ain t he desired result . T he P TAS described above uses randomizat ion in picking t he sample set of element s T and in rounding t he opt imal solut ion t o linear program M h . For t he procedure of rounding t he opt imal solut ion x h of linear program M h , we can derandomize it in a st andard way using t he met hod of condit ional probabilit ies [11]. As discussed in [1] (also in [8]), t he procedure of sampling t he set of element s T s can be subst it ut ed by an alt ernat ive way of picking random walks of lengt h | T s | on a const ant degree expander graph. Since t here are only polynomial many random walks of lengt h | T s | = O (log n s / δ 2 ) on t his expander, t he procedure of sampling t he t ot al set T can be subst it ut ed by picking polynomial many random walks of lengt h O (log n / δ 2 ). T hus, we can derandomize t he algorit hm 2 2 by exhaust edly going t hrough all possibilit ies, i.e., t T = t O ( log n / δ ) = n O ( 1 / ǫ ) placement s of t he element s in t he sample. T he running t ime of our algorit hm is 2 n O ( 1/ ǫ ) . ∗
∗
|
5
|
C o n c lu s io n a n d Fu rt h e r W o rk
Considering t he dist inct feat ures in t he cont ext of met a-search on t he web, we have developed a new rank aggregat ion met hod based on t he crit erion of Coherence. We have proposed not only a pract ical heurist ic algorit hm wit h t he solut ion sat isfying t he weight ed ext ended Condorcet crit erion, but also a t heoret ical
Approximat e Rank Aggregat ion
271
polynomial t ime approximat ion scheme (P TAS) for t he Coherence aggregat ion problems. Our algorit hm ext ends and exploit s t he general framework of Arora, et al., [1,2], for design and analysis of polynomial t ime approximat ion schemes. Ot her met rics in social choice t heory are also wort h of furt her explorat ion wit h t he algorit hmic approach. A ck n o w le d g e m e n t . T his work is support ed by a joint research grant (N CityU
102/ 01) of Hong Kong RGC and NNSFC of China.
R e fe re n c e s 1. S. Arora, A. Frieze and H. Kaplan, A new rounding procedure for t he assignment problem wit h applicat ions t o dense graph arrangement problems, FOCS96:21–30 2. S. Arora, D. Karger and M. Karpinski, P olynomial-t ime approximat ion schemes for dense inst ances of NP -hard opt imizat ion problems, ST OC95:284–293 3. J .P. Bart helemy, A. Guenoche and O. Hudry, Median linear orders: Heurist ics and a branch and bound algorit hm, European J ournal of Operat ional Research 42(1989): 313–325. 4. J .P. Bart helemy and B. Monjardet , T he median P rocedure in clust er analysis and social choice t heory, Mat hemat ical Social Sciences 1(1981): 235–267. 5. J .J . Bart holdi, D.A. Tovey and M.A. Trick, Vot ing schemes for which it can be diffi cult t o t ell who won t he elect ion, Social Choice and Welfare, 6(1989): 157–165. 6. I. Charon, A. Guenoche, O. Hudry and F . Woirgard, New result s on t he comput at ion of median orders, Discret e Mat hemat ics 165/ 166(1997): 139–153. 7. C. Dwork, R. Kumar, M. Naor and D. Sivakumar, Rank aggregat ion met hods for t he web, W W W 10 (2001), 613–622. 8. D. Gillman, A Chernoff bound for random walks on expanders, SIAM J . Comput . 27(1998): 1203–1220. 9. R.M. Karp, Reducibility among combinat orial problems, in: R.E. Miller and J .W . T hat cher, eds., Complexity of Comput er Comput at ions (P lenue, New York, 1972) 85–103. 10. J .G. Kemeny, Mat hemat ics wit hout numbers, Daedalus 88(1959): 577–591. 11. P. Raghavan, P robabilist ic const ruct ion of det erminist ic algorit hms: Approximat ing packing int eger programs, J ournal of Comput er and Syst em Sciences 37(1988): 130–143. 12. P. Raghavan and C. T hompson, Randomized rounding: a t echnique for provably good algorit hms and algorit hmic proofs, Combinat orica 7(1987): 365–374.
P e rt u rb a t io n o f t h e H y p e r-Lin ke d E nv iro n m e nt Hyun Chul Lee and Allan Borodin Depart ment of Comput er Science University of Toront o Toront o, Ont ario, M5S3G4 { leehyun,bor} @cs.toronto.edu
Aft er t he seminal paper of Kleinberg [1] and t he int roduct ion of P ageRank [2], t here has been a surge of research act ivity in t he area of web mining using link analysis algorit hms. Subsequent t o t he first generat ion of algorit hms, a significant amount of improvement s and variat ions appeared. However, t he issue of st ability has received lit t le at t ent ion in spit e of it s pract ical and t heoret ical implicat ions. For inst ance, t he issue of “link spamming” is closely relat ed t o st ability: is it possible t o boost up t he rank of a page by adding/ removing few nodes t o/ from it ? In t his paper, we st udy t he st ability aspect of various link analysis algorit hms concluding t hat some algorit hms are more robust t han ot hers. Also, we show t hat t hose unst able algorit hms may become st able when t hey are properly “randomized”.
A b st ract .
1
Int ro d u c t io n
T he use of link analysis algorit hms for diff erent web mining purposes became quit e popular aft er t he first int roduct ion of algorit hms t o ident ify aut horit at ive sources in t he web [1,2]. Diff erent at t empt s [6,7,3,9,10,12,13,14] t o improve t hese algorit hms were t aken. A simple evaluat ion of query result s using human judgement is normally employed t o measure t he performance of algorit hms. Ng et al. [4] and Borodin et al. [3] t ake a slight ly diff erent pat h from ot her papers: Ng et al. st udy t he st ability aspect of some link analysis algorit hms like PageRank and HIT S, providing some insight int o ways of designing st able link analysis met hods. Borodin et al. int roduce some formal definit ions of st ability and rank st ability along wit h t he analysis of some algorit hms. St ability is an import ant feat ure t o consider in a such highly dynamic environment as World Wide Web. T he World Wide Web is cont inuously evolving, so if a link analysis is t o provide a robust not ion of aut horit at iveness of pages, t hen it is nat ural t o ask for a link analysis algorit hm t o be st able under small pert urbat ions on t he web t opology. Int uit ively, a small change of t he web t opology should not aff ect t he overall link st ruct ure, and a proper definit ion of st ability should reflect t his int uit ion properly. T he st ability issue also has some pract ical implicat ions such as t hat of “link spamming”, i.e. a good link analysis algorit hm should be robust t o any malicious at t empt of web designers t o promot e t he rank of t heir pages by adding/ removing few links t o/ from t hem. T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 272–283, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
P ert urbat ion of t he Hyper-Linked Environment
273
T he current link analysis algorit hms can be classified int o two cat egories. T he first class of algorit hms are algebraic m ethods such as HIT S [1],PageRank [2], SALSA [6] and various hybrid algorit hms of t he first two [3,9,11]. T hese met hods essent ially comput e principal eigenvect ors of part icular mat rices relat ed t o t he adjacency mat rix of a cert ain web graph t o ident ify t he most relevant pages on t hat web graph. T he second class of algorit hms are probabilistic m ethods such as P HIT S [10] and Bayesian [3] algorit hms. T hese algorit hms, using some probabilist ic assumpt ions and t echniques, est imat e t he rank of pages on a specific t opic. A lgebraic m ethods are t he most popular ones, t hus in t his paper we only st udy t he algebraic m ethods . More specifically, aft er int roducing our revised definit ion of st ability, we show t he following result s regarding t he st ability of algebraic met hods: 1) PageRank is st able on t he class of all direct ed graphs. 2) SALSA is st able on t he class of aut hority connect ed graphs but not st able on t he class of all direct ed graphs. 3) HIT S is not st able on t he class of aut hority connect ed graphs. Finally, we int roduce randomized versions of HIT S and SALSA showing st ability for t hese algorit hms.
2
O v e rv ie w o f A lg o rit h m s
We begin by reviewing some algebraic link analysis algorit hms, t he reader familiar wit h t his mat erial may wish t o skip ahead t o Sect ion 3.
2 .1
H IT S
Creat ed by Kleinberg [1], HIT S is t he first link analysis algorit hm used for web mining. In cont rast t o PageRank, it was never implement ed in a commercial search engine unt il a new search engine Teoma 1 int egrat ed a variat ion of HIT S2 as part of it s ranking syst em. First , t his algorit hm const ruct s a R oot Set of pages consist ing of a short list of webpages ret urned by t he search engine. Lat er, t his R oot Set is augment ed by pages t hat are point ed t o by pages in t he R oot Set , and also by pages t hat point t o pages in t he R oot Set t o form a larger set called B ase Set , which makes HIT S a query dependent met hod. Wit h t he B ase set , HIT S forms t he adjacency mat rix A where A i j = 1 if t here is a link from i t o j and 0 ot herwise. Next , it assigns t o each page i an aut hority weight a i and a (t ) (t ) (t ) ( t + 1) a k are h j and h i = hub weight h i , t hen t he equat ions a i = i→ k j → i (t )
(t )
it erat ed unt il a i and h i converge t o t he fixed point s a ∗i and h ∗i respect ively (wit h t he vect ors renormalized t o unit lengt h at each it erat ion). Also, it is easily seen t han t he fixed point s a ∗ and h ∗ are principal eigenvect ors of A t A and A A t respect ively. T he aut hority value of a page i is t aken t o be a ∗i , and t he hub value of page i is t aken t o be h ∗i in a similar manner. 1 2
ht t p:/ / www.t eoma.com t eoma vs. Google, Round T wo, Siliconvalley.int ernet .com, April 2, 2002
274 2 .2
H.C. Lee and A. Borodin P ageR ank
T he popularity of PageRank is due t o t he commercial success search engine Google3 creat ed by Brin and Page [2]. PageRank simulat es a random surfer who jumps t o a randomly chosen web page wit h probability ǫ , and follows one of t he forward-links on t he current page wit h probability 1 − ǫ . T his process defines a markov chain on t he web pages. T he t ransit ion probability mat rix of t his markov chain is given by ( ǫ U + (1 − ǫ ) A r o w ) where A r o w is const ruct ed by renormalizing each row of t he adjacency mat rix A t o sum t o 14 and U is t he t ransit ion mat rix of uniform t ransit ion probabilit ies. T he vect or p t hat represent s PageRank scores of pages is t hen defined t o be t he st at ionary dist ribut ion of t his markov chain. PageRank does not make dist inct ion between hub values and aut hority values, rat her it assigns a single value(PageRank) t o each page. In t his paper, t he PageRank score p i of page i is t aken t o be bot h aut hority and hub values of t he page for t he sake of our analysis. 2 .3
S A LS A
As an alt ernat ive algorit hm t o HIT S(an algorit hm t o avoid “t opic-drift ”), SALSA is proposed by Lempel and Moran [6]. SALSA performs two random walks on web pages; a random walk by following a backward-link and t hen a forward-link alt ernat ely, and anot her one by following a forward-link and t hen a backward-link alt ernat ely. T he aut hority weight s are defined t o be t he st at ionary dist ribut ion of t he former random walk, and t he hub weight s are defined t o be t he st at ionary dist ribut ion of t he lat t er random walk. T hus, SALSA assigns separat e hub and aut hority scores t o each page. T he t ransit ion probability mat rices of t he markov chains for t he aut horit ies and hubs are given by A˜ = A tc o l A r o w , H˜ = A r o w A tc o l , where A c o l is const ruct ed by renormalizing each column of t he adjacency mat rix A t o sum t o 1, and A r o w is const ruct ed by renormalizing each row of t he adjacency mat rix A t o sum t o 1. One at t ract ive aspect of SALSA is t hat it s st at ionarity dist ribut ions have explicit forms [6].
3
D e fi n it io n s a n d N o t a t io n s
In t his sect ion, we int roduce some basic definit ions and not at ions used t hroughout t he rest of paper. Given G = ( V , E ) a direct ed graph represent ing a set of pages and t heir int erconnect ing links, we define t he co-citation graph of G as an undirect ed graph G a = ( V ′ , E ′ ) such t hat V ′ = V and E ′ = { ( p, q) | if t here exist s a node r t hat links t o bot h p and q } . A direct ed graph G = ( V , E ) is called authority connected if it s co-cit at ion graph is connect ed. T he edge 3 4
ht t p:/ / www.google.com It is not clear from t he original definit ion how t o deal wit h t he sit uat ion where t he current page has no forward-link from it . In t his paper, we use t he simplest approach, i.e. when a page has no forward-link(a row of A has all zero ent ries), t hen t he corresponding row of A r o w is const ruct ed t o have all ent ries equal t o 1/ n.
P ert urbat ion of t he Hyper-Linked Environment
275
dist ance d e between two graphs G 1 = ( V , E 1 ) and G 2 = ( V , E 2 ) is defined as d e ( G 1 , G 2 ) = | ( E 1 ∪ E 2 ) \ ( E 1 ∩ E 2 ) | . We define a link analysis algorit hm T = ( a T ( G ) , h T ( G )) as a pair of funct ions t hat map a direct ed graph G of size N t o a N-dimensional vect or. We call t he vect or a T ( G ) t he aut hority weight vect or of algorit hm T on graph G and h T ( G ) t he hub weight vect or of algorit hm T on graph G . T he value of t he ent ry a Ti ( G ) of vect or a T ( G ) denot es t he aut hority weight assigned by t he algorit hm T t o t he page i. Similarly, t he value of t he ent ry h Ti ( G ) of vect or h T ( G ) denot es t he hub weight assigned by t he algorit hm T t o t he page i. If t he algorit hm T does not make dist inct ion between hub and aut hority values, t hen we t reat t he single weight of page as bot h hub and aut hority weight s. If it is clear in t he cont ext , t hen we simply use a inst ead of a T ( G ) t o denot e t he aut hority vect or of algorit hm on graph G , and a i inst ead of a Ti ( G ) t o denot e t he aut hority weight assigned by t he algorit hm T t o t he page i . A similar convent ion is used for t he hub vect or. Given a graph G , we can view a pert urbat ion on graph G , as an operat ion ∂ on graph G , t hat adds and/ or removes links t o produce a new graph G ′ = ∂ G . We denot e by a˜ T ( G ) = a T ( ∂ G ) t he new aut hority vect or of t he pert urbed graph ∂ G , and by a Ti it s respect ive new aut hority weight assigned by t he algorit hm T t o page i. Let BP and FP denot e t he set of pages whose backward-links are pert urbed and t he set of pages whose forward-links are pert urbed respect ively. Let BU denot e t he set of pages whose backward-links remain unpert urbed even aft er t he pert urbat ion, and let FU be t he set of pages whose forward-links remain unpert urbed even aft er t he pert urbat ion. Let G˜ be t he set of all direct ed graphs, let G N be t he class of all direct ed graphs of size N, let G A C be t he class of all aut hority connect ed graphs, and let G AN C be t he class of aut hority connect ed graphs of size N. T herefore, G A C ⊂ G˜ , G N ⊂ G˜ and G AN C ⊂ G A C hold. It is our part icular int erest t o st udy t he st ability issues of link analysis algorit hms on t he class G A C because an aut hority connect ed graph can be viewed as represent at ion of t opical web graphs (a set of pages t hat pert ain t o t he same t opic). Before int roducing our definit ion of st ability, t he original definit ion of st ability will be int roduced, so t hat t he reader who is not familiar wit h [3] can underst and t he mot ivat ion driving a new definit ion. P re v io u s D e fi n it io n : An algorit hm T is st able if for every fixed K, we have
lim N →
∞
G1∈
G N
max
min
,de (G ,∂ G )≤ K γ 1 ,γ 2 ≥ 1
||γ 1a
T
(G ) − γ 2 aT (∂ G )| | 1 = 0
Based on t his definit ion, Borodin et al. show 1) HIT S is not st able on G N . 2) SALSA is not st able on G AN C but it is st able on G N . We t hink t his definit ion of st ability is not suffi cient ly robust t o reflect t he realist ic st ability of link analysis algorit hms, i.e. the im pact of perturbation depends on both the num ber and the weights of perturbed nodes, but rather, the definition only considers the num ber of perturbed links . T hus, mot ivat ed by [4] which bounds t he magnit ude of per-
t urbat ion for PageRank by a linear funct ion of t he aggregat ed PageRank scores of all pert urbed pages, we define our not ion of st ability.
276
H.C. Lee and A. Borodin
D e fi n it io n 1 . Let ci be the num ber of backward-links of page i that are per-
turbed. W e say that an algorithm T is stable on S value k such that for any G ∈ S and ∂ G ∈ S ⊆
˜ if we have a fixed constant
G
||a
T
(G ) − aT (∂ G )| | 1
≤
k
ci a i
+
hj j
i∈ B P
∈
F P
holds. T he int uit ive idea behind t his definit ion is as follows. Each t ime we add/ remove a link t here are two pages involved wit h t his act ion, namely a page(call it j) whose forward-link is pert urbed and anot her page(call it i) whose backward-link is pert urbed. Roughly speaking, t he “cost ” of t his addit ion/ removal is a i + h j . Bot h a i and h j will cont ribut e t o t he impact of pert urbat ion, but t he cont ribut ion of h j would not be as considerable as t hat of a i since t he aut hority weight of a page is mainly due t o backward-links rat her t han forward-links. T herefore, in our definit ion, a i is more heavily weight ed by t he number of pert urbed backward-links of page i. Alt hough it is also possible t o have a definit ion in t erms of t he eigengap of part icular mat rix relat ed t o t he link analysis algorit hm, it present s some diffi cult ies. For some link analysis algorit hms like probabilist ic ones, t here is no nat ural way of formalizing eigengap since it s role in t he algorit hm is obscure.
4
R e s u lt s
In t his sect ion, we present our result s regarding t he st ability of PageRank, SALSA, and HIT S.
4 .1
S t a b ilit y o f P a g e R a n k
It is proven in [4] t hat | | p˜ − p | | 1 ≤ 2/ ǫ · p i , where P denot es t he set of i∈ P pert urbed nodes. Slight ly adapt ing t his result t o our definit on of st ability, t he following proposit ion is obt ained. P ro p o s it io n 1 . P ageR ank is stable on the class of all directed graphs G˜ . Specif-
ically, given a graph G = ( V , E ) ∈ G˜ , G is perturbed producing a new graph ∂ G . Let p be the original P ageR ank score, then the new P ageR ank score p˜ satisfies:
˜
||p −
p| | 1
2(1 − ǫ ) ≤
ǫ
pi
· i∈ F P
Not e t hat our proposit ion only focuses on t he set FP rat her t han t he ent ire set of pert urbed nodes.
P ert urbat ion of t he Hyper-Linked Environment 4 .2
277
S t a b ilit y / I n s t a b ilit y o f S A L S A
P ro p o s it io n 2 . Let G , G ’
∈ G A C , s the original SA L SA authority vector, and c i the num ber of perturbed backward-links of page i, then the new SA L SA authority vector s˜ obtained after the perturbation satisfies:
||s −
s˜ | | 1
≤
2 i∈ B P
ci w
where w denotes the num ber of links ( edges) in G . M oreover, if we only perturb those pages whose | B ( i ) | > 0 ( † ) , then
||s −
s˜ | | 1
≤
2
ci s i i∈ B P
N ote that proposition 2 states that SA L SA is stable on the class of authority connected graphs G A C under the assum ption ( † ) . P ro p o s it io n 3 . SA L SA is not stable on the class of all directed graphs G˜ P ro o f: Consider a graph t hat consist s of complet e graphs C 1 and C 2 of size 2 and n respect ively. Also, t here exist s an ext ra hub h t hat point s t o two aut hority nodes p and q of t he component C 1 and C 2 respect ively. Now, we pert urb t he graph removing t he link from hub h t o aut hority p. T hen, we observe t hat for t he node s ∈ C 1 \ p , we have a s = 1/ ( n ( n − 1) + 4) , a s = (2/ ( n + 2))(1/ 2) = 1/ ( n + 2), and for p, we have a p = n ( n − 21) + 4 , a p = (2/ ( n + 2))(1/ 2) = 1/ ( n + 2). Moreover, h h = 2/ ( n ( n − 1) + 4). T hus, | a p − a p | + | a s − a s | = (2n 2 − 5n + 2) / (( n + 2)( n ( n − 1) + 4)) > ( n − 6) / 4 · (2/ ( n ( n − 1) + 4) + 2/ ( n ( n − / 1) + 4)) = ( n − 6) / 4 · ( a p + h h ). Consequent ly | | a − a˜ | | 1 > ( n − 6) / 4 · ( a p + h h ) which proves t he proposit ion. 4 .3
I n s t a b ilit y o f H I T S
To illust rat e t he high sensit ivity of HIT S t o t he t opology of graph, we st art wit h an example. E xam ple 1. Consider a graph G = ( V , E ) t hat consist s of n nodes t hat form
a cycle. More precisely, G has links { 1 → 2, 2 → 3, . . . , n − 1 → n , n → 1} . Next , G is pert urbed by removing 1 → 2 and adding 1 → 3. T he weight is evenly dist ribut ed among all nodes in G , i.e. for all i ∈ V, we have a i = 1/ n , h i = 1/ n . On t he ot her hand, we have a ˜ 3 = 1 and a˜ i = 0 for t he rest of nodes. Moreover, we have h˜ 1 = 1/ 2, h˜ 2 = 1/ 2 and h˜ i = 0 for t he rest of nodes. Hence, ||a − a ˜ | | 1 = ( n − 1) / n + 1 − 1/ n > 1 = n / 3( a 2 + a 3 + h 1 ). Not e t hat t his example shows t hat HIT S fails t o be st able even under small pert urbat ion of a connect ed graph.5 T herefore, t he following proposit ion is not surprising. 5
It is not answered in [3] whet her HIT S is st able or not when t he pert urbed graph remains connect ed aft er t he pert urbat ion.
278
H.C. Lee and A. Borodin
P ro p o s it io n 4 . HIT S is not stable on the class of authority connected graphs GA
C
P ro o f: Consider t he graphs G and ∂ G t hat consist of 2n+ 1 nodes. Let A = { 1, . . . , n } denot e t he first n nodes, let B = { n + 1, . . . , 2n } denot e t he next n nodes, and let s denot e t he last node. Bot h graphs cont ain t he links { s → i | i ∈ B } and { i → j | i ∈ A , j ∈ B } . T he pert urbed graph ∂ G addit ionally cont ains links { j → i |j ∈ B ,i ∈ A } and { s → i : i ∈ A } . G and ∂ G are aut hority connect ed graphs. For all i ∈ A , we have a i = 0, h i = 1/ ( n + 1), a ˜ i = 1/ (2n ). For all j ∈ B , we have a j = 1/ n , h j = 0, a ˜ j = 1/ (2n ). Finally, we have a s = 0, h s = 1/ ( n + 1), a˜ s = 0. T herefore, h j ) proving 2 · a + | | a − a ˜ | | = 1 / 2 > n / 2( ||a − a ˜ || ≥ i i i j ∈ B ∪ { s} i∈ A i∈ A inst ability.
Example 1 and P roposit ion 4 show some ext reme scenarios where HIT S fails t o be st able. Apparent ly, addit ion/ removal of even small number of links may alt ernat e subst ant ially t he whole weight dist ribut ion under HIT S, and t he experiment al st udy about t he st ability of HIT S appears in Sect ion 6.
5
Im p rov e m e nt o f A lg o rit h m s
In t he previous sect ion, some limit at ions of SALSA and HIT S in t erms of st ability were shown. In t his sect ion, we explore how t he randomizat ion of t he algorit hms can eliminat e t heir inst ability.
5 .1
R a n d o m iz e d H I T S
T he first version of randomized HIT S is int roduced in [9] under t he name of two-level reputation rank . Also, a slight ly diff erent version is proposed by Ng et al. [7] T his randomizat ion of HIT S consist s of t he following random surfer model: t he random surfer picks uniformly a random page wit h probability ǫ and follows a link wit h probability 1 − ǫ . If he decides t o follow a link t hen he checks if it is odd t ime st ep or even t ime st ep. If it is odd t ime st ep, t hen he follows uniformly at random a forward-link. If it is even t ime st ep, t hen he follows uniformly at random a backward-link. Not e t hat t his process defines a random walk on pages which is similiar in spirit t o HIT S. T he st at ionary dist ribut ion on odd t ime st eps is defined t o be t he aut hority weight s of pages and t he st at ionary dist ribut ion on even t ime st eps is defined t o be t he hub weight s of pages. Formally, t he aut hority weight s and hub weight s of pages are calculat ed by updat ing t he equat ions a ( t + 1) = ǫ · U + (1 − ǫ ) · A tr o w , h ( t ) an d h ( t + 1) = ǫ · U + (1 − ǫ ) · A c o l a ( t + 1) where each ent ry of U is 1/ n, A r o w is t he same as t he adjacency mat rix of t he graph A wit h it s rows normalized t o sum t o 1, A c o l is t he t he same as t he adjancency mat rix of t he graph A wit h it s rows normalized
P ert urbat ion of t he Hyper-Linked Environment
279
t o sum t o 1.6 T he equat ions in (1) are it erat ed unt il t hey converge t o t he fixed point s a ∗ and h ∗ . T he convergence of t hese it erat ions is proved in [9]. We refer t his version of HIT S as random ized HIT S or simply R HIT S . Under R HIT S each node is t reat ed as bot h aut hority and hub. Next , we invest igat e st ability aspect of R HIT S . P ro p o s it io n 5 . R HIT S is stable on the class of all directed graphs G˜ . Specifi-
cally, given a graph G = ( V , E ) graph ∂ G , then we have
˜ ,the graph G is perturbed producing a new
∈
G
˜
||a −
5 .2
a| | 1
≤
2(1 − ǫ ) ·
hi
ǫ
j ∈
+
F P
1 2− ǫ
ai
i∈ B P
R a n d o m iz e d S A L S A
In a similar manner as t hat of HIT S, it is possible t o overcome t he limit at ion of SALSA by randomizing t he algorit hm. We call t his algorit hm R andom ized SA L SA or simply R SA L SA . Let be two random surfers; t he first random surfer picks uniformly a random page wit h probability ǫ , and it follows a backward-link t hen a foward link wit h probability 1 − ǫ . T his random surfer model defines t he random walk on t he aut hority nodes. T he second random surfer picks uniformly a random page wit h probability ǫ , and it follows a forward-link t hen a backwardlink wit h probability 1 − ǫ , defining a random walk on t he hub nodes. More precisely, t he markov chain for t he aut horit ies and hubs have t he t ransit ion probabilit ies P a ( i , j ) = nǫ + (1 − ǫ ) { k : k ∈ B ( i ) ∩ B ( j ) } | B 1( i ) | | F (1k ) | and P h ( i , j ) = ǫ + (1 − ǫ ) { k : k ∈ F ( i ) ∩ F ( j ) } | F 1( i ) | | B (1k ) | . T he convergence of markov chains t o n unique dist ribut ions are guarant eed from t he fact t hat a markov chain t hat has t ransit ion probabilit ies P (x,y) of t he form P ( x , y ) = ǫ µ ( y ) + (1 − ǫ ) Q ( x , y ) for some dist ribut ions µ and Q is uniform ly ergodic [16]. Hence, t he powers of t ransit ion probabilit ies converge geomet rically t o t he unique dist ribut ions. Similar t o R HIT S , R SA L SA t reat s each page as bot h aut hority and hub. P ro p o s it io n 6 . R SA L SA is stable on the class of all directed graphs G˜ . Specifically, given a graph G = ( V , E ) ∈ G˜ representing a web subgraph,the graph G is perturbed producing a new graph ∂ G , then we have
˜
||a −
6
a| | 1
4(1 − ǫ ) ≤
ǫ
ai
· i∈ B P
W hen a row of A r o w has all zero ent ries, t hen t he corresponding row of A r o w is const ruct ed t o have all ent ries equal t o 1/ n. Similarly, if a col of A c o l has all zero ent ries, t hen t he corresponding col of A c o l is const ruct ed t o have all ent ries equal t o 1/ n.
280
H.C. Lee and A. Borodin Stability
Stability
15
15 RSALSA RHITS
HITS SALSA PAGERANK
K/min(K)
10
K/min(K)
10
5
5
1
1
0
0 20% 50% 75% Abortion
20% 50% 75% 20% 50% 75% 20% 50% 75% Genetic Movies Net Censorship
F ig . 1 .
6
20% 50% 75% Abortion
20% 50% 75% 20% 50% 75% 20% 50% 75% Genetic Movies Net Censorship
Sensit ivity Analysis
E x p e rim e nt a l R e s u lt s
Alt hough t he st udy of st ability from t he previous sect ions gives some useful t heoret ical insight about t he robust ness of algebraic link analysis algorit hms, t he not ion of st ability int roduced in t his paper is a worst-case not ion. Hence, t he t heoret ical analysis from previous sect ions will be complement ed wit h some experiment al st udies t o evaluat e t he robust ness of algorit hms in pract ice. Also, we st udy t he performance of R HIT S and R SA L SA relat ive t o some queries. From t his st udy we show t hat R HIT S can be, for inst ance, a way t o overcome t he limit at ion of HIT S while being robust t o pert urbat ions since bot h R HIT S and R SA L SA out perform HIT S specially on t hose queries in which HIT S fails because of “Topic Drift ” [6]. St ability result s will be present ed in Sect ion 6.1 while t he performance of algorit hms relat ive t o various queries will be present ed in Sect ion 6.2 6 .1
S t a b ilit y R e s u lt
Given t he four direct ed graphs,7 each one represent ing t he set of pages and t heir int erconnect ing links, obt ained as result s of queries on “Genet ic”, “Abort ion”, “Movies” and “Net Censorship” following t he guidelines suggest ed in [1], we pert urbed each graph by randomly removing 25%, 50% and 75% of links from each one. We ran five pert urbat ions on each graph t o const ruct fift een dat aset s in t ot al for each t opic. In order t o measure t he st ability, we compared t he magnit ude of pert urbat ion | | a − a˜ | | 1 t o t he weight s of pert urbed pages. More precisely, we defined our sensit ivity measure of link analysis algorit hm T h j ) where ci denot es t he number of as K = | | a − a˜ | | 1 / ( i ∈ B P ci a i + j ∈ F P backward-links t hat are pert urbed. Recall from our definit ion of st ability t hat 7
T hese web dat a are freely available at ht t p:/ / www.cs.t oront o.edu/ ∼ t sap/ experiment s
P ert urbat ion of t he Hyper-Linked Environment
281
when t he algorit hm is not st able t hen K would be unbounded. T hus, volat ile K values would be a possible indicat ion of inst ability of t he algorit hm. In fact , HIT S seems t o present t his kind of behavior as shown lat er on. We comput ed K for each dat aset respect t o all algebraic algorit hms considered in t his paper.8 Let min(K) be t he smallest K for each algebraic algorit hm over all queries and for all t rials. We divided each K by min(K) which corresponds t o t he Y axis in Figure 2. One can observe from Figure 2 t he high sensit ivity of HIT S from it s volat ile K/ min(K) values on diff erent queries. On t he ot her hand, t he st ability of PageRank is remarkable showing a st able behavior regardless of t he dat aset . Finally, t he sensit ivity of SALSA, R SA L SA and R HIT S can be seen t o be between PageRank and HIT S.
T a b le 1 .
Top 10 pages on “Abort ion” (ǫ = 0.1, Base Set Size= 2293)
In d ex
URL
(1165)
D im e C lick s.c o m -...
(1193)
H it B ox .c o m - ...
( 1 1 8 4 -9 2 ) A m a zo n .co m -... (1948) (962) (1769) (719) (925) (0) (666) (718) (1325) (2262) (717) (1139)
6 .2
T it le h t t p :/ / w w w 5 .d im e c lick s.c o m h t t p :/ / r d 1 .h it b ox .c o m / h t t p :/ / w w w .a m a z o n .c o m /
P o lit ic s1 : H o t P o lit ic s... h t t p :/ / w w w .p o lit ic s1 .c o m / P r o life I n fo P r ie s t s fo r L ife I n d e x A b o r t io n a n d r ep r o d . R es. P regn a n cy C e n t e r s O n lin e A b o r t io n C lin ic s O n L in e R o ev W a d e.or g H u m a n L ife In t e r n a t io n a l F e m in is t s F o r L ife o f A . T h e U lt im a t e P r o - L ife R e s o u r c e s N a t io n a l R ig h t t o L ife O r g a n iz a t io n S im p le C a t h o lic ism
h t t p :/ / w w w .p r o li fe . o r g / u lt im a t e h t t p :/ / w w w .p r ie st s fo r life . o r g
In d ex
URL
(368)
C u r r e n t E v e n t s - L a w h t t p :/ / la w .m in in g c o .c o m
T it le
( 1 7 6 9 ) P r ie s t s fo r L ife I n d e x h t t p :/ / w w w . p r ie s t s fo r life . o r g A b o r t io n (0) h t t p :/ / w w w .g y n p a g e s.c o m C lin ic s O n L in e P regn a n cy h t t p :/ / w w w .p r e g n a n c y (925) C e n t e r s O n lin e cen t er s.or g P la n n e d P a r e n t h o o d h t t p :/ / w w w .p la n n e d (1461) F e d e r a t io n p a r en t h o o d .or g (666)
R o ev W a d e.or g
h t t p :/ / w w w .r o e v w a d e .o r g
h t t p :/ / w w w .r o e v w a d e .o r g
T h e A b o r t io n R ig h t s A c t iv ist T h e J o h n B ir ch (1984) S o c ie t y A m e r ic a n O p in io n (1983) B o o k S e r v ic e (2375) A b ou t
h t t p :/ / w w w .h li.o r g
( 1 9 8 5 ) T R IM o n lin e
h t t p :/ / w w w .t r im o n lin e .o r g
h t t p :/ / w w w .se r v e .c o m / fe m 4 life
( 2 3 8 2 ) A llE x p e r t s.c o m
h t t p :/ / w w w .a lle x p e r t s.c o m
h t t p :/ / w w w .n a r a l.o r g h t t p :/ / w w w .p r e g n a n c y cen t er s.or g h t t p :/ / w w w .g y n p a g e s.c o m
h t t p :/ / w w w . p r o life in fo . o r g h t t p :/ / w w w .n r lc .o r g
(2)
h t t p :/ / w w w .c a is.c o m / a g m / m a in h t t p :/ / w w w .jb s.o r g h t t p :/ / w w w .a o b s-st o r e .c o m h t t p :/ / h o m e .a b o u t .c o m
(46)
P r o je c t R a ch e l,..
h t t p :/ / m a n a c o .sim p le n e t .c o m /
(2501)
T h e M a r ch F o r L ife F u n d
h t t p :/ / w w w . m a r ch fo r life . o r g
h t t p :/ / w w w .g e o c it ie s.c o m /
P e rfo rm a n c e E v a lu a t io n
In t his sect ion, we report result s of a series of experiment s t hat we conduct ed t o evaluat e t he ranking quality of algebraic link analysis algorit hms considered in t his paper. We ran each algorit hm on four diff erent queries using t he same dat aset s as t hose of [3]. For t he sake of brevity, we only present t he t op 10 pages on t he query “Abort ion” (Table 1). T he full set of experiment al result s can be found at t he web page ht t p:/ / www.cs.t oront o.edu/ ∼ leehyun/ experiment .ht m. T he “T ight ly Knit Community(T KC)” [6] eff ect for HIT S is clearly observed wit h t his part icular query since it s ret urned pages cont ain many irrelevant pages from “Amazon.com” in it s t op 10 pages. All t op 10 pages produced by R SA L SA 8
Not ice t hat when ǫ → 1, t he st ability of P ageRank, R H I T S and R SA L SA is increased as t he algorit hms are reduced int o simple uniform random jumps. T hus, t he value of ǫ = 0.1 was chosen t o minimize t he influence of ǫ on t he st ability of algorit hms even t hough 0.1 < ǫ < 0.2 is t he most widely used value of ǫ for P ageRank.
282
H.C. Lee and A. Borodin
and R HIT S , in cont rast , are relevant t o t he t opic “Abort ion”. It should be not ed t hat in spit e of t he ident ical t op 10 pages between SALSA and RSALSA, a more careful st udy of low ranked pages revealed subst ant ial diff erence between t hese algorit hms. HIT S SALSA RHIT S RSALSA PageRank 1165 717 717 717 1984 1193 962 962 962 1983 1184 1769 1769 1769 2375 1188 719 719 719 1985 1191 925 0 925 2382 1189 0 925 0 46 1187 666 1461 666 2501 1192 718 718 718 717 1190 1325 666 1325 1139 1948 2262 2 2262 368 precision 0.1 1 1 1 0.3
HIT S SALSA RHIT S RSALSA PageRank
7
HIT S SALSA RHIT S RSALSA PageRank 10 0 0 0 0 0 10 8 10 0 0 8 10 8 0 0 10 8 10 0 0 0 0 0 10
C o n c lu s io n s
We st udied t he st ability aspect of diff erent algebraic link analysis algorit hms. We gave a new definit ion of st ability mot ivat ed by t he definit ion of st ability given in [3] and some bounds for | | a − a˜ | | 1 found in [4]. In t his paper, we showed t hat PageRank is st able, HIT S is not st able, and SALSA is st able under cert ain circumst ances according t o our new definit ion of st ability. Also, we reexamined R andom ized HIT S int roduced in [9,7] showing t hat t he algorit hm is st able. Also, we proposed R andom ized SA L SA as a way t o overcome t he inst ability of SALSA on t he class of all direct ed graphs G˜ . Finally, st ability of link analysis algorit hms were st udied experiment ally. Our work leads t oward some pract ical and t heoret ical open quest ions t o be at t acked for fut ure work. Above all, a more det ailed st udies about t he st ability aspect of link analysis algorit hms on a large set of queries will be required. Also, it would be int erest ing t o st udy if t he not ion of rank st ability in [3] and our not ion of st ability are relat ed.
P ert urbat ion of t he Hyper-Linked Environment
283
R e fe re n c e s 1. J . Kleinberg, “Aut horit ive sources in a hyperlinked environment ”, J our n al of t he A C M , 46 1999. 2. S. Brin and L. P age, “T he nat omy of a large-scale hypert ext ual(Web) search engine”, P r oc. 7t h I n t er n at i on al W or ld W i de W eb C on fer en ce, 1998. 3. A. Borodin, G.O. Robert s, J .S. Rosent hal, and P. T saparas, “F inding aut horit ies and hubs from link st ruct ures on t he world wide web”, P r oc. 10t h I n t er n at i on al W W W con fer en ce, 2001. 4. A.Ng, A.Zheng and M.J ordan, “Link Analysis, Eigenvect ors and St ability”, P r oc. 7t h I n t er n at i on al C on fer en ce on A r t i fi ci al I n t el li gen ce, 2001. 5. R. Lempel and S. Moran, “Rank-St abilt iy and Rank-Similarity of Web LinkBased Ranking Algorit hms”, Technion CS Depart ment t echnical report , CS-200122, 2001. 6. R. Lempel and S. Moran, T he st ochast ic approach for link-st ruct ure analysis(SALSA) and t he T KC eff ect . P r oc. 9t h I n t er n at i on al W or ld W i de W eb C on fer en ce, May 2000. 7. A.Ng, A.Zheng and M.J ordan, “St able Algorit hms for Link Analysis”. P r oc. 24t h A C M -SI G I R C on fer en ce on r esear ch an d developm en t i n I n for m at i on Ret r i eval
415–429, May 2001. 8. T . Lindvall, Lect ures on t he coupling met hod, wiley series in probability and mat hemat ica st at ist ics, 1992. 9. D. Rafiei and A. Mendelzon, “W hat is t his page known for? Comput ing web page reput at ions”, P r oc. t he 9t h I n t er n at i on al W or ld W i de W eb C on fer en ce, Amst erdam, Net herlands, 2000. 10. D. Cohn and H. Chang, “P robabilist ically Ident ifying Aut horit at ive Document s”, P r oc. 17t h I n t er n at i on al C on fer en ce on M achi n e L ear n i n g, 2000. 11. K. Bharat and M. Henzinger, “Improved algorit hms for t opic dist illat ion in a hyperlinked environment ”, P r oc. of 21st I n t er n at i on al C on fer en ce on Resear ch an d D evelopm en t i n I n for m at i on Ret r i eval ( SI G I R 1998) . 12. S. Chakrabart i, M. J oshi and V. Tawde, “Enhanced t opic dist illat ion using t ext , markup t ags, and hyperlinks”, P r oc. 24t h A C M -SI G I R C on fer en ce on Resear ch an d D evelopm en t i n I n for m at i on Ret r i eval , 2001. 13. D. Achiliopt as, A. F iat , A. Karlin, and F . McSherry, “Web search t hrough hub synt hesis”, P r oc. 42n d Foun dat i on of C om put er Sci en ce, Las Vegas, Nevada, 2001. 14. Y. Azar, A. F iat , A. Karlin, F . McSherry, J . Saia, “Spect ral analysis of dat a”, P r oc. 33r d Sym posi um on T heor y of C om put i n g, Hersonissos, Cret e, Greece, 2001. 15. T . Haveliwala, “Effi cient Comput at ion of P ageRank”, Technical report , St anford University Dat abase Group, 1999. 16. S. Meyn and R. T weedie, “Markov chains and st ochast ic st ability”, Springer, 1993.
Fa st C o n st ru c t io n o f G e n e ra liz e d S u ffi x Tre e s ov e r a V e ry La rg e A lp h a b e t Zhixiang Chen 1 , Richard Fowler 1 , Ada Wai-Chee Fu 2 , and Chunyue Wang1 1
2
Depart ment of Comput er Science, University of Texas-P an American, Edinburg T X 78539 USA. [email protected], { fowler,cwang} @panam.edu Depart ment of Comput er Science, Chinese University of Hong Kong, Shat in, N.T ., Hong Kong. [email protected]
T he work in t his paper is mot ivat ed by t he real-world problems such as mining frequent t raversal pat h pat t erns from very large Web logs. Generalized suffi x t rees over a very large alphabet can be used t o solve such problems. However, t radit ional algorit hms such as t he Weiner, Ukkonen and McCreight algorit hms are not suffi cient assurance of pract icality because of large magnit udes of t he alphabet and t he set of st rings in t hose real-world problems. T wo new algorit hms are designed for fast const ruct ion of generalized suffi x t rees over a very large alphabet , and t heir performance is analyzed in comparison wit h t he wellknown Ukkonen algorit hm. It is shown t hat t hese two algorit hms have bet t er performance, and can deal wit h large alphabet s and large st ring set s well. A b st r a c t .
1 1 .1
Int ro d u c t io n a n d P ro b le m Fo rm u la t io n In t ro d u c t io n
Recent ly, suffi x t rees have found many applicat ions in bio-informat ics, dat a mining and knowledge discovery. T he first linear-t ime algorit hm for const ruct ing suffi x t rees was given by Weiner in [17] in 1973. A diff erent but more space efficient algorit hm was given by McCreight in [13] in 1976. Almost twenty years lat er Ukkonen gave a concept ually diff erent linear t ime algorit hm t hat allows on-line const ruct ion of a suffi x t ree and is much easier t o underst and. T hese algorit hms build, in t heir original design, a suffi x t ree for a single st ring S over a given alphabet Σ . However, for any set of st rings { S 1 , S 2 , . . . , S n } over Σ , t hose algorit hms can be easily ext ended t o build a t ree t o represent all suffi xes in t he set of st rings in linear t ime. Such a t ree t hat represent s all suffi xes in st rings S 1 , S 2 , . . . , S n , is called a “gen eralized” suffi x t ree. Typical applicat ions of generalized suffi x t rees include t he ident ificat ion of frequent (or longest frequent ) subst rings in a set of st rings. One part icular example of such applicat ions is t he mining of frequent t raversal pat h pat t erns of Web users from very large Web logs [7,5], because such pat t erns are frequent T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 284–293, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet
285
(or longest frequent ) subst rings in t he set of maximal forward references of Web users when maximal forward references are underst ood as st rings of URLs. Such discovered pat t erns (or knowledge) can be used t o predict where t he Web users are going, i.e., what t hey are seeking for, so t hat it helps t he const ruct ion and maint enance of real-t ime int elligent Web servers t hat are able t o dynamically t ailor t heir designs t o sat isfy users’ needs [7]. It has significant pot ent ial t o reduce, t hrough prefet ching and caching, Web lat encies t hat have been perceived by users year aft er year [12]. It can also help t he administ rat ive personnel t o predict t he t rends of t he users’ needs so t hat t hey can adjust t heir product st o at t ract more users (and cust omers) now and in t he fut ure [2]. Ot her examples include document clust ering, where a short summary of a document is viewed as a st ring of keywords and a generalized suffi x t ree is built for a set of such st rings t o group document s int o diff erent clust ers. In t he mining of frequent t raversal pat h pat t erns, specific propert ies exist for t he dat a set . As invest igat ed in [5], maximal forward references of Web logs exhibit propert ies as shown in Figure 1. In summary, t he following propert ies hold: (1) T he size of t he set of st rings (or maximal forward references) is very large, ranging from megabyt e magnit ude t o gigabyt e magnit ude. (2) T he size of t he alphabet (or t he number of unique URLs) is very large, ranging from t housands t o t ens of t housands or more. (3) All st rings have a lengt h ≤ 30 (derived from t he given paramet er set t ing of Web log sessionizat ion). (4) More t han 90% st rings have lengt hs less t han or equal t o 4, and t he average lengt h is about 2.04. 1 100MB Web Log 200MB Web Log 300MB Web Log 400MB Web Log 500MB Web Log
12
100MB Web Log 200MB Web Log 300MB Web Log 400MB Web Log 500MB Web Log
0.95 Percentages of Accumulative MFRs
Numbers of MFRs (Base-10 Logrithmic Values)
10
8
6
4
0.85
0.8
0.75
2
0
0.7 5
10
15 MFR Lengths
20
25
(a) MF R Dist ribut ions F ig. 1 .
1 .2
0.9
30
5
10
15 MFR Lengths
20
25
30
(b) Accumulat ive MF R Dist ribut ions
P ropert ies of Maximal Forward References (MF Rs)
P ro b le m Fo rm u la t io n
T hroughout t his paper, we use Σ t o denot e an alphabet , and let | Σ | denot e t he size of Σ . For any st ring s ∈ Σ , let | s | denot e it s size, i.e., t he number of all | s | . When occurrences of let t ers in s . For any set of st rings S , let | S | = s S is st ored as a file, we also refer | S | as t he number of byt es of S . Mot ivat ed by real world problems such as mining frequent t raversal pat h pat t erns, in t his paper we st udy fast const ruct ion of generalized suffi x t rees for a set S of st rings over an alphabet Σ under t he following condit ions: ∗
∈
S
286
Z. Chen et al.
C o n d it io n s . 1. | Σ | is very large, ran gin g from thousan ds to ten s of thousan ds or m ore. 2. | S | = s ∈ S | s | , the size of the set of of strin gs, is very large, ran gin g from m egabyte m agn itudes to gigabytes m agn itudes or m ore. 3. For each strin g s ∈ S , | s | ≤ α , where α is a sm all con stan t.
We shall point out t hat depending on concret e applicat ions, more rest rict ions can be added t o t he t hird condit ion. For example, in t he case of mining frequent t raversal pat h pat t erns, we can furt her require t hat 90% of st rings in S have a lengt h ≤ 4 and t he average st ring lengt h in S is about 2.04. We now give several formal definit ions. Unlike t radit ional suffi x t rees, in t his paper we addit ionally require t hat count ing informat ion of subst rings are recorded at int ernal nodes and leaves as well. D e fi n it io n 1 . For an y strin g s ∈ Σ , we also den ote s = s [1. . n ] where n = | s | . For every i , j with 1 ≤ i ≤ j ≤ n , s [i ] is the i -th letter in s , an d s [i . . j ] is the substrin g from the i -th letter to the j -th letter. N ote that s [i . . n ] is a suffi x startin g at the i -th letter. D e fi n it io n 2 . A suffi x tree T for a strin g s [1. . n ] over a given alphabet Σ is a rooted directed tree with exactly n leaves. E ach in tern al n ode other than the root has at least two children an d each edge is labeled with a n on em pty substrin g of s . N o two edges out of a n ode can have edge labels startin g with the sam e letter. E ach in tern al n ode or leaf has a coun ter to in dicate the n um ber of tim es the con caten ation of the edge labels on the path from the root to the n ode or leaf occurs in the strin g s . T he key feature of the suffi x tree is that the con caten ation of the edge labels on each path from the root to on e of the n leaves represen ts exactly on e of n suffi xes of s . D e fi n it io n 3 . G iven a set of strin gs S = { s 1 , s 1 , . . . , s m } over an alphabet Σ , a suffi x tree T for fi rst strin g s 1 can be gen eralized to represen t all suffi xes an d to record the coun tin g in form ation of substrin gs in the set of strin gs. T he key feature of such a tree is that the con caten ation of the edge labels on each path from the root to on e of the leaves represen ts exactly a distin ct suffi xes in S , an d every suffi x in S is represen ted by exactly on e of such con caten ation s. S uch a tree is called a “gen eralized” suffi x tree. Usually, we assum e that $ ∈ S , an d S is represen ted as s 1 $s 2 $ . . . $s m $.
In Figure 2(a), we illust rat e a generalized suffi x t ree for “m ississippi $m issin g$ sippin g$”.
T he goal of t his paper is t o design algorit hms for fast const ruct ion of generalized suffi x t rees under Condit ions (1) t o (3). A sort ing-based algorit hm SbSfxTree (Sort ing-based Suffi x Tree) and a hashing-based algorit hm HbSfxTree (Hashing-based Suffi x Tree) will be devised and t heir performance will be analyzed comparat ively. It is shown t hat algorit hms SbSfxTree and HbSfxTree are subst ant ially fast er t han Ukkonen’ s algorit hm. Furt hermore, t hese twoalgorit hms have superior space scalable performance and can be easily t uned t o parallel or dist ribut ed algorit hms.
Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet T1 missi (2)
ssippi (1) ng (1)
i (8)
missi (2)
ssippi (1)
$ (1)
ng (1)
$ (1)
ssi (3)
T2
ppi (2)
i (8)
$ (1) $ (1)
ssi (3)
ppi (1)
$ (1)
ng (1)
$ (1)
ppi (2)
ppi (1)
$ (1)
ng (1)
$ (1)
$ (1)
$ (1) ng (1)
ng (1) $ (1)
$ (1)
ssippi (1)
$ (1)
ssippi (1)
287
$ (1)
$ (1)
$ (1)
ng (2) ng (2)
T3 s (7)
si (3)
ssippi (1) ppi (1) ng (1)
i (4)
ssippi (1)
ng (1)
$ (1)
ng (2) g (2)
i (4)
$ (1)
ng (1) p (4)
pi (2) i (2)
$ (1)
T5 T6
ng (2) g (2)
$ (1)
$ (1)
$ (2) $ (1) ng (1)
$ (1)
$ (2)
$ (1)
ng (1)
T4
(a) “ mi ssi ssi ppi $mi ssi ng$si ppi ng$”
ssippi (1)
$ (1)
$ (1)
$ (1)
$ (2)
F ig. 2 .
$ (1) $ (1)
ppi (1)
$ (1)
$ (1) ng (1)
ssippi (1)
ng (1)
$ (1)
$ (2)
i (2)
si (3)
ppi (1)
ng (1)
pi (2)
s (7)
$ (1)
ppi (1)
p (4)
$ (2)
$ (2)
$ (1)
$ (2) $ (2)
(b) Subt rees of t he big t ree in (c)
A Generalized Suffi x Tree and It s Subt rees
T he rest of t he paper is organized as follows. In Sect ion 2, we will review pract ical implement at ion challenges of suffi x t ree const ruct ion. Some propert ies of suffi x t rees are given in Sect ion 3. Algorit hms SbSfxTree and HbSfxTree are devised in Sect ion 4. Performance analysis is given in Sect ion 5. Finally, we conclude t he paper in Sect ion 6.
2
P ra c t ic a l Im p le m e nt a t io n C h a lle n g e s
As well discussed in Gusfield [8] (pages 116 t o 119), t he Weiner, Ukkonen, and McCreight algorit hms [17,13,16] have ignored t he size of t he alphabet Σ , and have not considered memory paging when t rees are large and hence cannot be st ored in RAM. When t he size of Σ is t oo large t o be ignored, t hose t hree algorit hms all require θ ( | S | · |Σ | ) space, or t he linear t ime bound O ( | S | ) should be replaced wit h m i n { O ( | S | · log | S | ) , O ( | S | · log | Σ | ) } . T he main design issues in all t he t hree well known algorit hms [17,13,16] are how t o represent and search t he branches out of t he nodes of t he t ree. For example, in t he Ukkonen algorit hm, in order t o achieve linear space complexity, array indexes are used t o represent subst rings labeling t ree edges under t he implicit assumpt ion t hat t he whole st ring (or t he set of st rings) is kept in RAM and represent ed as an array; and in order t o achieve linear t ime complexity, suffi x links are used t o allow quick walks from one part of t he t ree t o anot her part
288
Z. Chen et al.
under t he implicit assumpt ion t hat t he ent ire t ree is kept in RAM. T hose design t echniques are great for t heoret ical t ime/ space bounds, but are inadequat e for paging if t he st ring (or t he set of st rings) or t he ent ire t ree cannot be st ored in RAM. Because of t hose algorit hms’ dependence on t he availability of t he ent ire st ring (or t he set of st rings) and t he ent ire t ree in RAM, and because of t he t ree’ s lack of nice locality propert ies, t hose algorit hms cannot support parallel or dist ribut ed const ruct ion of t he t ree. T herefore, new t echniques are needed for implement ing generalized suffi x t rees for very large set s of st rings over a very large alphabet . Gusfield [8] summaries four basic alt ernat ive t echniques for represent branches in order t o balance t he const raint s of space against t he need for speed. T he first one is t o use an array of size θ ( | Σ | ) at each non-leaf node t o represent branches t o children nodes. T he second is t o use linked list t o replace array in t he first t echnique. T he t hird is t o replace t he linked at each non-leaf node wit h some balanced t ree. Finally, t he last is t o use hashing at each non-leaf node t o facilit at e branch search. However, all t he above alt ernat ive t echniques fail t o overcome t he dependence on t he availability of t he ent ire st ring (or t he set of st rings) and t he ent ire t ree. T he first t hree also increase t he burden of space demand when t he alphabet is very large. T he challenge for t he last one is t o find a hashing scheme t o balance space wit h speed. T hese t echniques cannot facilit at e t he parallel or dist ribut ed const ruct ion of t he t rees.
3
S o m e P ro p e rt ie s
Let T be a generalized suffi x t ree for a set of st rings S over t he alphabet Σ . For each child node v of t he root of T , we can obt ain a subt ree for v by simply removing all ot her children nodes and t heir descendant s as well as t heir edges. E.g., Six subt rees are shown in Fig.2(b) for t he t ree in Fig.2(a). For each t of such subt rees, it is obvious t hat t he root of t has exact ly one edge leading t o it s only child node or t o it s only leaf. Let t [1] denot e t he first let t er in t he st ring on t he edge out of t he root . We say a st ring s is cont ained in a subt ree t if s is t he concat enat ion of all edge-labels on a pat h from t he root of t t o some leaf of t . Le m m a 1 . Let W be the n um ber of distin ct letters that appear in the set of strin gs S . T has exactly W m an y subtrees. M oreover, for an y two distin ct subtrees t ′ an d t ′ ′ of T , t ′ [1] = t ′ ′ [1].
P roof S ketch. Direct ly from Definit ions 2 and 3.
We may assume wit hout loss of generality t hat S cont ains every let t er in Σ (ot herwise, a smaller Σ can be used). Lemma 1 means t hat T has exact ly | Σ many subt rees, each of which st art s wit h a let t er in Σ . Le m m a 2 . For an y subtree t of T , an d for an y suffi x con tain s s if an d on ly if s [1] = t [1].
s
in an y strin g of
S
,
|
t
P roof S ketch. If t cont ains s , t hen s is t he concat enat ion of edge labels on a pat h from t he root of t t o some leaf of t , t hus we have s [1] = t [1]. By Definit ions
Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet
289
2 and 3, s is t he concat enat ion of edge labels on a pat h from t he root of T t o one of T ’ s leaves. Let t be t he subt ree of T t hat has t he pat h represent ing s , t hen we have s [1] = t [1]. If s [1] = t [1], t hen t [1] = t [1], hence it follows from Lemma 1 t hat t = t , i.e., t cont ains s . ′
′
′
′
C o ro lla ry 1 . Let t be an y subtree of T , an d s be an y substrin g in a strin g of S . T hen , s is the con caten ation of edge labels on a path from the root of t to som e in tern al n ode ( or leaf ) of t , an d the frequen cy of s is recorded at the n ode ( or leaf ) coun ter, if an d on ly if s [1] = t [1].
P roof S ketch. By Definit ions 2 and 3, Lemma 2 and t he fact t hat any subst ring
in a st ring of
4 4 .1
S
is a prefix of some suffi x in a st ring of S .
N e w A lg o rit h m s T h e S t ra t e g y
Lemma 2 and Corollary 1 combined imply a new way of fast const ruct ion of generalized suffi x t rees. T he st rat egy is t o organize all suffi xes st art ing wit h t he same let t er int o a group and build a subt ree for each of such groups. A more or less relat ed st rat egy has been devised in [9], but t he st rings considered t here are over a small alphabet and t he met hod used t o build subt rees is of quadrat ic t ime complexity. T he t ask of grouping can be done by means of sort ing or hashing. We shall point out t hat t he hashing here is subst ant ially diff erent from ot her hashing t echniques used t o improve t he performance of suffi x t ree const ruct ion [8]. We use hashing here for t he purpose of “divide-an d-con quer”, while ot hers use hashing t o speed up searching t he branches out of t he nodes. T he t ask of const ruct ing a subt ree can be done easily, say, wit h one phrase execut ion of t he Ukkonen Algorit hm. Recall t hat t he Ukkonen algorit hm builds a suffi x t ree for a st ring s [1 : n ] in n phrases wit h t he i -t h phrase adding t he i -t h suffi x s [i : n ] t o t he exist ing (but part ially built ) suffi x t ree. Let R esUkkon en ( S uffi xT ree t, N ewS trin g s) denot e t he one phrase execut ion of t he Ukkonen Algorit hm t o add t he only suffi x s [1 : n ] t o t . We addit ionally require t hat ResUkkonen records frequencies of subst rings at int ernal nodes and leaves, which can be done easily by t uning t he Ukkonen algorit hm.
4 .2
A lg o rit h m S b S fx T re e
T he key idea is as follows. Read st rings sequent ially from an input file, and for every st ring s [1 : n ] out put it s n suffi xes t o a t emporary file. Sort t he t emporary file t o group all t he suffi xes st art ing wit h t he same let t er t oget her. Finally, build a subt ree for each group of such suffi xes.
290
Z. Chen et al.
1. 2. 3. 4. 6. 7. 8. 9. 10. 11. 12. 13.
i nput: i nfi le: a set of str i ngs tmpfi le: a set of suffi xes outfi le: a set of subtrees B egi n whi le ( i nfi le i s not empty) readStr i ng( i nfi le, s[1:n]) for ( i = 1; i ≤ n ; i + + ) tmpfi le.append( s [i : n ]) sor t( tmpfi le) ; createSuffi xTree( t) whi le ( tmpfi le i s not empty) readStr i ng( tmpfi le, s) i f ( t.empty( ) or t[1] = = s[1]) RstUkkonen( sft, s) else i f ( t[1] = s[1]) Output( t,outfi le) , ResetTree( t) Output( t,outfi le) end F ig. 3 .
4 .3
Algorit hm SbSfxTree
A lg o rit h m H b S fx M in e r
T he key idea is t o replace sort ing wit h hashing t o group all suffi xes wit h t he same st art ing let t er t oget her.
1. 2. 3. 4. 5. 6. 7.
i nput: i nfi le: a set of str i ngs f : a hashi ng functi on from letter s to i nteger s outfi le: a set of subtrees B egi n create subtrees t 1 , . . . , t | Σ | ; whi le ( i nfi le i s not empty) readStr i ng( i nfi le, s[1:n]) for ( i = 1; i ≤ n ; i + + ) RstUkkonen( t f ( s [ i ] ) ,s[i :n]) for ( i = 0; i < | Σ | ; i + + ) Output( t i ,outfi le) end F ig. 4 .
5
Algorit hm HbSfxTree
P e rfo rm a n c e A n a ly sis
Due t o space limit , we only give complexity bounds for algorit hm SbSfxTree and would like t o point out t hat similar bounds can be given t o algorit hm HbSfxTree. We will also present experiment al result s for bot h algorit hms.
Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet
291
T h e o re m 1 . Let T be a gen eralized suffi x tree of a set of strin gs S over an alphabet Σ satisfyin g C on dition s( 1) , ( 2) an d ( 3) . A ssum e the size of each subtree t of T is O ( | S | / | Σ | ) . A lgorithm S bS fxT ree builds T ( via buildin g all its subtrees) in tim e O ( | S | · log | S | + | S | · log | Σ | ) an d in space O ( | S | / | Σ | ) .
P roof S ketch. By Condit ions (1), (2) and (3), each st ring s ∈ S has at most α suffi xes. Hence, t he size of t he suffi x file is at most α | S | , t his means t hat sort ing t o group suffi xes is of O | S | · log | S | ) t ime complexity and of O ( | S | / | Σ | ) space complexity when a buff er of O ( | S | / | Σ | ) size is used. It follows from t he Ukkonen algorit hm t hat building a subt ree requires O ( | S | / | Σ | ) space and O (( | S | / | Σ | ) · log | Σ | ) t ime. T his means t hat t he t ot al space for building all t he subt rees is st ill O ( | S | / | Σ | ), but t he t ot al t ime is by Lemma 1 O (( | Σ | · | S |/ | Σ | ) · log | Σ | ) = O ( | S | · log | Σ | ). In t heory, algorit hm SbSfxTree has bet t er space complexity, while it has almost t he same t ime complexity bound as t he Weiner, Ukkonen, and McCreight algorit hms. In Fig.5(a,b,c), we report experiment al analysis of SbSfxTree and HbSfxTree in comparison wit h t he Ukkonen algorit hm. T he comput ing environment is a Dell P WS 340 wit h a 1.5 GHz P 4 P rocessor, 512 MB RAM and 18 GB memory. In t hose experiment s, we used alphabet s Σ i , i = 1, 2, 3, such t hat | Σ 1 | = 10, 000, | Σ 2 | = 15, 000 and | Σ 3 | = 20, 000. For each Σ i , we generat ed t hree set s of 1 million st rings such t hat sizes of st rings follow Poisson dist ribut ions wit h means values of 1, 2 and 3, respect ively. It is clear t hat algorit hms SbSfxTree and HbSfxTree have subst ant ially bet t er performance t han t he Ukkonen algorit hm. For t he set of st rings following Poisson dist ribut ion of means value 3, t he Ukkonen algorit hm ran out of memory. T he current version of algorit hm HbSfxTree also ran out memory, because all t he subt rees were st ored in RAM. We shall point out t hat t his can be improved t hrough paging subt rees in t he next st age of implement at ion. In [5], we has applied algorit hms SbSfxTree and HbSfxTree t o t he mining of frequent t raversal pat h pat t erns from very large Web logs. Fig.5(d,e,f) shows performance of SbSfxTree and HbSfxTree based mining in comparison wit h t he Ukkonen algorit hm based mining. It is clear t hat SbSfxTree and HbSfxTree are far superior t o t he Ukkonen algorit hm. It is also shown [5] t hat SbSfxTree and HbSfxTree are far superior t o t he apriori-like algorit hms wit hin t he cont ext of mining frequent t raversal pat h pat t erns. R em ark 1. By Lemma 2, t he const ruct ion of one subt ree has no dependence on
any ot her subt rees. T his means t hat bot h algorit hms SbSfxTree and HbSfxTree can be easily revised t o allow parallel or dist ribut ed const ruct ion of generalized suffi x t ree.
6
C o n c lu sio n s
T he work in t his paper is mot ivat ed by t he real-world problems such as mining frequent t raversal pat h pat t erns from very large Web logs. Generalized suffi x t rees over a very large alphabet can be used t o solve such problems. However,
292
Z. Chen et al.
900
900 Poisson Mean=1 Poisson Mean=2 Poisson Mean=3
800
700 Computing Time (in Seconds)
700 Computing Time (in Seconds)
Poisson Mean=1 Poisson Mean=2 Poisson Mean=3, Out of Memory. No Time is shown
800
600
500
400
300
600
500
400
300
200
200
100
100
0
0 10
12
14 16 Alphabet Size (in Thousands)
18
20
10
(a) Algorit hm SbSfxTree
12
14 16 Alphabet Size (in Thousands)
18
20
(b) Algorit hm HbSfxTree
10000 Poisson Mean=1 Poisson Mean=2 Poisson Mean=3, Out of Memory. No Time is shown.
pct=0.05 pct=0.08 pct=0.11 pct=0.17 pct=0.2
110 100
8000
Execution Time (in Seconds)
Computing Time (in Seconds)
90
6000
4000
80 70 60 50 40
2000
30 0 10
12
14 16 Alphabet Size (in Thousands)
18
20 100
20
(c) Ukkonen Algorit hm 100
200
250
300 350 Web Logs (in MB)
400
450
500
(d) Algorit hm SbSfxTree Based Miner pct=0.05 pct=0.08 pct=0.11 pct=0.17 pct=0.2
110
150
pct=0.05 pct=0.08 pct=0.11 pct=0.17 pct=0.2
1800
1600
Execution Time (in Seconds)
Execution Time (in Seconds)
90 80 70 60 50
1400
1200
1000
800
40 600 30 400 20 100
150
200
250
300 350 Web Logs (in MB)
400
450
500
(e) Algorit hm HbSfxTree Based Miner F ig. 5 .
100
150
200
250
300 350 Web Logs (in MB)
400
450
500
(f) Ukkonen Algorit hm Based Miner
P erformance of t he Algorit hms
due t o large magnit udes of t he underlying alphabet and t he set of st rings, t radit ional algorit hms such as t he Weiner, Ukkonen and McCreight algorit hms are not suffi cient assurance of pract icality. We have designed two algorit hms for fast const ruct ion of generalized suffi x t rees over very alphabet . We have shown t hat t he two algorit hms are effi cient in t heory and in pract ice, and applied t hem t o solve t he problem of mining frequent t raversal pat h pat t erns. A ck n ow le d g m e n t . T hank P rof. Ukkonen for sending his work [16] t o us.
T hank Yavuz Tor for helping us on experiment s in Fig.5(a,b,c). T he work of t he first two and t he last aut hors is support ed in part by t he Comput ing and
Fast Const ruct ion of Generalized Suffi x Trees over a Very Large Alphabet
293
Informat ion Technology Cent er of t he University of Texas-Pan American. T he work of t he t hird aut hor is support ed by t he CUHK RGC Research Grant Direct Allocat ion ID 2050279.
R e fe re n c e s 1. J . Borges and M. Levene. Dat a mining of user navigat ion pat t erns. M S99, 1999. 2. A.G. Buchner and M.D. Mulvenna. Discovering int ernet market ing int elligence t hrough online analyt ical web usage mining. A CM SI GM OD RECORD , pages 54– 61, Dec. 1998. 3. L. Cat ledge and J . P it kow. Charact erizing browsing behaviors on t he world wide web. Computer Networ ks and I SD N Systems, 27, 1995. 4. Z. Chen, R. Fowler, and A. Fu, Linear t ime algorit hms for finding maximal forward references, P roc. of t he IEEE Int l. Conf. on Info. Tech.: Coding & comput ing (IT CC 2003), 2003. 5. Z. Chen, R. Fowler, A. Fu, and C. Wang, Linear and sublinear t ime algorit hms for mining frequent t raversal pat h pat t erns from very large Web logs, P roceeding of t he Sevent h Int ernat ional Dat abase Engineering and Applicat ions Symposium, 2003. 6. Z. Chen, A. Fu, and F . Tong, Opt imal algorit hms for finding user access sessions from very large Web logs, Advances in Knowledge Discovery and Dat a Mining/ PAKDD’ 02, Lect ure Not es in Comput er Science 2336, pages 290–296, 2002. (Full version will appear in J ournal of World W ide Web: Int ernet and Informat ion Syst ems, 2003.) 7. M.S. Chen, J .S. P ark, and P.S. Yu. Effi cient dat a mining for pat h t raversal pat t erns. I EEE Transacti ons on K nowledge and D ata Engi neer i ng, 10:2:209–221, 1998. 8. D. Gusfield, A lgor i thms on Str i ngs, Trees, and Sequences, Cambridge University P ress, 1997. 9. E. Hunt , M.P. At kinson and R.W . Irving, A dat abase index t o large biological sequences, P roceedings of t he 27t h Int ernat ional Conference on Very Large Dat a Bases, pages 139–148, 2001. 10. R. Kosala and H. Blockeel, Web mining research: A survey, SIGKDD Explorat ions, 2(1), pages 1–15, 2000. 11. F . Masseglia, P. P oncelet , and R. Cicchet t i, An effi cient algorit hm for Web usage mining, Networking and Informat ion Syst ems J ournal, 2(5–6), pages 571–603, 1999. 12. J . P it kow and P. P irolli, Mining longest repeat ing subsequences t o predict World W ide Web Surfing, P roc. of t he Second USENIX Symposium on Int ernet Technologies & Syst ems, pages 11–14, 1999. 13. E.M. McCreight , A space-economical suffi x t ree const ruct ion algorit hm, J ournal of Algorit hms, 23(2),pages 262–272, 1976. 14. C. Shababi, A.M. Zarkesh, J . Abidi, and V. Shah. Knowledge discovery from user’ s web page navigat ion. Proceedi ngs of the Seventh I EEE I ntl. W or kshop on Research I ssues i n D ata Engi neer i ng ( RI D E) , pages 20–29, 1997. 15. Z. Su, Q. Yang, Y. Lu, and H. Zhang, W hat Next : A predict ion syst em for Web request s using N-gram sequence models, P roc. of t he F irst Int ernat ional Conference on Web Informat ion Syst ems Engineering, pages 200–207, 2000. 16. E. Ukkonen, On-line const ruct ion of suffi x t rees, Algorit hmica, 14(3), pages 249– 260, 1995. 17. P. Weiner, Linear pat t ern mat ching algorit hms, P roc. of t he 14t h IEEE Annual Symp. on Swit ching and Aut omat a T heory, pages 1–11, 1973.
C o m p le x it y T h e o re t ic A sp e c t s o f S o m e C ry p t o g rap h ic Fu n c t io n s Eike Kilt z and Hans Ulrich Simon Lehrst uhl Mat hemat ik & Informat ik, Ruhr-Universit ¨a t Bochum, Germany. { kiltz,simon} @lmi.ruhr-uni-bochum.de
In t his work, we are int erest ed in non-t rivial upper bounds on t he spect ral norm of binary mat rices M from { − 1, 1} × . It is known t hat t he dist ribut ed Boolean funct ion represent ed by M is hard t o comput e in various rest rict ed models of comput at ion if t he spect ral norm is bounded from above by N 1− , where ε > 0 denot es a fixed const ant . For inst ance, t he size of a two-layer t hreshold circuit (wit h polynomially bounded weight s for t he gat es in t he hidden layer, but unbounded weight s for t he out put gat e) grows exponent ially fast wit h n := log N . We prove suffi cient condit ions on M t hat imply small spect ral norms (and t hus high comput at ional complexity in rest rict ed models). Our general result s cover specific cases, where t he mat rix M represent s a bit (t he least significant bit or ot her fixed bit s) of a crypt ographic decoding funct ion. For inst ance, t he decoding funct ions of t he P oint cheval [9], t he El Gamal [6], and t he RSA-P aillier [2] crypt osyst ems can be addressed by our t echnique. In order t o obt ain our result s, we make a det our on exponent ial sums and on spect ral norms of mat rices wit h complex ent ries. T his met hod might be considered int erest ing in it s own right . A b st r a c t .
N
N
ε
1
Int ro d u c t io n
Despit e t he fact t hat almost all Boolean funct ions require circuit s of exponent ial size for t heir comput at ion (which follows from count ing argument s), t here is amazingly small progress in proving lower bounds on t he circuit size for concrete families of Boolean funct ions. T he best result as yet is st ill t he lower bound of Blum [1] who present ed a family of Boolean funct ions t hat can only be comput ed if t he circuit cont ains at least 3n gat es. Even for some rest rict ed models of comput at ion, research process may get st uck as long as t he right t ools for proving lower bounds are missing. For inst ance, t here was no progress in proving exponent ial lower bounds on t he size of m onotone Boolean circuit s unt il Razborov discovered his celebrat ed lower bound on t he size of monot one circuit s t hat decide t he Clique problem. Anot her more recent example concerns a t heorem proven by Forst er [4]. He was able t o show t hat a dist ribut ed Boolean funct ion f : { 0, 1} n × { 0, 1} n → { 0, 1} has probabilist ic communicat ion complexity (in t he unbounded error model) at least n − log M 2 , where M is t he mat rix given by M x , y = ( − 1) f ( x , y ) and M 2 denot es t he so-called spectral norm of M T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 294–303, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions
295
(see Definit ion 8). Since t he spect ral norm of t he Hadamard mat rix H (wit h ± 1ent ries) is 2n / 2 , it has communicat ion complexity n − n / 2 = n / 2. T his resolved a problem t hat had been open for roughly twenty years since t he invent ion of t he unbounded error model of probabilist ic communicat ion complexity by Simon and P at uri [8]. As shown by several aut hors [5], t he new lower bound on t he communicat ion complexity could be used t o lift exist ing lower bounds in various ot her rest rict ed models of comput at ion t o a significant ly higher level. For inst ance, one can convert “good” upper bounds on t he spect ral norm int o exponent ial lower bounds on t he size of t hreshold circuit s wit h two layers, where t he gat es in t he hidden layer have polynomially bounded weight s, but t he out put gat e has unbounded weight s. Before Forst er came up wit h his result , one could get exponent ial lower bounds only when t he weight s of t he out put gat e were polynomially bounded. Despit e t his progress, it t urned out quit e soon t hat Forst er’ s result is not always easy t o apply. It clearly applies direct ly t o ort hogonal mat rices (whose spect ral norm is small and well-known). In general however, t he comput at ion of upper bounds on t he spect ral norm of a family of mat rices is a diffi cult t ask. As t here are not so many examples (besides t he ort hogonal mat rices) so far, we t hink it is just ified t o provide some addit ional t ools t hat allow one t o exploit Forst er’ s result in a more powerful manner. In t his paper, we show how exponent ial sums and t he analysis of t he spect ral norm of some auxiliary mat rices wit h ent ries from C (t he complex numbers) can be used for t his purpose. Int erest ingly, t he families of mat rices t hat can be analysed by our met hods are nat ural (and maybe of some int erest ) in t he sense t hat t hey represent t he bit s of crypt ographic decoding funct ions. It comes as no surprise t hat t hese bit s are hard t o comput e, but t he point is t hat , wit hout Forst er’ s T heorem and some addit ional t ools t hat are present ed in t his paper, t here is absolut ely no chance t o derive lower bounds of t his type. We see our paper as a st ep in t he long process of adding new “horse power” t o t he exist ing machinery for proving lower bounds. R elated W ork. T here are various research papers t hat are closely relat ed t o our work. In [3,11,13,14], lower bounds on several complexity measures (but not on t he spect ral norm) of t he Diffi e-Hellman funct ion, t he relat ed Squaring Exponent funct ion and t he discret e logarit hm funct ion are given. It is shown, for inst ance, t hat any polynomial represent at ion of t he Diffi e-Hellman funct ions, even for small subset s of t heir input , must inevit ably have many non-zero coeffi cient s and, t hus, high degree. Lower bounds t hat result from t he analysis of t he spect ral norm typically have a diff erent flavour (and are somet imes st ronger). For inst ance, t he aforement ioned t hreshold circuit s represent a proper superclass of t he class of funct ions t hat can be represent ed by sparse polynomials. T he paper wit h t he closest relat ion t o our own is probably [7]. T here t he spect ral norm of mat rices t hat represent t he bit s of t he Diffi e-Hellman funct ion is analysed. As in t his paper, a good upper bound is proven t hat leads t o lower bounds in various rest rict ed models of comput at ion (as explained above). It should be ment ioned, however, t hat t he t ools used in [7] and t he t ools required in t his paper are quit e diff erent .
296
2
E. Kilt z and H.U. Simon
Fu n c t io n s w it h M u lt ip lic at iv e S t ru c t u re
Let M : ZN × ZN be t he funct ion t hat sat isfies M ( x , y ) = x y (mult iplicat ion in ZN ). In t his paper, we want t o exploit t he fact t hat some crypt ographic funct ions are close relat ives of M . T he general concept of a “mult iplicat ive st ruct ure” is capt ured in t he following X and Y be two subsets of ZN . W e say H has a mult iplicat ive st ruct ure on subdomain X × Y if there exist perm utations σ , τ of ZN such that H ( x , y ) = M σ , τ ( x , y ) := σ ( x ) τ ( y ) for all x ∈ X and y ∈ Y .
D e fi n it io n 1 . Let
We present some examples: E xam ple 2 (P ointcheval Cryptosystem [9]). Let N be an RSA-modulus, i.e. N = pq for two primes p, q of (roughly) t he same bit lengt h. Let e, d ∈ ZN such t hat ed = 1 (mod ϕ ( N )). Let R = { r ∈ ZN | r + 1 ∈ Z∗N } . T he following funct ion F : R × ZN → ZN × ZN such t hat F ( r , m ) = ( r e , ( r + 1) e m ), where r is chosen at random, encodes a message m . Define X := { r e | r ∈ R } . As for decoding (given t he “secret key” d), we may use any funct ion H : ZN × ZN → ZN t hat sat isfies H ( x , y ) = y ( x d + 1) − e for all x ∈ X : it is easy t o check t hat t his implies t hat H ( r e , ( r + 1) e m ) = m for all r ∈ R . Out side t he subdomain X × ZN (when H is applied t o invalid cyphers), we may however allow H t o at t ain arbit rary values. Since σ ˜ ( x ) = ( x d + 1) − e is an inject ive mapping from X t o ZN , it can be complet ed t o a permut at ion σ on ZN . T hen H ( x , y ) = σ ( x ) y and it follows t hat any correct decoding funct ion H has a mult iplicat ive st ruct ure on subdomain X × ZN . Not e t hat | X | = ϕ ( N ) = ( p − 1)( q − 1). T hus, t he part out side t he subdomain has a relat ively small size: N − | X | = N − ϕ ( N ) = p + q − 1 ≈ N 1 / 2 . E xam ple 3 (E l Gam al Cryptosystem [6]). Let N = p be a prime modulus and let g be a generat or of Z∗N . T he “public key” has t he form h = gs for some s ∈ Z∗N . A message m ∈ ZN is encrypt ed wit h “randomness” r ∈ Z∗N by evaluat ing t he funct ion F : Z∗N × ZN → ZN × ZN such t hat F ( r , m ) = ( gr , h r m ). As for decoding (given t he “secret key” s), we may use any funct ion H : ZN × ZN → ZN t hat sat isfies H ( x , y ) = yx − s for all x ∈ Z∗N and all y ∈ ZN : it is easy t o check t hat H ( gr , h r m ) = m . Since, for all x , y ∈ Z∗N × ZN and for σ ( x ) := x − s , H sat isfies H ( x , y ) = σ ( x ) y , we may conclude t hat H has a a mult iplicat ive st ruct ure on subdomain Z∗N × ZN . Not e t hat N − | X | = p − ( p − 1) = 1. E xam ple 4 (R SA -P aillier Cryptosystem [2]). T his is a modificat ion of t he original P aillier crypt osyst em. Again t he funct ion t hat performs decoding has a mult iplicat ive st ruct ure. Det ails are given in t he full paper.
In all t hese examples Y = ZN and τ is t he ident ity. T he generality of Definit ion 1 will not however cause much t rouble in what follows. In t he course of t he paper we will prove t he following T h e o re m 5 . Let B k ( z ) denote the k -th least significant bit of (the binary representation) of z ∈ ZN . A ssum e that k is either constant or (as a function in N ) satisfies k ( N ) = o(log N ) . 1 Let H be a function with a m ultiplicative struc1
T his rules out t he possibility t o select bit s of high significance.
Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions
297
ture on subdom ain X × Y of ZN × ZN . A ssum e that N − | X | = O ( N α ) and N − | Y | = O ( N α ) for som e fixed constant 0 ≤ α < 1. T hen, the spectral norm of the m atrix B k ◦ H (defined in section 3) is bounded above by O ( N ( 1+ α ) / 2 ) if α > 0 and by N 1 / 2+ o ( 1) for α = 0.
Not e t hat t his t heorem applies t o t he crypt ographic funct ions from examples 2, 3, and 4, where N − | Y | = 0 and N − | X | = 1 (El-Gamal) or N − | X | = θ ( N 1 / 2 ) (P oint cheval and RSA-P aillier), respect ively. T h e o re m 6 ( [5 ], T h rm . 6 ) . A binary function A : ZN × ZN → { − 1, 1} having its associated spectral norm upper bounded by s( N ) cannot be com puted by a threshold circuit with two layers, where the output gate has unbounded weights and the gates in the hidden layer have polynom ially bounded weights, unless the num ber of threshold gates is N 1 − o ( 1) / s( N ) .
By t his lower-bound machinery applied t o T heorem 5 we obt ain t he C o ro lla ry 7 . Given the notation and assum ptions from T heorem 5, the binary function B k ◦ H (taking input values ( x , y ) ∈ ZN × ZN ) cannot be com puted by
a threshold circuit with two layers, where the output gate has unbounded weights and the gates in the hidden layer have polynom ially bounded weights, unless the 1 num ber of threshold gates is N 2 − o ( 1) . −
α
In t he full paper, we ment ion also t he lower bound on t he probabilist ic communicat ion complexity (and lower bounds in ot her rest rict ed models of comput at ion).
3
S o m e A lg e b raic D e fi n it io n s an d Fac t s
From here t hroughout t he paper, a vect or u is considered as column vect or and u ′ denot es it s t ranspose. T he so-called spect ral norm of a mat rix wit h real or complex ent ries plays a cent ral role in our paper: D e fi n it io n 8 . T he spect ral norm of M
M
2
:=
RN 1 × ∈
sup u
: u
2
N
M u
is defined as follows:
2
.
2
=1
Here, the suprem um ranges over vectors with real com ponents. T he analogous definition is used for m atrices from CN 1 × N 2 . (Clearly, the suprem um then ranges over vectors with com plex com ponents.)
We briefly ment ion some well-known fact s concerning t he spect ral norm: Fa c t 9 T he spectral norm of m atrix A ∈
RN
×
N
satisfies the following equation:
A
2
=
sup u , v : u
2
= v
|u 2 = 1
′
A v| =
N
2
= v
1 N
−
2 = 1
x
1
A x , y u x vy
sup u , v : u
−
= 0 y= 0
.
(1)
T he analogous rem ark holds for m atrices and vectors over the field C of com plex num bers.
298
E. Kilt z and H.U. Simon
As a consequence of t he Cauchy-Schwarz inequality, we obt ain N − 1 N − 1 sup u x vy = N . u , v : u 2 = v 2 = 1 x
For each a
ZN , we define t he following funct ion E aN : ZN ∈
E aN ( x ) = e
2π
i a x N
(2)
= 0 y= 0
= cos
2π ax
2π ax
+ i · sin
N
C: →
N
.
(3)
In t he sequel, we drop t he superscript N when it is obvious from cont ext . Clearly, t he following rules are valid: E a (x
y) = E a (x ) · E ± a (y)
±
E − a (y) = a∈
(4)
Z
N
E a (y)
(5)
0 if x = 0, 1 if x = 0.
(6)
Z
a∈
N
T he following ident ity is well-known:
1 N a∈
E a (x ) =
Z
N
From (6), we can immediat ely infer t he following ident ity, which holds for each binary funct ion B : ZN → { − 1, 1} : B ( z0 ) =
1 N z∈
B (z)
Z
N
E a ( z0 a∈
−
N
U p p e r B o u n d s o n t h e S p e c t ral N o rm
Let
X
Y
(7)
Z
4
and
z) .
be finit e set s. In t his sect ion, we ident ify funct ions of t he form
X × Y H : X × Y → Z wit h mat rices from Z . Similarly, funct ions of t he form K : Z → K are viewed as (column) vect ors from K Z . Not e t hat t he composit ion K ◦ H : X × Y → K can t hen be ident ified wit h a mat rix from K X × Y . We are
mainly int erest ed in t he following sit uat ion: – X = Y = Z = ZN and H : ZN × ZN → ZN is a “crypt ographic funct ion”. – For K , we consider funct ions B : ZN → { − 1, 1} and t he funct ions E a : ZN → C from (3). B represent s a (hopefully secure) bit of t he crypt ographic funct ion H .
Funct ions E a are used as a mat hemat ical t ool wit hin t he analysis of t he comput at ional complexity of B ◦ H . We pursue t he st rat egy t o bound t he spect ral norm of B ◦ H in t erms of t he spect ral norm of E a ◦ H (and some ot her t erms). T he hope is t hat “good” upper bounds on t he spect ral norm of E a ◦ H are known (or easy t o comput e) and t hat t hey can be convert ed int o “good” upper
Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions
299
bounds on t he spect ral norm of B ◦ H . As indicat ed in t he int roduct ion, we may t hen conclude t hat B ◦ H is hard t o comput e on some rest rict ed comput at ional devices. T he remainder of t his sect ion is organised as follows. In subsect ion 4.1, we bound B ◦ H 2 in t erms of E a ◦ H 2 and some addit ional t erms. T he addit ional t erms depend on t he binary funct ion B only, but not on H . In t his sense, we isolat e t he eff ect s of B and H on t he spect ral norm of B ◦ H from each ot her. In subsect ion 4.2, we are concerned wit h bounds on E a ◦ H 2 . T he t erms depending on B only are analysed in subsect ion 4.3. T he whole analysis is complet ed in subsect ion 4.4. 4 .1
T h e S p lit t in g L e m m a
T he bias of a binary funct ion B : ZN → { − 1, 1} is given by B ( z ) ∈ { 0, . . . , N } . biasB ( N ) := z∈ Z
(8)
N
It measures t he degree of “balance” between negat ive and posit ive ent ries in vect or B (where value 0 reflect s perfect balance). T he inner product of B and E a (bot h viewed as vect ors wit h complex ent ries) is denot ed as B , E a . T he main result in t his subsect ion reads as follows: N−1 1 L e m m a 1 0 . B ◦ H 2 ≤ bias B ( N ) + N · B , Ea E− a ◦ H 2 . P roof. Choose u, v We obt ain |u
′
(B ◦
H )v|
N
R such t hat u ∈
2
=
a=
1
v
2
= 1 and B ◦ H
u x v y B ( H ( x , y ))
x
= | u′ (B ◦ H )v| .
=
2
Z
∈
N
Z
y∈
N
1 ( 7) = B ( z ) E ( H ( x , y ) − z ) u v a x y N x∈ Z y∈ Z z∈ Z a∈ Z ( 4) ( 5) 1 = B (z)E a (z) u x v y E − a ( H ( x , y )) N a∈ Z z∈ Z x∈ Z y∈ Z 1 S ( a ) , = N a∈ Z
N
N
N
N
N
N
N
N
N
where S ( a ) is given by S ( a) = B (z)E a (z) u x v y E − a ( H ( x , y )) z∈ Z x∈ Z y∈ Z = B , E a · u′ (E − a ◦ H )v ≤ B , E a · E − a ◦ H 2 . N
N
N
300
E. Kilt z and H.U. Simon
T he proof is complet ed by discussing t he case a = 0 separat ely. Since E 0 ( z ) = 1 for each z ∈ ZN , we get ( 2 ) 1 1 B ( z ) = biasB ( N ) . B (z) u x vy ≤ | S (0) | = N N z∈ Z z∈ Z x∈ Z y∈ Z N
N
N
N
T he set ZN can be cut int o τ ( N ) slices, where τ ( N ) is t he number of divisors of N . T he d-t h slice cont ains all a ∈ ZN such t hat gcd( a, N ) = d. T hese are precisely t he element s of t he form ad for a ∈ Z∗N / d . T his leads t o t he following C o ro lla ry 1 1 . A ssum e that B , E a d ≤ U B ( N , d ) and E a d ◦ H 2 ≤ a∈ Z B , E a d . T hen, U H ( N , d) for all a ∈ Z∗N / d . Define E X P B ( N , d) := a∈ Z 1 B ◦ H 2 ≤ bias B ( N ) + · B , Ead E− ad ◦ H 2 N d :d | N , d < N a ∈ Z 1 ≤ bias B ( N ) + · U B ( N , d) · U H ( N , d) . ∗
N / d
∗
N / d
∗
N / d
N
d :d | N , d < N
We refer t o t he t erms biasB ( N ) and E X P B ( N , d) as t he balance term s associated with B and briefly not e t he well-known fact [10] t hat ln N ln N
τ ( N ) = 2( 1+ o ( 1) ) l n 4 .2
= N o ( 1) .
(9)
T h e S p e c t ra l N o rm o f t h e A u x ilia ry M a t ric e s
In t his subsect ion, we will bound E a ◦ M 2 for t he funct ion M ( x , y ) = x y . We will explain lat er how result s dealing wit h M (mult iplicat ion in ZN ) can be ext ended t o arbit rary funct ions wit h a mult iplicat ive st ruct ure. We make use of t he following well-known result (t hat can be found in [12]): L e m m a 1 2 . For all a
Z∗N , the following holds: E a ∈
◦
M
2 ≤
N
1/ 2
.
Lemma 12 applies only if gcd( a, N ) = 1. However, it is easy t o ext end t he result t o arbit rary a ∈ { 1, . . . , N − 1} . To t his end we present t he following lemma t hat holds for general funct ions F : ZN × ZN → ZN . L e m m a 1 3 . For all d such that d| N and d < N , for all a ∈ Z∗N / d , for all perm utations σ , τ on ZN , and for F σ , τ ( x , y ) = F ( σ ( x ) , τ ( y )) , the following holds:
Ead ◦
Fσ
,τ
2
=
Ead ◦
F
2 ≤
N / d
d E a
◦
F
2.
Before we prove t his Lemma we can make t he following direct corollary by set t ing F = M and t hen using Lemma 12 t o obt ain C o ro lla ry 1 4 . For all d such that d| N and d < N , for all a
following holds: E a d ◦
Mσ
,τ
2 ≤
( dN ) 1 / 2 .
∈
Z∗N / d , the
Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions
301
P roof (of Lem m a 13). T he first equality is obvious since t he spect ral norm is invariant under permut at ion of rows and columns. Not e t hat each x ∈ ZN has a unique decomposit ion x = x 1 N / d + x 2 wit h x 1 ∈ { 0, . . . , d − 1} and x 2 ∈ { 0, . . . , N / d − 1} . We choose u, v ∈ RN such t hat ′ u 2 = v 2 = 1 and E a d ◦ F 2 = u ( E a d ◦ F ) v . For j = 0, . . . , d − 1, we define t he vect ors u¯ j , v¯ j as follows: u¯ j := ( u j N / d , . . . , u j N / d + N / d − 1 ) ′ ,
v¯ j := ( v j N / d , . . . , v j N / d + N / d − 1 ) ′ .
Define sj = u¯ j 2 and t j = v¯ j 2 . Not e t hat s 2 = t 2 = 1 for s = ( s0 , . . . , sd − 1 ) ′ and t = ( t 0 , . . . , t d − 1 ) ′ . T he following calculat ion complet es t he proof: 2 ( ) ′ N u x vy e | u (E a d ◦ F )v| = x ,y ∈ Z d− 1 N / d− 1 N / d = u x 1 N / d + x 2 v y 1 N / d + y 2 E a ( F ( x , y )) x 1 ,y 1 = 0 x 2 ,y 2 = 0 π
i a d F
x ,y
N
N
d −
1 ′
|u ¯j
≤ j ,k
( 2) ≤
4 .3
( E aN / d ◦
F ) v¯ k |
( 1 ) d − 1 ≤
=0
d · E aN / d ◦
j ,k
F
2
sj t k E aN / d
F ◦
2
=0
.
T h e B a la n c e T e rm s
In t his sect ion we show upper bounds on t he balance t erms biasB ( N ) and E X P B ( N , d) for various funct ions B . Due t o space const raint s we have t o refer t he reader t o t he full version of t his work for all proofs of t his sect ion. Funct ion B : ZN → { − 1, 1} is called unbiased if biasB ( N ) = N o ( 1) . L e m m a 1 5 . Let B k ( z ) denote the k -th least significant bit of z B k : ZN → { − 1, 1} is unbiased if k = k ( N ) = o(log N ) . ∈
ZN . T hen,
L e m m a 1 6 . For every divisor d < N of N ,
E X P B ( N , d) = O ( N / d · bias B ( N ) log( N / d)) . k
k
(10)
In particular, if B k is unbiased, then E X P B ( N , d) = N 1+ o ( 1) / d. k
Funct ion B : ZN → { − 1, 1} is called sem ilinear of length k if t here exist paramet ers M i , L i ∈ ZN and K i ∈ Z∗N such t hat , for all z ∈ ZN , condit ion B (z) = 1 ⇐ ⇒ z ∈ H i , H i := { K i z + M i mod N | 0 ≤ z ≤ L i } , i=
1. . . k
is valid and t he set s H i are pairwise disjoint . We call B strongly sem ilinear of length k if B and − B bot h are semilinear of lengt h k . T he next lemma shows t hat t he property strongly sem ilinear implies a “good” upper bound on E X P B ( N , d). Some concret e st rongly semilinear funct ions are ment ioned in t he full paper.
302
E. Kilt z and H.U. Simon
L e m m a 1 7 . Let B : ZN → { − 1, 1} be strongly sem ilinear of length k . T hen, for every divisor d < N of N , the following holds:
E X P B ( N , d) = O ( k N / d · log( N / d)) = k N 1+ o ( 1) / d . 4 .4
(11)
P u t t in g A ll T o g e t h e r
We may now apply Corollary 11 wit h U M ( N , d) = ( dN ) 1 / 2 (according t o Corollary 14) and wit h t he bounds from (10) and (11): σ
,τ
C o ro lla ry 1 8 . For each function B k : ZN → { − 1, 1} (the k-th least significant bit) and for all perm utations σ , τ of ZN , the following holds:
Bk ◦
Mσ
,τ
2
= O ( bias B ( N ) N 1 / 2 log( N )
1/ 2
d−
k
( 9) ) = bias B ( N ) N 1 / 2+ o ( 1) k
d :d | N , d < N
In particular, if B k is unbiased, then B k ◦
Mσ
,τ
2
= N 1 / 2+ o ( 1) .
C o ro lla ry 1 9 . For each strongly sem ilinear function B : ZN → length k and for all perm utations σ , τ of ZN , the following holds:
B ◦
Mσ
,τ
2
{ −
1, 1} of
= bias B ( N ) + k N 1 / 2+ o ( 1) .
In particular, if B is unbiased and strongly sem ilinear of length N o ( 1) , then 1 / 2+ o ( 1) B ◦ M σ ,τ 2 = N .
A funct ion H wit h a mult iplicat ive st ruct ure coincides wit h M σ , τ on a subdomain X × Y . T he “non-mult iplicat ive behaviour” out side t he subdomain can however be cont rolled by showing t hat whenever two mat rices C, D : ZN × ZN → { − 1, 1} coincide on a large enough subdomain X × Y , t hen | C 2 − D 2 | is small. To be more precise, in t he full version of t his paper we prove L e m m a 2 0 . If H has a m ultiplicative structure on subdom ain coincides with M σ , τ on X × Y , then
B ◦
H
2 ≤
B
(N
◦ ·
Mσ
(N
,τ
2
+ (N
− | Y | ))
1/ 2
·
(N
− | X | ))
+ (( N
1/ 2
− |X |) ·
X
×
Y
1/ 2
.
, i.e., it
+ (N
− | Y | ))
Now T heorem 5 (even a more general version) follows direct ly by combining Corollaries 18 and 19 wit h Lemma 20.
5
C o n c lu sio n s
From Corollary 19, we know t hat for each st rongly semilinear funct ion B : ZN { − 1, 1} of lengt h k and for all permut at ions σ , τ of ZN ,
B ◦
Mσ
,τ
2
= biasB ( N ) + k N 1 / 2+ o ( 1) .
→
(12)
Complexity T heoret ic Aspect s of Some Crypt ographic Funct ions
303
We will argue t hat in general t here is no hope for improving t his upper bound on t he spect ral norm beyond t he value biasB ( N ). To t his end, let B be t he indicat or funct ion on a small int erval (say of lengt h ε N for a small const ant ε > 0). Obviously, B is st rongly semilinear of lengt h 1 and has a large bias ( N (1 − 2ε )). Now t he given upper bound on t he spect ral norm is dominat ed by t his t erm. Since t he mat rix M σ , τ defines permut at ions in every row and every column, we can conclude t hat biasB ( N ) = 1/ N M x , y . On t he ot her x ,y ∈ Z hand, we know t hat 1 1 1 √ B ◦ M σ ,τ 2 ≥ M x ,y √ = M x , y = biasB ( N ) = N (1 − 2ε ) . N N N x ,y ∈ Z x ,y ∈ Z N
N
Not e t hat t his lower bound on B ◦ M σ t he upper bound derived from (12).
N
,τ
2
has t he same order of magnit ude as
R e fe re n c e s 1. N. Blum. A Boolean funct ion requiring 3n network size. T heoreti cal Computer Sci ence, 28(3):337–345, February 1984. 2. D. Cat alano, R. Gennaro, N. Howgrave-Graham, and P. Q. Nguyen. P aillier’ s crypt osyst em revisit ed. In P roceedi ngs of the 8th A CM Conference on Computer and Communi cati ons Secur i ty , pages 206–214, 2001. 3. D. Coppersmit h and I. Shparlinski. On polynomial approximat ion of t he Discret e Logarit hm and t he Diffi e-Hellman mapping. Jour nal of Cr yptology , 13(3):339–360, March 2000. 4. J . Forst er. A linear lower bound on t he unbounded error probabilist ic communicat ion complexity. In P roceedi ngs of the Si thteenth A nnual Conference on Computati onal Complexi ty , pages 100–106. IEEE Comput er Society, 2001. 5. J . Forst er, M. Krause, S. V. Lokam, R. Mubarakzjanov, N. Schmit t , and H. U. Simon. Relat ions between communicat ion complexity, linear arrangement s, and comput at ional complexity. In P roceedi ngs of the Conference on Foundati ons of Software T echnology and T heoreti cal Computer Sci ence, pages 171–182, 2001. 6. T . El Gamal. A public key crypt osyst em and a signat ure scheme based on discret e logarit hms. A dvances i n Cr yptology— CRY P T O ’ 84, pages 10–18, 1984. 7. E. Kilt z. On t he represent at ion of boolean predicat es of t he Diffi e-Hellman funct ion. In P roc. of 20th I nter nati onal Symposi um on T heoreti cal A spects of Computer Sci ence ST A CS, pages 223–233, 2003. 8. R. P at uri and J . Simon. P robabilist ic communicat ion complexity. Jour nal of Computer and System Sci ences, 33(1):106–123, 1986. 9. D. P oint cheval. New public key crypt osyst ems based on t he dependent — RSA problems. Lecture N otes i n Computer Sci ence, 1592:239–254, 1999. 10. K. P rachar. P r i mzahlver tei lung. Springer-Verlag, Berlin, 1957. 11. I. E. Shparlinski. Cr yptographi c A ppli cati on of A nalyti c N umber T heor y . Birkh¨a user Verlag, 2002. 12. I. M. Vinogradov. E lements of number theor y . Dover P ublicat ions., 1954. 13. A. W int erhof. A not e on t he int erpolat ion of t he Diffi e-Hellman mapping. In B ul leti n of the A ustrali an M athemati cal Soci ety , volume 64, pages 475–477, 2001. 14. A. W int erhof. P olynomial int erpolat ion of t he discret e logarit hm. D esi gns, Codes and Cr yptography , 25:63–72, 2002.
Quant um Sampling for Balanced A llocat ions K azuo I wama1, 2 , A kinori K awachi 1, 2 , and Shigeru Yamashit a1⋆ 1
I mai Quant um Comput at ion and I nformat ion Proj ect , ERAT O, Japan Sci. and Tech. Corp. 406, I seya-cho, K amigyo-ku, K yot o 602-0873, Japan [email protected] 2 Graduat e School of I nformat ics, K yot o Universit y Yoshida Honmachi, Sakyo-ku, K yot o 606-8501, Japan { iwama,kawachi} @kuis.kyoto-u.ac.jp
A bst ract . I t is known t hat t he original Grover Search (GS) can be modified t o use a general value for t he phase θ of t he diff usion t ransform. T hen, if t he number of answers is relat ively large, t his modified GS can find one of t he answers wit h probabilit y one in a single it erat ion. However, such a quick and error-free GS can only be possible if we can init ially adj ust t he value of θ correct ly against t he number of answers, and t his seems very hard in usual occasions. A nat ural quest ion now arises: Can we enj oy a merit even if GS is used wit hout such an adj ust ment ? I n t his paper, we give a posit ive answer using t he balls-and-bins game in which t he random sampling of bins is replaced by t he quant um sampling, i.e., a single round of modified GS. I t is shown t hat by using t he quant um sampling: (i) T he maximum load can be improved quadrat ically for t he st at ic model of t he game and t his improvement is opt imal. (ii) T hat is also improved t o O (1) for t he cont inuous model if we have a cert ain knowledge about t he t ot al number of balls in t he bins aft er t he syst em becomes st able.
1
I nt roduct ion
Suppose t hat we are given a1 , a2 , · · · , aN , such t hat one ai has value 1 and all t he ot hers have 0. Grover search (GS, [13]), which is apparent ly one of t he most celebrat ed quant um algorit hms, can ret rieve t his ai , called an answer , in t ime √ O( N ). T he scheme is so general and many applicat ions have been invest igat ed, including quant um count ing [8], minimum finding [12], claw finding [9] and so on. One can see, however, t hat all t hese applicat ions focus on t he case t hat t he number of answers is relat ively small, where t he goal is how t o find one of t hem quickly. I n t his paper, we focus on t he opposit e case, i.e., t he case t hat t here are relat ively many answers. I f one half of { a1 , · · · , aN } are answers, for inst ance, ⋆
Current affi liat ion: Graduat e School of I nformat ion Science, Nara I nst it ut e of Science and Technology.
T . W ar now and B . Zhu ( E ds.) : COCOON 2003, L N CS 2697, pp. 304–318, 2003. c Spr i nger -Ver l ag B er l i n H ei del b er g 2003
Quant um Sampling for Balanced A llocat ions
305
t hen one can get an answer easily by repeat ing a (classical) random sampling, say t wice. So, we are no longer int erest ed in t he t ime complexit y. I nst ead, we are int erest ed in t he probabilit y t hat we hit an answer. I n t he above case, t he random sampling hit s an answer wit h probabilit y one half. I f we could increase t his probabilit y t o, for example, 1 − o(1) by using quant um mechanisms, t hen it would be much more desirable especially when we use such a sampling repeat edly. One t ypical example is t he load-balancing problem invest igat ed in t his paper. Suppose t hat we have N processors. Jobs arrive one aft er anot her, each of which should be assigned t o one of t he N processors. I f we do not have enough informat ion such as t he loading fact or of each machine or do not wish t o spend t oo much t ime for NP-t ype scheduling, randomization oft en works well. T his has been a popular problem wit h a long hist ory and widely st udied using t he so-called balls-and-bins model [16][17][20]: Suppose t hat M balls are placed int o N bins, one by one, uniformly at random. T he number of balls st acked in each bin is called t he load of t he bin. T hen if M ≈ N , it is well known t hat t he load of t he highest bin is Θ (ln N / ln ln N ) wit h high probabilit y. I t is also known t hat if we allow a small amount of coordinat ion, i.e., if we select t wo bins at random and put t he ball int o t he less high bin, t hen t he maximum load drops dramat ically, i.e., t o O(ln ln N ) [2][19][23]. Our maj or obj ect ive in t his paper is t o st udy what happens if t he above random sampling for placing balls is replaced by quant um sampling.
1.1
M odified G rover Search
I n t his paper, we use t he modified Grover Search(GS) int roduced in [5][10][18] whose unit ary t ransformat ion is given by
G( θ , f ) = − H S0 H Sf , where H is t he Hadamard t ransformat ion and f is a given oracle { 0, ..., N − 1} → { 0, 1} , and
S0 = I + ( ei θ − 1) |0 0|,
Sf = I + ( ei θ − 1)
|i i |. f (i )= 1
Here S0 and Sf are generalizat ion of I 0 = I − 2|0 0| and I f = I − 2 f ( i ) = 1 |i i |, respect ively, which are used in t he original GS[13]. I f we set θ = − π , t hen it is t he same as t he original GS. Suppose for example t hat t he number, # f , of answers (i.e., # f = |{ i |f ( i ) = 1} |) is N / 2. T hen if we set θ = π / 2, we can get an answer wit h zero error by applying G( π / 2, f ) only once. I n general, suppose t hat M = cN for a const ant c such t hat c ≤ 3/ 4. T hen t his single-round, error-free GS is available by set t ing θ = arccos(1 − 2#N f ) [10].
1.2
Load Balancing
T here are t wo diff erent balls-and-bins models. I n t he static model , we put M balls int o N bins, one by one, uniformly at random. I n t he continuous model ,
306
K . I wama, A . K awachi, and S. Yamashit a
aft er we have put M balls as before, we cont inue put t ing balls uniformly at random, one at a unit t ime, and t hen remove one ball at a unit t ime. (T hus t he t ot al number of t he balls in t he bins remains unchanged during t he game.) Now suppose t hat t he random sampling, which is used when put t ing a ball int o a bin, is replaced by t he quant um sampling based on t he (modified) GS. T hen t he procedure is called quantum load balancing (QL B). M ore precisely, QL B is det ermined by t wo paramet ers 0 ≤ θ ≤ 2π and an int eger T and is denot ed by QL B ( θ , T ). I n each round, QL B select s t he bin int o which a ball is t o be placed as follows; (i) I nit ialize a log N -bit quant um regist er t o all 0’s and apply t he Hadamard t ransformat ion H . (ii) A pply G( θ , f T ) t o t he regist er, where f T is an oracle defined by
f T (i ) =
1
if bin i holds T − 1 balls or less
0
ot herwise
(iii) Observe t he regist er t o get value j . Put t he ball t o bin j . QL B is similarly defined also for t he cont inuous model but when we remove a ball, it is select ed uniformly at random.
1.3
Our C ont ribut ion
Suppose t hat we know t he number, m ≥ 41 N , of empt y bins out of t he all N N bins in each round. T hen, by set t ing T = 1 and θ = arccos(1 − 2m ), t he quant um search always select s an empt y bin, namely, we can achieve t he complet ely balanced allocat ion or t he cost of t he highest bin is equal t o one. However, t his is obviously unfair, since t he condit ion is almost t he same as t hat we know t he current round is t he i -t h one. (I f so, we can achieve t he same result by put t ing t he i t h ball int o t he i t h bin det erminist ically.) T he nat ural set t ing, t herefore, is t o assume t hat bot h T and θ have fixed values during t he game. T hen it is no longer possible t o enj oy t he above-ment ioned ideal select ion of t he bins during t he whole game. T hen it is no longer possible t o enj oy t he above-ment ioned error-free select ion during t he whole game. To see t his, suppose t hat we would set T = 1 as before, i.e., we always wish 3 as t he error t o select an empt y bin. T hen, as described lat er, we can get N N− m probabilit y (= t he probabilit y t hat t he quant um sampling select s a nonempt y bin) by set t ing θ appropriat ely. T his much bet t er t han t he classical appears sampling whose error probabilit y is N N− m . Unfort unat ely t his is not t rue. T he number of nonempt y bins can grow t o, say, cN for a const ant c. T hen t he above error probabilit y of t he quant um sampling becomes c3 , which is essent ially t he same as c in t he sense t hat bot h are const ant . I t is not hard t o see t hat t he maximum load is Ω (ln N / ln ln N ), which is t he same as t he classical case up t o a const ant fact or. T hus, t he primary quest ion is how t o select T and θ t o minimize t he maximum load. I n t his paper we prove t he following result s: (i) T he maximum load is at
Quant um Sampling for Balanced A llocat ions
307
most (2+ o(1)) ln N / ln ln N wit h high probabilit y, if we set T = ln N / ln ln N and θ = π / 3. Namely, even if we use fixed T and θ , QL B is quadrat ically bet t er t han it s classical count erpart . (ii) T his select ion of T and θ is opt imal since we can prove t hat t he maximum load is Ω ( ln N / ln ln N ) wit h high probabilit y for any T and θ . (iii) A pparent ly QL B is more powerful for t he cont inuous game, since t he number of balls does not alt er once it becomes st able. Suppose t hat M ∗ is t he number of balls aft er t he syst em √ becomes st able and t hat we can guess t he value of M ∗ wit hin t he error of ± O( M ∗ ). T hen QL B can achieve a maximum load of O(1). Recall t hat t he maximum load does not change essent ially bet ween t he st at ic and cont inuous models in classical case.
1.4
P revious R esult s
A s ment ioned earlier, many applicat ions of GS have appeared in t he lit erat ure. Recent ly, t he first nont rivial lower bound of Ω ( N 1/ 5 ) was proven [1] for t he collision problem [9], and t his result was improved in [21]. See [7][8][12][15] for more applicat ions. We need significant ly less it erat ions if we have some informat ion (e.g., t he number of 1’s in t he vect or) of t he answer. See [14] for more. I t has also been a popular research t opic t o increase t he success probabilit y of GS in several occasions. Ot her t han [10] described before, [18] invest igat es t he case when t here are few answers and [4][5] invest igat es t he case when we have no informat ion about t he number of answers.
2
Basic I deas and U seful Lemmas
I nt uit ively, QL B works as follows: Suppose t hat we set T = T0 and θ = θ 0 . T hen at t he beginning (unt il some fract ion of N balls have been placed), t he maximum load does not reach T0 as shown in Fig 1. (T he figure illust rat es how t he load of each bin looks like supposing t he bins are sort ed wit h t heir load.) I n t his case, f T 0 ( i ) = 1 for 1 ≤ ∀ i ≤ N , and t herefore one can see t hat G( θ 0 , f T 0 ) does not change t he amplit ude of each quant um st at e, i.e., QL B ( θ 0 , T0 ) is exact ly t he same as t he classical load balancing. Now, t he load of t he highest bin reaches T0 as shown in Fig. 1 (b). Fig. 1 (d) shows t he final dist ribut ion. We call t he bin whose load is at least T0 a high bin and a low bin ot herwise. From t his point of t ime, f T 0 ( i ) = 0 if bin i is high. T herefore QL B select s a low bin wit h higher probabilit y as t he bin t o which a ball is placed. Recall, however, t hat we set θ = θ 0 , which means t hat QL B select s a low bin wit h probabilit y one (or never select s a high bin) only when t he number of high bins is equal t o X 0 t hat is det ermined by θ 0 and N (see Fig. 1 (c)). I n ot her words, QL B select s high bins wit h some non-zero probabilit y Pe before and aft er t his opt imal point of t ime. We oft en call t his probabilit y Pe error probability since select ing high bins obviously increases t he maximum height . Our first lemma gives t his error probabilit y:
308
K . I wama, A . K awachi, and S. Yamashit a
T0
T0
N
N
(b)
(a) T0
T0
X0
N
N
(d)
(c) F ig. 1.
Lemma 1 L et k be t he number of bins whose height is T or more. T hen QL B ( θ , T ) select s a high bin wit h probabilit y 2 2k k (1 − cos θ ) . 1 − 2 cos θ − Pe ( k ) = N N P roof
A ft er applying G( θ , f T ), t he amplit ude of each high bin is
√
1
N
k 2 ) , − e − ( e − 1) (1 − N iθ
iθ
2
as described in Sec. 1.1. Since we have k high bins, t he error probabilit y is
k N
k − e − ( e − 1) (1 − ) N iθ
iθ
2
2
k = N
1 − 2 cos θ −
2k
N
(1 − cos θ )
2
.✷
T he next lemma [19] is convenient when we approximat e t he balls-and-bins game by t he independent Poisson process. Suppose t hat we place M balls int o N bins uniformly at random, which is called t he exact case. We also consider t he Poisson case where each bin independent ly receives a ball wit h probabilit y M / N in each round (t hus it s load becomes a Poisson variable wit h mean M / N ). A lso, let a load based event be an event t hat depends solely on t he loads of t he bins.
Lemma 2 Suppose t hat t he probabilit y of a load based event is monot onically increasing wit h t he t ot al number of balls. T hen t he event which t akes place wit h probabilit y p in t he Poisson case t akes place wit h at most 4p in t he exact case. T he t hird lemma (see e.g., [19]) is on t he maximum load of t he classical balls-and-bins process. Lemma 3 Suppose t hat M balls are put int o N bins uniformly at random. T hen t he maximum load is Ω (ln N / ln( N / M )) wit h at least probabilit y 1 − 1/ N if M < N / ln N , and is Ω (ln N / ln ln N ) wit h probabilit y at least 1 − 1/ N if N / ln N ≤ M ≤ N .
Quant um Sampling for Balanced A llocat ions
3
309
St at ic U pper Bounds
A s ment ioned in Sec. 1.3, we need t o use a relat ively large value for t he t hreshold T in order t o t ake advant age of t he quant um sampling. A s for t he angle θ , L emma 1 st rongly suggest s t o use θ = π / 3, which implies t hat 1 − 2 cos θ = 0.
T heorem 1 Suppose t hat N balls are put int o N bins using QL B
ln N π . T hen t he maximum load is at most (2 + o(1)) ln N / ln ln N 3, ln ln N
wit h high probabilit y.
P roof Our proof is composed of t wo st ages. I n t he first st age, we bound from above t he number k of t he bins whose height is T or more when t he game ends. I n t he second st age, we evaluat e t he number ν i of bins whose height is i or more for each i ≥ T . To do so, we use t he met hod called layered induct ion [2] wit h t he base condit ion t hat ν T ≤ k . I t should be not ed t hat we can use t he layered induct ion since t he probabilit y t hat a bin of height T or more receives a ball is very small t hanks t o t he quant um sampling. T his condit ion is not met for t he bins whose height is less t han T and t here is no obvious way of using t he layered induct ion for t he first st age. We use not at ions similar t o [2] t o represent t he st at e of QL B at t ime t : L et hA ( t ) be t he height of t he t -t h ball by an algorit hm A , i.e., t he number of balls in t he bin right aft er t he t -t h ball is put int o t he bin. A lso let ν iA ( t ) be t he number of bins t hat have a load of i or more at t ime t by an algorit hm A . We omit t he superscript A when it is clear which algorit hm we are considering. St age 1: Our basic approach is t o approximat e t he behavior of t he game by an independent Poisson process. Consider t he moment t hat t he t -t h ball is coming. T hen each of t he low bins receives t hat ball wit h probabilit y p( t ) = ν (t ) (1 − ( TN ) 3 ) N − ν 1T ( t ) ≤ N3 by L emma 1 for θ = π / 3. Recall t hat we are int erest ed in t he number of bins whose height is at least T , which is not aff ect ed by t he behaviour of t he bins aft er t heir height becomes T . T herefore, we can use t he above probabilit y p( t ) also for a high bin. T hus, we can use t he independent Poisson process wit h probabilit y p( t ). M ore precisely, we can claim t he following lemma using L emma 2. Lemma 4 For independent binomially dist ribut ed random variables X 1 ,..., X n wit h paramet ers n and p, let κ ( n, p, T ) be t he number of t he ranQ L B ( π / 3,T ) dom variables whose value is larger t han T . T hen, P r [ν T ( N ) ≥ k] ≤ 3 4P r [κ ( N , N , T ) ≥ k ] for all T . L et X be t he random variable for ν T ( N ) of QL B ( π / 3, ln N / ln ln N ) and X ′ be t he corresponding random variable when we use t he above Poisson ap3 N
proximat ion where a bin receives a ball wit h probabilit y for 0 < δ < 2e − 1
′
′
′
P r [X > (1 + δ ) E ( X )] < exp − E ( X )
δ
. By Chernoff bounds, 2
4
.
L et p be t he probabilit y t hat a specific bin receives T or more balls in t he above Poisson approximat ion. Since t he probabilit y t hat a specific bin receives
310
K . I wama, A . K awachi, and S. Yamashit a
a ball at one moment is
N T
≤
eN T
T
3 N
and since
N i
N i= T
i
q (1 − q)
N−i
≤
N T
qT and
[11],
N
N i
p= i= T
3
i
1−
N
3
N−i
N T
≤
N
3
T
≤
N
(3e) T
TT
.
L et p′ be t his final value (3e) T / T T . T hus,
′
′
′
′
P r [X > (1 + δ ) N p ) ≤ P r ( X > (1 + δ ) N p] ≤ exp − E ( X ) Since p ≥
N T
3 N
T
1−
3 N
N−T
and we now set T =
δ
2
4
.
ln N / ln ln N , one
can easily see t hat t here must exist const ant 0 < δ < 2e − 1 such t hat
′
exp − E ( X )
δ
2
4
= exp −
δ
2
4
Np ≤
1 . 4N
Combining t he above inequalit ies and L emma 4, we can show
P r [X > (1 + δ )
(3e) T
N ] ≤ 4P r [X ′ > (1 + δ )
TT
(3e) T
TT
N ] ≤ 1/ N .
T herefore t he number of t he bins whose load is at least T is at most (1 + δ ) (3e) T N / T T wit h probabilit y 1 − 1/ N .
St age 2: Next we define a sequence α
as follows and show ν i ( N ) ≤ α
i
each i ≥ T + 1 wit h high probabilit y under t he condit ion t hat α
α
i
=
eα
2 2 i− T T/N α
T
T
= (1+ δ )
i ( 3e) T TT
for
N:
(i ≥ T )
T hus one can obt ain t he bound by calculat ing t he value i such t hat α i less t han one. Since t he argument from now on is similar t o [2], we omit it in t his paper.✷
4
St at ic Lower Bounds
Here we show t he mat ching lower bounds.
T heorem 2 Suppose t hat N balls are put int o N bins using QL B ( θ , T ). T hen t he maximum load is Ω ( ln N / ln ln N ) wit h high probabilit y for any 0 ≤ θ ≤ 2π and any 0 ≤ T ≤ N . P roof
I f we set T > ln N / ln ln N , t hen t he maximum load clearly reaches t he bound as illust rat ed in Sec. 2. So, wit hout loss of generalit y we can ln N / ln ln N . A lso we can assume cos θ = 1 since by L emma 1 assume T ≤ cos θ = 1 means t hat Pe ( k ) = Nk which implies QL B is exact ly t he same as t he classical load balancing (CL B for short ). L et us fix T and θ accordingly.
Quant um Sampling for Balanced A llocat ions
311
A s before our proof consist s of t wo st ages. I n t he first st age, we put N / 18 balls and calculat e t he number of high bins. T his t ime, t he number of high bins is bounded from below. (I t was bounded from above, previously.) L et k1 be t his lower bound. I n t he second st age, we show t hat k1 high bins receive at least , say, l balls during some period of t ime. Here we need t o be careful t o select t his t ime period , since we wish t o bound t he error probabilit y from below. Recall t hat a ball goes t o a high bin by t he error of quant um sampling and t his error probabilit y can be zero when t he set t ing of θ and T is opt imal for t he number of high bins. Once we obt ain l , t hen we can conclude t hat t he maximum load is at least T + Ω ( l n(l nk k1 /1 l ) ) by L emma 3, since t he l balls are put int o t he high k1 bins uniformly at random.
St age 1: Suppose t hat t he bins have received t he first N / 18 balls. Since ln N T≤ l n l n N , one can easily calculat e t hat some bins get t o height T during t his period. A lso it is easy t o show t hat t he probabilit y t hat a low bin receives a ball is great er t han 1/ 2N during t he above period. However, recall t hat we now wish t o obt ain a lower bound for t he number of high bins and, as before, we are not int erest ed in t he behavior of t he high bins once t hey becomes high. L et X t he random variable for t he number of high bins when we have received N / 18 balls and let X ′ be t he number of t he random independent binomially dist ribut ed random variables wit h paramet ers N / 18 and 1/ 2N , whose value is larger t han T . A s before, we can approximat e X by X ′ . M ore precisely, we use t he following lemma. Q L B ( θ ,T ) N ( 18 )
Lemma 5 For all θ and T , P r [ν T
< k ] ≤ 4P r [κ
1 N 18 , 2N
, T < k ].
By Chernoff bounds,
δ P r [X ′ < (1 − δ ) E ( X ′ )] < exp − where E ( X ′ ) =
1 T − ( 36 ) e
1 36
N / T ! by Poisson dist ribut ion. T herefore,
1 T − ( 36 ) e − 2 T!
δ
′
P r [X < (1 − δ ) E ( X )] < exp
2
E (X ′ ) ,
′
Since T ≤
2
2
1 36
N
.
ln N / ln ln N , we can select 0 < δ < 1 such t hat
exp −
δ
2
2
α
T −α
e T!
N
≤
1 . 4N
Now by L emma 5,
P r [X < (1 − δ )
1 T − ) e ( 36 T!
1 36
N ] ≤ 4P r [X ′ < (1 − δ )
1 T − ) e ( 36 T!
1 36
N ] ≤ 1/ N ,
namely, at t he end of St age 1, t he number of high bins is at least (1 − δ ) ( 316 ) T e− T!
1 36
N , denot ed by k1 hereaft er wit h probabilit y 1 − 1/ N .
312
K . I wama, A . K awachi, and S. Yamashit a
St age 2: Since k1 is a lower bound, t here must be a point of t ime, say t , before N / 18 when t he number of high bins becomes k1 . We will calculat e t he number of bins t hat t hese k1 bins receive during some period of t ime st art ing at t . L et k ( ≥ k1 ) be t he number of high bins at some moment in t his period. T hen, by L emma 1, t he probabilit y t hat a ball goes t o one of t he k1 high bins is 2 Pe ( k ) = kN1 1 − 2 cos θ − 2k N (1 − cos θ ) . T hus Pe ( k ) becomes a local minimum 2 cos θ N ∗ (= 0) at k = 1− 1− cos θ 2 = k . Here, wit hout loss of generalit y, we can assume ∗ ∗ t hat |k1 − k | ≥ c1 k for a const ant c1 > 0 (Ot herwise, we modify St age 1 so t hat we receive, say, N / 5 balls inst ead of N / 18 balls. T hen t he value of k1 is shift ed and t hat of k ∗ unchanged. So, t he condit ion is met .) A simple calculat ion implies t hat if P e( k ∗ ) = 0, t hen for a posit ive value c, k1 k1 (1 − c) 2 (1 − 2 cos θ ) 2 = (1 − c) 2 P e( ck ) = N N
k∗ N − k∗
∗
2
.
T herefore, if |k1 − k ∗ | ≥ c1 k ∗ for a const ant c1 > 0, P e( dk1 ) = c2 ( kN1 ) 3 for some const ant d > 0 and c2 > 0. Now we select t he above period so t hat t he bins receive anot her c1 k1 balls in it . T he number of high bins is obviously less t han (1 + c1 ) k1 at t he end of t his period. A ccordingly, t he number of high bins is dk1 for some const ant d during t he above period. T he above discussion follows t hat t he probabilit y t hat a ball goes t o one of t he k1 high bins is at least c2 ( kN1 ) 3 for some const ant c2 > 0 during t he period. T hus, using t he similar discussion as before, we can conclude t hat t he k1 bins receive at least
l = (1 − δ ) c2
k1 N
3
c1 k1 = c3
1 T − ) e ( 36 T!
1 36
4
N
balls during t his period for some const ant c3 wit h probabilit y 1 − 1/ N . Since t hose balls are placed int o t he k1 bins uniformly at random, we can use L emma 3 t o claim t hat t he maximum load only for t his period is at least ln k1 = Ω ln( k1 / l )
ln N T ln T
for any θ wit h high probabilit y. (T his is t he case when l < k1 / ln k1 . I f l > k1 / ln k1 , t he maximum load becomes even more.) T hus t he overall load is
T+ Ω
ln k1 ln( k1 / l )
≥ T+ Ω
ln N T ln T
,
which becomes minimum when T = O( ln N / ln ln N ). One can easily see t hat t his minimum value is st ill Ω ( ln N / ln ln N ). ✷
Quant um Sampling for Balanced A llocat ions
5 5.1
313
Cont inuous M odel Basic I dea
A s described in t he previous sect ion, t he reason why t he maximum load for t he st at ic model increases is t hat t he value for θ cannot follow t he increasing number of balls during t he game. I n t he cont inuous model, t he number of balls does not alt er once t he syst em ent ers a st able st at e; QL B appears t o be much more suit ed for t his model. L et B B ( M , N ) be t he cont inuous model of N bins which becomes st able when M balls have come. W it hout ot herwise st at ed, we also assume t hat M can be writ t en as M = cN for 0 < c ≤ 43 . I t is known t hat if we use CL B, t hen t he maximum load does not diff er from t he st at ic case, i.e., Θ (ln N / ln ln N ) for simple random sampling and Θ (ln ln N ) for t he coordinat ion. Now let us design QL B for B B ( N , M ). I f we know t he value of c, say c = 12 , t hen we can set T = 1 and also can set θ such t hat t he error probability ( = t he probabilit y of select ing high bins) of GS( θ , f 1 ) becomes zero when t he number 1 of high bins is N2 . By L emma 1, θ = arccos(1 − 2( 1− c) ). T hen t he game proceeds as follows: ( i ) W hen cN balls have arrived, t he dist ribut ion of t he load looks like Fig. 2, where one can easily calculat e t hat t he maximum load is Θ (ln N / ln ln N ). ( i i ) A ft er t hat , however, t he number k of empt y bins are decreasing because of t he posit ive eff ect of quant um sampling. T his can be shown by a st andard analysis using t he one-dimensional M arkov chain (see lat er for det ails). ( i i i ) One can see t hat t he st at e for k = 0 is so-called an absorbing st at e of t he M arkov chain (i.e., once t he syst em ent ers t hat st at e, it never leaves). T hus, t he syst em is approaching t o t he complet ely balanced st at e where all t he bins have load one. T he reason for rest rict ing c ≤ 43 is t hat it is no longer possible t o achieve t he zero-error by a singe it erat ion of GS if c > 43 . However, if we allow mult iple it erat ions, t hen we can ext end t he above met hod for a larger c, for inst ance, up t o c ≈ 0.90 by t wo it erat ions and up t o c ≈ 0.95 by t hree it erat ions.
R emark
T=1 cN
F ig. 2 T hus QL B is really powerful if we know t he number M of balls in t he st able st at e correct ly. Unfort unat ely however, t his assumpt ion is apparent ly t oo st rong due t o our original mot ivat ions. Not e t hat it also loses a lot of int erest if we assume t hat no informat ion is available about M : I t is not hard t o show using t he same argument as in Sect ion 4 t hat t he maximum load becomes similarly large if t he est imat ion of M diff ers from it s real value by ǫ N for a const ant ǫ . We shall now invest igat e t he case t hat we have a pret t y good est imat ion about t his value M .
314
5.2
K . I wama, A . K awachi, and S. Yamashit a
A pproximat ion wit hin Sublinear Bounds
Suppose t hat we know t he value of M wit hin sublinear bounds. T hen our QL B works well, i.e., t he maximum load is bounded by O(1). T he first t heorem deals wit h t he case t hat our est imat ion is shift ed t o a smaller value.
T=1
T=1 cN
cN-t
cN+δ
F ig. 3
cN cN+δ
F ig. 4
1 Suppose t hat our QL B uses GS(arccos(1 − 2( 1− c) ) , 1), which becomes opt imal when M = cN , but t he real value of M is cN + δ . T hen t he 1 maximum load is at most k wit h probabilit y at least 1 − N1 if 0 ≤ δ ≤ O( N 1− k − 1 ) for any const ant k ≥ 2.
T heorem 3
P roof See Fig. 3. I t is not hard t o see t hat t he number t of nonempt y bins reaches cN aft er a suffi cient ly long period of t ime. A ft er t hat t can be more t han cN but can never be less t han cN since balls never go t o high bins when t = cN . L et Pe ( t ) be t he probabilit y t hat a ball falls in a nonempt y bin. T hen, by L emma 1 Pe ( t ) =
cN − t cN − N
2
t , N
for cN ≤ t ≤ cN + δ and it becomes maximum when t = cN + δ , whose value is
Pe∗ =
δ 2 ( cN + δ ) . N 3 (1 − c) 2
Now suppose t hat t he load of some specific bin is k . We invest igat e how large t his value can be using t he one-dimensional M arkov chain. L et Pk be t he probabilit y t hat t he syst em is in st at e k (i.e., t he load is k ) aft er it becomes st able. L et µ i ( λ i , resp.) be t he probabilit y t hat t he st at e t ransit ion occurs from st at e i t o i + 1 ( i t o i − 1, resp.). T hen it is well known t hat Pk can be writ t en as k − 1
Pk = P0 i= 0
µi λ
.
i+ 1
One can observe t hat t he st at e t ransit ion from i t o i − 1 occurs if one of t he i balls in t he bin is select ed (at random) t o be removed. T hus λ i = cNi+ δ . Similarly, t he st at e t ransit ion from i t o i + 1 occurs if t he bin is select ed by QL B. Since k ≥ 1, t his occurs wit h probabilit y Pe ( t ). Since Pe ( t ) ≤ Pe∗ , we have µ i ≤ Pe∗ / ( cN + t ) ≤ Pe∗ / cN .
Quant um Sampling for Balanced A llocat ions
315
Recall t hat t he number of empt y bins is N − t , it follows t hat µ 0 = (1 − Pe ( t )) / ( N − t ) ≤ 1/ ( N − cN − δ ). We can t hus conclude t hat
Pk ≤ P0
1/ ( N − cN − δ ) cN + δ k − 1 ∗ k − 1 ( ) ( Pe ) 1/ ( cN + δ ) cN
cN + δ ≤ P0 (1 − c) N − δ
( cN + δ )
cN
1/ i
i= 1 k− 1
δ 2 ( cN + δ ) N 3 ( 1− c) 2
k
,
and it is not hard t o see Pk = O(1/ N 2 ) if k sat isfies δ ≤ O( N 1− 1/ ( k − 1) ). Since µk 1 λ k + 1 < 2 , we have cN +δ
Pl < 2Pk < O(1/ N 2 ) ,
l= k
which means t here is no bin holding k or more balls wit h probabilit y 1−O(1/ N ).✷ We next consider t he case t hat our est imat ion of t he number of balls is shift ed t o t he larger side. Suppose t hat our QL B uses GS(arccos(1 − 2{ 1− c−1( δ / N ) } , 1)); namely it becomes opt imal when t he number of balls in t he st able st at e is cN + δ . T hen if t he act ual number of balls is cN and if 0 ≤ δ ≤ O( N 1/ 2 ), t hen t he maximum load is O(1) wit h probabilit y at least 1 − O(1/ N ).
T heorem 4
P roof See Fig. 4. L et t he number of nonempt y bins aft er t he syst em becomes st able be cN − t and Pe ( t ) be t he (error) probabilit y t hat a ball falls in a nonempt y bin. T hen by L emma 1,
Pe ( t ) =
1
N2
δ + t 1− c−
δ N
2
(c −
t ). N
Now we use t he M arkov chain t o analyze how t he value t changes. L et Pt be t he probabilit y t hat t he syst em is in st at e t (i.e., t he number of nonempt y bins is cN − t ) and µ t ( λ t , resp.) be t he probabilit y t hat t he st at e changes from t t o t + 1 ( t t o t − 1, resp.). One can see t hat t he st at e changes from t t o t + 1 if a ball falls in a bin wit h load t wo or more and a ball is removed from a bin of load one. T herefore
µ t = Pe ( t )
t s cN − t ≤ Pe ( t )(1 − ) = µˆ t , cN − t cN cN
where s is t he number of bins whose load is one. Conversely, t he number of nonempt y bins decreases if a ball falls in an empt y bin and a ball is removed from a bin of load t wo or more. T hus
λ
t
= (1 − Pe ( t ))(1 −
cN − t t ) ≥ (1 − Pe ( t )) = λ ˆt . cN + δ cN
316
K . I wama, A . K awachi, and S. Yamashit a
Exact ly as before we have
t − 1 Pe ( i ) µ0 · · · µt − 1 cN µˆ 0 · · · µˆ t − 1 Pt = P0 = . ≤ λ 1 ···λ t 1 − Pe ( i + 1) t λˆ 1 · · · λˆ t i= 0 Not e t hat δ ≪ N and we can assume t hat t ≤ δ ( t cannot be t oo large as shown 2 lat er). Consequent ly, Pe ( t ) ≤ 4δN 2 ( 1−cc) 2 , which implies t − 1 i= 0
√
Since δ ≤
Pt ≤
Pe ( i ) ≤ 1 − Pe ( i + 1)
4c (1 −
N , we can conclude 2t 2c δ cN 4c2 e ≤ 1 − c cN (1 − c) 2 t
t
t
δ 2t . N 2t
c) 2
δ 2 cN
t
1
tt
≤
4ce (1 −
c) 2
t
1
tt
.
We next prove t hat Pt decreases monot onically. To do so, we calculat e −1 ) Pe ( t − 1)(1 − tcN µt − 1 µ tˆ− 1 ≤ ≤ ≤ t ˆ λ t (1 − Pe ( t )) cN λ t t
cN 2
1− c δ +t
≈
N2 − c
c , (1 − c) 2 t
√
since δ ≤ N . T his value is obviously less t han one if t ≥ ( 1−cc) 2 , which guarant ees t hat Pt decreases monot onically for almost all range of t . Using t his fact and t he upper bound of Pt previously calculat ed, we can claim t hat cN −1 t=
√
Pt ≤ P√
N
·N ≤
N
1
N
1 2
√
√
N−2
, 1
√
which means t hat t he probabilit y t hat t ≤ N is at√ least 1− 1/ N 2 N − 2 . Namely t he number of nonempt y bins is at least cN − O( N ) wit h high probabilit y. Since t he number of nonempt y bins is bounded below, we can now bound t he error probabilit y Pe ( t ) from above. Namely,
Pe ( t ) ≤
1 4c . (1 − c) 2 N
One can see t hat t his error probabilit y is even smaller t han t he case discussed in t he proof of t he previous t heorem. T herefore, we can use t he same argument as before t o bound t he maximum load. A lt hough det ails are omit t ed, t he maximum load is at most five wit h probabilit y 1 − O(1/ N ). ✷
6
Concluding R emarks
A lt hough we omit det ails, if we allow t o sample t wo bins at each st ep, quant um sampling does not help, i.e., t he maximum load is Θ (ln ln N ) as t he same as classical case[2]. T he proof is very similar t o t hat of [2]. Since t he error probabilit y
Quant um Sampling for Balanced A llocat ions
317
is already very small in t he classical case, it s furt her reduct ion by quant um sampling does not make any essent ial diff erence. T he anonymous reviewer informed us t hat t here exist s anot her model, called t he “ parallel bins-and-balls” [3][19], in which each ball can select d( ≥ 1) bins and ask t hem t he sit uat ion of collision,
all in parallel. T he bound is Θ
r
ln N ln ln N
if t he prot ocol involves r rounds of
communicat ion. T his model is also quit e powerful and it does not seem t hat quant um mechanism gives us any significant improvement .
R eferences 1. S. A aronson, “ Quant um L ower Bound for t he Collision Problem,” Proceedings of t he 34t h ACM Symposium on T heory of Comput ing, 635–642, 2002. 2. Y . A zar, A . Z. Broder, A . R. K arlin, and E. Upfal, “ Balanced A llocat ions,” SI A M Journal on Comput ing, Vol. 29, No. 1, 180–200, 1999. 3. M . A dler, S. Chakarabart i, M . M it zenmacher, and L . Rasmussen, “ Parallel Randomized L oad Balancing,” Proceedings of t he 27t h ACM Symposium on T heory of Comput ing, 238–247, 1995. 4. M . Boyer, G. Brassard, P. Høyer, and A . Tapp, “ T ight Bounds on Quant um Searching,” Fort schrit t e der Physik, vol. 46(4-5), 493–505, 1998. 5. G. Brassard, P. Høyer, M . M osca, and A . Tapp, “ Quant um amplit ude amplificat ion and est imat ion” , Quant um Comput at ion and Quant um I nformat ion: A M illennium Volume, A M S Cont emporary M at hemat ics Series, M ay 2000. 6. P. Berenbrink, A . Czumaj , A . St eger, and B. V ¨ocking, “ Balanced A llocat ions: T he Heavily L oaded Case,” Proceedings of t he 32nd ACM Symposium on T heory of Comput ing, 745–754, 2000. 7. G. Brassard, P. Høyer and A . Tapp, “ Quant um crypt analysis of hash and clawfree funct ions,” Proceedings of 3rd L at in A merican Symposium on T heoret ical I nformat ics (L AT I N’98), Vol. 1380 of L ect ure Not es in Comput er Science, 163– 169, 1998. 8. G. Brassard, P. Høyer, and A . Tapp, “ Quant um Count ing,” Proceedings of t he 25t h I nt ernat ional Colloquium on A ut omat a, L anguages, and Programming, Vol. 1443 of L ect ure Not es in Comput er Science, 820–831, 1998. 9. H. Buhrman, C. D u ¨ rr, M . Heiligman, P. Høyer, F. M agniez, M . Sant ha, and R. de Wolf, “ Quant um A lgorit hm for Element Dist inct ness” , Proceedings of t he 16t h I EEE Conference on Comput at ional Complexit y, 131–137, 2001. 10. D. P. Chi and J. K im, “ Quant um Dat abase Searching by a Single Query,” L ect ure at First NA SA I nt ernat ional Conference on Quant um Comput ing and Quant um Communicat ions, 1998. 11. T . H. Cormen, C. E. L eiserson and R. L . Rivest , “ I nt roduct ion t o A lgorit hms,” Cambridge, M ass.: M I T Press, 1990. 12. C. D u ¨ rr and P. Høyer “ A Quant um A lgorit hm for Finding t he M inimum,” L A NL preprint , ht t p:/ / xxx.lanl.gov/ archive/ quant -ph/ 9607014. 13. L . K . Grover, “ A fast quant um mechanical algorit hm for dat abase search,” Proceedings of t he 28t h ACM Symposium on T heory of Comput ing, 212–218, 1996. 14. L . K . Grover, “ A framework for fast quant um mechanical algorit hms,” Proceedings of t he 30t h ACM Symposium on T heory of Comput ing, 53–56, 1998. 15. L . K . Grover, “ Rapid sampling t hrough quant um comput ing,” Proceedings of t he 32nd ACM Symposium on T heory of Comput ing, 618–626, 2000.
318
K . I wama, A . K awachi, and S. Yamashit a
16. N. Johnson, and S. K ot z, “ Urn M odels and T heir A pplicat ion,” John W ily & Sons, New York, 1977. 17. V . K olchin, B. Sevast yanov, and V . Chist yakov, “ Random A llocat ions,” John W iley & Sons, New York, 1978. 18. G. L . L ong, “ Grover A lgorit hm wit h Zero T heoret ical Failure Rat e,” Physical Review A , Vol. 64 022307, June, 2001. 19. M . M it zenmacher, “ T he Power of T wo Choices in Randomized L oad Balancing,” Ph.D. T hesis, 1996. 20. R. M ot wani, and P. Raghavan, “ Randomized A lgorit hms,” Cambridge Universit y Press, 1995. 21. Y . Shi, “ Quant um L ower Bounds for t he Collision and t he Element Dist inct ness Problems,” Proceedings of t he 43rd I EEE Symposium on Foundat ions of Comput er Science, 513–519, 2002. 22. P. W . Shor, “ A lgorit hms for Quant um Comput at ion: Discret e L og and Fact oring” , SI A M Journal of Comput ing, Vol. 26, No. 5, 1414–1509, 1997. 23. B. V ¨ocking, “ How A symmet ry Helps L oad Balancing,” Proceedings of t he 40t h I EEE Symposium on Foundat ions of Comput er Science, 131–140, 1999.
F a u lt - H a m ilt o n ic it y o f P ro d u c t G ra p h o f P a t h a n d C y c le ⋆ J ung-Heum P ark 1 and Hee-Chul Kim 2 1
2
T he Cat holic University of Korea, P uchon, Kyonggi-do 420-743, Korea [email protected] Hankuk University of Foreign St udies, Yongin, Kyonggi-do 449-791, Korea [email protected]
A b s t r a c t . We invest igat e hamilt onian propert ies of P m × C n , m ≥ 2 and even n ≥ 4, which is bipart it e, in t he presence of faulty vert ices and/ or edges. We show t hat P m × C n wit h n even is st rongly hamilt onianlaceable if t he number of faulty element s is one or less. W hen t he number of faulty element s is two, it has a fault -free cycle of lengt h at least m n − 2 unless bot h faulty element s are cont ained in t he same part it e vert ex set ; ot herwise, it has a fault -free cycle of lengt h m n − 4. A suffi cient condit ion is derived for t he graph wit h two faulty edges t o have a hamilt onian cycle. By applying fault -hamilt onicity of P m × C n t o a two-dimensional t orus C m × C n , we obt ain int erest ing hamilt onian propert ies of a faulty C m × C n .
1
I n t ro d u c t io n
Emb edding of linear arrays and rings int o a faulty int erconnect ion graph is one of t he cent ral issues in parallel processing. T he problem is modeled as finding as long fault -free pat hs and cycles as p ossible in t he graph wit h some faulty vert ices and/ or edges. Fault -hamilt onicity of various int erconnect ion graphs were invest igat ed in t he lit erat ure. Among t hem, hamilt onian prop ert ies of faulty P m × C n and C m × C n were considered in [4,5,6,8]. Here, P m is a pat h wit h m vert ices and C n is a cycle wit h n vert ices. Many int erconnect ion graphs such as t ori, hyp ercub es, recursive circulant s[7], and double loop networks have a spanning subgraph isomorphic t o P m × C n for some m and n . Hamilt onian prop ert ies of P m × C n wit h faulty element s play an imp ort ant role in discovering fault -hamilt onicity of such int erconnect ion graphs. A graph G is called k - fa u lt h a m ilt o n ia n (resp. k - fa u lt h a m ilt o n ia n - co n n ec t ed ) if G − F has a hamilt onian cycle (resp. a hamilt onian pat h joining every pair of vert ices) for any set F of faulty element s such t hat | F | ≤ k . It was proved in [4, 8] t hat P m × C n , n ≥ 3 odd, is hamilt onian-connect ed and 1-fault hamilt onian. T hroughout t his pap er, a hamilt onian pat h (resp. cycle) in a graph G wit h faulty element s F means a hamilt onian pat h (resp. cycle) in G − F .
⋆
T his work was support ed by grant No. 98-0102-07-01-3 from t he Basic Research P rogram of t he KOSEF .
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 319–328, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
320
J .-H. P ark and H.-C. Kim
We let G b e a bipart it e graph wit h N vert ices such t hat | B | = | W | , where B and W are t he set s of black and whit e vert ices in G , resp ect ively. We denot e by F v and F e t he set s of faulty vert ices and edges in G , resp ect ively. We let F = F v ∪ F e , f vw = | F v ∩ W | , f vb = | F v ∩ B | , f e = | F e | , f v = f vw + f vb, and f = f v + f e . W hen f vb = f vw , a fault -free pat h of lengt h N − 2f vb − 1 joining a pair of vert ices wit h diff erent colors is called an L op t - pa t h . For a pair of vert ices wit h t he same color, a fault -free pat h of lengt h N − 2f vb − 2 b etween t hem is called an L op t - pa t h . W hen f vb < f vw , fault -free pat hs of lengt h N − 2f vw for a pair of black vert ices, of lengt h N − 2f vw − 1 for a pair of vert ices wit h diff erent colors, and of lengt h N − 2f vw − 2 for a pair of whit e vert ices, are called L op t - pa t h s . Similarly, we can define an L op t -pat h for a bipart it e graph wit h f vw < f vb. A fault -free cycle of lengt h N − 2 max { f vb, f vw } is called an L op t - c y c le . T he lengt hs of an L op t -pat h and an L op t -cycle are t he longest p ossible. In ot her words, t here are no fault -free pat h and cycle longer t han an L op t - pa t h and an L op t - c y c le , resp ect ively. A bipart it e graph wit h | B | = | W | (resp. | B | = | W | + 1) is called h a m ilt o n ia n la cea ble if it has a hamilt onian pat h joining every pair of vert ices wit h diff erent colors (resp. joining every pair of black vert ices). St rong hamilt onian-laceability of a bipart it e graph wit h | B | = | W | was defined in [2]. We ext end t he not ion of st rong hamilt onian-laceability t o a bipart it e graph wit h faulty element s as follows. For any faulty set F such t hat | F | ≤ k , a bipart it e graph G which has an L op t -pat h b etween every pair of fault -free vert ices is called k - fa u lt s t ro n gly h a m ilt o n ia n - la cea ble . P m × P n , m , n ≥ 4, is hamilt onian-laceable[3], and P m × P n wit h f = f v ≤ 2 has an L op t -cycle when b ot h m and n are mult iples of four[5]. It has b een known in [6,8] t hat P m × C n , n ≥ 4 even, wit h one or less faulty element is hamilt onianlaceable. We will show in Sect ion 3 t hat P m × C n , n ≥ 4 even, is 1-fault st rongly hamilt onian-laceable, which is an ext ension of t he work in [6,8]. Moreover, we will show t hat P m × C n , n ≥ 4 even, has an L op t -cycle if f = 2 and f v ≥ 1. W hen f = f e = 2, it has a fault -free cycle of lengt h at least m n − 2, and has a hamilt onian cycle if m ≥ 3, n ≥ 6 even and two faulty edges are not incident t o a common vert ex of degree t hree. It has b een known in [4] t hat a non-bipart it e C m × C n is 1-fault hamilt onianconnect ed and 2-fault hamilt onian, and t hat a bipart it e C m × C n wit h one or less faulty element is hamilt onian-laceable. C m × C n wit h f = f v ≤ 4 has an L op t -cycle when b ot h m and n are mult iples of four[5]. We will show in Sect ion 4, by ut ilizing hamilt onian prop ert ies of faulty P m × C n , t hat a bipart it e C m × C n is 1-fault st rongly hamilt onian-laceable and has an L op t -cycle when f ≤ 2.
2
P re lim in a rie s
T he vert ex set V of P m × C n is { v ji | 1 ≤ i ≤ m , 1 ≤ j ≤ n } , and t he edge set E = E r ∪ E c , where E r = { ( v ji , v ji + 1 ) | 1 ≤ i ≤ m , 1 ≤ j < n } ∪ { ( v ni , v 1i ) | 1 ≤ i ≤ m } and E c = { ( v ji , v ji + 1 ) | 1 ≤ i < m , 1 ≤ j ≤ n } . An edge cont ained in E r is called a ro w ed ge , and an edge in E c is called a co lu m n ed ge . We denot e by R ( i ) and C ( j ) t he vert ices in row i and column j , resp ect ively. T hat is, R ( i ) = { v ji | 1 ≤ j ≤ n }
Fault -Hamilt onicity of P roduct Graph of P at h and Cycle
321
and C ( j ) = { v ji | 1 ≤ i ≤ m } . We let R ( i , i ′ ) = i ≤ k ≤ i R ( k ) if i ≤ i ′ ; ot herwise, ′ R ( i , i ′ ) = ∅ . Similarly, we let C ( j , j ′ ) = j ≤ k ≤ j C ( k ) if j ≤ j ; ot herwise, ′ i C ( j , j ) = ∅ . v j is a bla c k vert ex if i + j is even; ot herwise, it is a w h it e vert ex. In P m × C n , every pair of vert ices v and w in R ( i ) ∪ R ( m − i + 1) for each i , 1 ≤ i ≤ m , are s im ila r , t hat is, t here is an aut omorphism φ such t hat φ ( v ) = w . A pair of edges ( v , w ) and ( v ′ , w ′ ) are called s im ila r if t here is an aut omorphism ψ such t hat ψ ( v ) = v ′ and ψ ( w ) = w ′ . Any two row edges in { ( v , w ) | eit her v , w ∈ R ( i ) or v , w ∈ R ( m − i + 1) } are similar for each i , 1 ≤ i ≤ m , and any two column edges in { ( v , w ) | eit her v ∈ R ( i ) , w ∈ R ( i + 1) or v ∈ R ( m − i + 1) , w ∈ R ( m − i ) } are also similar for each i , 1 ≤ i ≤ m . We employ lemmas on hamilt onian prop ert ies of P m × P n and P m × C n . We call a vert ex in P m × P n a co r n e r v e r t e x if it is of degree two. ′
′
L e m m a 1 . [1 ] L e t G be a rec t a n gu la r gr id P m × P n , m , n ≥ 2. ( a ) I f m n is e v e n , t h e n G h a s a h a m ilt o n ia n pa t h fro m a n y co r n e r v e r t e x v t o a n y o t h e r v e r t e x w it h co lo r d iff e re n t fro m v . ( b) I f m n is od d , t h e n G h a s a h a m ilt o n ia n pa t h fro m a n y co r n e r v e r t e x v t o a n y o t h e r v e r t e x w it h t h e s a m e co lo r a s v .
L e m m a 2 . [8 ] ( a ) P m × C n , n ≥ 3 od d , is h a m ilt o n ia n - co n n ec t ed a n d 1- fa u lt h a m ilt o n ia n . ( b) P m × C n , n ≥ 4 e v e n , is 1- fa u lt h a m ilt o n ia n - la cea ble .
We denot e by H [v , w | X ] a hamilt onian pat h in G X − F joining a pair of vert ices v and w , if any, where G X is t he subgraph of G induced by a vert ex subset X . A pat h is represent ed as a sequence of vert ices. If G X − F is empty or has no hamilt onian pat h b etween v and w , H [v , w | X ] is an empty sequence. We let P and Q b e two vert ex-disjoint pat hs ( a 1 , a 2 , · · ·, a k ) and ( b1 , b2 , · · ·, bl ) on a graph G , resp ect ively, such t hat ( a i , b1 ) and ( a i + 1 , bl ) are edges in G . If we replace ( a i , a i + 1 ) wit h ( a i , b1 ) and ( a i + 1 , bl ), t hen P and Q are merged int o a single pat h ( a 1 , a 2 , · · ·, a i , b1 , b2 , · · ·, bl , a i + 1 , · · ·, a k ). We call such a replacement a m e rge of P and Q w.r.t . ( a i , b1 ) and ( a i + 1 , bl ). If P is a closed pat h (t hat is, a cycle), t he merge op erat ion result s in a single cycle. We denot e by V ( P ) t he set of vert ices on a pat h P .
3 3 .1
P m ×
P m ×
C n
w it h E v e n
C n
w it h O n e o r L e s s F a u lt y E le m e n t
n
≥
4
We will show, in t his sect ion, t hat P m × C n , n ≥ 4 even, is 1-fault st rongly hamilt onian-laceable. F irst of all, we are going t o show t hat P m × C n wit h a single faulty vert ex is st rongly hamilt onian-laceable by const ruct ing an L op t pat h P joining every pair of fault -free vert ices s and t . L e m m a 3 . P 2 × C n , n e v e n , w it h a s in gle fa u lt y v e r t e x is s t ro n gly h a m ilt o n ia n la cea ble . Fu r t h e r m o re , t h e re is a n L op t - pa t h jo in in g e v e r y pa ir o f v e r t ice s w h ic h pa s s e s t h ro u gh bo t h a n ed ge in G R (1) a n d a n ed ge in G R (2) .
322
J .-H. P ark and H.-C. Kim y
P roo f. W .l.o.g., we assume t hat t he faulty vert ex is v n1 . We let s = v ix and t = v j ,
1
2, and assume w.l.o.g. t hat i ≤ j . s, t ∈ B (see F ig. 1 (a)). P = ( H [s, v 12 | C (1, j − 1)], v n2 , H [v n2 − 1 , t | C ( j , n − 1)]). Not e t hat when j = n , H [v n2 − 1 , t | C ( j , n − 1)] is an empty sequence. T he exist ence of a nonempty H [s, v 12 | C (1, j − 1)] is due t o Lemma 1 (a). C ase 2 s, t ∈ W . F irst , let us consider t he case t hat i = 1. If j = i + 1 y (see F ig. 1 (b)), P = ( s, H [v ix− 1 , v 12 | C (1, i − 1)], v n2 , H [v n2 − 1 , v j + 1 | C ( j + 1, n − 1)], t ); ot herwise (see F ig. 1 (c)), P = ( H [s, v i3 − x | C ( i , j − 1)], H [v i3−− 1x , v 22 | C (2, i − y 1)], v 12 , v n2 , H [v n2 − 1 , v j + 1 | C ( j + 1, n − 1)], t ). For t he case t hat i = 1, P = ( s, H [v 22 , t | C (2, n − 1)]). C a s e 3 Eit her s ∈ B , t ∈ W or s ∈ W , t ∈ B . C ase 3.1 i = j . Let us consider t he case t hat j = n (see F ig. 1 (d)). Let P ′ b e a hamilt onian pat h joining s and t in G C ( i , j ) . P ′ passes t hrough b ot h edges ( v i1 , v i2 ) and ( v j1 , v j2 ) since P ′ passes t hrough one of t he two vert ices v i1 and v i2 (resp. v j1 and v j2 ) of degree 2 in G C ( i , j ) as an int ermediat e vert ex. Let Q ′ = H [v i1− 1 , v i2− 1 | C (1, i − 1)] and Q ′ ′ = H [v j1+ 1 , v j2+ 1 | C ( j + 1, n − 1)]. We let P ′ ′ b e a result ing pat h by a merge of P ′ and Q ′ w.r.t . ( v i1 , v i1− 1 ) and ( v i2 , v i2− 1 ) if Q ′ is not empty; ot herwise, let P ′ ′ = P ′ . If Q ′ ′ is empty, P ′ ′ is an L op t -pat h; ot herwise, by applying a merge of P ′ ′ and Q ′ ′ w.r.t . ( v j1 , v j1+ 1 ) and ( v j2 , v j2+ 1 ), we can get an L op t -pat h. Now, we consider t he case t hat j = n . If i = n − 1 (see F ig. 1 (e)), P = ( H [s, v n2 − 2 | C (1, n − 2)], v n2 − 1 , t ); ot herwise (see F ig. 1 (f)), P = ( H [s, v 22 | C (2, n − 1)], v 12 , t ). C ase 3.2 i = j . We first let i b e odd. W hen i = 1, n − 1 (see F ig. 1 (g)), P = ( v i1 , H [v i1− 1 , v 22 | C (2, i − 1)], v 12 , v n2 , H [v n2 − 1 , v i2+ 1 | C ( i + 1, n − 1)], v i2 ). W hen i = 1, P = H [v 11 , v 12 | C (1, n − 1)]. W hen i = n − 1, P = H [v n1 − 1 , v n2 − 1 | C (1, n − 1)]. For t he case t hat i is even (see F ig. 1 (h)), P = ( v i1 , H [v i1+ 1 , v n2 − 1 | C ( i + 1, n − 1)], v n2 , v 12 , H [v 22 , v i2− 1 | C (2, i − 1)], v i2 ). Unless eit her (i) n = 4 and s, t ∈ W , or (ii) n = 4 and s ∈ R (1) has a color diff erent from t ∈ R (1), any L op t -pat h passes t hrough a vert ex in R (1) and a vert ex in R (2) as int ermediat e vert ices, and t hus it passes t hrough b ot h an edge in G R (1) and an edge in G R (2) . For t he cases (i) and (ii), it is easy t o see t hat t he L op t -pat hs const ruct ed here (Case 2 and Case 3.1) always sat isfy t he condit ion. ⊓⊔ ≤
x, y
≤
C ase 1
L e m m a 4 . P m × C n , n e v e n , w it h a s in gle fa u lt y v e r t e x is s t ro n gly h a m ilt o n ia n la cea ble . Fu r t h e r m o re , t h e re is a n L op t - pa t h jo in in g e v e r y pa ir o f v e r t ice s w h ic h pa s s e s t h ro u gh bo t h a n ed ge in G R (1) a n d a n ed ge in G R ( m ) .
P roo f. T he proof is by induct ion on m . We consider t he case m ≥ 3 by Lemma 3. We assume w.l.o.g. t hat t he faulty vert ex v f is whit e and cont ained in G R (1, m − 1) due t o t he similarity of P m × C n discussed in Sect ion 2. C ase 1 s, t ∈ R (1, m − 1). We let P ′ b e an L op t -pat h joining s and t in G R (1, m − 1) which passes t hrough b ot h an edge in G R (1) and an edge ( x , y ) in G R ( m − 1) . A merge of P ′ and G R ( m ) − ( x ′ , y ′ ) w.r.t . ( x , x ′ ) and ( y , y ′ ) result s in an L op t -pat h P , where x ′ and y ′ are t he vert ices in R ( m ) adjacent t o
Fault -Hamilt onicity of P roduct Graph of P at h and Cycle
t s
(a)
s
t
s
s
s
t
(b)
(c)
s
t
(e)
t
(f) F ig. 1 .
323
t
(d)
s
s
t
t
(g)
(h)
Illust rat ion of t he proof of Lemma 3
x and y , resp ect ively. Obviously, P passes t hrough an edge in G R ( m ) as well as an edge in G R (1) . C a s e 2 s, t ∈ R ( m ). W hen s, t ∈ B (see F ig. 2 (a)) or s has a color diff erent from t (see F ig. 2 (b)), we choose s ′ and t ′ in R ( m ) which are not adjacent t o v f such t hat t here are two pat hs P ′ joining s and s ′ and P ′ ′ joining t ′ and t which sat isfy V ( P ′ ) ∩ V ( P ′ ′ ) = ∅ and V ( P ′ ) ∪ V ( P ′ ′ ) = R ( m ). W hen s, t ∈ W (see F ig. 2 (c)), we choose s ′ and t ′ in R ( m ) which are not adjacent t o v f such t hat t here are two pat hs P ′ joining s and s ′ and P ′ ′ joining t ′ and t which sat isfy V ( P ′ ) ∩ V ( P ′ ′ ) = ∅ , V ( P ′ ) ∪ V ( P ′ ′ ) ⊆ R ( m ), and | V ( P ′ ) ∪ V ( P ′ ′ ) | = n − 1. We let s ′ ′ and t ′ ′ b e t he vert ices in R ( m − 1) which are adjacent t o s ′ and t ′ , resp ect ively. Observe t hat s ′ ′ , t ′ ′ ∈ B if s, t ∈ B ; ot herwise, s ′ ′ has a color diff erent from t ′ ′ . P = ( P ′ , Q , P ′ ′ ) is a desired L op t -pat h, where Q is an L op t -pat h in G R (1, m − 1) joining s ′ ′ and t ′ ′ which sat isfies t he condit ion. C ase 3 s ∈ R (1, m − 1) and t ∈ R ( m ). W hen s, t ∈ B or s has a color diff erent from t (see F ig. 2 (d)), we choose t ′ in R ( m ) which is not adjacent t o s and v f such t hat t here is a pat h P ′ joining t ′ and t which sat isfies V ( P ′ ) = R ( m ). W hen s, t ∈ W , we choose t ′ in R ( m ) such t hat t here is a pat h P ′ joining t ′ and t which sat isfies V ( P ′ ) ⊆ R ( m ) and | V ( P ′ ) | = n − 1. We let t ′ ′ b e t he vert ex in R ( m − 1) which is adjacent t o t ′ . P = ( Q , P ′ ) is a desired L op t -pat h, where Q is an L op t -pat h in G R (1, m − 1) b etween s and t ′ ′ which sat isfies t he condit ion. ⊓⊔
t''
s'' s
s'
t
t'
t''
s''
t'
s'
(a)
s
(b) F ig. 2 .
t
t''
s''
t'
s s'
t''
s
t
(c)
t
t'
(d)
Illust rat ion of t he proof of Lemma 4
St rong hamilt onian-laceability of P m × C n , n ≥ 4 even, wit h a single faulty edge can b e shown by ut ilizing Lemma 4 as follows.
324
J .-H. P ark and H.-C. Kim
L e m m a 5 . Pm la cea ble .
C n , n e v e n , w it h a s in gle fa u lt y ed ge is s t ro n gly h a m ilt o n ia n -
×
P roo f. By Lemma 2 (b), P m × C n has a hamilt onian pat h b etween any two vert ices wit h diff erent colors. It remains t o show t hat t here is an L op t -pat h (of lengt h m n − 2) joining every pair of vert ices s and t wit h t he same color. Let ( x , y ) b e t he faulty edge. We assume w.l.o.g. t hat x is black and y is whit e. W hen s and t are black, we find an L op t -pat h P b etween s and t regarding y as a faulty vert ex by using Lemma 4. P does not pass t hrough ( x , y ) as well as y , and t he lengt h of P is m n − 2. T hus, P is a desired L op t -pat h. In a similar way, we can const ruct an L op t -pat h for a pair of whit e vert ices. ⊓⊔
We know, by Lemma 4 and Lemma 5, t hat P m × C n , n ≥ 4 even, wit h a single faulty element is st rongly hamilt onian-laceable, which implies t hat P m × C n wit hout faulty element s is also st rongly hamilt onian-laceable. T hus, we have t he following t heorem. T h e o r e m 1 . Pm
×
Cn , n
≥
4 e v e n , is 1- fa u lt s t ro n gly h a m ilt o n ia n - la cea ble .
C o r o l l a r y 1 . P m × C n , n ≥ 4 e v e n , h a s a h a m ilt o n ia n c y c le pa s s in g t h ro u gh a n y a r bit ra r y ed ge w h e n f = f e ≤ 1.
An m -dimensional hyp ercub e Q m has a spanning subgraph isomorphic t o C 2 m 1 . A recursive circulant G ( cd m , d ) wit h degree four or more has a spanning subgraph isomorphic t o P d × C cdm 1 . G ( cd m , d ) wit h degree four or more is bipart it e if and only if c is even and d is odd[7]. P2
×
−
−
C o r o l l a r y 2 . ( a ) A n m - d im e n s io n a l h y pe rc u be Q m , m ≥ 3, is 1- fa u lt s t ro n gly h a m ilt o n ia n - la cea ble . ( b) A bipa r t it e rec u r s iv e c irc u la n t G ( cd m , d ) w it h d egree fo u r o r m o re is 1- fa u lt s t ro n gly h a m ilt o n ia n - la cea ble .
3 .2
P m ×
C n
w it h T w o F a u lt y E le m e n t s
A bipart it e graph is called 2- v e r t e x - fa u lt L op t - c y c lic if it has an L op t -cycle when f = f v ≤ 2. L e m m a 6 . P2
×
Cn , n
≥
4 e v e n , is 2- v e r t e x - fa u lt L op t - c y c lic .
cient t o show t hat P 2 × C n has an L op t -cycle C when f = f v = 2 by T heorem 1. We assume w.l.o.g. t hat v n1 is faulty, and let v f b e t he faulty vert ex ot her t han v n1 . Let us consider t he case t hat v f ∈ B first . W hen v f = v i1 and i = 1 (see F ig. 3 (a)), C = ( H [v 12 , v i2− 1 | C (1, i − 1)], v i2 , H [v i2+ 1 , v n2 − 1 | C ( i + 1, n − 1)], v n2 ). W hen v f = v 11 , C = ( v 12 , H [v 22 , v n2 − 1 | C (2, n − 1)], v n2 ). W hen v f = v i2 and i = n (see F ig. 3 (b)), C = ( H [v 12 , v i1− 1 | C (1, i − 1)], v i1 , H [v i1+ 1 , v n2 − 1 | C ( i + 1, n − 1)], v n2 ). W hen v f = v n2 , C = H [v 11 , v 12 | C (1, n − 1)] + ( v 11 , v 12 ). Now, we consider t he case t hat v f ∈ W . W hen v f = v i1 (see F ig. 3 (c)), C = ( v 12 , H [v 22 , v i2− 1 | C (2, i − 1)], v i2 , H [v i2+ 1 , v n2 − 2 | C ( i + 1, n − 2)], v n2 − 1 , v n2 ). W hen v f = v i2 and i = 1, n − 1 (see F ig. 3 (d)), C = ( v 12 , H [v 22 , v i1− 1 | C (2, i − 1)], v i1 , H [v i1+ 1 , v n2 − 2 | C ( i + 1, n − 2)], v n2 − 1 , v n2 ). W hen v f = v 12 , C = H [v 21 , v 22 | C (2, n − 1)] + ( v 21 , v 22 ). W hen v f = v n2 − 1 , C = H [v 11 , v 12 | C (1, n − 2)] + ( v 11 , v 12 ). ⊓⊔ P roo f. It is suffi
Fault -Hamilt onicity of P roduct Graph of P at h and Cycle
(a)
(b)
×
(d)
Illust rat ion of t he proof of Lemma 6
F ig. 3 .
T h e o r e m 2 . Pm
(c)
325
Cn , n
≥
4 e v e n , is 2- v e r t e x - fa u lt L op t - c y c lic .
cient t o const ruct an L op t cycle C for t he case t hat m ≥ 3 and f = f v = 2. We assume w.l.o.g. t hat at most one faulty vert ex is cont ained in R (1) due t o t he similarity of P m × C n . C ase 1 T here is one faulty vert ex in R (1). We assume w.l.o.g. t hat v n1 is faulty, and let v f b e t he faulty vert ex ot her t han v n1 . W hen v f ∈ B (see F ig. 4 (a)), C = ( v 11 , v 21 , · · ·, v n1 − 1 , P ′ ), where P ′ is an L op t -pat h b etween v n2 − 1 and v 12 in G R (2, m ) . T he exist ence of P ′ is due t o T heorem 1. W hen v f ∈ W and v f = v 12 (see F ig. 4 (b)), C = ( v 11 , v 21 , · · ·, v n1 − 2 , P ′ ), where P ′ is an L op t -pat h b etween v n2 − 2 and v 12 in G R (2, m ) . W hen v f = v 12 (see F ig. 4 (c)), C = ( v 21 , v 31 , · · ·, v n1 − 1 , P ′ ), where P ′ is an L op t -pat h b etween v n2 − 1 and v 22 in G R (2, m ) . C ase 2 T here is no faulty vert ex in R (1). We let C ′ b e an L op t -cycle in G R (2, m ) . If C ′ passes t hrough an edge ( x , y ) in G R (2) , a merge of C ′ and G R (1) − ( x ′ , y ′ ) w.r.t . ( x , x ′ ) and ( y , y ′ ) result s in an L op t -cycle, where x ′ and y ′ are t he vert ices in R (1) adjacent t o x and y , resp ect ively. No such an edge ( x , y ) exist s only when n = 4 and a pair of vert ices wit h t he same color in R (2) are faulty. We consider t he case t hat n = 4 and two whit e vert ices are faulty. For m ≥ 4 (see F ig. 4 (d)), C = ( v 22 , v 21 , v 31 , v 41 , v 42 , P ′ ), where P ′ is an L op t -pat h in G R (3, m ) b etween v 43 and v 23 . For m = 3, C = ( v 22 , v 21 , v 31 , v 41 , v 42 , v 43 , v 33 , v 23 ). Similarly, we can const ruct an L op t -cycle for t he case t hat two black vert ices are faulty. ⊓⊔ P roo f. T he proof is by induct ion on m . We are suffi
(a)
(b) F ig. 4 .
(c)
(d)
Illust rat ion of t he proof of T heorem 2
A bipart it e graph is called 1- v e r t e x a n d 1- ed ge - fa u lt L op t - c y c lic if it has an ≤ 1 and f e ≤ 1.
L op t -cycle when f v T h e o r e m 3 . Pm
×
Cn , n
≥
4 e v e n , is 1- v e r t e x a n d 1- ed ge - fa u lt L op t - c y c lic .
326
J .-H. P ark and H.-C. Kim
P roo f. We consider t he case t hat f v = 1 and f e = 1 by T heorem 1. We let v f and ( x , y ) b e t he faulty vert ex and edge, resp ect ively. We assume w.l.o.g. t hat x has a color diff erent from v f . We find an L op t -cycle C regarding x (as well as v f ) as a faulty vert ex by using T heorem 2. C does not pass t hrough ( x , y ) and v f , and t he lengt h of C is m n − 2. T hus, C is a desired L op t -cycle. ⊓⊔
Cont rary t o T heorem 2 and 3, P m × C n , n ≥ 4 even, wit h two faulty edges does not always have an L op t -cycle since b ot h faulty edges may b e incident t o a common vert ex of degree 3. Not e t hat , when t here are no faulty vert ices, an L op t -cycle means a hamilt onian cycle. T here are some ot her fault pat t erns which prevent P m × C n from having a hamilt onian cycle. For example, P 2 × C n has no hamilt onian cycle if ( v n1 , v 11 ) and ( v 22 , v 32 ) are faulty (see F ig. 5 (a)): supp osing t hat t here is a hamilt onian cycle, a faulty edge ( v n1 , v 11 ) (resp. ( v 22 , v 32 )) forces ( v 11 , v 21 ) and ( v 11 , v 12 ) (resp. ( v 22 , v 12 ) and ( v 22 , v 21 )) t o b e included in t he hamilt onian cycle, which is imp ossible. Similarly, we can see t hat P m × C 4 has no hamilt onian cycle if ( v 21 , v 22 ) and ( v 41 , v 42 ) are faulty (see F ig. 5 (b)).
(a) F ig. 5 .
Nonhamilt onian
T h e o r e m 4 . Pm × C n , n o f le n gt h a t lea s t m n − 2.
≥
(b) P
m
×
C
n
wit h
f
=
f
e
= 2
4 e v e n , w it h t w o fa u lt y ed ge s h a s a fa u lt - free c y c le
P roo f. We let ( x , y ) and ( x ′ , y ′ ) b e t he faulty edges, and assume w.l.o.g. t hat x
and x ′ are black. We find an L op t -cycle C regarding x and y ′ as faulty vert ices by using T heorem 2. C does not pass t hrough ( x , y ) and ( x ′ , y ′ ) as well as x and y ′ , and t he lengt h of C is m n − 2, as required by t he t heorem. ⊓⊔ T h e o r e m 5 . P m × C n , m ≥ 3 a n d e v e n n ≥ 6, w it h t w o fa u lt y ed ge s h a s a h a m ilt o n ia n c y c le if bo t h fa u lt y ed ge s a re n o t in c id e n t t o a co m m o n v e r t e x o f d egree 3.
P roo f. T he proof is by induct ion on m . We let ef and e′f b e t he faulty edges,
and will const ruct a hamilt onian cycle C . C ase 1 ef , e′f ∈ G R (1) . We assume w.l.o.g. t hat ef = ( v n1 , v 11 ) and ′ 1 1 ef = ( v i , v i + 1 ). By assumpt ion, we have i = 1, n − 1. W hen i is even, C = ( H [v 1m , v im | C (1, i )], H [v im+ 1 , v nm | C ( i + 1, n )]). W hen b ot h i and m are odd, C = ( H [v 1m , v im | C (1, i )], H [v im+ 1 , v nm | C ( i + 1, n )]). T he exist ence of hamilt onian pat hs in G C (1, i ) and in G C ( i + 1, n ) is due t o Lemma 1 (b). W hen i is odd and m is even, C = ( H [v 1m , v im − 1 | C (1, i )], H [v im+ −1 1 , v nm | C ( i + 1, n )]).
Fault -Hamilt onicity of P roduct Graph of P at h and Cycle
327
G R (1) . W .l.o.g., we let ef = ( v n1 , v 11 ). By assumpt ion, b ot h and v n2 ) are fault -free. C = ( v 11 , v 21 , · · ·, v n1 , P ′ ), ′ where P is a hamilt onian pat h in G R (2, m ) b etween v n2 and v 12 due t o T heoC ase 2
ef
∈
G R (1) and e′f
( v 11 ,
v 12 )
∈
( v n1 ,
rem 1. C a s e 3 ef , e′f ∈ G R (1) . C a s e 3 . 1 T here is a faulty column edge joining a vert ex in R (1) and a vert ex
in R (2). T here exist s i such t hat b ot h ( v i1 , v i2 ) and ( v i1+ 1 , v i2+ 1 ) are fault -free since f e = 2 and n ≥ 6. C = ( H [v i1 , v i1+ 1 | R (1)], P ′ ), where P ′ is a hamilt onian pat h in G R (2, m ) b etween v i2+ 1 and v i2 . C ase 3.2 T here is no faulty column edge joining a vert ex in R (1) and a vert ex in R (2). F irst , we consider t he case t hat t here is a faulty edge in G R (2) . We assume w.l.o.g. t hat ef = ( v n2 , v 12 ). We find a hamilt onian pat h P ′ in G R (2, m ) b etween v n2 and v 12 regarding ef as a fault -free edge by using T heorem 1. Obviously, P ′ does not pass t hrough ef . T hus, we have a hamilt onian cycle C = ( H [v 11 , v n1 | R (1)], P ′ ). T he const ruct ion of a hamilt onian cycle for t he base case m = 3 is complet ed since t he case t hat t here is a faulty edge in G R (3) is reduced t o Case 1 and 2, and t he case t hat t here is a faulty edge joining a vert ex in R (2) and a vert ex in R (3) is reduced t o Case 3.1. T he remaining case is t hat m ≥ 4 and t here is no faulty edge in G R (1, 2) . T he faulty edges are cont ained in G R (2, m ) , and b ot h of t hem are not incident t o a common vert ex in R (2). T hat is, we have G R (2, m ) isomorphic t o P m − 1 × C n such t hat b ot h faulty edges are not incident t o a common vert ex of degree 3. T hus, we have a hamilt onian cycle C ′ in G R (2, m ) by t he induct ion hyp ot hesis. A merge of C ′ and G R (1) − ( x ′ , y ′ ) w.r.t . ( x , x ′ ) and ( y , y ′ ) result s in a hamilt onian cycle in P m × C n , where x and y are t he vert ices in R (2) such t hat ( x , y ) is an edge on C ′ , and x ′ and y ′ are t he vert ices in R (1) adjacent t o x and y , resp ect ively. T his complet es t he proof. ⊓⊔
4
C m ×
C n
w it h E v e n
m
and
n
Let us consider fault -hamilt onicity of a bipart it e C m × C n wit h m , n is bipart it e if and only if b ot h m and n are even.
≥
4. C m × C n
T h e o r e m 6 . ( a ) C m × C n , m a n d n e v e n , is 1- fa u lt s t ro n gly h a m ilt o n ia n la cea ble . ( b) C m × C n , m a n d n e v e n , is 2- fa u lt L op t - c y c lic .
P roo f. T he st at ement (a) is due t o T heorem 1. It is suffi
cient t o show t hat
C n wit h two faulty edges has a hamilt onian cycle by T heorem 2 and T heorem 3. C m × C n has a spanning subgraph isomorphic t o P m × C n or P n × C m which has at most one faulty edge. T hus, C m × C n has a hamilt onian cycle by Cm
×
Corollary 1.
5
⊓⊔
C o n c lu d in g R e m a rk s
We proved t hat P m × C n , n ≥ 4 even, is 1-fault st rongly hamilt onian-laceable, 2-vert ex-fault L op t -cyclic, 1-vert ex and 1-edge-fault L op t -cyclic. If t here are two
328
J .-H. P ark and H.-C. Kim
faulty edges, P m × C n has a fault -free cycle of lengt h at least m n − 2. It was also proved t hat P m × C n , m ≥ 3 and even n ≥ 6, is hamilt onian if b ot h faulty edges are not incident t o a common vert ex of degree 3. By employing fault hamilt onicity of P m × C n , we found t hat a bipart it e C m × C n is 1-fault st rongly hamilt onian-laceable and 2-fault L op t -cyclic.
R e fe re n c e s 1. C.C. Chen and N.F . Quimpo, “On st rongly hamilt onian abelian group graphs,” in. A u st r ali an C on fer en ce on C om bi n at or i al M at hem at i cs ( L ect u r e N ot es i n M at hem at i cs # 884) , pp. 23–34, 1980.
2. S.-Y. Hsieh, G.-H. Chen, and C.-W . Ho, “Hamilt onian-laceability of st ar graphs,” N et wor ks 3 6 ( 4 ) , pp. 225–232, 2000. 3. A. It ai, C.H. P apadimit riou, and J .L. Czwarcfit er, “Hamilt onian pat hs in grid graphs,” SI A M J . C om pu t . 1 1 ( 4 ) , pp. 676–686, 1982. 4. H.-C. Kim and J .-H. P ark, “Fault hamilt onicity of two-dimensional t orus networks,” in P r oc. of W or kshop on A lgor i t hm s an d C om pu t at i on W A A C ’ 00, Tokyo, J apan, pp. 110–117, 2000. 5. J .S. Kim, S.R. Maeng, and H. Yoon, “Embedding of rings in 2-D meshes and t ori wit h faulty nodes,” J ou r n al of Syst em s A r chi t ect u r e 4 3 , pp. 643–654, 1997. 6. M. Lewint er and W . W idulski, “Hyper-hamilt on laceable and cat erpillar-spannable product graphs,” C om pu t er s M at h. A ppli c. 3 4 ( 1 1 ) , pp. 99–104, 1997. 7. J .-H. P ark and K.Y. Chwa, “Recursive circulant s and t heir embeddings among hypercubes,” T heor et i cal C om pu t er Sci en ce 2 4 4 , pp. 35–62, 2000. 8. C.-H. T sai, J .M. Tan, Y.-C. Chuang, and L.-H. Hsu, “Fault -free cycles and links in faulty recursive circulant graphs,” in P r oc. of W or kshop on A lgor i t hm s an d T heor y of C om pu t at i on I C S2000 , pp. 74–77, 2000.
H ow t o O b t a in t h e C o m p le t e Lis t o f C a t e rp illa rs ( E x t e n d e d A b s t ra c t ) Yosuke K ikuchi, Hiroyuki Tanaka, Shin-ichi Nakano, and Yukio Shibat a Depart ment of Comput er Science, Gunma University, 1-5-1 Tenjin-cho, Kiryu, Gunma, 376-8515 J apan { kikuchi,hiroyuki,nakano,shibata} @msc.cs.gunma-u.ac.jp
We propose a simple algorit hm t o generat e all cat erpillars wit hout repet it ion. Also some ot her generat ion algorit hms are present ed. Our algorit hm generat es each cat erpillar in a const ant t ime per cat erpillar. A b st r a c t .
1
In t ro d u c t io n
T here are several st udies for enum erat ing graphs wit h som e prop ert ies [2,3,4,5,6, 8,10]. Such researches have b een accom plished by combinat orial m et hod. O n t he ot her hand, it was hard t o act ually generat e all graphs having som e prop ert ies, since t he numb er of such graphs is very huge in general. However, due t o t he im provem ent of t he p erform ance of com put ers in recent years, now it is p ossible t o generat e all such graphs, and various algorit hm s have b een invent ed for such generat ion problem s [1,7,9]. In t his pap er, we enum erat e all cat erpillars wit hout rep et it ion. T he cat erpillars form an im p ort ant sub class of t rees. T he st ruct ure of a cat erpillar is sim ple. W hereas cat erpillars have som e int erest ing prop ert ies. It is known t hat a t ree is an int erval graph if and only if t he t ree is a cat erpillar[11]. G enerat ing algorit hm s for t rees have b een st udied in m any researches. For exam ple, t he algorit hm in [1] generat es all root ed t rees, t he algorit hm in [12] generat es all (un-root ed) t rees, and t he algorit hm in [9] generat es all plane t rees. It is known t hat t he numb er of cat erpillars wit h n + 4 vert ices is 2 n + 2 ⌊ n / 2 ⌋ [5].
F ig. 1 .
Cat erpillars wit h 8 vert ices and diamet er 4.
In t his pap er, we give an algorit hm t o generat e all cat erpillars wit h n vert ices and diam et er d . F igure 1 shows all cat erpillars wit h eight vert ices and diam et er T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 329–338, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
330
Y. Kikuchi et al.
four. T hen, using t he algorit hm as a subrout ine we design an algorit hm t o generat e all cat erpillars wit h n vert ices. We also design an algorit hm t o generat e all “plane” cat erpillars. T hen, based on t he sam e idea, we design t wo m ore generat ing algorit hm s. We generat e all spiders and all scorpions, t hose are sub classes of t rees. T he rest of t he pap er is organized as follows. Sect ion 2 gives som e definit ion. In Sect ion 3, we give an algorit hm t o generat e all cat erpillars wit h n vert ices and diam et er d . In Sect ion 4, we im prove t he running t im e of t he algorit hm . In Sect ion 5, we give an algorit hm t o generat e all “plane” cat erpillars. In Sect ion 6 we give t wo algorit hm s t o generat e all spiders and all scorpions. F inally Sect ion 7 concludes t he pap er.
2
D e fi n it io n
Let G = ( V , E ) b e a sim ple graph wit h vert ex set V and edge set E . T he d egree of a vert ex v ∈ V , denot ed by d ( v ), is t he numb er of neighb ors of v in G . A pa t h is an ordered list of dist inct vert ices v 1 , v 2 , . . . , v n such t hat ( v i − 1 , v i ) is an edge for all 2 ≤ i ≤ n . We denot e a pat h wit h n vert ices P n . T he le n gt h of a pat h m eans t he numb er of edges in t he pat h. For t wo vert ices u and v in G , ℓ ( u , v ) is t he short est lengt h of pat hs b et ween u and v . For a vert ex u in G , t he ecce n t r i c i t y of u , denot ed by ecc( u ), is m ax v ∈ V ℓ ( u , v ). T he d i a m e t e r of G is m ax v ∈ V ecc( v ). A t ree is a connect ed graph wit hout cycles. A vert ex v in a t ree is a lea f if d ( v ) = 1. A t ree is a ca t e r p i l la r if rem oving all leaves rem ains a pat h. In t his pap er, we assum e t he numb er of vert ices in a cat erpillars is t hree or m ore. F igure 1 shows som e exam ples of cat erpillars. A leaf of a cat erpillar is called a f oo t , and an edge incident t o a foot is called a leg . G iven a cat erpillar C wit h diam et er d , we designat e one pat h wit h lengt h d , and call it t he ba c k bo n e of C . We denot e t he backb one by a sequence of vert ices, say P d = ( u 0 , u 1 , . . . , u d ). A s p i d e r is a t ree having at m ost one vert ex having degree m ore t han t wo[10]. See F igure 2(b). T he vert ex having degree m ore t han t wo is called t he bod y of t he spider. A pat h connect ing t he b ody and a leaf is called a leg . If all legs but p ossible except ion of one have lengt h at m ost t wo, t hen t he spider is called a s co r p i o n [10]. See F igure 2(c).
(a) F ig. 2 .
(b)
(c)
Illust rat ions of (a)a cat erpillar (b)a spider and (c)a scorpion.
How t o Obt ain t he Complet e List of Cat erpillars
3
331
G e n e ra t in g A ll C a t e rp illa rs w it h D ia m e t e r d
In t his sect ion, we give an algorit hm t o generat e all cat erpillars wit h n vert ices and diam et er d . Here, not e t hat , t he numb er of foot s in t hese cat erpillars is n − d + 1. F irst , we define a unique lab el sequence for each cat erpillar as follows. For a cat erpillar C wit h n vert ices and diam et er d , let P d = { u 0 , u 1 , . . . , u d } b e an arbit rary backb one in C . We call a vert ex in t he cat erpillar a cocoo n if t he vert ex is not in t he backb one. For each vert ex u i on P d , let l ( u i ) b e t he numb er of cocoons adjacent wit h u i . For each i we have l ( u i ) ≤ n − d − 1 since t he t ot al numb er of cocoons is n − d − 1. T hus l ( u 0 ) + l ( u 1 ) + · · ·+ l ( u d ) is also n − d − 1. For C we define it s lab el sequence L = ( l ( u 0 ), l ( u 1 ) , . . . , l ( u d ) ). For exam ple, for t he cat erpillar in F igure 2 (a), if we choose t he horizont al segm ent chain from left t o right as P d t hen we have L = (0 , 3 , 1 , 2 , 1 , 0), ot herwise if we choose P d in t he ot her direct ion t hen we have L = (0 , 1 , 2 , 1 , 3 , 0). By t he st ruct ure of a cat erpillar l ( u 0 ) = l ( u d ) = 0 always holds. So we ignore t hese t wo lab els. It is easy t o see t hat each cat erpillar has at m ost t wo lab el sequences, b ecause P d has t o include t he pat h consist ing of all vert ices wit h degree t wo or m ore, and we have only choice for it s direct ion. If a cat erpillar has t wo lab el sequences, t hen t hey are m irror-copy each ot her, so one sequence can b e derived from t he ot her by reversing. If a cat erpillar has only one lab el sequence, t hen t he lab el sequence is sym m et ric. For exam ple, we obt ain only L = (0 , 3 , 0) for t he cat erpillar at t he lower right side of F igure 1. For a lab el sequence L = ( l ( u 1 ) , l ( u 2 ) , . . . , l ( u d − 1 )), if l ( u i ) = l ( u d − i ) holds for each i = 1 , 2 , . . . , d − 1, t hen L is called a s y m m e t r i c lab el sequence. O t herwise let j b e t he m inimum int eger such t hat l ( u j ) = l ( u d − j ). If l ( u j ) > l ( u d − j ) t hen L is called a f o r w a rd lab el sequence, ot herwise called a ba c k w a rd lab el sequence. If a cat erpillar has t wo lab el sequences t hen we choose t he forward one for “t he” lab el sequence of t he cat erpillar. For exam ple, t he cat erpillar at t he lower left side of F igure 1 has t wo lab el sequences (3 , 0 , 0) and (0 , 0 , 3), t hen we choose (3 , 0 , 0) as it s lab el sequence. If t wo lab el sequences defined ab ove are dist inct , t hen corresp onding t wo cat erpillars are not isom orphic. So we have defined a unique lab el sequence for each cat erpillar. O ne can also observe t hat any lab el sequence corresp onds t o a cat erpillar wit h n vert ices and diam et er d if (i) it consist s of d − 1 lab els, (ii) each lab el is an int eger less t han n − d , (iii) t he sum of lab els is n − d − 1, and (iv) it is sym m et ric or forward. G iven d and n , we are going t o design an algorit hm t o generat e all lab el sequences corresp onding t o cat erpillars wit h n vert ices and diam et er d . O ur algorit hm regards t hese lab el sequences as ( n − d )-ary ( d − 1) digit numb ers, and generat es t hese lab el sequences in decreasing order. For exam ple, cat erpillars wit h eight vert ices and diam et er four corresp ond t o lab el sequences which are 4-ary 3 digit numb ers. We generat e such 4-ary 3 digit numb ers in decreasing order as follows:
332
Y. Kikuchi et al.
→
(3,0,0) (1,0,2)
→ →
(2,1,0) (0,3,0)
→ →
(2,0,1) (0,2,1)
→ →
(1,2,0) (0,1,2)
→ →
(1,1,1) (0,0,3).
T hese 4-ary 3 digit numb ers include four forward lab el sequences, t wo sym m et ric lab el sequences and four backward lab el sequences, and t hese four forward lab el sequences and t wo sym m et ric lab el sequences corresp ond t o six cat erpillars in F igure 1. We can easily count t he numb er of t hose lab el sequences ab ove. T hat equals t o t he t ot al numb er of division of ( n − d − 1) ident ical cocoons int o ( d − 1) ( n − d − 1) + ( d − 1) − 1 3+ 3− 1 lab eled p oint s. So t he numb er is = = ( d − 1) − 1 3− 1 10. However how can we act ually generat e all such lab el sequences? We can define t he successor of a lab el sequence ( c 1 , c 2 , · · ·, c d − 1 ) as follows. C a s e 1 : For som e i (1 ≤ i ≤ d − 2), t here exist s c i = 0. Let i = s b e t he m aximum index wit h c i = 0 and 1 ≤ i ≤ d − 2. T he successor of ( c 1 , c 2 , · · ·, c d − 1 ) is ( c 1 , c 2 , · · ·, c s − 1 , 1 + c d − 1 , 0 , 0 , · · ·, 0). C a s e 2 : c i = 0 for all i (1 ≤ i ≤ d − 2). ( c 1 , c 2 , · · ·, c d − 1 ) does not have t he successor and t he generat ion is com plet ed. At first , we choose t he lowest digit except for t he last digit wit h nonzero value and let it b e s -t h digit . If s = d − 2, t hat m eans t he digit c s is t he 2nd lowest digit , t hen decrease t he value of c s by one, and increase t he value of c d − 1 by one. If s < d − 2, t hen decrease t he value of c s by one, set c s + 1 = 1 + c d − 1 and set c d − 1 = 0. Not e t hat t he values of c s + 1 , c s + 2 , . . . , c d − 2 are all zero in t he given lab el sequence ( c 1 , c 2 , · · ·, c d − 1 ). For exam ple, t he successor of (1 , 2 , 3 , 4 , 5) is (1 , 2 , 3 , 3 , 6), t he successor of (1 , 2 , 3 , 0 , 2) is (1 , 2 , 2 , 3 , 0). If we out put only forward lab el sequences and sym m et ric lab el sequences am ong generat ed lab el sequences, t hen we can generat e all cat erpillars wit h n vert ices and diam et er d . We have t he following algorit hm . A l g o r i t h m g e n e r a t e - a l l - c a t e r p i l l a r s (d , n ) { G enerat e all ( n − d )-ary ( d − 1)digit numb ers such t hat t he sum of each digit is n − d − 1. } 1 init ialize ( c 1 , c 2 , · · ·, c d − 1 ) = ( n − d − 1 , 0 , 0 , · · ·, 0) and out put t his lab el sequence; 2 w h i l e ( c 1 , c 2 , · · ·, c d − 2 ) is not all zero; 3 d o { T he lab el sequence has t he successor. } 4 b e g in 5 Let i = s b e t he m aximum index wit h c i = 0 and 1 ≤ i ≤ d − 2; 6 if s = d − 2 7 t h e n decrease c d − 2 by one and increase c d − 1 by one; 8 e ls e { s > 2 } 9 t h e n decrease c s by one, set c s + 1 = 1 + c d − 1 , set c d − 1 = 0; 10 i f t he obt ained lab el sequence is forward or sym m et ric
How t o Obt ain t he Complet e List of Cat erpillars
11 12
333
t h e n out put t he lab el sequence; end
L e m m a 1 . T h e a lgo r i t h m ge n e ra t e s a l l ca t e r p i l la r s w i t h n v e r t i ce s a n d d i a m e t e r d . T h e a lgo r i t h m u s e s O ( d ) s pa ce i n t o t a l a n d r u n s i n O ( d
·
g ( n )) t i m e , w h e re
g ( n ) i s t h e t o t a l n u m be r o f ca t e r p i l la r s w i t h n v e r t i ce s a n d d i a m e t e r d .
P roo f . T his algorit hm up dat es t he lab el sequence consist ing of ( d − 1) lab els. We need at m ost a const ant am ount of m em ory except for t he “current ” lab el sequence, so it is clear t hat t he algorit hm needs O ( d ) space in t ot al. C om put at ion in line 2 and 5 in t he algorit hm can b e execut ed effi cient ly as follows. Here we need t o choose t he m aximum index i wit h c i = 0. By connect ing t he nonzero elem ent s am ong c 1 , c 2 · · ·, c s by a doubly linked list , (we can up dat e such a doubly linked list in O (1) t im e p er lab el sequence), line 2 and 5 can b e accom plished in O (1) t im e by checking t he last elem ent of t he doubly linked list . Line 7 and 9 t ake O (1) t im e. Not e t hat t he numb er of lab els t o b e up dat ed is at m ost t hree. Line 10 and 11 t ake O ( d ) t im e. T he algorit hm out put s m ore t han half of all generat ed lab el sequences, since t he numb er of forward lab el sequences is equal t o t he numb er of backward lab el sequences, and t he algorit hm out put s all forward lab el sequences and sym m et ric lab el sequences. T hus t he algorit hm runs in O ( d · g ( n )) t im e. ⊓⊔
4
Im p rov e m e n t
T he algorit hm in Sect ion 3 generat es all lab el sequences, t hose corresp ond t o ( n − d )-ary ( d − 1) digit numb ers such t hat t he sum of each digit is n − d − 1. T hen t he algorit hm checks whet her each generat ed lab el sequence is eit her forward, sym m et ric or backward, and out put s only forward or sym m et ric lab el sequences. T his check t akes O ( d ) t im e p er lab el sequence. However if we em ploy t he following dat a st ruct ure, t hen t his check can b e accom plished in only O (1) t im e. c1 c2 c3 c4 c5 c6 c7 c8 c9
c10 c11 c12 c13 c14 c15 c16 c17 c18
3
3
0
3
4
5
0
5
4
3
4
0
0
5
4
3
1
2
(a)
c1 c2 c3 c4 c5 c6 c7 c8 c9
c10 c11 c12 c13 c14 c15 c16 c17 c18
3
3
0
3
4
5
0
5
4
3
4
0
0
5
4
3
0
3
(b)
F ig. 3 .
T he dat a st ruct ure for effi cient running t ime.
334
Y. Kikuchi et al.
We m em orize all “sym m et ric pair”, t hat is a pair of leb els ( c i , c d − i ) having t he sam e value. See F igure 3, where such lab els are hat ched. T hen we connect consecut ive occurrence of such lab els by a doubly linked list , and also connect t he ext rem es of t hose doubly linked list s by a p oint er. W it h t he p oint ers we can decide in O (1) t im e t he current sequence is eit her forward, sym m et ric or backward. A lab el sequence L = ( c 1 , c 2 , · · ·, c d − 1 ) diff ers from it s successor at at m ost t hree lab els. T wo of t hese are consecut ive, t hose are c s and c s + 1 , and c s is decreased by one, and c s + 1 is set t o 1 + c d − 1 . E sp ecially, if s = d − 2, t hen c d − 1 b ecom es zero. Hence t he ab ove dat a st ruct ure can b e up dat ed in const ant t im e p er a lab el sequence. We have t he following lem m a. L e m m a 2 . T h e a lgo r i t h m u s e s O ( d ) s pa ce a n d r u n s i n O ( g ( n )) t i m e , w h e re g ( n ) i s t h e t o t a l n u m be r o f ca t e r p i l la r s w i t h n v e r t i ce s a n d d i a m e t e r d . S o t h e
a lgo r i t h m ge n e ra t e s ea c h ca t e r p i l la r i n O (1) t i m e pe r ca t e r p i l la r o n a v e ra ge .
T hen we im prove t he algorit hm m ore. How can we generat e only sym m et ric and forward lab el sequences, wit hout generat ing any backward lab el sequences? We need t o observe t he lab el sequences generat ed by t he algorit hm . Supp ose now t he algorit hm out put s forward or sym m et ric lab el sequence ′ ′ ′ ′ L = ( c 1 , c 2 , · · ·, c d − 1 ). Let L = ( c 1 , c 2 , · · ·, c d − 1 ) b e t he successor of L . If som e backward lab el sequence are generat ed aft er L consecut ively, t hen t hese lab el sequences should b e skipp ed wit hout out put . W hich lab el sequence should we out put aft er L ? Let L n e x t b e t he next lab el sequence t hat should b e out put aft er L. If c 1 = 0, t hen c d − 1 = 0 for all out put sequence aft er L , since we never out put backward lab el sequences. So, by rem oving t he first and t he last digit from t he current lab el sequence, we can reduce t he generat ing problem t o a generat ing problem wit h t wo fewer lab els. If t he first digit ’ s value b ecom es zero t hen we fix t he last digit ’ s value t o zero. By applying t his idea t o t he alg orit hm , we have t he following lab el sequences if n = 12 and d = 8. All backward lab el aequences are underlined.
→ → → → → → → → → → →
(3 , 0 , 0 , 0 , 0 , 0 , 0) (2 , 0 , 0 , 0 , 1 , 0 , 0) (1 , 1 , 1 , 0 , 0 , 0 , 0) (1 , 1 , 0 , 0 , 0 , 0 , 1) (1 , 0 , 1 , 0 , 0 , 1 , 0) (1 , 0 , 0 , 1 , 0 , 1 , 0) (1 , 0 , 0 , 0 , 1 , 0 , 1) (-, 2 , 1 , 0 , 0 , 0 , -) (-, 1 , 2 , 0 , 0 , 0 , -) (-, 1 , 0 , 2 , 0 , 0 , -) (-, 1 , 0 , 0 , 0 , 2 , -) (-, -, 1 , 2 , 0 , -, -)
→ → → → → → → → → → → →
(2 , 1 , 0 , 0 , 0 , 0 , 0) (2 , 0 , 0 , 0 , 0 , 1 , 0) (1 , 1 , 0 , 1 , 0 , 0 , 0) (1 , 0 , 2 , 0 , 0 , 0 , 0) (1 , 0 , 1 , 0 , 0 , 0 , 1) (1 , 0 , 0 , 1 , 0 , 0 , 1) (1 , 0 , 0 , 0 , 0 , 1 , 1) (-, 2 , 0 , 1 , 0 , 0 , -) (-, 1 , 1 , 1 , 0 , 0 , -) (-, 1 , 0 , 1 , 1 , 0 , -) (-, -, 3 , 0 , 0 , -, -) (-, -, 1 , 1 , 1 , -, -)
→ → → → → → → → → → → →
(2 , 0 , 1 , 0 , 0 , 0 , 0) (2 , 0 , 0 , 0 , 0 , 0 , 1) (1 , 1 , 0 , 0 , 1 , 0 , 0) (1 , 0 , 1 , 1 , 0 , 0 , 0) (1 , 0 , 0 , 2 , 0 , 0 , 0) (1 , 0 , 0 , 0 , 2 , 0 , 0) (1 , 0 , 0 , 0 , 0 , 0 , 2) (-, 2 , 0 , 0 , 1 , 0 , -) (-, 1 , 1 , 0 , 1 , 0 , -) (-, 1 , 0 , 1 , 0 , 1 , -) (-, -, 2 , 1 , 0 , -, -) (-, -, 1 , 0 , 2 , -, -)
→ → → → → → → → → → → →
(2 , 0 , 0 , 1 , 0 , 0 , 0) (1 , 2 , 0 , 0 , 0 , 0 , 0) (1 , 1 , 0 , 0 , 0 , 1 , 0) (1 , 0 , 1 , 0 , 1 , 0 , 0) (1 , 0 , 0 , 1 , 1 , 0 , 0) (1 , 0 , 0 , 0 , 1 , 1 , 0) (-, 3 , 0 , 0 , 0 , 0 , -) (-, 2 , 0 , 0 , 0 , 1 , -) (-, 1 , 1 , 0 , 0 , 1 , -) (-, 1 , 0 , 0 , 1 , 1 , -) (-, -, 2 , 0 , 1 , -, -) (-, -, -, 3 , -, -, -).
How t o Obt ain t he Complet e List of Cat erpillars
We apply t he idea ab ove t o our algorit hm . Let ′
′
L
′
′
′
= (c1 , c2 , ·
· ·,
cd − 1 )
335
be
t he successor of L . If L is a backward lab el sequence, t hen we should skip all ′ consecut ively generat ed backward lab el sequences aft er L and we need t o find t he next sym m et ric or forward lab el sequence L n e x t . W hen L is given, we can det erm ine L n e x t as follows. We have t hree cases. ′ ′ C a s e 1 : c1 = cd − 1 . We have t he following t hree sub cases. ′ C a s e 1 ( a ) : L is a sym m et ric lab el sequence. ′ ′ If L consist s of at m ost t wo lab els, t hen out put L and exit t he algorit hm . ′ O t herwise, set L n e x t = L . O t herwise, we m ay choose t he m inimum index ′
′
j
such t hat
′
cj
=
′
cd −
j
.
′
C a s e 1 ( b ) : cj < cd −
. Now L is a backward lab el sequence. If j = 2, t hen we choose t he m aximum index s such t hat 1 ≤ s ≤ d − 3 and ′ c s > 0. If s < d − 3 t hen we decrease c s by one, set c s + 1 = 1 + c d − 2 + c d − 1 , set c d − 2 and c d − 1 t o zero. T hus L n e x t = ( c 1 , c 2 , . . . , c s − 1 , 1 + c d − 2 + c d − 1 , 0 , . . . , 0). If s = 1 and c 1 = 1, t hen we rem ove t he first digit and t he last digit from L , and obt ain L n e x t = ( n − d − 1 , 0 , 0 , . . . , 0) having t wo fewer lab els. If s = d − 3 t hen L n e x t = ( c 1 , c 2 , . . . , c d − 3 − 1 , c d − 2 + c d − 1 + 1 , 0). Not e t hat by assum pt ion, t he first digit is not zero but t he last digit is always zero. So it m eans t hat t he derived lab el sequence is forward. ′ If j > 2 and c d − j > 0, t hen we choose t he m aximum index s such t hat 1 ≤ s ≤ j
′
3 and c s > 0, and decrease c s by one. Set c s + 1 = 1 + c s + 1 + c s + 2 + · · ·+ c d − 1 , and set c s + 2 = c s + 3 = · · · = c d − 1 = 0. T hus L n e x t = ( c 1 , c 2 , . . . , c s − 1 , 1 + c s + 1 + c s + 2 + · · · + c d − 1 , 0 , . . . , 0). Not e t hat by assum pt ion t he first digit is not zero, but t he last digit always b ecom es zero. ′ ′ ′ If j > 2 and c d − j = 0, t hen it cont radict s c j < c d − j . So t his case never occur. d
−
′
′
C a s e 1 ( c ) : cj > cd −
Set
L
n ex t
′
=
L
j
(T hus
′
L
is a forward lab el sequence.).
.
′
′
C a s e 2 : c1 > cd − 1 .
Set
L
n ex t
′
′
=
L
.
′
C a s e 3 : c1 < cd − 1 .
Since L is a sym m et ric or forward lab el sequence, c 1 = c d − 1 = c ′d − 1 − 1 and 0 < c 2 = c d − 2 = c ′d − 2 + 1. If t here exist s an index j such t hat c j = c d − j t hen we choose t he m inimum index j . T hen L is not sym m et ric and so L is forward and c j > c d − j holds. In t his case we const ruct L n e x t from L as follows. If j ≥ 3 t hen we choose t he m aximum index k such t hat 1 ≤ k ≤ d − j and c k = 0. T hen we decrease t he value of c k by one, and set 1 + c k + 1 = c k + 1 + c k + 2 + · · · + c d − 1 and set c k + 2 = c k + 3 = · · ·c d − 1 = 0. T hus L n e x t = ( c 1 , c 2 , . . . , c k − 1 , 1 + c k + 1 + c k + 2 + · · ·+ c d − 1 , 0 , . . . , 0) Not e t hat by assum pt ion t he value of t he first digit is not zero but t he value of t he last digit always b ecom es zero.
336
Y. Kikuchi et al.
O t herwise, t here is no index j such t hat c j = c d − j , so L is sym m et ric. T hen we choose t he m aximum index k such t hat 1 ≤ k ≤ d − 3 and c k = 0. We decrease t he value of c k by one, and set c k + 1 = c d − 2 + c d − 1 + 1 and c d − 2 = c d − 1 = 0. L e m m a 3 . U s i n g t h e a bo v e i d ea , a f t e r O ( d ) p re p roce s s i n g t i m e , o n e ca n ge n e r -
a t e ea c h ca t e r p i l la r i n O (1) t i m e . T h e a lgo r i t h m u s e s O ( d ) s pa ce i n t o t a l.
5
G e n e ra t in g O t h e r C la s s e s o f Tre e s
By execut ing t he algorit hm in Sect ion 4 for each value of diam et er k = 2 , 3 , · · ·, d , we generat e all cat erpillars wit h n vert ices. T he algorit hm generat es each cat erpillar in O (1) t im e. We can also generat e plane cat erpillars as follows. A plane graph is a graph wit h a fixed plane emb edding. In t his sect ion, t wo graphs are dist inct if t heir plane emb eddings are diff erent . For exam ple, t he four plane cat erpillars in F igure 4 are dist inct , alt hough t hey are isom orphic as cat erpillar.
F ig. 4 .
P lane cat erpillars corresponding t o t he same cat erpillars.
G iven a plane cat erpillar wit h n vert ices and diam et er d . We choose a pat h = ( u 0 , u 1 , . . . , u d ) wit h lengt h d as a backb one. For each u i (2 ≤ i ≤ d − 2) on P d , let ( u i − 1 , v 1 , v 2 , · · ·, v a ( i ) , u i + 1 , w 1 , w 2 , · · ·, w b ( i ) ) b e t he sequence of vert ices given when we list adjacent vert ices of u i clockwise, where v 1 , v 2 , · · ·, v a ( i ) and w 1 , w 2 , · · ·, w b ( i ) are adjacent cocoons of u i . Furt herm ore, let t he numb er of cocoons adjacent t o u 1 and u d − 1 b e c (1) and c ( d − 1), resp ect ively. Hence, for a plane cat erpillar wit h t he backb one P d , we can regard t he lab el sequence t o b e ( c (1) , a (2) , a (3) , · · ·, a ( d − 2) , c ( d − 1) , b(2) , b(3) · · ·, b( d − 2)). T here are t wo choices for P d and one of which is obt ained when we reverse t he ot her one. T hen for a plane cat erpillar, we can choose at m ost t wo lab el sequences. So t hese lab el sequences corresp ond t o ( n − d )-ary numb ers wit h 2 + ( d − 1)2 digit s wit h sum m at ion of values is n − d − 1. T herefore we can generat e plane cat erpillars in O (1) t im e p er cat erpillar by sim ilar way of t he algorit hm b efore. Pd
How t o Obt ain t he Complet e List of Cat erpillars
6
337
G e n e ra t in g S p id e rs a n d S c o rp io n s
In a sim ilar way t o generat e cat erpillars, we can const ruct algorit hm s t o generat e all spiders wit h n vert ices and all scorpions wit h n vert ices. We sket ch t hese algorit hm s as follows. At first we define a lab el sequence for each spider. Let v b e a b ody of t he spider and d ( v ) t he degree of t he b ody. Let L 1 , L 2 , . . . , L d ( v ) b e a set of legs. We denot e t he lengt h of each L i by l ( L i ). Here ( l ( L 1 ) − 1 , l ( L 2 ) − 1 , · · ,· l ( L d ( v ) ) − 1)) is t he lab el sequence corresp onding t o a spider. For exam ple, for a spider shown in F igure 2, we get t he lab el sequence by list ing six lab els 0 , 0 , 1 , 1 , 2 , 2 in any order. We can get (1 , 0 , 2 , 1 , 2 , 0), (2 , 2 , 1 , 1 , 0 , 0), (2 , 1 , 2 , 1 , 0 , 0) and so on. T hese lab el sequences can b e regarded as ( n − d )-ary d digit s numb ers wit h sum m at ion of values is n − d − 1. In order t o define a unique lab el sequence for each spider, we choose t he m aximum lab el sequence when we regard t hese lab el sequences as ( n − d )-ary d digit s numb ers. For exam ple, we choose (2 , 2 , 1 , 1 , 0 , 0) for t he spider in F igure 2. By generat ing such lab el sequences in decreasing order, we can generat e all spiders wit h n vert ices and t he degree of t he b ody is d ( v ). E sp ecially, if all legs, wit h t he p ossible except ion of one, have lengt h 2 or less, t hen t he spider is called a scorpion. We can also generat e all scorpions by slight ly m odifying t he algorit hm .
7
C o n c lu s io n
In t his pap er, we gave an algorit hm t o generat e all cat erpillars wit h n vert ices and diam et er d wit hout duplicat ions. O ur algorit hm generat es each cat erpillars in a const ant t im e p er cat erpillar. We also prop osed som e algorit hm s t o generat e ot her sub classes of t rees. How can we generat e all t rees wit h a given diam et er?
R e fe re n c e s 1. Beyer, T . and Hedet iniemi, S. M., Const ant T ime Generat ion of Root ed Trees, SI A M J . C om put . , 9 (1980) 706–712. 2. Biggs, N. L., Lloyd, E. K., W illson, R. J ., G r aph T heor y 1736-1936 , Clarendon P ress, Oxford (1976). 3. Chauve, C., Dulucq, S. and Rechnit zer, A., Enumerat ing Alt ernat ing Trees, J our n al of C om bi n at or i al T heor y, Ser i es A , 94 (2001) 142–151. 4. Chung, K.- L. and Yan, W .- M., On t he Number of Spanning Trees of a Mult iComplet e/ St ar Relat ed Graph, I n for m at i on P r ocessi n g L et t er s, 76 (2000) 113–119. 5. Harary, F . and Schwenk, A. J ., T he Number of Cat erpillars, D i scr et e M at hem at i cs, 6 (1973) 359–365. 6. Hasunuma, T . and Shibat a, Y., Count ing Small Cycles in Generalized de Bruijn Digraphs, N et wor ks, 29 (1997) 39–47.
338
Y. Kikuchi et al.
7. Li, Z. and Nakano, S., Effi cient Generat ion of P lane Triangulat ions wit hout Repet it ions, P r oc. of I C A L P 2001 , Lect ure Not es in Comp. Sci., 2079, (2001) 433–443. 8. Lonc, Z., P arol, K. and Wojciechowski, J . M., On t he Number of Spanning Trees in Direct ed Circulant Graphs, N et wor ks, 37 (2001) 129–133. 9. Nakano, S., Effi cient Generat ion of P lane Trees, I n for m at i on P r ocessi n g L et t er s, 84 (2002) 167–172. 10. Simone, C. D., Lucert ini, M., P allot t ino, S. and Simeone, B., Fair Dissect ions of Spiders, Worms, and Cat erpillars, N et wor ks, 20 (1990) 323–344. 11. West , D. B., I n t r oduct i on t o G r aph T heor y, Secon d E d. , P rent ice Hall, NJ (2001) 12. Wright , R. A., Richmond, B., Odlyzko, A. and Mckay, B. D., Const ant T ime Generat ion of Free Tree, SI A M J . C om put . , 15 (1986) 540–548.
R a n d o m iz e d A p p ro x im a t io n o f t h e S t a b le M a rria g e P ro b le m ⋆ Magn´u s Halld´orsson 1 , Kazuo Iwama 2 , and Shuichi Miyazaki3 , and Hiroki Yanagisawa 2 1
3
Science Inst it ut e, University of Iceland [email protected] 2 Graduat e School of Informat ics, Kyot o University Academic Cent er for Comput ing and Media St udies, Kyot o University, { iwama,shuichi,yanagis} @kuis.kyoto-u.ac.jp
W hile t he original st able marriage problem requires all part icipant s t o rank all members of t he opposit e sex in a st rict order, two nat ural variat ions are t o allow for incomplet e preference list s and t ies in t he preferences. Eit her variat ion is polynomially solvable, but it has recent ly been shown t o be NP -hard t o find a maximum cardinality st able mat ching when bot h of t he variat ions are allowed. It is easy t o see t hat t he size of any two st able mat chings diff er by at most a fact or of two, and so, an approximat ion algorit hm wit h a fact or two is t rivial. In t his paper, we give a first nont rivial result for t he approximat ion wit h fact or less t han two. Our randomized algorit hm achieves a fact or of 10/ 7 for a rest rict ed but st ill NP -hard case, where t ies occur in only men’ s list s, each man writ es at most one t ie, and t he lengt h of t ies is two. Furt hermore, we show t hat t hese rest rict ions except for t he last one can be removed wit hout increasing t he approximat ion rat io t oo much.
A b st r a c t .
1
In t ro d u c t io n
An inst ance of t he original stable m arriage problem ( S M ) [3] consist s of N men and N women, wit h each person having a preference list t hat t ot ally orders all members of t he opposit e sex. A man and a woman form a blockin g pair in a mat ching if bot h prefer each ot her t o t heir current part ners. A perfect mat ching is stable if it cont ains no blocking pair. T he st able marriage problem was first st udied by Gale and Shapley [1], who showed t hat every inst ance cont ains a st able mat ching, and gave an O ( N 2 )-t ime algorit hm t o find one. One nat ural relaxat ion is t o allow for indiff erence [3,6], in which each person is allowed t o include ties in his/ her preference. T his problem is denot ed by S M T (St able Marriage wit h T ies). When t ies are allowed, t he definit ion of st ability needs t o be ext ended. A man and a woman form a blocking pair if each strictly prefers t he ot her t o his/ her current part ner. A mat ching wit hout such a blocking pair is called weakly stable (or simply “st able”) and t he Gale-Shapley algorit hm
⋆
Support ed in part by Scient ific Research Grant , Minist ry of J apan, 13480081
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 339–350, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
340
M. Halld´orsson et al.
can be modified t o always find a weakly st able mat ching [3]. Anot her nat ural variat ion is t o allow part icipant s t o declare one or more unaccept able part ners. T hus each person’ s preference list may be incomplet e. We refer t o t his problem as S M I (St able Marriage wit h Incomplet e list s). Again, t he definit ion of a blocking pair is ext ended, so t hat each member of t he pair prefers t he ot her over t he current part ner or is current ly single and accept able. In t his case, a st able mat ching may not be a perfect mat ching, but all st able mat chings for a fixed SMI inst ance are of t he same size [2]. Hence, finding a maximum cardinality st able mat ching is t rivial. T he problem allowing for bot h relaxat ions, denot ed by S M T I (St able Marriage wit h T ies and Incomplet e list s), was recent ly st udied in [7,8,4] and it was shown t hat finding a maximum st able mat ching (denot ed by M A X S M T I ) is NP -hard. T his hardness result was furt her shown t o hold for t he rest rict ed case when all t ies occur only in one sex, and are of lengt h only two [8]. It is easy t o show t hat st able mat chings for any inst ance diff er in size by at most a fact or of two, since a st able mat ching is a maximal mat ching. Hence approximat ing MAX SMT I wit hin a fact or two is t rivial. However, t here is no known algorit hm whose approximat ion rat io is less t han two. Our goal in t his paper is t o approximat e MAX SMT I wit h a fact or of 2 − ǫ . It is int erest ing t o see t hat MIN SMT I (t he problem of finding a st able mat ching of m in im um size) is also NP -hard [8], for which no approximat ion algorit hms wit h a fact or of 2 − ǫ were known eit her. T his resembles t he sit uat ion for approximat ing a minimum maximal mat ching in a graph [10,5,9], which is in t urn relat ed t o approximat ing a minimum vert ex cover in a graph [5,9]. Whet her or not approximat ion wit h a fact or of 2 − ǫ is possible has long been open for bot h problems. T hese resemblances t o t he famous open problems is apparent ly a negat ive fact or t o our goal. However, SMT I has one good at t ribut e, namely, t he diffi culty of obt aining (good) solut ions can be convert ed t o t he diffi culty of breaking t ies in t he SMT I inst ance. More specifically, suppose t hat a given inst ance I of SMT I has st able mat chings of size dist ribut ing between s/ 2 and s . T hen for any st able mat ching M of size s ( s/ 2 ≤ s ≤ s ) for I , t here is an SMI inst ance I which has a st able mat ching M (also st able for t he original I ) of t he same size s . I can be obt ained by breaking t ies of I , and M can be obt ained from I in polynomial t ime. However, we do not know how t o break t ies; if we hit a good (bad, resp.) break, t hen we would obt ain a good (bad, resp.) st able mat ching whose size s is close t o s ( s/ 2, resp.). Recall t hat it appears hard t o hit eit her an ext remely good or an ext remely bad break. T herefore, a nat ural conject ure is t hat it would be easy t o hit an “int ermediat e” break. T he main purpose of t his paper is t o prove t hat t his conject ure is t rue. We give a randomized approximat ion algorit hm RandBrk whose expect ed approximat ion rat io is at most 10/ 7 ≈ 1. 429. RandBrk is ext remely simple; for a given SMT I inst ance I , we just break it s t ies uniformly at random and t hen obt ain a st able mat ching for t he result ing SMI inst ance using t he Gale-Shapley algorit hm. Unfort unat ely, however, t he rat io 10/ 7 is guarant eed only for a rest rict ed class of inst ances such t hat (i) t ies appear in only men’ s list s, (ii) each man writ es at ′
′
′
′
′
′
′
′
′
Randomized Approximat ion of t he St able Marriage P roblem
341
most one t ie, and (iii) t he lengt h of each t ie is two. (MAX SMT I is st ill NP -hard under t hese rest rict ions [8].) In t his paper, we present our analysis for a weaker bound of 5/ 3 ≈ 1. 667. For t he analysis for 10/ 7 which is almost t ight but quit e involved, we only show basic ideas. We also observe in Sec. 4 how result s change if we remove each of t he condit ions (i) t hrough (iii) above. We show t hat t he same approximat ion rat io is guarant eed wit hout condit ion (ii). If we remove (i) but rest rict t he number of t ies t o at most N (= t he number of men in a given inst ance), t he approximat ion rat io increases t o 7/ 4 = 1. 75, which is st ill bet t er t han two. However, if t he t hird condit ion is complet ely removed, t hen t here is a worst -case example for which t he approximat ion rat io of RandBrk becomes as bad as two. For a small const ant , say t hree, RandBrk appears t o work well but we cannot prove explicit bounds for it s approximat ion rat io, which is obviously a next t arget of t he research. T hroughout t his paper, inst ances cont ain equal number N of men and women. A goodness measure of an approximat ion algorit hm T of a maximizat ion problem is defined as usual: t he approxim ation ratio of T is t he maximum max{ opt ( x ) / T ( x ) } over all inst ances x of size N , where opt ( x ) ( T ( x )) is t he size of t he opt imal (algorit hm’ s) solut ion, respect ively.
2
A lg o rit h m R a n d B rk a n d It s P e rfo rm a n c e A n a ly s e s
Recall t hat our SMT I inst ances sat isfy t hree condit ions (i) t hrough (iii) ment ioned in t he previous sect ion. Algorit hm RandBrk, which receives such an inst ance Iˆ and produces a st able mat ching for Iˆ , consist s of t he following two st eps: St ep 1. For each man m who writ es a t ie in Iˆ , break t he t ie wit h equal probability, namely, if women w 1 and w 2 are t ied in m ’ s list , t hen w 1 precedes w 2 wit h probability 1/ 2, and vice versa. Let I be t he result ing SMI inst ance. St ep 2. Find a st able mat ching M for I by t he Gale-Shapley algorit hm and out put it . Since Gale-Shapley runs in det erminist ic polynomial t ime, RandBrk is a (randomized) polynomial t ime algorit hm. We already know several basic fact s about it s correct ness and performance. Let S denot e t he set of men who writ e a t ie in Iˆ and S M I ( Iˆ ) denot e t he set of 2 S diff erent SMI inst ances obt ained by breaking t ies in Iˆ (recall t hat t he lengt h of t ies is two). |
|
Le m m a 1 . [3] For an y I ∈ S M I ( Iˆ ) , an y stable m atchin g for I is also stable for Iˆ . ( N am ely R an dB rk outputs a feasible solution .) Le m m a 2 . [2,3] Let M 1 an d M 2 be arbitrary stable m atchin gs for the sam e S M I in stan ce. T hen ( i) | M 1 | = | M 2 | ( where | M | den otes the size of the m atchin g M ) an d ( ii) the set of m en ( wom en , resp.) m atched in M 1 is exactly the sam e as the set of m en ( wom en , resp.) m atched in M 2 .
342
M. Halld´orsson et al.
T hus t he performance of RandBrk depends only on St ep 1. By t his lemma, we can define cost ( I ) for an SMI inst ance I as t he (unique) size of st able mat chings for I . Also, let O P T ( Iˆ ) denot e t he size of a largest st able mat ching for SMT I inst ance Iˆ . Le m m a 3 . [8] ( i) T here exists I 1 ∈ S M I ( Iˆ ) such that cost ( I 1 ) = O P T ( Iˆ ) an d ( ii) for an y I 2 ∈ S M I ( Iˆ ) , cost ( I 2 ) ≥ O P T ( Iˆ ) / 2. ( T he reason for ( ii) is easy: S uppose that m an d w are m atched in a largest stable m atchin g for Iˆ . T hen at least on e of them has a partn er in an y stable m atchin g for I 2 . O therwise they are clearly a blockin g pair for that m atchin g.)
Hence t he approximat ion rat io of RandBrk apparent ly does not exceed two. It s t rue value, denot ed by C ost R B ( Iˆ ), is obt ained by calculat ing t he expect ed value for cost ( I ), namely, by calculat ing C ost R B ( Iˆ ) =
1 2S |
cost ( I ) .
|
I ∈
SM I
( Iˆ )
Here are some more not at ions and convent ions: Let us fix an arbit rary SMT I inst ance Iˆ . As defined above, S always denot es t he set of men whose preference list includes a t ie. Let I ∈ S M I ( Iˆ ) and m be a man. If m prefers w i t o w j in I , we writ e “ w i ≻ w j in m ’ s list ofI .” T his not at ion is also used in a woman’ s list . If t he inst ance I and/ or t he man m are clear from t he cont ext , we oft en omit t hem. Let m ∈ S , i.e., m writ es a t ie in Iˆ . T hen we oft en writ e “[w i w j ] in m ’ s list ofI ” t o show t hat women w i and w j are t ied in m ’ s list ofIˆ and t hat t he t ie is broken int o w i ≻ w j in I . Also, we frequent ly say t hat “flip t he t ie of a man m of I ” (alt hough I is an SMI inst ance), which means t hat we obt ain a new SMI inst ance I by changing [w i w j ] in m ’ s list ofI int o [w j w i ]. For SMI inst ances I 1 and I 2 , if I 1 is obt ained by flipping t he t ie of m of I 2 , t hen we writ e I 1 = f p ( I 2 , m ) (equivalent ly, I 2 = f p ( I 1 , m )). If a man (woman) has a part ner in a st able mat ching M , t hen he/ she is said t o be m atched in M , ot herwise, is said t o be sin gle . If m and w are mat ched in M , we writ e M ( m ) = w and M ( w ) = m . ′
2 .1
O v e rv ie w o f t h e A n a ly s is
To evaluat e C ost R B ( Iˆ ), we int roduce t he following determ in istic algorit hm called TreeGen. TreeGen accept s an SMI inst ance I ∈ S M I ( Iˆ ) and a subset A of S , and produces a binary t ree T . Each vert ex v of T is associat ed wit h some inst ance I in S M I ( Iˆ ) and a subset A of S . It should be not ed t hat t he int roduct ion of TreeGen is only for t he purpose of analysis; we are not int erest ed in act ually running it or ot her feat ures, such as it s t ime complexity (which is clearly exponent ial). ′
′
T r e e G e n ( I , A ) . (Given an SMI inst ance I and a subset A of men, const ruct a binary t ree T .) (1) Creat e a vert ex v whose label is ( I , A ). (2) If A = ∅ , ret urn v .
P ro c e d u re
⊆
S
Randomized Approximat ion of t he St able Marriage P roblem
343
(3) Else, select a man m , denot ed by f l i p ( v ), in A , and let T r eeG en ( I , A − { m } ) and T r eeG en ( f p ( I , m ) , A − { m } ) be t he left child and t he right child of v , respect ively. (How t o select f l i p ( v ) will be specified lat er.) We are int erest ed in t he behavior of TreeGen for t he special input ( I o p t , S ), where I o p t is an SMI inst ance in S M I ( Iˆ ) such t hat cost ( I o p t ) = O P T ( Iˆ ) (it s exist ence is due t o Lemma 3). T hen t he t ree T o p t generat ed by TreeGen from I o p t looks as follows: T he root is associat ed wit h I o p t , which can produce an opt imal st able mat ching M o p t of t he original Iˆ . Let v = ( I , A ) be a vert ex in T o p t . T hen, if we select a man m in A and if we go t o t he left child, t he associat ed inst ance does not change (and of course t he associat ed mat ching size does not change). However, if we go t o t he right child, t hen it s associat ed inst ance receives a single flip of m and it s mat ching size can decrease. In bot h cases, m is removed from A as a “t ouched” man. Now t he next lemma is import ant , which guarant ees t hat t he amount of loss in t he size of mat ching when we go t o t he right child is at most one. Le m m a 4 . [8] Let I 1 an d I 2 be in S M I ( Iˆ ) an d m ∗ be a m an in S such that I 1 = f p ( I 2 , m ∗ ) ( equivalen tly, I 2 = f p ( I 1 , m ∗ ) ) . A lso let M 1 an d M 2 be stable m atchin gs for I 1 an d I 2 , respectively. T hen | | M 2 | − | M 1 | | ≤ 1.
Our analysis uses TreeGen in t he following way: Not e t hat t he generat ed t ree T o p t has exact ly 2 S leaves. Let Γ be t he set of inst ances associat ed wit h t hose leaves. T hen one can see t hat Γ is exact ly t he same as t he set S M I ( Iˆ ). T herefore, C ost R B ( Iˆ ) is equal t o t he average value of cost ( I ) for all I ∈ Γ since RandBrk produces each inst ance in S M I ( Iˆ ) wit h equal probability. Let v = ( I , A ) be a vert ex of T o p t . T hen si z e( v ) is defined t o be t he size of a st able mat ching associat ed wit h v , namely, si z e( v ) = cost ( I ). Now we define av e( v ) as follows: (i) If v is a leaf (i.e., A = ∅ ), t hen av e( v ) = si z e( v ). (ii) Ot herwise, av e( v ) = 12 ( av e( l ( v )) + av e( r ( v ))), where l ( v ) (resp. r ( v )) is t he left child (resp. right child) of v . (We use t hese not at ions, l ( v ) and r ( v ), t hroughout t his paper.) T he following lemma is now immediat e: |
|
Le m m a 5 . Let v 0 be the root of T o p t . T hen av e( v 0 ) = C ost R B ( Iˆ ) .
T hus all we have t o do is t o evaluat e av e( v 0 ). Remember t hat T o p t has t he property t hat if we move t o t he left child, t hen t he size of t he st able mat ching is preserved and if we go t o t he right child, t hen t he size may decrease by one. T hen one might be curious about what kind of result can be obt ained for t he value of av e( v 0 ) if we assume t his worst case, i.e., if we always lose one when moving t o t he right . Unfort unat ely, t he result of t his analysis is very poor, or we can only guarant ee a half of t he size of t he maximum st able mat ching, which means t hat t he approximat ion rat io is as bad as two. Our basic idea t o avoid t his worst -case scenario is as follows: (i) If | S | (= t he number of t ies) is small compared t o σ = cost ( Iˆ ) = cost ( I o p t ), say | S | = σ / 2, t hen even t he above simple analysis guarant ees a (good) approximat ion rat io of 4/ 3. (Det ails are omit t ed, but t he following observat ion might help: If we always t raverse left sons, t hen t he pat h includes zero (losing-one) right edges. If we
344
M. Halld´orsson et al.
always t raverse right sons, t he pat h includes σ / 2 right edges. So if we t raverse “at random”, t he pat h would include σ / 4 right edges, which guarant ees a cost of σ − 41 σ = 34 σ or an approximat ion rat io of 4/ 3. If | S | is large, say | S | = σ , t hen t he “average pat h” can include σ / 2 right edges and we can only guarant ee a size of σ − 21 σ = 21 σ .) (ii) If | S | is relat ively large, t hen we can select a “good” man m as f l i p ( v ) in St ep (3) of TreeGen in t he following sense: If we flip t he t ie of m , t hen eit her we do not lose t he size of mat ching, or if we do lose t he size of mat ching t hen we can always select m in t he next round such t hat flipping his t ie does not make t he size decrease, due t o t he lemma below. For a vert ex v in T o p t , let h ei gh t ( v ) be t he height of v in T o p t . Not e t hat if t he label of v is ( I , A ), t hen h ei gh t ( v ) = | A | . ′
Le m m a 6 . Let v = ( I , A ) be an arbitrary vertex in T o p t such that h ei gh t ( v ) > si z e( v ) / 2. S uppose that for an y m an m ∈ A , selectin g m as f l i p ( v ) im plies that si z e( r ( v )) = si z e( v ) − 1. T hen there exist two m en m α an d m β in A such that si z e( l ( v )) = si z e( v ) , si z e( r ( v )) = si z e( v ) − 1, an d si z e( l ( r ( v ))) = si z e( r ( r ( v ))) = si z e( v ) − 1, by choosin g f l i p ( v ) = m α an d f l i p ( r ( v )) = m β . ( T he rightm ost fi gure in F ig. 1 shows how si z e( v ) chan ges by fl ippin g the ties of m α an d m β . S ee S ec. 2.2 for the proof.) v
v
v
0 ✁ ❆
☛ ✁
−1
❆❯
Case 1
0 ✁ ❆
☛ ✁
✁ 0 ❆ −1 ☛ ✁ ❆ ❯ 0 ✁ ❆ 0 ❆❯ ✁☛
v
❆❯
0
Case 2-(i) F ig. 1 .
0 ✁ ❆
+1
❆❯
☛ ✁
Case 2-(ii)
Case 2-(iii)
Each case of t he rule
Now we select m (= f l i p ( v )) in TreeGen by t he following rule (see Fig. 1): C a s e 1 . h ei gh t ( v ) ≤ si z e( v ) / 2. In t his case, set f l i p ( v ) t o be an arbit rary man in A . (In t his case, we assume t he worst case, i.e., t he size-decrease in every st ep.) C a s e 2 . h ei gh t ( v ) > si z e( v ) / 2. C a s e 2 -( i) : If t here exist s a man m ∈ A such t hat let t ing f l i p ( v ) = m makes si z e( r ( v )) = si z e( v ), t hen set f l i p ( v ) = m . C a s e 2 -( ii) : Ot herwise, if t here exist s a man m ∈ A such t hat let t ing f l i p ( v ) = m makes si z e( r ( v )) = si z e( v ) + 1, t hen set f l i p ( v ) = m . C a s e 2 -( iii) : Ot herwise, set f l i p ( v ) = m α and f l i p ( r ( v )) = m β whose exist ence is guarant eed by Lemma 6.
By t he above rule, we can obt ain t he following lemma whose proof is given in Sec. 2.3. Le m m a 7 . For an y n ode v in T o p t , av e( v )
≥
3 si z e( v ) . 5
By applying Lemma 7 t o t he root vert ex v 0 of T o p t , we have t hat av e( v 0 ) ≥ Since si z e( v 0 ) is t he opt imal cost and av e( v 0 ) (= C ost R B ( Iˆ ) by
3 si z e( v 0 ). 5
Randomized Approximat ion of t he St able Marriage P roblem
345
Lemma 5) is t he expect ed cost of RandBrk’ s out put , we have t he following t heorem. T h e o re m 1 . T he approxim ation ratio of A lgorithm R an dB rk is at m ost 2 .2
5 . 3
P ro o f o f Le m m a 6
By t he assumpt ion of t he lemma, si z e( r ( v )) = si z e( v ) − 1 no mat t er how we choose f l i p ( v ). Clearly, si z e( l ( v )) = si z e( v ) and si z e( l ( r ( v ))) = si z e( v ) − 1. We only need t o show t hat we can choose m α and m β t hat makes si z e( r ( r ( v ))) = si z e( v ) − 1. We need some preparat ions. Le m m a 8 . Let I 1 ∈ S M I ( Iˆ ) , [w i w j ] in m ∗ ’s list of I 1 , an d M 1 be a stable m atchin g for I 1 . Let I 2 = f p ( I 1 , m ∗ ) an d M 2 be a stable m atchin g for I 2 . If ∗ | M 1 | = | M 2 | then M 1 ( m ) = w i . P roof. Since | M 1 | = | M 2 | , M 1 is not st able in I 2 (ot herwise, | M 1 | = | M 2 | by
Lemma 2). So, t here is a blocking pair ( m , w ) for M 1 in I 2 . First of all, m must be m (ot herwise, ( m , w ) is also a blocking pair for M 1 in I 1 since t he preference list s of m and w are same in I 1 and I 2 , a cont radict ion). Secondly, m must not be single in M 1 (ot herwise, t he same cont radict ion as above). So, suppose t hat ( m , w ) is a blocking pair for M 1 in I 2 . T hen since ( m , w ) is a blocking pair in I 2 , we must have t hat w ≻ M 1 ( m ) in m ’ s list of I 2 . However, since ( m , w ) is not a blocking pair in I 1 , M 1 ( m ) ≻ w in m ’ s list of I 1 . Since I 1 and I 2 diff er only in [w i w j ] or [w j w i ] in m ’ s list , it follows t hat M 1 ( m ) = w i and w = wj . ⊓⊔ ∗
∗
∗
∗
∗
∗
∗
∗
∗
∗
∗
Le m m a 9 . Let I 1 , I 2 , M 1 , M 2 , m ∗ , w i , w j be the sam e as Lem m a 8. T hen | M 1 | = ∗ | M 2 | if ( i) m is sin gle in M 1 or ( ii) M 1 ( m ∗ ) = w i . P roof. T his is immediat e from t he previous lemma. ⊓⊔
Now we are ready t o prove Lemma 6. Consider a vert ex v = ( I , A ) in T o p t sat isfying t he assumpt ion of Lemma 6. Let M be an arbit rary st able mat ching for I . For an arbit rary man m i in A , let [w i a w i b ] in m i ’ s preference list in I . We claim t hat (1) M ( m i ) = w i a and (2) w i b is mat ched in M . P ro o f o f c la im ( 1 ) By t he assumpt ion of Lemma 6, set t ing f l i p ( v ) = m i makes si z e( r ( v )) = si z e( v ) − 1, namely, si z e( v ) = si z e( r ( v )). T hen Lemma 8 ⊓⊔ implies t hat M ( m i ) = w i a .
Suppose t hat w i b is single in M . Set f l i p ( v ) = m i and let I r (= f p ( I , m i )) be an SMI inst ance associat ed wit h r ( v ), a right child of v . Let M r be a st able mat ching for I r . Since we have assumed t hat | M r | = | M | − 1, M r ( w i b ) = m i by Lemma 8 (let I and I r be I 2 and I 1 in Lemma 8, respect ively). T hus w i b is mat ched in M r . Now, const ruct t he bipart it e graph G M , M r as follows (t he basic idea of t his proof is given in [8]): Each vert ex of G M , M r corresponds t o a person in I (or P ro o f o f c la im ( 2 )
346
M. Halld´orsson et al.
equivalent ly I r ). T here is an edge between m and w if and only if m and w are mat ched in exact ly one of M or M r . T hen t he degree of each vert ex is at most two. Hence any connect ed component (including at least one edge) of G M , M r is a simple pat h or a cycle. We first show t hat a connect ed component which does not cont ain m i is a cycle. Assume t hat t here is a pat h which does not cont ain m i , and suppose t hat t he pat h st art s from a man and ends wit h a woman. (For ot her cases, we can do a similar argument .) Now let t he pat h be m 1 , w 1 , m 2 , w 2 , · · ·, m k , w k . Assume t hat ( m 1 , w 1 ) , ( m 2 , w 2 ) , · · ·( m k , w k ) are couples in M and ( m 2 , w 1 ) , ( m 3 , w 2 ) , · · ·, ( m k , w k 1 ) are couples in M r . It should be not ed t hat preference list s of t hese persons are same in I and I r . Since m 1 is mat ched wit h w 1 in M , m 1 ’ s list cont ainsw 1 . T hen, m 2 ≻ m 1 in w 1 ’ s list , since ot herwise,m 1 (who is single in M r ) and w 1 form a blocking pair for M r . For t he same reason, w 2 ≻ w 1 in m 2 ’ s list . Cont inuing t his argument along wit h t he pat h, we have t hat w k ≻ w k 1 in m k ’ s list . Also, we can conclude t hat w k writ es m k in her list . T hen it follows t hat m k and w k form a blocking pair for M r in I r , which cont radict s t he st ability of M r . Hence, t here is only one pat h in G M , M r which cont ains m i . Recall t hat w i b is mat ched in M r but single in M . Hence t his pat h st art s from w i b , which means t he number of M r edges is great er t han or equal t o t he number of M edges in t his pat h. Since t hose numbers are equal in all t he ot her cycles, | M r | ≥ | M | , which cont radict s t he assumpt ion t hat | M r | = | M | − 1. ⊓ ⊔ −
−
T hus we have shown t hat for any man m i in A who has a t ie [w i a w i b ], M ( m i ) = w i a and w i b is mat ched in M . Now let us t ake anot her man m j in A who has a t ie [w j a w j b ]. We say t hat m i and m j are disjoint if { w i a , w i b } ∩ { w j a , w j b } = ∅ . Suppose t hat all pairs of m i and m j are disjoint . T hen since none of t hose w i a , w i b , w j a and w j b is single as proved above, t he mat ching size | M | (= si z e( v )) is at least 2 · |A | , which is equal t o 2 · h ei gh t ( v ). T his implies si z e( v ) ≥ 2 · h ei gh t ( v ), which cont radict s t he assumpt ion of t his lemma. Hence t here must be a pair of m i and m j t hat are not disjoint . Wit hout loss of generality, we consider t he following two cases: (1) w i b = w j a or (2) w i b = w j b . (Not e t hat w i a and w j a are mat ched in M wit h m i and m j , respect ively, namely, w i a = w j a .) C a s e ( 1 ) : In t his case, set f l i p ( v ) = m i and f l i p ( r ( v )) = m j . Let I r and I r r be
SMI inst ances associat ed wit h r ( v ) and r ( r ( v )), respect ively. Let M r and M r r be st able mat chings for I r and I r r , respect ively. By Lemma 8, M r ( m i ) = w i b (= w j a ). T his means t hat M r ( m j ) = w j a . Hence by Lemma 9, | M r r | = | M r | (= | M | − 1) as desired. C a s e ( 2 ) : For clarity, let w b denot e w i b (= w j b ). Wit hout loss of generality, suppose t hat m i ≻ m j in w b ’ s list . T hen we set f l i p ( v ) = m i and f l i p ( r ( v )) = m j . Let I r , I r r , M r and M r r be same as Case (1). Not e t hat , by Lemma 8, M r ( m i ) = w b . T hen it t urns out t hat M r is st able in I r r . (Reason: Assume t hat M r is st able in I r but not st able in I r r . An easy observat ion shows t hat t he blocking pair must be ( m j , w b ). However, M r ( m i ) = w b as ment ioned above. So
Randomized Approximat ion of t he St able Marriage P roblem
it is impossible t hat t his pair blocks M r in I r r because m i Hence | M r r | = | M r | by Lemma 2. 2 .3
≻
347
m j in w b ’ s list .) ⊓⊔
P ro o f o f Le m m a 7
We int roduce t he following funct ion f ( s, h ) for two int egers s and h ( s ≥ 0, h ≥ 9 3 s − 10 h , and for 0): For 0 ≤ h ≤ 2s , f ( s, h ) = s − h2 , for 2s < h ≤ s , f ( s, h ) = 10 3 h > s , f ( s, h ) = 5 s . Le m m a 1 0 . f ( s, h )
2
< h
≤
3 s. 5
h ≤ 2s , f ( s, h ) = s 9 3 s , f ( s, h ) = 10 s − 10 h =
P roof. If 0 s
≥
≤
h = 53 s + ( 25 s − h2 ) ≥ 2 3 3 s + 10 ( s − h ) ≥ 53 s . If h 5
−
Le m m a 1 1 . For an y vertex v in T o p t , av e( v )
≥
3 s 5
since 25 s ≥ 21 h . If > s , f ( s, h ) = 35 s . ⊓ ⊔
f ( si z e( v ) , h ei gh t ( v )) .
P roof. By t he definit ion of av e( v ), if v is a leaf of T o p t , t hen av e( v ) = si z e( v ), and if v is a non-leaf vert ex, t hen av e( v ) = 12 ( av e( l ( v )) + av e( r ( v ))). We will prove t he lemma by induct ion. First , suppose t hat v is a leaf of T o p t . T hen av e( v ) = si z e( v ) by definit ion. By t he definit ion of funct ion f , f ( si z e( v ) , h ei gh t ( v )) = f ( si z e( v ) , 0) = si z e( v ) − 20 = si z e( v ). Hence t he lemma is t rue. Next , consider a non-leaf vert ex v and assume t hat t he claim is t rue for all vert ices (except for v ) in t he subt ree root ed at v . We will show t hat t he lemma is t rue for v . We will consider four cases according t o t he rule in Sec. 2.1, which is used when v is expanded at St ep (3) of TreeGen:
C a s e 1 : Suppose t hat f l i p ( v ) is det ermined using Case 1 of Sec. 2.1. It can be seen t hat in t his case, si z e( l ( v )) = si z e( v ), si z e( r ( v )) ≥ si z e( v ) − 1 and h ei gh t ( l ( v )) = h ei gh t ( r ( v )) = h ei gh t ( v ) − 1. Also by induct ion hypot hesis, av e( l ( v )) ≥ f ( si z e( l ( v )), h ei gh t ( l ( v ))) and av e( r ( v )) ≥ f ( si z e( r ( v )), h ei gh t ( r ( v ))). Hence av e( v ) = 21 av e( l ( v )) + 21 av e( r ( v )) ≥ 12 f ( si z e( l ( v )), h ei gh t ( l ( v ))) + 21 f ( si z e( r ( v )), h ei gh t ( r ( v ))) = 12 f ( si z e( v ), h ei gh t ( v ) − 1) + 1 f ( si z e( r ( v )), h ei gh t ( v ) − 1). Since Case 1 is used, it must be t he case t hat 2 0 ≤ h ei gh t ( v ) ≤ s i z 2e ( v ) . T hus, 12 f ( si z e( v ), h ei gh t ( v ) − 1) + 21 f ( si z e( r ( v )), h ei gh t ( v ) − 1) = 21 ( si z e( v ) - 12 ( h ei gh t ( v ) − 1)) + 21 ( si z e( r ( v )) - 12 ( h ei gh t ( v ) − 1)) 1 h ei gh t ( v ) = f ( si z e( v ), h ei gh t ( v )). ≥ si z e( v ) 2
For Cases 2-(i), 2-(ii) and 2-(iii), we can do t he same argument as above, by t aking care of t he following fact s: Since Case 2 applies, h ei gh t ( v ) > si z e( v ) / 2. Furt hermore, we can show t hat if Case 2-(iii) is used t o v , t hen 12 si z e( v ) < h ei gh t ( v ) ≤ si z e( v ) for t he following reason: Suppose t hat h ei gh t ( v ) > si z e( v ). T hen, t here must be a man in A who is single in a st able mat ching for I but has an unt ouched t ie in his list , where v = ( I , A ). By Lemma 9 (i), we can select t his man as f l i p ( v ), result ing t hat si z e( r ( v )) = si z e( v ). T hus we must use Case 2-(i) for t his vert ex v , a cont radict ion. ⊓ ⊔ Now Lemma 7 is immediat e from t hese two lemmas. ⊓
⊔
348
2 .4
M. Halld´orsson et al.
E x t e n s io n t o a n U p p e r B o u n d o f 1 0 / 7
We can improve t he analysis in t he previous sect ion t o get a bet t er upper bound of 10/ 7, which is based on t he following observat ion. Recall t he following fact about t he binary t ree T o p t : In t he worst case, if we go t o t he right child, we always lose t he size of mat ching by one. However, in our analysis, we showed t hat t his is not always t he case: When h ei gh t ( v ) > si z e( v ) / 2, if we lose t he size by one by going t o t he right child, t hen we do not lose t he size in t he next st ep. We can st rengt hen Lemma 6 t o show t hat if we lose t he size by one when moving t o t he right child, t hen we do not lose t he size in t he n ext two steps or even n ext three steps . To achieve t his, however, we need t o be much more careful when select ing f l i p ( v ) by int roducing many diff erent cases, which is a key port ion of t he proof for t his st ronger bound.
3
L o w e r B o u n d fo r R a n d B rk
Here, we give an inst ance for which Algorit hm RandBrk gives approximat ion rat io of 32/ 23 ≈ 1. 391, which shows t hat our analysis is almost t ight . Consider t he following SMT I inst ance Iˆ . m 1: m 2: m 3: m 4:
w1 (w 2 w 1 ) (w 3 w 1 ) (w 4 w 3 )
w1: w2: w3: w4:
m2 m3 m1 m2 m4 m3 m4
T he largest st able mat ching for t his inst ance is of size 4 ( m i is mat ched wit h w i for 1 ≤ i ≤ 4). T here are eight SMI inst ances in S M I ( Iˆ ). T he size of st able mat ching for each of t hose eight inst ances is 4, 3, 3, 3, 3, 3, 2 and 2. Hence t he expect ed size is (4+ 3+ 3+ 3+ 3+ 3+ 2+ 2) / 8 = 23/ 8. Namely, t he approximat ion rat io is 32/ 23 for t his inst ance.
4
M o re G e n e ra l In s t a n c e s
Recall t hat we imposed t he following rest rict ions t o SMT I inst ances: (i) T ies appear only in men’ s list s, (ii) each man’ s list includes at most one t ie and (iii) t he lengt h of t ies is two. In t his sect ion, we analyze t he performance of RandBrk when some of t hese condit ions are removed. 4 .1
In s t a n c e s w it h T ie s in B o t h S id e s
If t ies appear in bot h men and women’ s list s, t he approximat ion rat io of RandBrk becomes worse. However, if t he number of people who writ e a t ie is not t oo large, t hen it is st ill bet t er t han two. In t his sect ion, we consider t he case t hat t he number of such people is N (recall t hat N is t he number of men in a given inst ance). Given an SMT I inst ance Iˆ , let S m and S w be t he set of men
Randomized Approximat ion of t he St able Marriage P roblem
349
and women, respect ively, who writ e a t ie in Iˆ . We const ruct a t ree T o p t by T r eeG en ( I o p t , S m ∪ S w ), where I o p t is t he same as before, i.e., an SMI inst ance corresponding t o a largest st able mat ching for Iˆ . We can prove t he following lemma similar t o Lemma 6. Le m m a 1 2 . Let v = ( I , A ) be an arbitrary vertex in T o p t such that h ei gh t ( v ) > 2 si z e( v ) . S uppose that for an y person p ∈ A , fl ippin g p im plies that si z e( r ( v )) = 3 si z e( v ) − 1. T hen there exists a pair of two person s p α an d p β in A such that si z e( l ( v )) = si z e( v ) , si z e( r ( v )) = si z e( v ) − 1, an d si z e( l ( r ( v ))) = si z e( r ( r ( v ))) = si z e( v ) − 1, by choosin g f l i p ( v ) = p α an d f l i p ( r ( v )) = p β . P roof ( sketch) . Since we assume t hat flipping p implies t hat si z e( r ( v )) = si z e( v ) − 1, people in A are all mat ched (see Lemma 9). Part it ion A int o A m and A w , where A m and A w are set s of men and women in A , respect ively. Wit hout loss of generality, assume t hat | A m | ≥ | A w | . Let W be t he mult iset of women who appear in A w , or in t he t ies of men in A m . T hen 3 3 |A | = h ei gh t ( v ) > si z e( v ). As we have discussed | W | = 2| A m | + | A w | ≥ 2 2 in t he claims (1) and (2) in Sec. 2.2, all women in W are mat ched. Hence at least one woman, say w , appears at least twice in W . If w appears in two men’ s
t ies, we can do t he same argument in Cases (1) and (2) of Sec. 2.2. So, assume t hat w appears in some man m ( ∈ A m )’ s t ie and in A w . Choose m and w as p α and p β , respect ively. Again, we can use an argument similar t o Sec. 2.2 t o complet e t he proof. ⊓ ⊔ We can obt ain 7/ 4 upper bound by modifying f ( s, h ) as follows: For 0 ≤ h ≤ 23 s , f ( s, h ) = s − h2 , for 32 s < h ≤ s , f ( s, h ) = 67 s − 27 h , and for h > s , f ( s, h ) = 74 s .
4 .2
M u lt ip le T ie s fo r E a ch M a n
T he upper bound does not change for t his generalizat ion. In t he previous analysis, each vert ex in T o p t is labeled wit h ( I , A ), where A is t he set of men whose preference list has not been t ouched yet . Here we generalize A t o be t he set of ties which have not been t ouched yet . T o p t is const ruct ed by T r eeG en ( I o p t , X ), where X is t he set of all t ies in Iˆ . At a vert ex v = ( I , A ), when select ing an element (a t ie, t his t ime) in A t o creat e two children l ( v ) and r ( v ) of v , we add t he following rule which has t he highest priority: If t here are two or more t ies in A which belong t o t he same man m , select a t ie which does not include M ( m ). We can apply t he above rule as long as t here are two or more t ies belonging t o t he same man. Suppose t hat we apply t he above rule t o v = ( I , A ). T hen, by Lemma 9 (i), we can guarant ee t hat si z e( l ( v )) = si z e( r ( v )) = si z e( v ), namely, we do not lose t he size even for t he right child. T hen it is not hard t o see t hat t his analysis gives t he same upper bound as before.
350
4 .3
M. Halld´orsson et al.
Lo n g e r T ie s
In t his sect ion, we show t hat t he performance of RandBrk becomes poor if we allow arbit rary lengt h of t ies. Consider t he following inst ance: m 1:
.. . mℓ − m ′1 :
(w 1 w 1 · · · w ℓ 1 ) .. . : 1 (w ℓ 1 w 1 · · · w ℓ 1 ) −
′
−
−
w1
.. .
1:
w ℓ′
′
−
′
.. .
m ′ℓ
′
′
w1:
m1
.. .
.. .
wℓ − 1: m ℓ − 1 w 1′ : m 1 · · · m ℓ
.. . −
1
w ℓ′
−
1
m ′1
−
1
m ′ℓ
.. .
−
1:
m1
· · ·m ℓ
−
1
It is not hard t o see t hat t here is a st able mat ching of size 2ℓ − 2 for t his example ( m 1 t o w 1 , m 2 t o w 2 , and so on). If we break t ies of men uniformly at random, t he expect ed size of a st able mat ching we obt ain is at most ℓ + log ℓ (det ails are omit t ed because of t he space const raint ). T he approximat ion rat io of RandBrk is t hen at least log ℓ 2ℓ − 2 . = 2− O ℓ + log ℓ ℓ
R e fe re n c e s 1. D. Gale and L. S. Shapley, “College admissions and t he st ability of marriage,” A m er . M at h. M on t hl y , Vol.69, pp.9–15, 1962. 2. D. Gale and M. Sot omayor, “Some remarks on t he st able mat ching problem,” D i scr et e A ppl i ed M at hem at i cs, Vol.11, pp.223–232, 1985. 3. D. Gusfield and R. W . Irving, “T he St able Marriage P roblem: St ruct ure and Algorit hms,” MIT P ress, Bost on, MA, 1989. 4. M. Halld´orsson, K. Iwama, S. Miyazaki and Y. Morit a, “Inapproximability Result s on St able Marriage P roblems,” P r oc. L A T I N 2002 , LNCS 2286, pp.554–568, 2002. 5. E. Halperin, “Improved approximat ion algorit hms for t he vert ex cover problem in graphs and hypergraphs,” P r oc. 11t h A n n . A C M - SI A M Sy m p. on D i scr et e A l gor i t hm s, pp. 329–337, 2000. 6. R. W . Irving, “St able marriage and indiff erence,” D i scr et e A ppl i ed M at hem at i cs, Vol.48, pp.261–272, 1994. 7. K. Iwama, D. Manlove, S. Miyazaki, and Y. Morit a, “St able marriage wit h incomplet e list s and t ies,” In P r oc. I C A L P ’ 99, LNCS 1644, pp. 443–452, 1999. 8. D. Manlove, R. W . Irving, K. Iwama, S. Miyazaki, Y. Morit a, “Hard variant s of st able marriage,” T heor et i cal C om pu t er Sci en ce, Vol. 276, Issue 1-2, pp. 261–279, 2002. 9. B. Monien and E. Speckenmeyer, “Ramsey numbers and an approximat ion algorit hm for t he vert ex cover problem,” A ct a I n f . , Vol. 22, pp. 115–123, 1985. 10. M. Yannakakis and F . Gavril,“Edge dominat ing set s in graphs,” SI A M J . A ppl . M at h. , Vol. 38, pp. 364–372, 1980.
T e t ris is H a rd , E v e n t o A p p rox im a t e Erik D. Demaine, Susan Hohenberger, and David Liben-Nowell Laborat ory for Comput er Science, Massachuset t s Inst it ut e of Technology 200 Technology Square, Cambridge, MA 02139, USA { edemaine,srhohen,dln} @theory.lcs.mit.edu
A b s t r a c t . In t he popular comput er game of T et r i s, t he player is given a sequence of t et romino pieces and must pack t hem int o a rect angular gameboard init ially occupied by a given configurat ion of filled squares; any complet ely filled row of t he gameboard is cleared and all pieces above it drop by one row. We prove t hat in t he offl ine version of Tet ris, it is N P -complet e t o maximize t he number of cleared rows, maximize t he number of t et rises (quadruples of rows simult aneously filled and cleared), minimize t he maximum height of an occupied square, or maximize t he number of pieces placed before t he game ends. We furt hermore show t he ext reme inapproximability of t he first and last of t hese ob ject ives t o wit hin a fact or of p 1− ε , when given a sequence of p pieces, and t he inapproximability of t he t hird ob ject ive t o wit hin a fact or of 2− ε , for any ε > 0. Our result s hold under several variat ions on t he rules of Tet ris, including diff erent models of rot at ion, limit at ions on player agility, and rest rict ed pieceset s.
1
In t ro d u c t io n
Tet ris [13] is a popular comput er game t hat was invent ed by mat hemat ician Alexey Pazhit nov in t he mid-1980s. By 1988, just a few years aft er it s invent ion, Tet ris was already t he best -selling game in t he Unit ed St at es and England. Over 50 million copies have been sold worldwide. (Incident ally, Sheff [12] gives a fascinat ing account of t he t angled legal debat e over t he profit s, ownership, and licensing of Tet ris.) In t his paper, we embark on t he st udy of t he comput at ional complexity of playing Tet ris. We consider t he offl in e version of Tet ris, in which t he sequence of pieces t hat will be dropped is specified in advance. Our main result is t hat playing offl ine Tet ris opt imally is N P -complet e, and furt hermore is highly inapproximable. T he gam e of T et ris. Concret ely, t he game of Tet ris is as follows. (We give precise
definit ions in Sect ion 2, and discuss some variant s on t hese definit ions in Sect ion 6.) We are given an init ial gam eboard , which is a rect angular grid wit h some gridsquares filled and some empty. (In typical Tet ris implement at ions, t he gameboard is 20-by-10, and “easy” levels have an init ially empty gameboard, while “hard” levels have non-empty init ial gameboards, usually wit h t he gridsquares below a cert ain row filled independent ly at random.) T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 351–363, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
352
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
A sequence of t et rom in oes —see Figure 1—is generat ed, typically probabilist ically; t he next piece appears in t he middle of t he t op row of t he gameboard. T he piece falls, and as it falls t he player can rot at e t he piece and slide it horizont ally. It st ops falling when it lands on a filled F i g . 1 . T he t et rominoes S q (“square”), gridsquare, t hough t he player has a final L G (“left gun”), R G (“right gun”), L S (“left snake”), R S (“right snake”), I , opport unity t o slide or rot at e it before it and T , wit h each piece’s cent er marked. st ops moving permanent ly. If, when t he piece comes t o rest , all gridsquares in an ent ire row h of t he gameboard are filled, row h is cleared : all rows above h fall one row lower, and t he t op row of t he gameboard is replaced by an ent irely unfilled row. As soon as a piece is fixed in place, t he next piece appears at t he t op of t he gameboard. To assist t he player, typically a one-piece lookahead is provided—when t he i t h piece begins falling, t he ident ity of t he ( i + 1)st piece is revealed. A player loses when a new piece is blocked from ent irely ent ering t he gameboard by filled gridsquares. Normally, t he player can never win a Tet ris game, since pieces cont inue t o be generat ed unt il t he player loses. T hus t he player’s ob ject ive is t o maximize his or her score (which increases as pieces are placed and as rows are cleared). O u r resu lt s. In t his paper, we int roduce t he nat ural full-informat ion (offl ine) version of Tet ris: we have a det erm in ist ic, fi n it e piece sequence, and t he player knows t he ident ity and order of all pieces t hat will be present ed. ( G am es M agazin e has posed several Tet ris puzzles based on t he offl ine game [9].) We st udy
t he offl ine version because it s hardness capt ures much of t he diffi culty of playing Tet ris; int uit ively, it is only easier t o play Tet ris wit h complet e knowledge of t he fut ure, so t he diffi culty of playing t he offl ine version suggest s t he diffi culty of playing t he online version. It also nat urally generalizes t he one-piece lookahead of implement ed versions of Tet ris. It is nat ural t o generalize t he Tet ris gameboard t o m -by-n , since a relat ively simple dynamic program solves t he m · n = O (1) case in t ime polynomial in t he number of pieces. Furt hermore, in an at t empt t o consider t he inherent diffi culty of t he game—and not any accident al diffi culty due t o t he limit ed react ion t ime of t he player—we init ially allow t he player an arbit rary number of shift s and rot at ions before t he current piece drops by one row. (We rest rict t o realist ic agility levels lat er.) In t his paper, we prove t hat it is N P -complet e t o opt imize any of several nat ural ob ject ive funct ions for Tet ris: (1) maximizing t he number of rows cleared while playing t he given piece sequence; (2) maximizing t he number of pieces placed before a loss occurs; (3) maximizing t he number of t imes a t et ris —t he simult aneous clearing of four rows—occurs; and (4) minimizing t he height of t he highest filled gridsquare over t he course of t he sequence. We also prove t he ext reme inapproximability of t he first two (and t he most nat ural) of t hese ob ject ive funct ions: given an init ial gameboard and a sequence of p pieces, for any const ant
Tet ris is Hard, Even t o Approximat e ε
353
> 0, it is N P -hard t o approximat e t o wit hin a fact or of p 1 ε t he maximum number of pieces t hat can be placed wit hout a loss, or t he maximum number of rows t hat can be cleared. We also show t hat it is N P -hard t o approximat e t he minimum height of t he highest filled gridsquare t o wit hin a fact or of 2 − ε . To prove t hese result s, we first show t hat t he cleared-row maximizat ion problem is N P -hard, and t hen give ext ensions of our reduct ion for t he remaining object ives. Our init ial proof of hardness proceeds by a reduct ion from 3-Partition, in which we are given a set S of 3s int egers and a bound T , and asked t o part it ion S int o s set s of t hree numbers each so t hat t he sum of t he numbers in each set is exact ly T . Int uit ively, we define an init ial gameboard t hat forces pieces t o be placed int o s piles, and give a sequence of pieces so t hat all of t he pieces associat ed wit h each int eger must be placed int o t he same pile. T he player can clear all rows of t he gameboard if and only if all s of t hese piles have t he same height . A key diffi culty in our reduct ion is t hat t here are only a const ant number of piece types, so any int erest ing component of a desired N P -hard problem inst ance must be encoded by a sequence of mult iple pieces. T he bulk of our proof of correct ness is devot ed t o showing t hat , despit e t he decoupled nat ure of a sequence of Tet ris pieces, t he only way t o possibly clear t he ent ire gameboard is t o place in a single pile all pieces associat ed wit h a part icular int eger. Our reduct ion is robust t o a wide variety of modificat ions t o t he rules of t he game. In part icular, our result s cont inue t o hold in t he following set t ings: (1) wit h rest rict ed player agility—allowing only two rot at ion/ t ranslat ion moves before each piece drops in height ; (2) under a wide variety of diff erent rot at ion models— including t he somewhat non-int uit ive model t hat we have observed in real Tet ris implement at ions; (3) wit hout any losses—i.e., wit h an infinit ely t all gameboard; and (4) when t he pieceset is rest rict ed t o { L G , L S , I , S q } or { R G , R S , I , S q } , plus at least one ot her piece. −
R elat ed work: T et ris. T his paper is, t o t he best of our knowledge, t he first
considerat ion of t he complexity of playing Tet ris. Kost reva and Hart man [10] consider Tet ris from a cont rol-t heoret ic perspect ive, using dynamic programming t o choose t he “opt imal” move, using a heurist ic measure of configurat ion quality. Ot her previous work has concent rat ed on t he possibility of a perpet u al lossavoidin g st rat egy in t he online, infinit e version of t he game. In ot her words, under what circumst ances can t he player be forced t o lose, and how quickly? Brzust owski [2] has charact erized all one-piece (and some two-piece) pieceset s for which t here are perpet ual loss-avoiding st rat egies. He has also shown t hat , if t he machine can adversarially choose t he next piece (following t he lookahead piece) in react ion t o t he player’ s moves, t hen t he machine can force an event ual loss using any pieceset cont aining { L S , R S } . Burgiel [3] has st rengt hened t his result , showing t hat an alt ernat ing sequence of L S ’ s and R S ’ s will event ually cause a loss in any gameboard of widt h 2n for odd n , regardless of t he player’ s st rat egy. T his implies t hat , if pieces are chosen independent ly at random wit h non-zero probability mass on bot h L S and R S , t here is a forced event ual loss wit h probability one.
354
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
Recent ly, Breukelaar, Hoogeboom, and Kost ers [1] have given a significant simplificat ion of our reduct ion and proof of t he N P -hardness of maximizing t he number of rows cleared in a Tet ris game. By using a more rest rict ive const ruct ion t o limit piece placement , t hey are able t o give a much short er proof t hat all pieces associat ed wit h a part icular int eger must be placed in t he same pile. (T hey have many fewer cases t o consider.) T he ext ensions t o our reduct ion t hat we present in Sect ions 4, 5, and 6 can also be applied t o t heir reduct ion t o achieve t he same result s regarding diff erent rules/ ob ject ives and inapproximability. R elat ed work: ot her gam es an d pu zzles. A number of ot her popular one-player
comput er games have recent ly been proven t o be N P -hard, most not ably t he game of Minesweeper [8]—or, more precisely, t he Minesweeper “consist ency” problem. See t he survey of t he first aut hor [4] for a summary of ot her games and puzzles t hat have been st udied from t he perspect ive of comput at ional complexity. T hese result s form t he emerging area of algorit hm ic com bin at orial gam e t heory , in which many new result s have been est ablished in t he past few years, e.g., Zwick’ s posit ive result s on opt imal st rat egies for t he two-player block-st acking game J en ga [14].
2
R u le s o f T e t ris
Here we rigorously define t he game of Tet ris, formalizing t he int uit ion of t he previous sect ion. For concret eness, we have chosen t o give very specific rules, but in fact t he remainder of t his paper is robust t o a variety of modificat ions t o t hese rules; in Sect ion 6, we will discuss some variat ions on t hese rules for which our result s st ill apply. T he gam eboard is a grid of m rows and n columns, indexed from bot t om-t ot op and left -t o-right . T he i , j t h gridsqu are is eit her u n fi lled ( open , u n occu pied ) or fi lled ( occu pied ). In a legal gameboard, no row is complet ely filled, and t here are no complet ely empty rows t hat lie below any filled gridsquare. When det ermining t he legality of cert ain moves, we consider all gridsquares out side t he gameboard as always-occupied sent inels. T he seven Tet ris pieces are exact ly t hose connect ed rect ilinear polygons t hat can be creat ed by assembling four 1-by-1 gridsquares. T he cen t er of each piece is shown in Figure 1. A piece st at e P = t , o, i , j , f consist s of: (1) a piece t y pe t ∈ { S q , L G , R G , L S , R S , I , T } ; (2) an orien t at ion o ∈ { 0 , 90 , 180 , 270 } , t he number of degrees clockwise from t he piece’ s base orien t at ion (shown in Figure 1); (3) a posit ion i , j ∈ { 1, . . . , m } × { 1, . . . n } of t he piece’ s cent er on t he gameboard; and (4) t he value f ∈ { fi xed , u n fi xed } , indicat ing whet her t he piece can cont inue t o move. (T he posit ion of a S q is t he locat ion of t he upper-left gridsquare of t he S q , since it s cent er falls on t he boundary of four gridsquares rat her t han in t he int erior of one.) In an in it ial piece st at e , t he piece is in it s base orient at ion, and t he init ial posit ion places t he highest gridsquares of t he piece int o row m , and t he cent er int o column ⌊ n / 2⌋ , and t he piece is unfixed. For now, rot at ions will follow t he in st an t an eou s rot at ion m odel. (We discuss ot her rot at ion models in Sect ion 6.) For a piece st at e P = t , o, i , j , u n fi xed , a ◦
◦
◦
◦
Tet ris is Hard, Even t o Approximat e
355
gameboard B , and a rot at ion angle θ = ± 90 , t he rot at ed piece st at e R ( P , θ , B ) is t , ( o + θ ) m o d 360 , i , j , u n fi xed as long as all t he gridsquares occupied by t he rot at ed piece are unoccupied in B ; if some of t hese gridsquares are full in B t hen R ( P , θ , B ) = P and t he rot at ion is illegal. ◦
◦
P lay in g t he gam e. No moves are legal for a piece P = t , o, i , j , fi xed . T he following moves are legal for a piece P = t , o, i , j , u n fi xed , wit h current gameboard B : (1) a rot at ion , result ing in t he piece st at e R ( P , ± 90 , B ); (2) a t ran slat ion , result ing in t he piece st at e t , o, i , j ± 1 , u n fi xed , if t he gridsquares adjacent t o P are open in B ; (3) a drop , result ing in t he piece st at e t , o, i − 1, j , u n fi xed , if all t he gridsquares beneat h P are open in B ; and (4) a fi x , result ing in t , o, i , j , fi xed , if at least one gridsquare below P is occupied in B . A t raject ory σ of a piece P is a sequence of legal moves st art ing from an init ial st at e and ending wit h a fix move. T he result of t his t ra ject ory on gameboard B is a new gameboard B , as follows: ◦
′
1. T he new gameboard B is init ially B wit h t he gridsquares of P filled. 2. If t he piece is fixed so t hat , for some row r , every gridsquare in row r of B is full, t hen row r is cleared . For each r ≥ r , replace row r of B by row r + 1 of B . Row m of B is an empty row. Mult iple rows may be cleared by t he fixing of a single piece. 3. If t he next piece’s init ial st at e is blocked in B , t he game ends and t he player loses . ′
′
′
′
′
′
′
′
′
For a gam e B 0 , P 1 , . . . , P p , a t raject ory sequ en ce Σ is a sequence B 0 , σ 1 , B 1 , . . . , σ p , B p so t hat , for each i , t he t ra ject ory σ i for piece P i on gameboard B i 1 result s in gameboard B i . However, if t here is a losing move σ q for some q ≤ p t hen t he sequence Σ t erminat es at B q inst ead of B p . −
T he T et ris problem . For concret eness, we will focus our at t ent ion on t he fol-
lowing Tetris problem: given a Tet ris game G = B , P 1 , P 2 , . . . , P p , does t here exist a t ra ject ory sequence Σ t hat clears t he ent ire gameboard of G ? (We will consider ot her Tet ris ob ject ives in Sect ion 4.) Membership of Tetris in N P follows st raight forwardly.
3
N P -C o m p le t e n e s s o f T e t ris
We define a mapping from inst ances of 3-Partition [7, p. 224] t o inst ances of Tetris. Recall t he 3-Partition problem: G iv e n : A sequence a 1 , . . . , a 3 s of non-negat ive int egers and a non-negat ive int e-
ger
, so t hat T / 4 < a i < T / 2 for all 1 ≤ i O u t p u t : Can { 1, . . . , 3s } be part it ioned int o t hat , for all 1 ≤ j ≤ s , we have i A j a i = T
∈
3s and so t hat s disjoint subset s T? ≤
3s ai i = 1
=
A 1, . . . , A
. so
sT s
We choose t o reduce from 3-Partition because it is N P -hard t o solve t his problem even if t he input s a i and T are provided in unary:
356
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
T h e o re m 1 ( G a re y a n d J o h n s o n [6 ]) . 3-Partition is st ron g sen se. ⊓ ⊔
N P -com plet e
in t he
Ì
× Ç
Given an arbit rary inst ance P = a 1 , . . . , a 3 s , T of 3-Partition, we will produce a Tet ris game G ( P ) whose gameboard can be complet ely cleared precisely if P is a “yes” inst ance. (For brevity, we omit some det ails; see [5].) T he init ial gameboard is shown in Figure 2. T he t opmost 3s + O (1) rows form an empty st aging area for rot at ions and t ranslat ions. Below, t here are s bu cket s , each six columns wide, corresponding t o t he set s A 1 , . . . , A s for t he inst ance of 3-Partition. Each bucket has unfilled n ot ches in it s fourt h and fift h columns in every sixt h row, beginººº ning in t he fift h row. T he first four rows of t he first and second columns in each bucket are init ially filled, and t he sixt h column of each bucket is ent irely filled. T he last t hree columns of t he gameboard form a lock , blocking access t o t he last column, which is unfilled in × all rows but t he second-highest . Unt il F i g . 2 . T he init ial gameboard for a Tet ris game mapped from an inst ance of 3- a piece is placed int o t he lock t o clear t he t op two rows, no lower rows can be Partition. cleared. T he piece sequence consist s of t he following sequence of pieces for each a 1 , . . . , a 3 s : one in it iat or I , L G , S q , t hen a i repet it ions of t he fi ller L G , L S , L G , L G , S q , and t hen one t erm in at or S q , S q . Aft er t he pieces associat ed wit h a 1 , . . . , a 3 s , we have t he following addit ional pieces: s successive I ’s, one R G , and 3T / 2 + 5 successive I ’s. (Wit hout loss of generality, we can assume T is even by mult iplying all input numbers by two.) T he Tetris inst ance G ( P ) has size polynomial in t he size of t he 3-Partition inst ance P , since a 1 , . . . , a 3 s and T are represent ed in unary, and can be const ruct ed in polynomial t ime.
F ig. 3 .
A valid sequence of moves wit hin a bucket .
Tet ris is Hard, Even t o Approximat e
357
L e m m a 2 ( C o m p le t e n e s s ) . For an y “y es” in st an ce P of 3-Partition, t here is a t raject ory sequ en ce Σ t hat clears t he en t ire gam eboard of G ( P ) wit hou t t riggerin g a loss. P roof. In Figure 3, we show how t o place all of t he pieces associat ed wit h t he
number a i in a bucket . Since P is a “yes” inst ance, t here is a part it ioning of a i = T . P lace all pieces asso{ 1, . . . , 3s } int o set s A 1 , . . . , A s so t hat i A j ciat ed wit h each i ∈ A j int o t he j t h bucket of t he gameboard. T his yields a configurat ion in which only t he last four rows of t he t hird column of each bucket are unfilled. Next we place one of t he s successive I ’s int o each bucket , and t he R G int o t he lock; t he first two rows are t hen cleared. Finally, we place t he 3T / 2 + 5 successive I ’s int o t he last column. Each of t he I ’s clears four rows; in t ot al, t his clears t he ent ire gameboard. ⊓ ⊔ ∈
T he proof of soundness is somewhat more involved; here we give a high-level summary and some suggest ive det ails only. Call a t ra ject ory sequence valid if it complet ely clears t he gameboard of G ( P ), and call a bucket u n fi llable if it is impossible t o fill all of t he empty gridsquares in it using arbit rarily many pieces from t he set { L G , L S , S q , I } . Also, we say t hat a configurat ion wit h all bucket s as in Figure 4 is u n prepped . P ro p o s it io n 3 . I n an y valid t raject ory sequ en ce:
F ig. 4 .
Unprepped bucket s.
1. n o gridsqu are above row 6T + 22 is ever fi lled; 2. all gridsqu ares of all pieces precedin g t he R G m u st all be placed in t o bu cket s, fi llin g all em pt y bu cket gridsqu ares; 3. n o rows are cleared before t he R G in t he sequ en ce; 4. all gridsqu ares of all pieces st art in g wit h ( an d in clu din g) t he R G m u st be placed in t o t he lock colu m n s, fi llin g all em pt y lock gridsqu ares; 5. n o con fi gu rat ion wit h an u n fi llable bu cket arises. 6. in an u n prepped con fi gu rat ion , all pieces in t he sequ en ce I , L G , S q , r × L G , L S , L G , L G , S q , S q , S q , for an y r ≥ 1, m u st be placed in t o a sin gle bu cket , y ieldin g an u n prepped con fi gu rat ion . P roof. For (1), t here are only enough pieces t o fill and clear t he gameboard if
every filled gridsquare (from t he init ial gameboard or from pieces in t he sequence) is placed int o t he lowest 6T + 22 rows. For (2) and (3), placing any piece ot her t han R G as t he first piece t o ent er t he lock columns violat es (1), and no row can be cleared unt il some piece ent ers t he lock. We have (4) from (1,2) and t he fact t hat t here are exact ly as many gridsquares following t he R G as t here are empty gridsquares in t he lock columns. Finally, (5) follows immediat ely from (2,3). T he (t edious) det ails for (6) can be found in [5]; here we give a high-level overview. Call a t ra ject ory sequence deviat in g if it does not place all t he pieces int o t he same bucket t o yield an unprepped configurat ion. We first cat alogue t en diff erent classes of bucket s t hat we show t o be unfillable. (For example, a bucket wit h a disconnect ed region of unfilled gridsquares is unfillable.) We t hen
358
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
exhaust ively consider t he t ree of all possible placement s of t he pieces in t he given sequence int o t he gameboard, and show t hat an unfillable bucket is produced by every deviat ing t ra ject ory sequence. T he overwhelming ma jority of deviat ing t ra ject ory sequences creat e an unfillable bucket wit h t heir first deviat ing move, while some do not creat e an unfillable bucket unt il up t o five pieces lat er. ⊓ ⊔ L e m m a 4 ( S o u n d n e s s ) . I f t here is a valid t raject ory sequ en ce for P is a “y es” in st an ce of 3-Partition.
( ) , t hen
G P
P roof. If t here is a valid st rat egy for
G ( P ), t hen by P roposit ion 3.2, t here is a way of placing all pieces preceding t he R G t o exact ly fill t he bucket s. By P roposit ion 3.6, we must place all of t he pieces associat ed wit h a i int o t he same bucket ; by P roposit ion 3.1, we must have exact ly t he same number of filled gridsquares in each bucket . Define A j := { i : all t he pieces associat ed wit h a i are placed int o bucket j } . T he t ot al number of gridsquares placed int o each bucket is t he same; because every a i ∈ ( T / 4, T / 2), we have t hat each | A j | = 3. T hus t he A j ’s form a legal 3-part it ion, and P is a “yes” inst ance. ⊓ ⊔
T h e o re m 5 . M axim izin g t he n u m ber of rows cleared in a T et ris gam e is com plet e. ⊓⊔
4
NP-
N P -H a rd n e s s fo r O t h e r O b je c t iv e s
In t his sect ion, we sket ch reduct ions ext ending t hat of Sect ion 3 t o est ablish t he hardness of opt imizing several ot her nat ural Tet ris ob ject ives. It is easy t o confirm t hat Tetris remains in N P for all ob ject ives considered below. T h e o re m 6 . M axim izin g t he n u m ber of t et rises ( t he n u m ber of t im es t hat fou r rows are cleared sim u lt an eou sly ) in a T et ris gam e is N P -com plet e. P roof. Our gameboard, shown in Figure 5, is augment ed wit h four new bot t om
rows t hat are full in all but t he sixt h column. We append a single I t o our previous piece sequence. For a “yes” inst ance of 3-Partition, (6T + 20) / 4 + 1 t et rises are achievable. For a “no” inst ance, we cannot clear t he t op 6T + 22 rows using t he original pieces and t hus we clear at most 6T + 22 t ot al rows. T his implies t hat t here were at most (6T + 20) / 4 < (6T + 20) / 4 + 1 t et rises. (Recall T is even.) T herefore we can achieve (6T + 24) / 4 t et rises exact ly when t he t op 6T + 22 rows exact ly when t he 3-Partition inst ance is a “yes” inst ance. ⊓⊔
Gameboard for t he hardness of maximizing t et rises. F ig. 5 .
A diff erent type of ob ject ive—considered by Brzust owski [2] and Burgiel [3], for example—is t hat of su rvival. How many pieces can be placed before a loss must occur? Our original reduct ion yields some init ial int uit ion on t he hardness
Tet ris is Hard, Even t o Approximat e
359
of maximizing lifet ime. In t he “yes” case of 3-Partition, t here is a t ra ject ory sequence t hat fills no gridsquares above t he (6T + 22)nd row, while in t he “no” case we must fill some gridsquare in t he (6T + 23)rd row: T h e o re m 7 . M in im izin g t he m axim u m height of a fi lled gridsqu are in a T et ris gam e is N P -com plet e. ⊓ ⊔
However, t his does not imply t he hardness of maximizing t he number of pieces t hat can be placed wit hout losing, because T heorem 7 only applies for cert ain height s—and, in part icular, does not apply for height m , because t he t raject ory sequence from Lemma 2 requires space above t he (6T + 22)nd row for rot at ions and t ranslat ions. To show t he hardness of maximizing survival t ime, we need t o do some more work. T h e o re m 8 . M axim izin g t he n u m ber of pieces placed wit hou t losin g is N P -com plet e. P roof. We augment our previous reduct ion as shown in Figure 6. We have creat ed a large reservoir of r rows filled only in t he first column, and a second lock in four new columns, which pre-
F ig. 6 .
Gameboard for hard-
vent s access t o t he reservoir unt il all t he t op rows ness of maximizing survival are cleared. We append t o our piece sequence a t ime. single R G (t o open t he lock) and enough S q ’s t o complet ely fill t he reservoir. Choose r so t hat t he unfilled area R of t he reservoir is more t han twice t he t ot al area A of t he remainder of t he gameboard. Observe t hat t he gameboard has odd widt h, so t he unfilled block of t he reservoir has even widt h. In t he “yes” case of 3-Partition, we can clear t he t op part of t he gameboard as before, t hen open t he lock using t he R G , and t hen complet ely fill and clear t he reservoir using t he S q ’s. In t he “no” case, we cannot ent irely clear t he t op part , and t hus cannot unlock t he reservoir wit h t he R G . No number of t he S q ’s can ever subsequent ly clear t he lower lock row. We claim t hat a loss will occur before all of t he S q ’s are placed. T here are an odd number of columns, so only rows t hat init ially cont ain an odd number of filled gridsquares can be cleared by t he S q ’s. T hus each row in t he t op of t he gameboard can be cleared at most once; t his uses fewer t han half of t he S q ’s. T he remainder of t he S q ’s cover R / 2 > A area, and never clear rows. T hus t hey must cause a loss. ⊓⊔
5
H a rd n e s s o f A p p rox im a t io n
T h e o re m 9 . G iven a gam e con sist in g of p pieces, approxim at in g t he m axim u m n u m ber of rows t hat can be cleared t o wit hin a fact or of p 1 − ε for an y con st an t ε > 0 is N P -hard.
360
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
P roof. Our const ruct ion is as in Figure 6, wit h r > a 2 /
ε rows in t he reservoir, where t here are a t ot al rows at or above t he second lock. As before, we append t o t he original piece sequence one R G followed by exact ly enough S q ’s t o complet ely fill t he reservoir. As in T heorem 8, in t he “yes” case of 3-Partition, we can clear t he ent ire gameboard (including t he r rows of t he reservoir), while in t he “no” case case we can clear at most a rows. T hus it is N P -hard t o dist inguish t he case in which at least r rows can be cleared from t he case in which at most a < r ε / 2 rows can be cleared. Not e t hat t he number of columns c in our gameboard is fixed and independent of r , and t hat t he number of pieces in t he sequence is const rained by r < p < ( r + a ) c . We also require t hat r be large enough t hat p < ( r + a ) c < r 2 / ( 2 ε ) . (Not e t hat r , and t hus our game, is st ill polynomial in t he size of t he 3-Partition inst ance.) T hus in t he “yes” case we clear at least r > p 1 ε / 2 rows, and in t he “no” case we clear at most a < r ε / 2 < p ε / 2 . T hus it is N P -hard t o approximat e t he number of cleared rows t o wit hin a fact or of ( p 1 ε / 2 ) / ( p ε / 2 ) = p 1 ε . ⊓ ⊔ −
−
−
−
Using t he const ruct ion in Figure 6 (wit h appropriat e choice of r ), similar argument s yield t he following inapproximability result s [5]: T h e o re m 1 0 . G iven a gam e con sist in g of p pieces, approxim at in g t he m axim u m n u m ber of pieces t hat can be placed wit hou t a loss t o wit hin a fact or of p 1 − ε for an y con st an t ε > 0 is N P -hard. ⊓⊔
T h e o re m 1 1 . G iven a gam e con sist in g of p pieces, approxim at in g t he m in im u m height of t he highest fi lled gridsqu are t o wit hin a fact or of 2 − ε for an y con st an t ε > 0 is N P -hard. ⊓⊔
6
V a ry in g t h e R u le s o f T e t ris
Because t he complet eness of our reduct ion does not depend on t he full set of allowable moves in Tet ris—nor soundness on all limit at ions—our result s cont inue t o hold in some modified set t ings. In real implement at ions of Tet ris, t here is a fixed amount of t ime (varying wit h t he diffi culty level) in which t o make manipulat ions at height h . We consider players wit h limit ed dext erity, who can only make a small number of t ranslat ions and rot at ions before t he piece drops anot her row. We defined a loss as t he fixing of a piece so t hat it does not fit ent irely wit hin t he gameboard. Ot her models also make sense: e.g., we might define a loss as occurring only aft er rows have been cleared—t hat is, a piece can be fixed so t hat it ext ends int o t he would-be ( m + 1)st row of t he m -row gameboard, so long as t his is not t he case once all filled rows are cleared. Finally, we consider a broad class of reason able models for piece rot at ion. T hree models of part icular int erest are: (1) t he inst ant aneous model of Sect ion 2; (2) t he con t in u ou s (or E u clidean ) rot at ion model—t he nat ural model if one pict ures pieces physically rot at ing in space—which ext ends t he inst ant aneous model
Tet ris is Hard, Even t o Approximat e
361
by requiring t hat all gridsquares t hat a piece passes t hrou gh during it s rot at ion be unoccupied; and (3) t he T et ris rot at ion m odel, illust rat ed in Figure 7, which we have observed in a number of act ual Tet ris implement at ions. In t his model, t he posit ion of a piece in a part icular orient at ion is det ermined as follows: wit hin t he pict ured k -by-k square (fixed independent ly of orient at ion), t he piece is posit ioned so t hat t he smallest rect angle bounding it is cent ered in t he square, shift ed upwards and leftwards as necessary t o align it wit h t he grid. (Incident ally, it t ook us some t ime t o realize t hat t he “real” rot at ion in Tet ris did not follow t he inst ant aneous model, which is int uit ively t he most nat ural one.) T h e o re m 1 2 . I t rem ain s N P -hard t o opt im ize ( or approxim at e) t he m axim u m height of a fi lled gridsqu are or t he n u m ber of rows cleared, t et rises at t ain ed, or pieces placed wit hou t a loss when an y of t he followin g hold:
T he Tet ris model of rot at ion. Each piece can be rot at ed clockwise (respect ively, count erclockwise) t o yield t he configurat ion on it s right (respect ively, left ). F ig. 7 .
1. t he play er is rest rict ed t o t wo rot at ion / t ran slat ion m oves before each piece drops in height . 2. pieces are rest rict ed t o { L G , L S , I , S q } or { R G , R S , I , S q } plu s on e ot her piece. 3. losses are n ot t riggered u n t il aft er fi lled rows are cleared, or n o losses occu r at all. ( I n t he lat t er case, t he object ive of T heorem 8 is irrelevan t .) 4. rot at ion s follow an y reason able rot at ion m odel. P roof. For (1), not e t hat complet eness (Lemma 2) requires only two t ranslat ions
(t o slide a L G int o a not ch) before t he piece falls; soundness (Lemma 4) cannot be falsified by rest rict ing legal moves. For (2), observe t hat our reduct ion uses only t he pieces { L G , L S , I , S q , R G } . For t he ot her pieceset s, we can t ake t he mirror image of our reduct ion and/ or replace t he R G and t he lock—our sole requirement on t he lock is t hat t hat it be opened by a piece t hat does not appear elsewhere in t he sequence. Claim (3) follows since we do not depend on t he definit ion of losses in our proof: t he complet eness t ra ject ory sequence does not approach t he t op of t he gameboard, and t he proof of soundness relies only on unfillability (and not on losses). Finally, for (4), our proof of Lemma 4 assumes an arbit rary reasonable rot at ion model [5]. Complet eness follows even wit h t he reasonability condit ions, since t he only rot at ions required for Lemma 2 occur in t he upper st aging area of t he gameboard. ⊓ ⊔
362
7
E.D. Demaine, S. Hohenberger, and D. Liben-Nowell
Fu t u re D ire c t io n s
An essent ial part of our reduct ion is a complicat ed init ial gameboard; it is a ma jor open quest ion whet her Tet ris can be played effi cient ly wit h an empty init ial configurat ion. Our result s are largely robust t o variat ions on t he rules (see Sect ion 6), but our complet eness result relies on t he t ranslat ion of pieces as t hey fall. At more diffi cult levels of t he game, it may be very hard t o make two t ranslat ions before t he piece drops anot her row in height . Suppose each piece can be t ranslat ed and rot at ed as many t imes as t he player pleases, and t hen falls int o place [2]; no manipulat ions are allowed aft er t he first downward st ep. Is t he game st ill hard? It is also int erest ing t o consider Tet ris wit h gameboards of rest rict ed size. What is t he complexity of Tet ris for an m -by-n gameboard wit h m = O (1) or n = O (1)? Is Tet ris fixed-paramet er t ract able wit h respect t o eit her m or n ? (We have polynomial-t ime algorit hms for t he special cases in which m · n is logarit hmic in t he number of pieces in t he sequence, or for t he case of n = 2.) We have reduced t he pieceset down t o five of t he seven pieces. For what pieceset s is Tet ris polynomial-t ime solvable? (E.g., t he pieceset { I } seems polynomially solvable, t hough non-t rivial because of t he init ial part ially filled gameboard.) Finally, in t his paper we have concent rat ed our eff ort s on t he offl ine, adversarial version of Tet ris. In a real Tet ris game, t he init ial gameboard and piece sequence are generat ed probabilist ically, and t he pieces are present ed in an online fashion. What can be said about t he diffi culty of playing online Tet ris if pieces are generat ed independent ly at random according t o t he uniform dist ribut ion, and t he init ial gameboard is randomly generat ed? Some possible direct ions for t his type of quest ion have been considered by Papadimit riou [11]. A ck n o w le d g m e n t s . We would like t o t hank Amos Fiat and Ming-wei Wang
for helpful init ial discussions, Chris Peikert for comment s on an earlier draft , and J osh Tauber for point ing out t he puzzles in G am es M agazin e [9]. T his work was part ially support ed by NDSEG and NSF Graduat e Research Fellowships.
R e fe re n c e s 1. R. Breukelaar, H. J . Hoogeboom, and W . A. Kost ers. Tet ris is hard, made easy. Technical report , Leiden Inst it ut e of Advanced Comput er Science, 2003. 2. J . Brzust owski. Can you win at T et ris? Mast er’s t hesis, U. Brit ish Columbia, 1992. 3. H. Burgiel. How t o lose at T et ris. M at hem at i cal G azet t e, J uly 1997. 4. E. D. Demaine. P laying games wit h algorit hms: Algorit hmic combinat orial game t heory. In P r oc. M F C S, pages 18–32, August 2001. cs.CC/0106019. 5. E. D. Demaine, S. Hohenberger, and D. Liben-Nowell. Tet ris is hard, even t o approximat e. Technical Report MIT -LCS-T R-865, 2002. cc.CC/0210020. 6. M. R. Garey and D. S. J ohnson. Complexity result s for mult iprocessor scheduling under resource const raint s. SI A M J . C om put . , 4:397–411, 1975. 7. M. R. Garey and D. S. J ohnson. C om put er s an d I n t r act abi li t y: A G ui de t o t he T heor y of N P -C om plet en ess. W . H. Freeman and Company, New York, 1979.
Tet ris is Hard, Even t o Approximat e
363
8. R. Kaye. Minesweeper is NP -Complet e. M at h. I n t el li gen cer , 22(2):9–15, 2000. 9. S. Kim. Tet ris unplugged. G am es M agazi n e, pages 66–67, J uly 2002. 10. M. M. Kost reva and R. Hart man. Mult iple ob ject ive solut ion for T et ris. Technical Report 670, Depart ment of Mat hemat ical Sciences, Clemson U., May 1999. 11. C. P apadimit riou. Games against nat ure. J . C om p. Sys. Sci . , 31:288–301, 1985. 12. D. Sheff . G am e O ver : N i n t en do’ s B at t le t o D om i n at e an I n dust r y. Hodder and St ought on, London, 1993. 13. Tet ris, Inc. http://www.tetris.com. 14. U. Zwick. J enga. In P r oc. SO D A , pages 243–246, 2002.
Approximate MST for UDG Locally Xiang-Yang Li Department of Computer Science, Illinois Institute of Technology 10 W. 31st Street, Chicago, IL 60616, USA [email protected]
Abstract. We consider a wireless network composed of a set of n wireless nodes distributed in a two dimensional plane. The signal sent by a node can be received by all nodes within its transmission region, which is a unit disk centered at this node. The nodes together define a unit disk graph (UDG) with edge u v iff u v ≤ 1. We present the first localized method to construct a bounded degree planar connected structure for UDG whose total edge length is within a constant factor of the minimum spanning tree. The total communication cost of our method is O ( n ), and every node only uses its two-hop information to construct such structure. We show that some two-hop information is necessary to construct any low-weighted structure. We also study the application of this structure in efficient broadcasting in wireless ad hoc networks. We prove that this structure uses only O (1/ n ) of the total energy of the previously best-known light weighted structure RNG.
1
Introduction
We consider a wireless ad hoc network composed of n nodes distributed in a twodimensional plane. Assume that all wireless nodes have distinctive identities and each static wireless node knows its position information either through a low-power Global Position System (GPS) receiver or through some other way. We assume that each wireless node has an omni-directional antenna and a single transmission of a node can be received by any node within its vicinity which, we assume, is a unit disk centered at this node. By one-hop broadcasting, each node u can gather the location information of all nodes within the transmission range of u . Consequently, all wireless nodes V together define a unit-disk graph UDG, which has an edge uv iff the Euclidean distance uv is less than one unit. Throughout this paper, a local broadcast by a node means it sends the message to all nodes within its transmission range; a global broadcast by a node means it tries to send the message to all nodes in the network by the possible relaying of other nodes. Since the main communication cost in wireless networks is to send out the signal while the receiving cost of a message is neglected here, a protocol’s message complexity is only measured by how many messages are sent out by all nodes. In recent years, there are substantial amount of research on topology control for wireless ad hoc networks [1,2,3,4]. These algorithms are designed for different objectives: minimizing the maximum link length while maintaining the network connectivity [3]; bounding the node degree [2]; bounding the spanning ratio [2,1]; constructing planar spanner locally [1]. Planar structures are used by several localized routing algorithms [5,6]. We [7] recently also proposed the first localized algorithm to construct a bounded T. Warnow and B. Zhu (Eds.): COCOON 2003, LNCS 2697, pp. 364–373, 2003. c Springer-Verlag Berlin Heidelberg 2003
Approximate MST for UDG Locally
365
degree planar spanner. A structure is called low weight if its total edge length is within a constant factor of the minimum spanning tree (MST). However, no localized algorithm is known to construct a low-weighted structure. It was recently shown in [8] that a broadcasting based on MST consumes energy within a constant factor of the optimum. The best distributed algorithm [9,10] can compute MST in O ( n ) rounds using O ( m + n l o g n ) communications for a general graph with m edges and n nodes. We can construct the minimum spanning tree of UDG in a distributed manner using O ( n l o g n ) messages. Unfortunately, even for wireless network modeled by a ring, the O ( n l o g n ) number of messages is still necessary for constructing MST of UDG. We present the first localized method to construct a bounded degree planar connected structure H whose total edge length is within a constant factor of MST. The total communication cost of our method is O ( n ) , and every node only uses its two-hop information to construct such structure. We also show that some two-hop information is necessary to construct any low-weighted structure. We also show the application of this structure in efficient broadcasting in wireless ad hoc networks. Energy conservation is a critical issue in ad hoc wireless network for the node and network life, as the nodes are powered by batteries only. In the most common power-attenuation model, the power needed to support a link uv is uv β , where β is a real constant between 2 and 5 dependent on the wireless transmission environment. Minimum-energy broadcast/multicast routing in ad hoc networking environment has been addressed in [11,12]. Wan et al. [8] showed that the approximation ratios of MSTbased approach is between 6 and 1 2 . Unfortunately, MST cannot be constructed in a localized manner, i.e., each node cannot determine which edge is in the defined structure by purely using the information of the nodes within some constant hops. Relative neighborhood graph has been used for broadcasting in wireless ad hoc networks [13]. It is well-known that M ST ⊆ R N G . The ratio of the weight of RNG over the weight of MST could be O ( n ) for n points set [14]. As will show later, the total energy used by this approach could be about O ( n β ) times optimum. Notice that a structure with low-weight cannot guarantee that the broadcasting based on it consumes energy within a constant factor of the optimum. We show that the energy consumption using the structure H is within O ( n β 1 ) of the optimum, i.e., ω β ( H ) = O ( n β 1 ) · ω β ( M ST ) . This improves the previously known “lightest” structure RNG by O ( n ) factor since in the worst case ω β ( R N G ) = Θ ( n β ) · ω β ( M ST ) . The remainder of the paper is organized as follows. We present our efficient localized method constructing a bounded degree planar structure with low weight in Section 2. In Section 3, we discuss its applications in broadcasting, and find that it saves considerable energy consumption compared with that based on RNG. We conclude our paper in Section 4 with the discussion of possible future works. −
−
2
Low Weight Topology
Let x y denote the Euclidean distance between two points x and y . A disk centered at a point x with radius r is denoted by disk ( x , r ) . Let lun e ( u, v ) defined by two points u and v be the intersection of two disks with radius uv and centered at u and v respectively, i.e., lun e ( u, v ) = disk ( u, uv ) ∩ disk ( v, uv ) . The relative neighborhood graph
366
X.-Y. Li
[15], denoted by RNG(V ), consists of all edges uv such that the interior of lun e ( u, v ) contains no point w ∈ V . Notice here if only the boundary of lun e ( u, v ) contains a point from V , edge uv is still included in RNG. Given a geometry graph G over a set of points, let ω ( G ) be the total length of the edges in G . More specifically, if the weight of b an edge uv is defined as uv , then let ω b ( G ) be the total weight of the weighted edges b uv . When b = 1 , b is often omitted from the notations. in G , i.e., ω b ( G ) = uv G It is known that M ST ⊆ R N G . ∈
2.1
Modified RNG
Our low-weight structure is based on a modified relative neighborhood graph. Notice that, traditionally, the relative neighborhood graph will always select an edge uv even if there is some node on the boundary of lun e ( u, v ) . Thus, RNG may have unbounded node degree, e.g., considering n − 1 points equally distributed on the circle centered at the n th point v , the degree of v is n − 1 . The modified relative neighborhood graph consists of all edges uv such that (1) the interior of lun e ( u, v ) contains no point w ∈ V and, (2) there is no point w ∈ V with I D ( w ) < I D ( v ) on the boundary of lun e ( u, v ) and w v < uv , and (3) there is no point w ∈ V with I D ( w ) < I D ( u ) on the boundary of lun e ( u, v ) and w u < uv , and (4) there is no point w ∈ V on the boundary of lun e ( u, v ) with I D ( w ) < I D ( u ) , I D ( w ) < I D ( v ) , and w u = uv . See Figure 1 for an illustration when an edge uv is not included in the modified relative neighborhood graph. We denote such structure by RNG’ hereafter. Obviously, RNG’ is a subgraph of traditional RNG. We prove that RNG’ has a maximum node degree 6 and still contains a MST as a subgraph. The proof of the following lemma is omitted due to space limitation.
w
w
w u
v
u
v
u
w v
u
v
Fig. 1. Four cases when edges are not in the modified RNG.
Lemma 1. The maximum node degree in graph RNG’ is at most 6 . Lemma 2. The graph RNG’ contains a Euclidean MST as a subgraph.
P
. One way to construct MST is to add edges in the order of their lengths to the MST if it does not create a cycle with previously added edges. We break the tie as follows. We label an edge uv by ( uv , m a x ( I D ( u ) , I D ( v ) ) , m i n ( I D ( u ) , I D ( v ) ) ) , and an edge uv is ordered before an edge x y if the lexicographic order of the label of uv is less than that of x y . Let T be the MST constructed using the above edge ordering. We can show that T ⊆ R N G . The detail is omitted due to space limitation. ROOF
′
Approximate MST for UDG Locally
367
Obviously, graph RNG’ still can be constructed using n messages. Each node first locally broadcasts its location and ID to its one-hop neighbors. Then every node decides which edge to keep solely based on the one-hop neighbors’ location information collected. Since the definition is still symmetric, the edges constructed by different nodes are consistent, i.e., an edge uv is kept by a node u iff it is also kept by node v . The computational cost of a node u is still O ( d l o g d) , where d is its degree in UDG. A simple edge by edge testing method has time complexity O ( d2 ) . Although graph RNG’ has possibly less edges than RNG, its total edge weight could still be arbitrarily large compared with the MST. Figure 2 (a) illustrates an example where ω ( R N G ) / ω ( M ST ) = O ( n ) for a set of n points. Here n / 2 points are equally distributed with separation ǫ ≤ 2 / n on two parallel vertical segments with distance 1 respectively. Obviously, all edges forming RNG’ have total weight n / 2 + ( n − 2 ) ǫ and the MST has total weight 1 + ( n − 2 ) ǫ . On the other hand, we have ′
Lemma 3. For any sparse graph G with O ( n ) edges, containing MST as subgraph, ω b ( G ) = O ( n b ) · ω b ( M ST ) for b ≥ 1 , and it has length spanning ratio at most O ( n ) . b
For any edge uv ∈ G , if uv ∈ M ST , then uv < ω b ( M ST ) . If uv ∈ M ST , then there is a path in MST with edges not longer than uv connecting u and v . Let a j , 1 ≤ j ≤ k ≤ n be the lengths of these edges. Then uv < 1 j k aj . b b 1 b b b 1 Thus, uv < ( 1 j k a j ) ≤ n · ω b ( M ST ) . Consequently, 1 j k aj ≤ n ω b ( G ) = O ( n b ) · ω b ( M ST ) since G has only O ( n ) edges. Similar proof can show that G has length spanning ratio at most O ( n ) . ROOF.
≤
≤
2.2
≤
≤
−
−
≤
≤
Bound the Weight
In this section, we give a communication efficient method to construct a sparse topology from RNG’ whose total edge weight is within a constant factor of ω ( M ST ) . Previously no localized method is known to construct a structure with weight O ( ω ( M ST ) ) . We first show by example that it is impossible to construct a low-weighted structure using only one hop neighbor information. Assume that there is such algorithm. Consider a set of points illustrated by Figure 2 (a). Let’s see what this hypothetical algorithm will do to this point set. Since it uses only one-hop information, at every node, the algorithm only knows that there is a sequence of nodes evenly distributed with small separation, and another node which is one-unit away from current node. Since the algorithm has the same (or almost same) information at each node, the algorithm cannot decide whether to keep the long edge. If it keeps the long edge, then the total weight of the final structure is O ( n · ω ( M ST ) ) . If it discards the long edge, however, it may disconnect the graph since the nodes known by the algorithm at one node may be the whole network. See Figure 2 (b) for an illustration. We then give the first localized algorithm that constructs a low-weighted structure using only some two hops information. Algorithm 1 Construct Low Weight Structure 1. All nodes together construct the graph RNG’ in a localized manner.
368
X.-Y. Li x
v
v
u1
v1
uk
vk y
(a)
(b)
(c)
u
v
(d)
Fig. 2. The hypothetical algorithm cannot distinguish two cases (a) and (b) here. (c): Broadcasting based on RNG is expensive. (d) ω β ( H ) = O ( n β − 1 ) · ω β ( M S T ).
2. Each node u locally broadcasts its incident edges in RNG’ to its one-hop neighbors. Node u listens to the messages from its one-hop neighbors. 3. Assume node u received a message informing existence of edge x y from its neighbor x . For each edge uv in RNG’, if uv is the longest among x y , ux , and vy , node u removes edge uv . Ties are broken by the label of the edges. Here assume that uvyx is the convex hull of u , v , x , and y . Let H be the final structure formed by all remaining edges in RNG’, and we call it low weighted modified relative neighborhood graph. Obviously, if an edge uv is kept by node u , then it is also kept by node v . To study the total weight of this structure, we will show that the edges in H satisfies the isolation property [16], which is defined as follows. Let c > 0 be a constant. Let E be a set of edges in d-dimensional space, and let e ∈ E be an edge of weight l . If it is possible to place a hyper-cylinder B of radius and height c · l each, such that the axis of B is a subedge of e and B does not intersect with any other edge, i.e., B ∩ ( E − { e} ) = φ , then edge e is said to be isolated [16]. If all the edges in E are isolated, then E is said to satisfy the isolation property. The following theorem is proved by Das et al. [16]. Theorem 1. [16] If a set of line segments E in d-dimensional space satisfies the isolation property, then ω ( E ) = O ( 1 ) · ω ( SM T ) . Here SMT is the Steiner minimum tree over the end points of E . Obviously, total edge weight of SMT is no more than that of the minimum spanning tree. Generally, ω ( M ST ) = O ( ω ( SM T ) ) for a set of points in Euclidean space. It is also known [16] that, in the definition of the isolation property, we can replace the hyper-cylinder by a hypersphere, a hypercube etc., without affecting the correctness of the above theorem. We will use a disk and call it protecting disk. Specifically, the protecting disk of a segment uv is disk ( p, 43 uv ) , where p is the midpoint of segment uv . Obviously, we need all such disks do not intersect any edge except the one that defines it. We first partition the edges of H into at most 8 groups such that the edges in each group satisfy the isolation property. Notice, given any node u , any cone apexed at u with angle less than π / 3 will contain at most one edge of H incident on u since H ⊆ R N G . Thus, we partition the region surrounded the origin by 8 equal-sized cones, say C1 , C2 , · · · , C8 (the cone is half-open and half-close). The cones at different nodes are just a simple shifting of cones from the origin. Let E i be the set of edges at cone C i (one end-point is the apex of the cone and the other end-point is inside the cone). √
′
Approximate MST for UDG Locally
369
Lemma 4. No two edges in E i share an end-point.
. Assume that there are two edges x u and yu share a common node u , then obviously, these two edges cannot be from the cone apexed at node u ; Clearly, angle ∠x uy ≤ 2 π / 8 . However, we already showed that there are no two edges incident on u form an angle less than π / 3 . This finishes the proof. ROOF
Theorem 2. The total edge weight of H is O ( ω
ST ) ) .
(M
We basically just show that the edges in E i satisfy the isolation property, for 8 . For the sake of contradiction, assume that E i does not satisfy the isolation property. Consider any edge uv from E i and assume that it is not isolated. Thus, there is an edge, say x y , intersects the protecting disk of uv . There are four different cases: Case (a): x ∈ disk ( u, uv ) and y ∈ disk ( v, uv ) ; Case (b): x ∈ disk ( u, uv ) and y ∈ disk ( v, uv ) ; Case (c): x ∈ disk ( u, uv ) and y ∈ disk ( v, uv ) ; Case (d): x ∈ disk ( u, uv ) and y ∈ disk ( v, uv ) . These four cases are illustrated by Figure 3. We will show that none of these four cases is possible. ROOF.
i
1 ≤
≤
y
y x v
u
(a)
x v
u
(b)
y
y x v
u
(c)
x v
u
(d)
Fig. 3. Four cases that an edge u v is not isolated. Assume edge x y intersects the protecting disk.
For the first case, since x is in disk ( u, uv ) and y is in disk ( v, uv ) , we know that x u and yv are both shorter than uv . Here, x u and yv need not be in the structure E i . Thus, either uv or x y is the longest edge among uv , x y , x u and yv . Consequently, our algorithm will remove either uv or x y (whichever is longer). For the remaining three cases, we will show that edge x y is the longest of these four edges. First of all, nodes x and y cannot be on the different side of the line passing through nodes u and v . Assume that they do, and x is below the line uv . Assume that x is outside of the disk centered at u with radius uv since one of the x and y is outside of the corresponding disk. See Figure 4 for an illustration. We first show that ∠yx u < π / 3 . Let q be the intersection point of segment x y with line uv . Let p be the corner point of the lune lun e ( u, v ) that is on the same side of uv as y . Obviously, ∠yx u < ∠yqu < ∠pqu < ∠puv = π / 3 . We then show that x y > x u . Let z be the intersection point of x y with the boundary of lun e ( u, v ) and closer to u than v . Obviously, ∠x uz > π / 2 , thus, x y > x z > x u . Consequently, point u is inside the lune defined by points x and y , which is a contradiction to the fact that x y ∈ R N G . We then prove that the Case (b) is impossible. Assume that y is outside of disk centered at v with radius uv . See Figure 4 (2) for an illustration of the proof that ′
370
X.-Y. Li p
t
z y
y q x
x
x’
z
w
x
v
u
y z
s
u
v
p
(1)
u
q v
α
p
(2)
(3)
Fig. 4. (1) Node x is below u v and y is above. (2) Case (b) is impossible. (3) Edge x y is longest.
follows. Let z be the intersection point of x y with disk ( v, uv ) that is closer to y . Let x be the point on the disk disk ( v, uv ) such that segment zx is tangent to the protecting disk of segment uv . Obviously, ∠ux z > π / 2 . Then zx > zx . We can show that zx is at least zv (the proof is presented in next paragraph). Then ′
′
′
′
′
yx >
yz
+
zx ′
>
yv
−
zv
+
zx ′
>
yv
Then x y is the longest segment of the convex hull x yvu since x u ≤ uv ≤ vy . This is a contradiction since our algorithm will remove edge x y . Notice here edge x y is the longest edge implies that node u is a neighbor of x and node v is a neighbor of y . Thus both node x and node y will know the existence of edge uv , and thus will remove edge x y according to our algorithm. Figure 4 (3) illustrates the proof of zx ≥ zv that follows. Consider any chord x y tangent on the protecting disk for uv . We then prove x y ≥ yv = uv . Let z be the midpoint of x y , i.e., vz is perpendicular to x y . To make x y shorter, segment vz must be as long as possible. Let p be the midpoint of uv and s be the point on x y such that segment ps is perpendicular to segment x y . Then clearly, vz = ps + pv · c o s ( ∠ups) . Thus, x y is minimized when angle ∠ups is minimized. However, ∠ups > ∠upw since x and y are all above the line uv . Here w is the only intersecting point of chord ut with the protecting disk disk ( p, 43 uv ) . It is easy to show ut = t v = uv . Thus, the minimum length of segment x y is uv when ∠ups = ∠upw . The proof of Case (c) is exactly the same as that for Case (b). For Case (d), same to the proof of Case (b), we know that x u < x y and vy < x y . Then edge x y is also the longest edge of the convex hull x yvu . This is a contradiction since our algorithm will remove edge x y (nodes x and y will be informed by u and v respectively of the existence of edge uv since x u < 1 and vy < 1 ). This finishes the proof. ′
√
Lemma 5. The constructed topology H still contains a MST as a subgraph.
. Consider the minimum spanning tree T constructed in the proof of Lemma 2. We will prove that T ⊆ H by induction on the order of the edges added to the minimum spanning tree T . For the edge with the smallest order, it is clearly still in H . Assume that the first k − 1 edges added to T are still in H . Consider the k th edge, say uv , added to T . If uv is not in H , there must have two points x and y such that edge uv has the largest lexicographical label among edges on the convex hull uvyx . ROOF
Approximate MST for UDG Locally
371
Notice that for RNG’, it is easy to show by induction that, for any two points p and q, there is a path in RNG’ connecting p and q, whose edges have label less than that of pq. For any edge in this path, if it is not in T , then by definition of T , we know that there is another path with edges in T to connect the two endpoints of this edge. Thus, for any two points p and q, there is a path in T connecting p and q, whose edges have label less than that of pq. Consequently, for points u and v , there is a path in T connecting them using edges with label lexicographically less than uv . This is a contradiction to the fact that uv is also in the minimum spanning tree T . This finishes the proof.
3 Application in Broadcasting Minimum-energy broadcast/multicast routing in a simple ad hoc networking environment has been addressed in [11,12]. Any broadcast routing is viewed as an arborescence (a directed tree) T , rooted at the source node of the broadcasting, that spans all nodes. Let f T ( p) denote the transmission power of the node p required by T . For any leaf node β p of T , f T ( p) = 0 . For any internal node p of T , f T ( p) = m a x p q T pq , i.e., the β -th power of the longest distance between p and its children in T . The total energy required by T is p V f T ( p) . It is known [17] that the minimum-energy broadcast routing problem cannot be solved in polynomial time if P = N P . Wan et al. [8] showed that the approximation ratio of MST based approach is between 6 and 1 2 . ∈
∈
Lemma 6. For any point set V in the plane, the total energy required by any broadcasting among V is at least ω β ( M ST ) / C m s t , where 6 ≤ C m s t ≤ 1 2 is a constant related to the geometry minimum spanning tree. RNG has been used for broadcasting in wireless ad hoc networks [13]. Obviously, the ratio of the weight in RNG over the weight of MST could be O ( n ) for n points set [14]. Figure 2 (c) illustrates an example that the total energy used by broadcasting on RNG could be about O ( n β ) times of the minimum-energy used by an optimum method. Here the n nodes are evenly distributed on the arc x u 1 , segment u 1 u k , arc u k y , arc yv k , segment v k v 1 , and arc v 1 x . Here four nodes u 1 , u k , v 1 , and v k form a unit square. It is not difficult to show that ω ( M ST ) = Θ ( 1 ) and ω β ( M ST ) = Θ ( 1 / n β 1 ) , while ω ( R N G ) = Θ ( n ) and ω β ( R N G ) = Θ ( n ) . Together with Lemma 3, we know that in the worst case, ω β ( R N G ) = Θ ( n β ) · ω β ( M ST ) . Notice that although the structure H has total edge weight ω ( H ) ≤ c · ω ( M ST ) for some constant c, it does not guarantee that ω β ( H ) is within a constant factor of ω β ( M ST ) for β > 1 . Figure 2 (d) illustrates such an example. Here the segment uv has length 1 . The other n − 2 nodes are evenly distributed along the three segments of a square (with side length 1 + ǫ ) such that the lines drawn in Figure 2 is indeed the graph RNG’. It is not difficult to show that H = R N G . Obviously, ω β ( H ) = O ( 1 ) and ω β ( M ST ) = O ( 1 / n β 1 ) for any β > 1 . On the other hand, we have −
′
′
−
Lemma 7. ω β
(H ) ≤
O( nβ
−
1
) ·
ω β
(M
ST ) .
372
X.-Y. Li
. Assume that ω ( H ) ≤ c · ω ( M ST ) for a constant c. Let a i , 1 ≤ i ≤ k be the edge lengths of H , and bi , 1 ≤ i ≤ n − 1 be the edge lengths of M ST . Here k = O ( n ) is the number of edges in H . Then 1 i k a βi ≤ ( 1 i k a i ) β ≤ cβ · ( 1 i n 1 bi ) β ≤ β cβ · n β 1 · 1 i n 1 bi .This finishes the proof. ROOF
≤
≤
≤
≤
≤
≤
−
−
≤
≤
−
Consequently, we know that in the worst case, ω β ( H ) = Θ ( n β 1 ) · ω β ( M ST ) . Figure 2 (d) shows that, to get a structure with weight O ( ω β ( M ST ) ) , we have to construct a MST for that example. Notice that the worst case communication cost to build a MST is O ( n l o g n ) under the broadcast communication model. It seems that the we may have to spend O ( n l o g n ) communications to build a structure with weight O ( ω β ( M ST ) ) . However, this worst case may not happen at all: for the configurations of nodes that need O ( n l o g n ) communications to build MST, the structure built by our method may be good enough; on the other hand, for the example that our algorithm does not perform well, we may find an efficient way to build a MST using o( n l o g n ) messages. We leave it as an open problem whether we can construct a structure G whose weight ω β ( G ) is O ( ω β ( M ST ) ) using only o( n l o g n ) messages, or even O ( n ) messages. Here each message has O ( l o g n ) bits always. −
4
Conclusion
We consider a wireless network composed of n a set of wireless nodes distributed in a two dimensional plane. We presented the first localized method to construct a bounded degree planar connected structure H with ω ( H ) = O ( 1 ) · ω ( M ST ) . The total communication cost of our method is O ( n ) , and every node only uses its two-hop information to construct such structure. We showed that some two-hop information is necessary to construct any low-weighted structure. We also studied the application of this structure in efficient broadcasting in wireless ad hoc networks. We showed that the energy consumption using this structure is within O ( n β 1 ) of the optimum, i.e., ω β ( H ) = O ( n β 1 ) · ω β ( M ST ) for any β ≥ 1 . This improves the previously known “lightest” structure RNG by O ( n ) factor since ω ( R N G ) = Θ ( n ) · ω ( M ST ) and ω β ( R N G ) = O ( n β ) · ω β ( M ST ) . On one aspect, a structure with low-weight does not guarantee that it approximates the optimum broadcasting structure in terms of the total energy consumption. On the other hand, a structure for broadcasting whose total energy consumption is within a constant factor of optimum does√not guarantee that it is low-weight. We can show that its total edge length is within O ( n ) of ω ( M ST ) for a n -nodes network. Considering this “non-relevance” of the low-weight structure and the optimum broadcasting structure, it remains open how to construct a topology good for broadcasting. The constructed structure is planar, and has bounded degree, low-weight. We [18] recently gave an O ( n l o g n ) -time centralized algorithm constructing a bounded degree, planar, and low-weighted spanner. However, we cannot make that a distributed algorithm using O ( n ) communications without sacrificing the spanner property. On the other hand, we [7] showed how to construct a planar spanner with bounded degree in a localized manner (using O ( n ) messages) for unit disk graph. However, the constructed structure does not seem to have low-weight. It remains open how to construct a bounded degree, −
−
Approximate MST for UDG Locally
373
planar, and low-weighted spanner in a distributed manner using only O ( n ) communications under the local broadcasting communication model.
References 1. Li, X.Y., Calinescu, G., Wan, P.J.: Distributed construction of planar spanner and routing for ad hoc wireless networks. In: 21st Annual Joint Conference of the IEEE Computer and Communications Societies (INFOCOM). Volume 3. (2002) 2. Li, X.Y., Wan, P.J., Wang, Y., Frieder, O.: Sparse power efficient topology for wireless networks. Journal of Parallel and Distributed Computing (2002) To appear. Preliminary version appeared in ICCCN 2001. 3. Ramanathan, R., Rosales-Hain, R.: Topology control of multihop wireless networks using transmit power adjustment. In: IEEE INFOCOM. (2000) 4. Wang, Y., Li, X.Y.: Geometric spanners for wireless ad hoc networks. In: Proc. of 22nd IEEE International Conference on Distributed Computing Systems (ICDCS). (2002) 5. Bose, P., Morin, P., Stojmenovic, I., Urrutia, J.: Routing with guaranteed delivery in ad hoc wireless networks. ACM/Kluwer Wireless Networks 7 (2001) 609–616 3rd int. Workshop on Discrete Algorithms and methods for mobile computing and communications, 1999, 48–55. 6. Karp, B., Kung, H.T.: GPSR: Greedy perimeter stateless routing for wireless networks. In: ACM/IEEE International Conference on Mobile Computing and Networking. (2000) 7. Li, X.Y., Wang, Y.: Localized construction of bounded degree planar spanner for wireless networks (2003) Submitted for publication. 8. Wan, P.J., Calinescu, G., Li, X.Y., Frieder, O.: Minimum-energy broadcast routing in static ad hoc wireless networks. ACM Wireless Networks (2002) Preliminary version appeared in IEEE INFOCOM 2000. 9. Faloutsos, M., Molle, M.: Creating optimal distributed algorithms for minimum spanning trees. Technical Report Technical Report CSRI-327 (also submitted in WDAG ’95) (1995) 10. Gallager, R., Humblet, P., Spira, P.: A distributed algorithm for minimumweight spanning trees. ACM Transactions on Programming Languages and Systems 5 (1983) 66–77 11. Clementi, A., Penna, P., Silvestri, R.: On the power assignment problem in radio networks. Electronic Colloquium on Computational Complexity (2001) To approach. Preliminary results in APPROX’99 and STACS’2000. 12. Wieselthier, J., Nguyen, G., Ephremides, A.: On the construction of energy-efficient broadcast and multicast trees in wireless networks. In: Proc. IEEE INFOCOM 2000. (2000) 586–594 13. Seddigh, M., Gonzalez, J.S., Stojmenovic, I.: Rng and internal node based broadcasting algorithms for wireless one-to-one networks. ACM Mobile Computing and Communications Review 5 (2002) 37–44 14. Li, X.Y., Wan, P.J., Wang, Y., Frieder, O.: Sparse power efficient topology for wireless networks. In: IEEE Hawaii Int. Conf. on System Sciences (HICSS). (2002) 15. Toussaint, G.T.: The relative neighborhood graph of a finite planar set. Pattern Recognition 12 (1980) 261–268 16. Das, G., Narasimhan, G., Salowe, J.: A new way to weigh malnourished euclidean graphs. In: ACM Symposium of Discrete Algorithms. (1995) 215–222 17. Clementi, A., Crescenzi, P., Penna, P., Rossi, G., Vocca, P.: On the complexity of computing minimum energy consumption broadcast subgraphs. In: 18th Annual Symposium on Theoretical Aspects of Computer Science, LNCS 2010. (2001) 121–131 18. Li, X.Y., Wang, Y.: Efficient construction of low weight bounded degree planar spanner (2003). COCOON 2003.
Efficient Construction of Low Weight Bounded Degree Planar Spanner Xiang-Yang Li and Yu Wang Department of Computer Science, Illinois Institute of Technology 10 W. 31st Street, Chicago, IL 60616, USA [email protected], [email protected]
Abstract. Given a set V of n points in a two-dimensional plane, we give an O ( n l o g n ) -time centralized algorithm that constructs a planar t -spanner for V , for t ≤ m a x { π 2 , π s i n α 2 + 1 } · C d e l , such that the degree of each node is bounded from above by 1 9 + ⌈ 2α π ⌉ , and the total edge length is proportional to the weight of the minimum spanning tree of V , where 0 < α < π / 2 is an adjustable parameter. Here C d e l is the spanning ratio of the Delaunay triangulation, which is at most √ 4 3 π . Moreover, we show that our method can be extended to construct a planar 9 bounded degree spanner for unit disk graphs with the adjustable parameter α satisfying 0 < α < π / 3 . This method can be converted to a localized algorithm where the total number of messages sent by all nodes is at most O ( n ) (under broadcasting communication model). These constants are all worst case constants due to our proofs. Previously, only centralized method [1] of constructing bounded degree planar spanner is known, with degree bound 2 7 and spanning ratio t ≃ 2 1 0 . 0 2 . The distributed implementation of this centralized method takes O ( n ) communications in the worst case.
1
Introduction
Let d G ( u , v ) be the length of the shortest path in graph G connecting two vertices u and v . Given a set of points V in a two-dimensional plane, a graph G = ( V, E ) is a t -spanner of another graph H if for any two nodes u and v d G ( u , v ) ≤ t · d H ( u , v ) . Here the length of an edge is the Euclidean distance between its two endpoints. When H is the complete graph, we simply say that G is a t -spanner. If graph G has only O ( n ) edges, then G is called sparse spanner. If the total edge length of G is within a constant factor of the Euclidean minimum spanning tree of V , then G is called low weight spanner. Many algorithms are known that compute sparse t -spanners with some additional properties such as bounded node degree, small spanner diameter (i.e., any two points are connected by a t -spanner path consisting of only a small number of edges), low weight, and fault-tolerance, see, e.g., [2,3,4,5,6,7,8]. All these algorithms compute t -spanners for any given constant t > 1 and thus, the hidden constants all depend on t . We consider how to construct planar spanners for a set of two-dimensional points or a unit disk graph. Several planar geometry structures are studied before. It is known that the relative neighborhood graph [9,10] and Gabriel graph [9,11,12]√ are not spanners, while the Delaunay triangulation [13,14,15] is a t -spanner for t ≤ 4 9 3 π . Hereafter, we T. Warnow and B. Zhu (Eds.): COCOON 2003, LNCS 2697, pp. 374–384, 2003. c Springer-Verlag Berlin Heidelberg 2003
Efficient Construction of Low Weight Bounded Degree Planar Spanner
375
use C d e l to denote the spanning ratio of the Delaunay triangulation. Das and Joseph [16] showed that the minimum weighted triangulation and the greedy triangulation are t spanners for some constant t . Levcopoulos and Lingas [17] showed, for any real number r > 0 , how to construct a planar t -spanner from the Delaunay triangulation, whose total edge length is at most 2 r + 1 times the weight of a minimum spanning tree of V , where t = ( 1 + 1 / r ) C d e l . Notice that all these structures could have unbounded node degree. Recently Bose et al. [1] proposed a centralized O ( n l o g n ) -time algorithm that constructs a planar t -spanner for a given nodes set V , for t = ( 1 + π ) · C d e l ≃ 1 0 . 0 2 , such that the node degree is bounded from above by 2 7 . As we knew, this algorithm is the first method to compute a planar spanner of bounded degree. In this paper, we give a simpler method to construct bounded degree planar t -spanner with low weight. In addition, degree bound and spanning ratio of our method are better than those in [1]. The main result of this paper is the following theorem. Theorem 1. There is an O ( n l o g n ) -time algorithm that, given a set V of n points in a two-dimensional plane, constructs a graph 1. 2. 3. 4.
that is planar, that is a t -spanner, for t = m a x { π 2 , π s i n α 2 + 1 } · C d e l ( 1 + ǫ ) , in which each point of V has degree at most 1 9 + ⌈ 2α π ⌉ , and whose total edge weight is bounded from above by a constant factor of the weight of the Euclidean minimum spanning tree of V . Here the constant factor depends on ǫ .
Here 0 < α < π / 2 is an adjustable parameter. The rest of the paper is organized as follows. In Section 2, we propose our method constructing bounded degree planar t -spanner with low weight for a two-dimensional point set. In Section 3, we extend our method to construct bounded degree planar t spanner for any unit disk graph defined over a two-dimensional point set. Moreover, we show this centralized method can be converted to a localized algorithm, which can be used for wireless networks. We conclude our paper in Section 4.
2
Bounded Degree and Planar Spanner on Point Set
Our algorithms borrow some idea from the algorithm by Bose et al. [1]. They show that the length stretch factor of the final graph is ( 3 c o( sπ π + / 16) )2(π 1 + ǫ ) and node degree is at most 2 7 . The running time of their algorithm is O ( n l o g n ) . However, their method is impossible to have a localized even distributed version, since they use BFS and many operations on polygons (such as degree-3 partitions). Notice that breadth-first-search may take O ( n 2 ) communications. In this section, we will give a new method for constructing a planar spanner with bounded node degree for a point set V . The basic idea of our methods is to combine Delaunay triangulation and the ordered Yao structure [18].
376
X.-Y. Li and Y. Wang
2.1
Construction Algorithm
Algorithm: Constructing Bounded Degree Planar Spanner with Low Weight 1. First, it computes the Delaunay triangulation of a set V of n nodes, D el ( V ) . Let N D e l ( u ) be the neighbors of node u in the Delaunay triangulation D el ( V ) , and d u be the degree of node u in D el ( V ) . By proper data structure, N D e l ( u ) and d u can be achieved in time O ( n ) . 2. Find an order π of V as follows. Let G 1 = D el ( V ) and d G , u be the node degree of u in graph G . Remove the node u with the smallest value of ( d G i , u , I D ( u ) ) from G i , let π u = n − i + 1 , and call the remaining graph G i + 1 . Repeat this procedure for 1 ≤ i ≤ n . Let π u n = 1 . Let P v denote the predecessors of v in π , i.e., P v = { u ∈ V : π u < π v } . Notice since G i is always a planar graph, we know that the smallest value of d G i , u is at most 5 . Then, in ordering π , node u at most have 5 edges to its predecessors P u in D el ( V ) . 3. Let E be the edge set of D el ( V ) , E ′ be the edge set of the desired spanner. Initialize E ′ to be empty set and all nodes in V are unprocessed. Then, for each node u in V , following the increasing order π , run the following steps to add some edges from E to E ′ (we only consider the Delaunay neighbors N D e l ( u ) of u ): a) We use v 1 , v 2 , · · · , v k to denote the predecessors of node u (see Figure 1 ). Notice that u can have at most 5 edges to its predecessors (processed Delaunay neighbors) in E , i.e., k ≤ 5 . Then there are k ≤ 5 open sectors at node u whose boundaries are rays emanated from u to the processed neighbors v i of u in D el ( V ) . For each such sector at u , we divide it into a minimum number of open cones of degree at most α , where α ≤ π / 2 is a parameter. b) For each such cone, let s 1 , s 2 , · · · , s m be the geometrically ordered neighborhood N D e l ( u ) of u in this cone. That is, s 1 , s 2 , · · · , s m are all unprocessed nodes that are connected by some edges of E to u in this cone. For this cone, we first add the shortest edge in E that is connected to u to the edge set E ′ , then add to E ′ all the edges ( s j , s j + 1 ) , 1 ≤ j < m . c) Mark node u processed. Repeat this procedure in the increasing order of π , until all nodes are processed. The final graph formed by edges E ′ is denoted by B P S ( V ) . 4. Run the greedy spanner algorithm by [7] to bound the weight of the graph. Notice that in the algorithm we use open sectors, which means that in the algorithm we do not consider adding the edges on the boundaries (any edge involved previously processed neighbors). For example, in Figure 1, the cones do not include any edges u v i . This guarantee the algorithm does not add any edges to node v i after v i has been processed. This approach, as we will show it later, bounds the node degree.
Efficient Construction of Low Weight Bounded Degree Planar Spanner
377
s 1 v4 s3 s 2
s1 (si ,v’)
v5 v1
u
s2 v3
v2
x
u Fig. 1. Constructing planar spanner with bounded degree point set: process node u .
θ
s3
s4 D s5 s6 s8 s7 (sj ) s9 (sk , v) w y-x
S P
x Fig. 2. The shortest path in polygon P .
2.2 Analysis of Algorithm To show degree of B P S ( V ) is bounded by a constant, we prove following theorem. Theorem 2. The maximum node degree of the graph B P S ( V ) is at most 1 9
+ ⌈
2π
α
⌉
.
α
. Notice that for a node u there are 2 cases that an edge u v is added to the B P S ( V ) , let us discuss them one by one. Case 1 : When we process node u , some edges u v have already been added by some processed nodes w before. There are two subcases for this case. Subcase 1 . 1 : The edge u v has been added by a processed node v (w = v ). For example, in Figure 1 , node u has edges from v 2 , v 3 and v 5 before it is processed. For each predecessor v , it only adds one edge to node u . Subcase 1 . 2 : The edge u v has been added by processed node w (w is not v ), node v is also an unprocessed node when processing w . For example, in Figure 1 , node s 2 have edges from s 1 and s 3 added by processing node u before node s 2 is processed. Notice that both v and u are neighbors of this processed node w . For each predecessor w , it at most adds two edges to node u . Because for each u , it can only have at most 5 predecessor neighbors (processed neighbors), and each of predecessor can at most add 3 edges to it (either Subcase 1 . 1 or Subcase 1 . 2 , or both). Thus, the number of this kind of edges (edges added by its predecessors before u is processed) is bounded by 1 5 . Case 2 : When node u is processed, we can add one edge u v for each cones. Since we have at most 5 sectors emanated from u and each cone must have angle at most α , it is easy to show that we can at most have 4 + ⌈ 2α π ⌉ cones at u . So the number of this kind of edges is also bounded by 4 + ⌈ 2α π ⌉ . Notice that after node u is processed, no edges will be added to it. Consequently, the degree of each node u is bounded by 1 9 + ⌈ 2α π ⌉ in the final structure. ROOF
For example, when α = π / 2 , then the maximum node degree is at most 2 3 ; when π / 3 , then the maximum node degree is at most 2 5 . Either case improves the previous bound 2 7 on the maximum node degree by Bose et al. [1]. =
378
X.-Y. Li and Y. Wang
It is trivial that B P S ( V ) is a planar graph. Since D el ( V ) is a planar graph and the algorithm only adds the Delaunay edges to B P S ( V ) . Notice that all edges s i s i + 1 are also in D el ( V ) since s i and s i + 1 are consecutive Delaunay neighbors of node u . Finally, we prove that the graph B P S ( V ) is a spanner. Theorem 3. The graph B P S ( V ) is a t -spanner, where t
=
m ax{
π 2
,π
s in
α 2
+ 1} ·
Cd el .
First, remember that D el ( V ) is a spanner with a constant length stretch factor √ 3 4 Cd el = π ≈ 2 . 4 2 . Keil and Gutwin [15] proved it using induction on the order of 9 the lengths of all pair of nodes (from the shortest to the longest). We can show that the path connecting nodes u and v constructed by the method given in [15] also satisfies that all edges of that path is shorter than u v . So if we can prove this claim: for any edge u v ∈ D el ( V ) , there exists a path in B P S ( V ) connecting u and v whose length is at most a constant ℓ times u v , then we know B P S ( V ) is a ℓ · C d e l -spanner. Then we prove the above claim. Consider an edge u v in D el ( V ) . If u v ∈ B G P ( V ) , the claim holds. So assume that u v ∈ / B G P ( V ) . Assume w.l.o.g. that π u < π v . It follows from the algorithm that, when we process node u , there must exist a node v ′ in the same cone with v such that u v > u v ′ , u v ′ ∈ B P S ( V ) , and ∠v ′ u v < α ≤ π / 2 . Let v ′ = s 1 , s 2 , · · · , s k = v be this sequence of nodes in the ordered unprocessed neighborhood of u from v ′ to v . Same with the proof in [1], consider the polygon P , consisting of nodes u , s 1 , · · · , s k . We will show that the path s 1 s 2 · · ·s k has length that is at most a small constant factor of the length u v . Let us consider the shortest path from s 1 to s k that is totally inside the polygon P . Let S ( s 1 , s k ) denote such path. This path consists of diagonals of P .For example, in Figure 2 , S ( s 1 , s k ) = s 1 s 7 s 9 . Assume that u v ′ = x . Let w be the point on segment u v such that u w = ′ ′ u v . Assume that u v = y , then w v = y − x . Notice that node v is the closest Delaunay neighbors in such cone. Obviously, all Delaunay neighbors s i in this cone is outside of the sector defined by segments u w and u v ′ . We will show that such path S ( s 1 , s k ) is contained inside the triangle △ w s 1 s k . First, if no Delaunay neighbors is inside △ w s 1 s k , then S ( s 1 , s k ) = s 1 s k . Thus, the claim trivially holds. If there is some Delaunay neighbors inside △ w s 1 s k , then s 1 will connect to the one S i forming the smallest angle ∠u s 1 s j . Similarly, node s k will connect to the one s j forming the smallest angle ∠u s k s j . Obviously s i and s j are inside △ w s 1 s k , thus, the shortest path connecting them is also inside △ w s 1 s k . Since path S ( s 1 , s k ) is the shortest path inside the polygon P to connect s 1 and s k , by convexity, the length of S ( s 1 , s k ) is at most θ ′ ′ v w + w v = 2 x s in + y − x . Here θ = ∠v u v < α . 2 An edge s i s j of S ( s 1 , s k ) has endpoints s i and s j in the neighborhood of u . Let D ( s i , s j ) be the sequence of edges between s i and s j in the ordered neighborhood of u , which are added by processing u . For example, in Figure 2 , D ( s 1 , s 7 ) = s 1 s 2 s 3 s 4 s 5 s 6 s 7 . This path is in B P S ( V ) . We can bound the length of D ( s i , s j ) by π / 2 s i s j by the argument in [1,19]. In [19], it is shown that the length of D ( s i , s j ) is at most π / 2 times s i s j , provided that (1) the straight-line segment between s i and s j lies outside the Voronoi region induced by u , and (2) that the path lies on one side of the line through s i and s j . In other words, we need D ( s i , s j ) to be one-sided Direct ROOF.
Efficient Construction of Low Weight Bounded Degree Planar Spanner
379
Delaunay path 1 [13]. In [1], they showed that both these two conditions hold when ∠s i u s j < π / 2 . This is trivially satisfied since ∠s i u s j < α ≤ π / 2 . Thus, we have a path u s 1 s 2 · · ·s k to connect u and v with length at most
x + ( 2 x s in
θ + 2
y
−
x)
π ≤
2
y(
π
x + 2
y
(π
α
π
s in
+
−
2
1)) ≤
y
π
,π
· m ax{
2
2
α s in
+
1}
2
Putting it all together, we know B P S ( V ) is a spanner with length stretch factor at most m a x { π 2 , π s i n α 2 + 1 } · C d e l . √
For example, when α = π / 2 , then the spanning ratio is at most ( 22 π + 1 ) · C d e l ; when α = π / 3 , then the spanning ratio is at most ( π 2 + 1 ) · C d e l ; when α = 2 a r c s i n ( 12 − π 1 ) ≃ π o · C d e l . We expect to further improve the bound 2 0 . 9 , then the spanning ratio is at most 2 on the spanning ratio by using the following property: all such Delaunay neighbors s i is inside the circumcircle of the triangle u v v ′ ; see Figure 2. Notice that, the method by Bose et al. [1] actually achieves the same spanning ratio as this one, although they did not prove this. However, the node degree of the graph generated by our method is smaller than that by [1]. Notice that the time complexity of our centralized algorithm is O ( n l o g n ) too. We can build Delaunay triangulation in O ( n l o g n ) , and do ordering in time O ( n l o g n ) (using heap for the ordering based on degrees), and Yao structure in O ( n ) (each edge is processed at most a constant times and there are O ( n ) edges to be processed). When using heap for the ordering, initially building a heap needs O ( n l o g n ) , then we remove one node and it has at most 5 adjacent edges, it needs at most 5 times updating the heap based on degree (each of which can be done in time O ( l o g n ) ). So the ordering can be done in O ( n l o g n ) . Consequently, the time complexity is O ( n l o g n ) , same with the method by Bose et al. [1]. However, our algorithm has smaller bounded node degree, and (more importantly) our algorithm has potential to become a localized version for wireless ad hoc networks application as we will describe later.
3
Bounded Degree and Planar Spanner on Unit Disk Graph
We consider a wireless ad hoc network (or sensor network) with all nodes distributed in a two-dimensional plane. Assume that all wireless nodes have distinctive identities and each static wireless node knows its position information either through a low-power Global Position System (GPS) receiver or through some other way. For simplicity, we also assume that all wireless nodes have the same maximum transmission range and we normalize it to one unit. By one-hop broadcasting, each node u can gather the location information of all nodes within the transmission range of u . Consequently, all wireless nodes V together define a unit-disk graph U D G ( S ) , which has an edge u v if and only 1
For any pair of nodes u and v , let u = w 1 , w 2 , · · ·, w k = v be the sequence of nodes whose Voronoi region intersect segment u v and the Voronoi regions at w i and w j share a common boundary segment. Then the Direct Delaunay path D T ( u , v ) is w 1 w 2 · · ·w k .
380
X.-Y. Li and Y. Wang
if the Euclidean distance u v between u and v is less than one unit. In this section we give two centralized algorithms to construct planar spanner with bounded degree for U D G ( V ) . Then, we show the first centralized method can be converted to a localized algorithm using O ( n ) messages, which can be used for wireless ad hoc networks.
3.1
Construction Algorithms
Algorithm 1: Constructing Planar Spanner with Bounded Degree for U D G ( V ) 1. Same with the algorithm for point set, first, compute Delaunay triangulation D el ( V ) . 2. Removing the edges whose length is longer than 1 in D el ( V ) . Call the remaining graph unit Delaunay triangulation U D el ( V ) . For every node u , we know its unit Delaunay neighbors N U D e l ( u ) and its node degree d u in U D el ( V ) . 3. Then, same with the algorithm for point set, find an order π of V as follows: Let G 1 = U D el ( V ) and d G , u is the node degree of u in graph G . Remove the node u with the smallest value of ( d G i , u , I D ( u ) ) from G i , let π u = n − i + 1 , and call the remaining graph G i + 1 . Repeat this procedure for 1 ≤ i ≤ n . Obviously, in ordering π , node u at most have 5 edges to its predecessors P u in U D el ( V ) . 4. Let E and E ′ be the edge sets of U D el ( V ) and the desired spanner. Initialize E ′ = ∅ and all nodes in V are unprocessed. Then, for each node u in V , following the increasing order π , run the following steps to add some edges to E ′ : a) Node u uses its predecessors (processed Unit Delaunay neighbors) in E to define at most 5 open sectors at node u (see Figure 3). For each sector, we divide it into a minimum number of open cones of degree α , where α ≤ π / 3 . b) For each cone, first add the shortest edge in E that is adjacent to u to the edge set E ′ , then add to E ′ all the edges s j s j + 1 between its geometrically ordered unprocessed neighbors in this cone, 1 ≤ j < m . Notice that, here such edges s j s j + 1 are not necessarily in U D el ( V ) . For example, when node u has a Delaunay neighbor x such that u x intersects edge s i s i + 1 and u x > 1 . c) Mark node u processed. Repeat this procedure in order of π , until all nodes are processed. Let B P S 1 ( U D G ( V ) ) denote the final graph formed by edge set E ′ . Algorithm 2: Constructing Planar Spanner with Bounded Degree for U D G ( V ) 1. Run the algorithm for point set to build B P S ( V ) with parameter α ≤ π / 3 . 2. Removing the edges whose length is longer than 1 in B P S ( V ) . The final graph is denoted by B P S 2 ( U D G ( V ) ) .
Efficient Construction of Low Weight Bounded Degree Planar Spanner
381
si
s 1 v4 s3 s 2 v5 v1
u
w
v3
v2
u
Q
si+1 Fig. 3. Constructing planar spanner with bounded degree for U D G ( V ) : process node u . v 1 , · · · , v 5 are the processed neighbors of node u in U D el ( V ) .
Fig. 4. No new edges can be added by other nodes to intersect s i s i + 1 , where s i s i + 1 is added by node u and not in U D el ( V ) .
Notice that in both these algorithms for U D G ( V ) , we change the cone angle bound from π / 2 to π / 3 . The reason is in the proof of spanner property we need to guarantee the edge s i s j and v v ′ must be in U D G ( V ) , i.e., s i s j ≤ 1 and v v ′ ≤ 1 . Notice that the constructed graphs B P S 1 ( U D G ( V ) ) and B P S 2 ( U D G ( V ) ) could be different since (1) the ordering of nodes could be different; (2) B P S 1 ( U D G ( V ) ) could add some edges (some s i s i + 1 type edges) that do not belong to U D el ( V ) = D el ( V ) ∩ U D G ( V ) , while B P S 2 ( U D G ( V ) ) always uses the edges from U D el ( V ) . 3.2 Analysis of Algorithms The bounded node degree properties of these two final structures are trivial. The proof is similar to the one for point set. Only difference is that the angle of open cone is α ≤ π / 3 instead of α ≤ π / 2 . Notice that node degree is bounded by 2 5 if α = π / 3 . Since B P S 2 ( U D G ( V ) ) is a subgraph of planar graph B P S ( V ) , it must be a planar graph. So we only need to prove that the graph B P S 1 ( U D G ( V ) ) is a planar graph. Theorem 4. B P S 1 ( U D G ( V ) ) is a planar graph.
. Observe that U D el ( V ) is a planar graph. When each node u is being processed, we add two kinds of edges: (1) edge u s i , where s i is the nearest unprocessed node in some cone divided by u ; (2) some edges s i s i + 1 , when s i and s i + 1 are consecutive unprocessed neighbors of u in graph U D el ( V ) . See Figure 3 for illustration. These edges u s i belong to U D el ( V ) , so they will not intersect each other. If edge s i s i + 1 is in U D el ( V ) , then it will not break the planar property of the graph also. Otherwise, the only possible reason which makes s i s i + 1 ∈ / U D el ( V ) is that there are some edges (such as u w in Figure 4 ) in D el ( V ) between u s i and u s i + 1 with length longer than 1 . Then all such endpoints w of these long edges and s i , s j , u will form a polygon, denoted by Q , in U D el ( V ) . We will show that after s i s i + 1 is added no intersecting edges can be added in B P S 1 ( U D G ( V ) ) . Notice that all the edges which are possible to add in B P S 1 ( U D G ( V ) ) must be diagonals of some polygons in U D el ( V ) . However, all the diagonals of polygon Q intersecting s i s i + 1 are longer than 1 , as u w is, i.e., they will ROOF
382
X.-Y. Li and Y. Wang
never be considered by our algorithm. Consequently, adding edge s i s i + the planar property. This finishes our proof.
1
will not break
Finally, we prove B P S 1 ( U D G ( V ) ) and B P S 2 ( U D G ( V ) ) are spanners. Theorem 5. B P S 1 ( U D G ( V ) ) is a ℓ
·
C d e l -spanner, where ℓ
=
π
m ax{
2
,π
α
s in
2
+ 1}
.
. Keil and Gutwin [15] showed that the Delaunay triangulation is a t -spanner for √ a constant C d e l = 4 9 3 π using induction on the increasing order of the lengths of all pair of nodes. We can show that the path connecting nodes u and v constructed in [15] also satisfies that all edges of that path is shorter than u v . Consequently, for√ any edge u v ∈ U D G ( V ) we can find a path in U D e l ( V ) with length at most a t = 4 9 3 π times u v , and all edges of the path is shorter than u v . So we only need to show that for any edge u v ∈ U D el ( V ) , there exists a path in B P S 1 ( U D G ( V ) ) between u and v whose length is at most a constant ℓ times u v . Then B P S 1 ( U D G ( V ) ) is a ℓ · C d e l -spanner. Consider an edge u v in U D el ( V ) . If edge u v is in B P S 1 ( U D G ( V ) ) , the claim trivially holds. Then consider the case u v ∈ / B P S 1 ( U D G ( V ) ) . The rest of the proof is similar to the proof of Theorem 3. There must exist a node v ′ in the same cone with v such that ′ ′ uv > uv , uv ∈ B P S ( V ) , and ∠v ′ u v < α ≤ π / 3 . Let v ′ = s 1 , s 2 , · · · , s k = v be the sequence of nodes in the ordered unprocessed neighborhood of u in U D el ( V ) from v ′ to v . Let v ′ = w 1 , w 2 , · · · , w k = v be the sequence of nodes in the ordered unprocessed neighborhood of u in D el ( V ) from v ′ to v . Obviously, the set { s 1 , s 2 , · · · , s k } is a subset of { w 1 , w 2 , · · · , w k } . Similar to Theorem 3, we know that the length of the path u w 1 w 2 · · · w k to connect u and v with length at most π , π s i n α 2 + 1 } · u v , where w 1 = s 1 is the nearest neighbor of u in the cone, m ax{ 2 and w k = v . Since any such node w i is not inside the polygon Q (defined in the Figure 4 of proof for Theorem 4), the path u s 1 s 2 · · · s k is not longer than the length of path u w 1 w 2 · · · w k . This finishes the proof. ROOF
Theorem 6. B P S 2 ( U D G ( V ) ) is a ℓ
·
C d e l -spanner, where ℓ
=
m ax{
π 2
,π
s in
α 2
+ 1}
.
. Since B P S 2 ( U D G ( V ) ) is a subgraph of B P S ( V ) , by removing edges longer than one, and B P S ( V ) is a spanner, we only need to prove the spanner path D ( v ′ , v ) constructed in B P S 2 ( V ) (in our spanner proof) does not have edges longer than one for each u and v if u v ∈ U D G ( V ) . This is trivial. Since the angle of cone is π / 3 here, s i s j < u v ≤ 1 . From the proof given by Keil and Gutwin [15], we know all the edges in the spanner path D ( s i , s j ) constructed in B P S 2 ( V ) are bounded by s i s j . Consequently, they all have length at most one. So the spanner path D ( v ′ , v ) survives after removing long edges. This finishes the proof. ROOF
Notice that the computation costs of both algorithms are O ( n l o g n ) . The first centralized algorithm can be extended to a localized algorithm [20]. The basic idea is as
Efficient Construction of Low Weight Bounded Degree Planar Spanner
383
follows: first construct a planar spanner, localized Delaunay triangulation (LDel), for UDG using method in [21]; then build a local order based on node degree in LDel; finally apply the same technique in previous algorithms to bound the node degree following the local order. The total communication cost of the algorithm is bounded by O ( n ) . We prove in [20] that the constructed final topology is still planar, has bounded node degree, and has bounded spanning ratio. (The proof is surprisingly much more complicated than the centralized counterpart because the distributed method adds some extra edges, and removes some edges compared with the centralized method.)
4
Conclusion
In this paper, we first proposed a new structure which is a planar spanner with bounded node degree for any point set V . Then we show two centralized algorithms to construct this structure for U D G ( V ) . We can further bound the total weight of the structure by applying the method by Gudmundsson et al. [7]. The centralized algorithms can be implemented in time O ( n l o g n ) . A localized algorithm [20] can be implemented using O ( n ) messages under the broadcast communication model for wireless networks. The basic idea of this new method is to use (localized) Delaunay triangulation to make planar spanner graph, then apply some ordered Yao graph to bound the node degree. It is carefully designed to not lose all good properties when combining them. Acknowledgment. The authors would like to thank Prosenjit Bose and Peng-Jun Wan for valuable discussions on paper [1].
References 1. Bose, P., Gudmundsson, J., Smid, M.: Constructing plane spanners of bounded degree and low weight. In: Proceedings of European Symposium of Algorithms. (2002) 2. Arya, S., Smid, M.: Efficient construction of a bounded degree spanner with low weight. Algorithmica 17 (1997) 33–54 3. Arya, S., Das, G., Mount, D., Salowe, J., Smid, M.: Euclidean spanners: short, thin, and lanky. In: Proc. 27th ACM STOC. (1995) 489–498 4. Levcopoulos, C., Narasimhan, G., Smid, M.: Improved algorithms for constructing fault tolerant geometric spanners. Algorithmica (2000) 5. Chandra, B., Das, G., Narasimhan, G., Soares, J.: New sparseness results on graph spanners. In: Proc. 8th Annual ACM Symposium on Computational Geometry. (1992) 192–201 6. Das, G., Narasimhan, G.: A fast algorithm for constructing sparse euclidean spanners. International Journal on Computational Geometry and Applications 7 (1997) 297–315 7. Gudmundsson, J., Levcopoulos, C., Narasimhan, G.: Improved greedy algorithms for constructing sparse geometric spanners. In: Scandinavian Workshop on Algorithm Theory. (2000) 314–327 8. Lukovszki, T.: New results on fault tolerant geometric spanners. Proceedings of the 6th Workshop on Algorithms an Data Structures (WADS’99), LNCS (1999) 193–204 9. Bose, P., Devroye, L., Evans, W., Kirkpatrick, D.: On the spanning ratio of Gabriel graphs and β -skeletons. In: Proc. of the Latin American Theoretical Infocomatics (LATIN). (2002)
384
X.-Y. Li and Y. Wang
10. Jaromczyk, J., Toussaint, G.: Relative neighborhood graphs and their relatives. Proceedings of IEEE 80 (1992) 1502–1517 11. Gabriel, K., Sokal, R.: A new statistical approach to geographic variation analysis. Systematic Zoology 18 (1969) 259–278 12. Eppstein, D.: β -skeletons have unbounded dilation. Technical Report ICS-TR-96-15, University of California, Irvine (1996) 13. Dobkin, D., Friedman, S., Supowit, K.: Delaunay graphs are almost as good as complete graphs. Discr. Comp. Geom. (1990) 399–407 14. Keil, J., Gutwin, C.: The Delaunay triangulation closely approximates the complete euclidean graph. In: Proc. 1st Workshop Algorithms Data Structure (LNCS 382). (1989) 15. Keil, J.M., Gutwin, C.A.: Classes of graphs which approximate the complete euclidean graph. Discr. Comp. Geom. 7 (1992) 13–28 16. Das, G., Joseph, D.: Which triangulations approximate the complete graph? In: Proceedings of International Symposium on Optimal Algorithms (LNCS 401). (1989) 168–192 17. Levcopoulos, C., Lingas, A.: There are planar graphs almost as good as the complete graphs and almost as cheap as minimum spanning trees. Algorithmica 8 (1992) 251–256 18. Bose, P., Gudmundsson, J., Morin, P.: Ordered θ graphs. In: Proc. of the Canadian Conf. on Computational Geometry (CCCG). (2002) 19. Bose, P., Morin, P.: Online routing in triangulations. In: Proc. of the 10 th Annual Int. Symp. on Algorithms and Computation ISAAC. (1999) 20. Li, X.Y., Wang, Y.: Localized construction of bounded degree planar spanner for wireless networks (2003) Submitted for publication. 21. Li, X.Y., Calinescu, G., Wan, P.J.: Distributed construction of planar spanner and routing for ad hoc wireless networks. In: 21st IEEE INFOCOM. Volume 3. (2002)
Iso p e rim e t ric In e qu a lit ie s a n d t h e W id t h P a ra m e t e rs o f G ra p h s ⋆ L. Sunil Chandran 1 , T . Kavit ha 1 , and C.R. Subramanian 2 1
2
Max-P lanck-Inst it ut e f¨u r Informat ik, St uhlsat zenhausweg 85, 66123 Saarbr¨u cken, Germany. { sunil,kavitha} @mpi-sb.mpg.de T he Inst it ut e of Mat hemat ical Sciences, Chennai, 600113, India. [email protected]
We relat e t he isoperimet ric inequalit ies wit h many widt h paramet ers of graphs: t reewidt h, pat hwidt h and t he carving widt h. Using t hese relat ions, we deduce 1. A lower bound for t he t reewidt h in t erms of girt h and average degree 2. T he exact values of t he pat hwidt h and carving widt h of t he d – dimensional hypercube, H A b st r a c t .
d
3. T hat t reewidt h ( H ) = d
Θ
d √2
.
d
Moreover we st udy t hese paramet ers in t he case of a generalizat ion of hypercubes, namely t he Hamming graphs.
1
Int ro d u c t io n
Discret e isoperimet ric inequalit ies have recent ly become import ant in combinat orics. Usually two kinds of isoperimet ric problems are considered: t he vert ex isoperimet ric problem and t he edge isoperimet ric problem. Let G = ( V, E ) be a graph. For S ⊆ V , t he vert ex boundary Φ ( S ) can be defined as follows. Φ (S ) =
{
w
V ∈
−
S :∃ v ∈
S such t hat
{
w , v} ∈
E}
(1)
T he vert ex isoperimet ric problem is t o minimize | Φ ( S ) | over all subset s S of V wit h | S | = ℓ for a given int eger ℓ . We denot e t his minimum value by bv ( ℓ , G ), i.e., bv ( l , G ) = min S V ( G ) , S = ℓ | Φ ( S ) | . (We denot e by V ( G ) and E ( G ) t he vert ex and edge set s of G , respect ively.) T he edge isoperimet ric problem can be defined in a similar way. Given a subset S of V , it s edge boundary δ ( S ) can be defined as ⊆
δ (S ) = ⋆
|
{
e∈
|
E : exact ly one end point of e is in S }
(2)
T his is a combined announcement of t he result s in two diff erent papers. T he result s explained in Sect ion 3 is from Gi r th and T reewi dth ( L . S. Chandran, C. R . Subramani an ) [8]. T he rest of t he result s are from Lower bounds for wi dth parameter s of graphs usi ng I soper i metr i c I nequali ti es ( L .S. Chandran, T . K avi tha ) [7].
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 385–393, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
386
L.S. Chandran, T . Kavit ha, and C.R. Subramanian
T he edge isoperimet ric problem is t o minimize | δ ( S ) | over all subset s S of V wit h | S | = ℓ for a given int eger ℓ . Let be ( ℓ , G ) = min S V ( G ) , S = ℓ | δ ( S ) | . Many met hods have been discovered t o at t ack t he isoperimet ric inequalit ies – including mart ingale t echniques [22], eigen value analysis [1] and purely combinat orial met hods. (See [19] for a survey.) T he discret e isoperimet ric inequalit ies are of int erest , not only because t hey answer ext remely nat ural and basic quest ions about graphs, but also because t hey have numerous applicat ions, most not ably t o random graphs and geomet ric funct ional analysis. In t his paper, we explore yet anot her applicat ion of isoperimet ric inequalit ies, namely t o provide lower bounds for cert ain “widt h” paramet ers of graphs. T he not ions of t reewidt h and pat hwidt h were int roduced by Robert son and Seymour [20,21] in t heir series of fundament al papers on graph minors. ⊆
|
|
D e fi n it io n 1 . A tree decom position of G = ( V, E ) is defi n ed to be a pair ( X , T ) where X = { X i : i ∈ I } is a collection of su bsets of V ( we call these su bsets the n odes of the decom position ) an d T = ( I , F ) is a tree havin g the in dex set I as the set of vertices su ch that the followin g con dition s are satisfi ed:
1. 2. 3.
Xi = V. ∈ E , ∃ i ∈ I : u, v ∈ X i . i , j , k ∈ I : if j is on a path in T from i to k , then X i i∈ I
∀ ∀
( u, v )
∩
Xk ⊆
Xj.
T he width of a tree decom position ( { X i : i ∈ I } , T ) is defi n ed to be equ al to 1. ∈ I |X i | − T he treewidth of G is defi n ed to be the m in im u m width over all tree decom position s of G an d is den oted by t w ( G ) . A path decom position of G = ( V, E ) is a tree decom position ( X , T ) in which T is requ ired to be a path. T he pathwidth of G is defi n ed to be the m in im u m width over all path decom position s of G an d is den oted by pw ( G ) .
maxi
Recent research has shown t hat many NP -complet e problems become polynomial or even linear t ime solvable, or belong t o NC, when rest rict ed t o graphs wit h small t reewidt h (See [2,3]). T he decision problem of checking, given G and k , whet her t w ( G ) ≤ k is known t o be NP -complet e. Hence t he problem of det ermining t he t reewidt h of an arbit rary graph is NP -hard. Anot her int erest ing “widt h” paramet er is t he carving widt h. T his not ion is used by Seymour and T homas in [23] in t heir algorit hm t o decide whet her t here exist s a rout ing t ree wit h congest ion less t han k , when t he underlying graph is planar. We present below t he definit ion of carving widt h. Let V be a finit e set wit h | V | ≥ 2. T wo subset s A , B ⊆ V cross if A ∩ B , A − B , B − A , V − ( A ∪ B ) are all non–empty. A carving in V is a set C of subset s of V such t hat 1. ∅ , V ∈ / C 2. no two members of C cross 3. C is maximal sub ject t o t he two condit ions above. Let G be a graph. For A ⊂ V ( G ), let δ ( A ) denot e t he set of all edges wit h exact ly one end point in A . For each e ∈ E ( G ), let p( e) ≥ 0 be an int eger. For
Isoperimet ric Inequalit ies and t he W idt h P aramet ers of Graphs
387
E ( G ), we denot e e ∈ X p( e) by p( X ). If | V ( G ) | ≥ 2, we define t he p–carving widt h of G t o be t he minimum over all carvings in V ( G ), of t he maximum over all A ∈ C , of p( δ ( A )). T he carving widt h of G is t he p–carving widt h of G where p( e) = 1 for every edge e and is denot ed by cw ( G ). Seymour and T homas show t hat comput ing cw ( G ) for general graphs is NP -hard. T he d–dimensional hypercube, H d , is t he graph on 2d vert ices, which correspond t o t he 2d d–vect ors whose component s are eit her 0 or 1, two of t he
X
⊆
vert ices being adjacent when t hey diff er in just one coordinat e. Hypercubes are a well-st udied class of graphs, which arise in t he cont ext of parallel comput ing, coding t heory, algebraic graph t heory and many ot her areas. T hey are popular because of t heir symmet ry, small diamet er and many int erest ing graph–t heoret ic propert ies. 1 .1
O u r R e s u lt s
In t his paper we develop lower bounds for t reewidt h, pat hwidt h and carving widt h of a graph in t erms of isoperimet ric inequalit ies. As applicat ions of t hese lower bounds we have t he following result s. R e s u lt 1 T he lengt h of t he short est cycle in a graph G is called t he girt h of G . We derive a lower bound for t he t reewidt h of G in t erms of it s girt h and average degree. In part icular, we show t hat if G has girt h g and average degree
max d2 , 4 e ( g1+ 1) ( d − 1) ( g 1) / 2 − 2 , where e is t he Napier number. In view of a well–known conject ure regarding t he exist ence of graphs wit h girt h g, minimum degree δ and having at most c( δ − 1) ( g 1) / 2 vert ices (for some const ant c), t his lower bound seems t o be almost t ight (but for a mult iplicat ive fact or of g + 1). (See sect ion 2 for det ails.) d , t hen t w ( G )
⌊
≥
−
⌋
⌊
−
⌋
R e s u lt 2 We st udy t he paramet ers t reewidt h, pat hwidt h and carving widt h in t he cont ext of d–dimensional hyper cubes. T he quest ion of est imat ing t he d
⌊ 2⌋ ≤ t reewidt h of hyper cube was proposed by Chlebikova [10] who st at es t hat 2 d d t w ( H d ) ≤ ⌊ d ⌋ + ⌈ d ⌉ . In [9], Chandran and Subramanian show t hat tw( H d ) ≥ 2 2
3.2d − 1. In t his paper we obt ain improved bounds for t he t reewidt h of H d 2( d + 4) and det ermine t he exact values for t he pat hwidt h and carving widt h of H d . d 1 m 1. pw ( H d ) = . m m = 0 −
2
2. c1
2
d
√
d
≥
t w (H d )
d
≥
c2 √2 , for some const ant s c1 , c2 , where c1 < 1. 2 and d
c2 > 0. 48, for large d . 3. cw ( H d ) = 2d − 1 .
R e s u lt 3 In fact , we st udy t hese paramet ers in t he cont ext of a more general class of graphs, namely t he Hamming graphs. T he H am m in g G raph K qd is t he graph on qd vert ices, which correspond t o t he qd d–vect ors wit h coordinat es coming from a set of size q, two of t he vert ices being adjacent if t hey diff er in
388
L.S. Chandran, T . Kavit ha, and C.R. Subramanian
just one coordinat e. (Clearly, t he d–dimensional hypercubes are a special case of t he Hamming graphs, K qd , namely, when q = 2). d 2 1. pw ( K qd ) ≥ c1 q d for some const ant c1 > 0, where c1 ≈ e 2 for large d . π −
√
2. pw ( K qd )
2
≤
q
c2 √
d
d
for some const ant c2 , where c2 < 1. 2 for large d.
A Low e r B o u n d fo r Tre e w id t h a n d a n A p p lic a t io n
D e fi n it io n 2 . Let G = ( V, E ) be a sim ple con n ected graph on n vertices with n o self loops, an d s be a n u m ber su ch that 1 ≤ s ≤ n . W e defi n e N m i n ( s ) = min | N ( X ) | over all ( n on em pty ) X with 2s ≤ | X | ≤ s.
It can be shown t hat t w ( G ) ≥ N m i n ( s) − 1, for any s, 1 ≤ s ≤ | V ( G ) | . T he det ails of t he proof of t his result is is available in t he full paper [8]. Not ing t hat N m i n ( s ) = min 2s x s bv ( x , G ), we can st at e t he following t heorem. ≤
≤
T h e o re m 1 . Let G = ( V, E ) be a graph an d let s be an in teger with 1 T hen t w ( G ) ≥ min 2s ≤ x ≤ s bv ( x , G ) − 1.
s
≤
≤
n.
We make use of t his lower bound for t reewidt h t o derive t he following result . We omit t he proof. (It is available in t he full paper [8]). T h e o re m 2 . Let G be a graph with girth at least g, average degree at least d . T hen
t w (G )
≥
max
1 ( d − 1) , 2 4e( g + 1)
d
⌊
( g − 1) / 2 ⌋
−
2
where e is the N apier n u m ber.
Perhaps, a nat ural approach t o t he quest ion of get t ing a lower bound for t he t reewidt h of G would be t o look for t he largest r such t hat G has a K r minor ( K r st ands for t he complet e graph on r vert ices), since t he t reewidt h of a graph is at least t he t reewidt h of any of it s minors and t w ( K r ) = r − 1. ( H is called a minor of G iff H can be obt ained from a subgraph of G by a sequence of edge cont ract ions). T his problem has received some at t ent ion in t he lit erat ure. It can be inferred from a result of T homassen [25] in conjunct ion wit h a result 1 in [17, √ 24] t hat if gi r t h ( G ) is at least cr log r and t he minimum degree of G is at least 3 t hen G has a K r minor. T his result was improved recent ly by Diest el and Rempel [12] who proved t hat if gi r t h ( G ) ≥ 6 log r + 3 log log r + c, and δ ( G ) ≥ 3, t hen G has a K r minor. One can infer from t he above result t hat if δ ( G ) ≥ 3, t hen t w ( G ) ≥ r − 1 ≥ 2g / 6 − 1, where r is t he largest int eger such t hat G has a K r minor. Very recent ly K¨u hn and Ost hus [18] have improved his result , and have shown using probabilist ic met hods t hat if gi r t h ( G ) ≥ g for some odd ′
′
′
1
T he result of [17,24] st at es t hat if t he average degree of a graph t hen G has a K minor. r
G
is at least
√
cr
log r
Isoperimet ric Inequalit ies and t he W idt h P aramet ers of Graphs
389
g+ 1
g, t hen for some c > 0, G has a K r minor for some r
≥
c.(δ
√
)
4
. Clearly, t he
log δ
lower bound we provide for t reewidt h in t erms of girt h and minimum degree is much bet t er t han (in fact about t he square of) what is derivable from t he minor t heoret ic result of K¨u hn and Ost hus. Moreover, our lower bound is expressed in t erms of average degree rat her t han t he minimum degree and t hus is st ronger. More fundament ally, K¨u hn and Ost hus argue t hat it is unlikely t hat t heir lower bound for t he clique minor size may be improved significant ly. T hus, ext ending t heir point furt her, it is unlikely t hat an approach based on clique minors may give a lower bound for t he t reewidt h (in t erms of girt h and minimum degree or average degree) comparable t o ours. For a brief exposit ion of t he early development s on t he exist ence of dense minors in graphs of large girt h, see Chapt er 8 of [11]. For an int roduct ory account of t he role of t reewidt h in minor t heory, see Chapt er 12 of [11]. R e m a rk o n t h e t ig h t n e s s o f t h e a b o v e lo w e r b o u n d : T he following is a well known conject ure on t he exist ence of high girt h graphs. (See for example, [5], page 164). C o n je c t u re : T here exists a con stan t c su ch that for all in tegers g, δ ≥ 3, there is a graph G ( g, δ ) of m in im u m degree at least δ an d girth at least g whose order g 1 ( n u m ber of vertices ) is at m ost c( δ − 1) ⌊ 2 ⌋ . In view of t his conject ure, we see t hat t he lower bound given in T heorem 2 is very close t o what is best possible (but for a mult iplicat ive fact or of g + 1) since g 1 t he t reewidt h of G ( g, δ ) can be at most c( δ − 1) ⌊ 2 ⌋ , t he t ot al number of vert ices, whereas t he lower bound proven by us is at least 4 e ( g1+ 1) ( δ − 1) ( g 1) / 2 − 2 since t he average degree d ≥ δ . It may be not ed t hat , by using G ( g, δ ) as component s it is easy t o const ruct graphs wit h minimum degree at least δ , girt h at least g, and having an arbit rarily large number of vert ices but it s t reewidt h (or pat hwidt h) g 1 st ill at most c( δ − 1) ⌊ 2 ⌋ . −
−
⌊
−
⌋
−
3
A Low e r B o u n d fo r P a t hw id t h a n d C a rv in g W id t h
Since t he t w ( G ) ≤ pw ( G ), we can, of course, use T heorem 1 t o provide a lower bound for t he pat hwidt h of a graph also. But we not ice t hat in t he case of pat hwidt h one can st at e a much st ronger result . Below we develop t he necessary concept s. A graph G = ( V, E ) is defined t o be an int erval graph iff it s vert ices V = { v 1 , v 2 , · · · , v n } can be put in one t o one correspondence wit h a set of int ervals { I 1 , I 2 , · · · , I n } on t he real line in such a way t hat { v i , v j } ∈ E if and only if t he corresponding int ervals I i and I j have a non empty int ersect ion. Wit hout loss of generality one can assume t hat all t he int ervals are closed int ervals, see for example [14], page 13. T he reader can easily convince himself t hat given any graph G t here exist super graphs G of G such t hat G is an int erval graph. For example, t he complet e graph on n nodes is an int erval graph. T he clique number ω ( G ) is defined t o be t he number of vert ices in a maximum sized clique in G . ′
′
390
L.S. Chandran, T . Kavit ha, and C.R. Subramanian
D e fi n it io n 3 . A graph G has in terval–width, I W ( G ) = k iff k is the sm allest n on –n egative in teger su ch that G is a su bgraph of som e in terval graph H , with ω ( H ) = k + 1.
T he following charact erizat ion of pat hwidt h in t erms of int erval graphs is well–known. T he omit t ed proofs (from t his sect ion onwards) are available in t he full paper [7]. L e m m a 1 . Let G be a graph. T hen pw ( G ) = I W ( G ) . L e m m a 2 . Let G = ( V, E ) be a con n ected in terval graph an d 1 ω ( G ) ≥ bv ( s, G ) + 1.
≤
s
≤
n . T hen
T h e o re m 3 . Let G = ( V, E ) be an y graph on n n odes, an d let 1 pw ( G ) ≥ bv ( s, G ) .
≤
s
≤
n . T hen
P roof. Clearly in any int erval super graph G ′ of G (on t he same number of vert ices) bv ( s, G ′ ) ≥ bv ( s, G ). T he t heorem follows from Lemma 1 and Lemma
2. A lower bound similar t o t hat of T heorem 1 can be proved for t he carving widt h of a graph G in t erms of it s edge isoperimet ry. T he following lemma is from [23]. L e m m a 3 ( [2 3 ]) . Let V be a fi n ite set with | V | ≥ 2, let T be a tree in which every vertex has valen cy 1 or 3, an d let τ be a bijection from V on to the set of leaves of T . For each edge e of T let T 1 ( e) an d T 2 ( e) be the two com pon en ts of T − e; an d let C
=
{ {
v ∈
V : τ (v ) ∈
V ( T i ( e)) } : e ∈
E ( T ) , i = 1, 2}
T hen C is a carvin g in V . C on versely, every carvin g in V arises from som e tree T an d bijection τ in this way. L e m m a 4 . Let T be a tree with each of its n odes havin g valen cy either 3 or 1. For an y edge e, let T 1 ( e) an d T 2 ( e) be the com pon en ts of T \ e. For an y 1 ≤ x ≤ n , ∃ an edge ex su ch that the n u m ber of leaves of on e of the trees T 1 ( ex ) an d T 2 ( ex ) lies between x2 an d x . T h e o re m 4 . Let G = ( V, E ) be a graph on n n odes an d let 1 cw ( G ) ≥ min x2 ≤ s ≤ x be ( s, G ) .
4 4 .1
≤
x
≤
n . T hen
A p p lic a t io n s t o H y p e rc u b e s a n d H a m m in g G ra p h s H y p e rc u b e
A prime example of a graph of combinat orial int erest is t he hypercube H d . T he reader may be reminded t hat H d can be considered as a graph on t he power set
Isoperimet ric Inequalit ies and t he W idt h P aramet ers of Graphs
391
( X ) of a d-point set X in which a vert ex corresponding t o a set x is adjacent t o a vert ex corresponding t o a set y if and only if | x ∆ y | = 1. (Here x ∆ y st ands for t he symmet ric diff erence of t he set s x and y .) Before we deal wit h t he pat hwidt h, t reewidt h and carving widt h of t he hypercube, we int roduce anot her well-known graph t heoret ic paramet er, namely t he bandwidt h. Let G = ( V, E ) be a graph. Let a biject ion φ : V → { 1, · · ·, n } be called an ordering of t he vert ices of G . T hen for any edge e = { u, v } ∈ E , let ∆ ( e, φ ) = | φ ( u ) − φ ( v ) | . T he bandwidt h of G is defined as t he minimum over all possible orderings φ of V ( G ), t he maximum value of ∆ ( e, φ ) over all edges e ∈ E . T he following is easy t o prove.
P
bandwidt h( G )
≥
max bv ( s, G )
(3)
1≤ s ≤ n
Also, it is not diffi cult t o see from t he definit ion of pat hwidt h and bandwidt h t hat ban dw i dt h ( G ) ≥ pw ( G ). Not e t hat t his inequality can be st rict and t he value of | ban dw i dt h ( G ) − pw ( G ) | can be arbit rarily large. Below we will show t hat in t he case of H d , pat hwidt h= bandwidt h. In [15], Harper addressed t he quest ion of finding t he bandwidt h of H d . To minimize t he value of maxe E ∆ ( e, φ ) he proposed an opt imal ordering φ of t he vert ices of H d . He indeed showed t hat maxe ∆ ( e, φ ) = m ax s bv ( s, H d ). Harper’s result on t he bandwidt h of H d can be summarised as below. d 1 m L e m m a 5 . ban dwidth ( H d ) = max s bv ( s, H d ) = m m = 0 ′
∈
′
−
2
T he last equality can be proved by induct ion and is ment ioned in t he last page of Harper’s art icle [15]. P ut t ing t oget her all t he pieces, we get our result on t he pat hwidt h of H d . d 1 m T h e o re m 5 . pw ( H d ) = ban dwidth ( H d ) = max s bv ( s, H d ) = m m = 0 −
2
P roof. By T heorem 3, we know t hat pw( H d ) ≥ max s bv ( s, H d ). It follows by Lemma 5, t hat pw( H d ) ≥ bandwidt h( H d ). But we know t hat bandwidt h of any graph is at least as much as it s pat hwidt h. T he required result follows. T he following result was first proved by Harper [15]. Simpler proofs were lat er given by Kat ona [16], Frankl and F u¨ redi [13] et c. See [4], Chapt er 16 for an exposit ion. r 1 d + m , where 0 < m ≤ dr L e m m a 6 . Let s be an in teger su ch that s = i = 0 i ( 1 ≤ r ≤ d .) T hen , bv ( s, H d ) = dr − m + ∂ u ( m ) where ∂ u ( m ) is the m in im u m −
possible cardin ality of the u pper shadow of a set of m su bsets in X chapter 5 for details) .
By set t ing m =
r
( see [4],
d
in t he above lemma, we have t he following simple corollary. r C o ro lla ry 1 . bv ( i = 0 dr , H d ) = r +d 1 r
Now, making use of Lemma 6, Corollary 1 and T heorem 1 and using st erling’s approximat ion for fact orials, we can present our bounds for t he t reewidt h of H d .
392
L.S. Chandran, T . Kavit ha, and C.R. Subramanian
T h e o re m 6 . c1 √2
d
d
≥
d
t w (H d )
≥
c2 √2 , for som e con stan ts c1 , c2 , where c1 < 1. 2 d
an d c2 > 0. 48, for large d .
Similarly, using T heorem 4 we can infer t he following result . T h e o re m 7 . cw ( H d ) = 2d − 1 .
P roof. It follows from Bollob´a s [4] and Bollob´a s and Leader [6] t hat min 2 d 2 s 2 d 1 be ( s, H d ) ≥ 2d 1 . So, by T heorem 4, we get t hat cw ( H d ) ≥ 2d 1 . In fact we can const ruct a carving C on H d wit h widt h = 2d 1 , t hus proving t he t heorem. (See t he full paper [7] for det ails.) −
−
≤
≤
−
−
−
4 .2
H a m m in g G ra p h s
Anot her graph of combinat orial int erest is K qd , t he product of d copies of a complet e graph of order q. Equivalent ly, t he vert ex set of K qd is t he set of all st rings of size d on t he alphabet { 1, 2, ..., q} and two st rings are adjacent if t hey diff er in exact ly one place. d q 2 T h e o re m 8 . pw ( K qd ) ≥ c1 for som e con stan t c1 > 0, where c1 ≈ e 2 for π d −
√
large d . T h e o re m 9 . pw ( K qd )
≤
q
c2 √
d
d
for som e con stan t c2 , where c2 < 1. 2 for large d .
Combining T heorems 8 and 9, we see t hat t he pw ( K qd ) = Θ (
q
d
√
d
).
R e fe re n c e s 1. N. Alon and V. D. Millman, λ 1 , i soper i metr i c i nequali ti es for graphs and super concentrator s, J ournal of Combinat orial T heory, Series. B, 38 (1985), pp. 73–88. 2. S. Arnborg and A. P roskurowski, L i near ti me algor i thms for N P –hard problems on graphs embedded i n k –trees, Discret e Applied Mat hemat ics, 23 (1989), pp. 11–24. 3. H. L. Bodlaender, A tour i st gui de through treewi dth, Act a Cybernet ica, 11 (1993), pp. 1–21. 4. B. Bollab´a s, Combi nator i cs, Cambridge University P ress, 1986. 5. B. Bollob´a s, E xtremal Graph T heor y , Academic P ress, 1978. 6. B. Bollob´a s and I. Leader, E dge-i soper i metr i c i nequali ti es i n the gr i d, Combinat orica, 11 (1991), pp. 299–314. 7. L. S. Chandran and T . Kavit ha, Lower bounds for wi dth parameter s of graphs usi ng i soper i metr i c i nequali ti es. Manuscript , 2003. 8. L. S. Chandran and C. R. Subramanian, Gi r th and treewi dth, Tech. Rep. MP I-I2003-NWG2-01, Max-P lanck-Inst it ut f¨u r Informat ik, Saarbr¨u cken, Germany, 2003. 9. , A spectral lower bound for the treewi dth of a graph and i ts consequences. To appear in Informat ion P rocessing Let t ers, 2003. 10. J . Chlebikova, On the tree-wi dth of a graph, Act a Mat hemat ica Universit at is Comenianae, 61 (1992), pp. 225–236. 11. R. Diest el, Graph T heor y , vol. 173, Springer Verlag, New York, 2 ed., 2000.
Isoperimet ric Inequalit ies and t he W idt h P aramet ers of Graphs
393
12. R. Diest el and C. Rempel, D ense mi nor s i n graphs of large gi r th. To Appear in Combinat orica, 2003. 13. P. Frankl and Z. F u¨ redi, A shor t proof for a theorem of H ar per about H ammi ng spheres, Discret e Mat h., 34 (1981), pp. 311–313. 14. M. C. Golumbic, A lgor i thmi c Graph T heor y A nd P er fect Graphs, Academic P ress, New York, 1980. 15. L. Harper, Opti mal number i ngs and i soper i metr i c problems on graphs, J ournal of Combinat orial T heory, 1 (1966), pp. 385–393. 16. G. O. H. Kat ona, T he hammi ng-sphere has mi ni mum boundar y , St udia Sci. Mat h. Hungar., 10 (1975), pp. 131–140. 17. A. V. Kost ochka, Lower bound of the hadwi ger number of graphs by thei r average degree, Combinat orica, 4 (1984), pp. 307–316. 18. D. K u¨ hn and D. Ost hus, M i nor s i n graphs of large gi r th. To appear in Random St ruct ures and Algorit hms, 2003. 19. I. Leader, D i screte i soper i metr i c i nequali ti es, P roc. Symp. Appl. Mat h., 44 (1991), pp. 57–80. 20. N. Robert son and P. D. Seymour, Graph mi nor s I . excludi ng a forest , J ournal of Combinat orial T heory, Ser. B, 35 (1983), pp. 39–61. 21. , Graph mi nor s I I : algor i thmi c aspects of tree-wi dth, J ournal of Algorit hms, 7 (1986), pp. 309–322. 22. G. Schecht man, L ´evy type i nequali ty for a class of metr i c spaces, in Mart ingale T heory in Harmonic Analysis and Banach Spaces, Lect ure Not es in Mat hemat ics, vol. 939, 1982, pp. 211–215. 23. P. Seymour and R. T homas, Cal l routi ng and the ratcatcher , Combinat orica, 14 (1994), pp. 217–241. 24. A. G. T homason, A n extremal functi on for contracti ons of graphs, Mat h. P roc. Camb. P hil. Soc., 95 (1984), pp. 261–265. 25. C. T homassen, Gi r th i n graphs, J ournal of Combinat orial T heory, Ser. B, 35 (1983), pp. 129–141.
G ra p h C o lo rin g a n d t h e Im m e rs io n O rd e r⋆ Faisal N. Abu-Khzam and Michael A. Langst on Depart ment of Comput er Science, University of Tennessee, Knoxville, T N 37996–3450, USA
T he relat ionship between graph coloring and t he immersion order is considered. Vert ex connect ivity, edge connect ivity and relat ed issues are explored. T hese lead t o t he conject ure t hat , if G requires at least t colors, t hen G must have immersed wit hin it K , t he complet e graph on t vert ices. Evidence in support of such a proposit ion is present ed. For each fixed value of t , t here can be only a finit e number of minimal count erexamples. T hese count erexamples are charact erized based on Kempe chains, connect ivity, cut set s and degree bounds. It is proved t hat minimal count erexamples must , if any exist , be bot h 4-vert ex-connect ed and t -edge-connect ed. A b st r a c t .
t
1
In t ro d u c t io n
T he applicat ions of graph coloring are legion. T he usual goal, and t he one we consider here, is t o assign colors t o vert ices so t hat no two adjacent vert ices are given t he same color. Graph coloring has a long and st oried hist ory. T he st udy of four-coloring planar graphs alone has generat ed int erest for over 150 years [21]. Despit e all t his eff ort , graph coloring in general remains a not oriously diffi cult combinat orial problem. T he chromat ic number of G , denot ed by χ ( G ), is t he minimum number of colors required by G in any proper coloring of it s vert ices. Of course it is well known t hat det ermining χ ( G ) is N P -hard. It is t empt ing t o t ry t o associat e χ ( G ) wit h some sort of clique cont ained wit hin G . Aft er all, if G cont ains K t as a subgraph, t hen it is easy t o show t hat G can be colored wit h no fewer t han t colors. To see t hat t he presence of a K t subgraph is not necessary, however, one needs only t o observe t hat C 5 , t he cycle of order five, requires t hree colors yet does not cont ain K 3 as a subgraph. Nevert heless, perhaps some weaker form of K t is present . One possibility is t opological cont ainment , in which t aking subgraphs is augment ed wit h removing subdivisions. An edge is subdivided when it is replaced by a pat h formed from two edges and an int ernal vert ex of degree two; subdivision removal reverses t his operat ion. For example, C 5 cont ains K 3 t opologically. Somet ime in t he 1940s
⋆
T his research is support ed in part by t he grant s EIA–9972889 and CCR–0075792, by grant N00014–01–1–0608, by t he Depart ment 00OR22725, and by t he Tennessee Cent er for der award E01–0178–081.
Nat ional Science Foundat ion under t he Offi ce of Naval Research under of Energy under cont ract DE–AC05– Informat ion Technology Research un-
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 394–403, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Graph Coloring and t he Immersion Order
395
Ha j´os conject ured t hat if χ ( G ) ≥ t , t hen G must cont ain a t opological K t [11]. T he conject ure is t rivially t rue for t ≤ 3. In 1952 Dirac proved it t rue for t = 4 [4]. It was not unt il Cat lin’s work in 1979 t hat Ha j´os’ conject ure was finally set t led, and negat ively, wit h a family of count erexamples for t ≥ 7 [3]. Ironically, one such count erexample is t he 15-vert ex graph defined by t he crossproduct of C 5 and K 3 . It requires eight colors but cont ains no t opological K 8 . Subsequent ly, Erd˝os and Fa jt lowicz were able t o prove t he rat her surprising result t hat almost all graphs are count erexamples [6]. T hus Ha j´os’ conject ure remains open only for t ∈ { 5, 6} . Anot her possibility is t he minor order, for which t he allowable operat ions are t aking subgraphs and cont ract ing edges. T he minor order is a generalizat ion of t he t opological order, because subdivision removal is just a special case of edge cont ract ion. Hadwiger conject ured in 1943 t hat , if χ ( G ) ≥ t , t hen G must cont ain a K t minor [10]. T his conject ure equat es t o Ha j´os’ conject ure for t ≤ 4. Wagner proved in 1964 t hat , for t = 5, it is equivalent t o t he four color t heorem [26]. In 1993 Robert son, Seymour and T homas proved it t rue for t = 6 [20]. Whet her Hadwiger’s conject ure holds t rue in general, however, has t hus far not been decided. T his is in spit e of decades of research, hordes of support ing evidence and a mult it ude of result s on many of it s variant s and rest rict ions [1,5,14,23,25, 27]. Even t he celebrat ed Graph Minor T heorem [19] appears t o shed no part icular light on t his quest ion. As of t his writ ing, a resolut ion of Hadwiger’s conject ure seems dist ant . In t his paper we focus inst ead on t he immersion order. A pair of adjacent edges u v and v w , wit h u = v = w , is lift ed by delet ing t he edges u v and v w , and adding t he edge u w . A graph H is said t o be immersed in a graph G if and only if a graph isomorphic t o H can be obt ained from G by lift ing pairs of edges and t aking a subgraph. P revious invest igat ions int o t he immersion order have generally been conduct ed from a purely algorit hmic st andpoint . We refer t he reader t o [2,7,8,9,17] for examples and applicat ions. In cont rast , here we mainly consider st ruct ural issues. We est ablish compelling connect ions between graph coloring and t he immersion order, and conject ure t hat K t is immersed in any graph requiring t or more colors.
2
P re lim in a rie s
We rest rict our at t ent ion t o finit e, simple undirect ed graphs (mult iple edges and loops t hat may arise from lift ing are irrelevant t o coloring). G is said t o be t -ver t ex-con n ect ed if at least t vert ex-disjoint pat hs connect every pair of it s vert ices. A ver t ex cu t set is a set of vert ices whose removal breaks G int o two or more nonempty connect ed component s. T he cardinality of a smallest vert ex cut set in G is equal t o t he largest t for which G is t -vert ex-connect ed (unless G is a complet e graph, which can have no vert ex cut set ). G is said t o be t -edgecon n ect ed if at least t edge-disjoint pat hs connect every pair of it s vert ices. An edge cu t set is a set of edges whose removal breaks G int o two or more nonempty
396
F .N. Abu-Khzam and M.A. Langst on
connect ed component s. T he cardinality of a smallest edge cut set in G is equal t o t he largest t for which G is t -edge-connect ed. If χ ( G ) ≤ t , t hen G is said t o be t -colorable . If χ ( G ) = t , t hen G is said t o be t -chrom at ic . If χ ( G ) = t and χ ( H ) < t for every proper subgraph H of G , t hen G is said t o be t -color -cr it ical . A t -coloring of G is realized by a map c from t he vert ices of G t o t he set { 1, 2, . . , t } so t hat , if G cont ains t he edge u v , t hen c ( u ) = c ( v ). Given such a map, c i j is used t o denot e t he subgraph induced by t he vert ex set { u : c ( u ) ∈ { i , j } } . A pat h cont ained wit hin c i j is t ermed a K em pe chain [28], so-named in honor of t he foundat ional work done on t hem by Kempe in [15]. (Ironically, t he main result in [15] was a purport ed proof of t he Four Color T heorem t hat , like so many ot hers, t urned out t o be fat ally flawed.) Of course c i j need not be connect ed, and so for any u ∈ c i j we employ c i j ( u ) t o denot e t he set { v : v resides in t he same connect ed component of c i j as does u } . Such set s have useful propert ies. O b s e rv a t io n 1 . I f
{
i , j } = { k , l } , t hen c i j an d c k l are edge disjoin t .
Alt hough t he immersion order is t radit ionally defined in t erms of t aking subgraphs and lift ing pairs of edges, Kempe chains and Observat ion 1 make it helpful for us t o ut ilize as well t he following alt ernat e charact erizat ion: H is immersed in G if and only if t here exist s an inject ion from t he vert ices of H t o t he vert ices of G for which t he images of adjacent element s of H are connect ed in G by edge-disjoint pat hs. Under such an inject ion, an image vert ex is called a cor n er of H in G ; all image vert ices and t heir associat ed pat hs are collect ively called a m odel of H in G . We use δ ( G ) t o denot e t he smallest degree found among t he vert ices of G . We use N ( u ) t o denot e t he neighborhood of u . Suppose u has degree t − 2 or less in a t -chromat ic graph G . T hen G − u must also be t -chromat ic. Ot herwise G − u could be colored wit h t − 1 colors, and u assigned one of t he t − 1 colors unused wit hin N ( u ). O b s e rv a t io n 2 . I f G is t -color -cr it ical, t hen δ ( G )
≥
t −
1.
It is somet imes advant ageous t o select , rest rict or manipulat e colorings. For example, if G is t -chromat ic but G − u is only ( t − 1)-chromat ic, t hen it is possible t o consider only colorings in which u is assigned a unique color. O b s e rv a t io n 3 . I f G is t -color -cr it ical, t hen for an y ver t ex u t here exist s a color in g c in w hich c ( u ) = 1 an d c ( v ) = 1 for ever y ver t ex v ∈ G − u .
Given t he various connect ions between graph coloring, degrees and connect ivity, and in t urn t he connect ions between connect ivity and t he immersion order, we seek t o det ermine just how χ ( G ) is relat ed t o immersion cont ainment . Our effort s t o dat e prompt us t o set t he st age for t his wit h t he following conject ure. (A superficially similar conject ure has been made by Lescure and Meyniel [22]. Alt hough somet imes called “t he immersion conject ure,” t he not ion of cont ainment used t here is not t he immersion order.) C o n je c t u re I f χ ( G )
≥
t , t hen K t is im m er sed in G .
Graph Coloring and t he Immersion Order
397
T his speculat ion mot ivat es our work in t he sequel. T here we shall present what we believe is compelling preliminary evidence in it s support . Our conject ure, like Hadwiger’s, is t rivially t rue for t ≤ 4. T his is because t he immersion order generalizes t he t opological order, for which Ha j´os’ conject ure is long known t o hold when t ≤ 4. Before proceeding, we int roduce a not ion of immersion-crit icality and show how it relat es t o t he possible exist ence of count erexamples. D e fi n it io n G is t -immersion-crit ical if χ ( G ) = t an d χ ( H ) < t w hen ever H is proper ly im m er sed in G .
Because χ ( K t ) = t , any count erexample must eit her be t -immersion-crit ical or have properly immersed wit hin it anot her t -immersion-crit ical count erexample. Similarly, any t -immersion-crit ical graph dist inct from K t must be a count erexample. T hus our conject ure is equivalent t o t he st at ement t hat K t is t he only t -immersion-crit ical graph for every t . Alt hough we have t hus far fallen short of est ablishing t his one way or t he ot her, we can show t hat t here are at most a finit e number of t hem. To do t his, we rely on propert ies of well-quasi-orders and immersion order obst ruct ion set s. We refer t he reader unfamiliar wit h t hese concept s t o [7,8,16]. T h e o re m 1 . For each t , t here are fi n it ely m an y t -im m er sion -cr it ical graphs. P ro o f. Consider t he family of graphs F =
{ G : χ ( G ) < t and χ ( H ) < t for every H ≤ i G } . T hen, by definit ion, F is closed in t he immersion order. Because graphs are well-quasi-ordered by t he immersion relat ion, it follows t hat F ’s obst ruct ion set is finit e. T his set cont ains precisely t he t -immersion-crit ical graphs. ✷
3
M a in R e s u lt s
Graph connect ivity has long been a cent ral feat ure of at t empt s t o set t le Hadwiger’s conject ure. G is said t o be t -m in or -cr it ical if χ ( G ) = t and χ ( H ) < t whenever H is a proper minor of G . K t is of course bot h ( t − 1)-vert ex-connect ed and ( t − 1)-edge-connect ed. T hus, if any t -minor-crit ical graph is not as st rongly connect ed, t hen Hadwiger’s conject ure is false for all t ≥ t . So suppose G denot es a t -minor-crit ical graph ot her t han K t (in which case t he conject ure fails). Some 35 years ago [18], Mader showed t hat G must be at least 7-vert ex-connect ed whenever t ≥ 7. T his provides evidence in support of t he conject ure for t ∈ { 7, 8} . A few years lat er [23], Toft proved t hat G must also be t -edge-connect ed. T his provides addit ional support ing evidence for all t . Very recent ly, Kawarabayashi has shown t hat G must be at least ⌈ 3t ⌉ -vert ex-connect ed as well [13]. Following t his approach, we st udy bot h t he vert ex and edge connect ivity of t -immersioncrit ical graphs. We assume t ≥ 5 unless st at ed ot herwise. Kempe chains play a pivot al role in our invest igat ion. ′
398
F .N. Abu-Khzam and M.A. Langst on
3 .1
V e rt e x C o n n e c t iv it y
Because t hey are t -color-crit ical, it is easy t o see t hat t -immersion-crit ical graphs are 2-vert ex-connect ed [1]. We now est ablish t hat t hey must in fact be at least 4-vert ex-connect ed. Our work linking coloring t o t he immersion order begins in earnest wit h Lemma 4. First , however, we present somet hing of an int roduct ion wit h t hree easy but useful lemmas about cut set s, pat hs and coloring. Lemmas 1 and 2 are probably well known, alt hough t hey may not be formulat ed anywhere else in precisely t he same way we st at e t hem in t his t reat ment . Lemma 2, which we dub T he P at chin g L em m a , is especially helpful. Lemma 3 is cert ainly well known, and ment ioned in a variety of sources (see, for example, [12,25,27]). L e m m a 1 . L et S den ot e a m in im u m -cardin alit y ver t ex cu t set in a 2-ver t excon n ect ed graph G , an d let C den ot e a con n ect ed com pon en t of G \ S . T hen an y t w o elem en t s of S m u st be con n ect ed by a pat h w hose in t er ior ver t ices lie com plet ely w it hin C .
T wo colorings are said t o be equ ivalen t if t he part it ions induced by t heir respect ive color classes are ident ical. L e m m a 2 . (T he Pat ching Lemma) L et S den ot e a ver t ex cu t set of G , an d let G 1 an d G 2 den ot e a pair of in du ced su bgraphs for w hich G 1 ∪ G 2 = G an d G 1 ∩ G 2 = S . I f G 1 an d G 2 adm it t -color in gs w hose rest r ict ion s t o S are equ ivalen t , t hen G is t -colorable.
T he Pat ching Lemma can be used t o est ablish t he following well-known fact . L e m m a 3 . N o ver t ex cu t set of a t -color -cr it ical graph can be a cliqu e.
T he preceding lemmas t ell us a good deal about t he make-up of vert ex cut set s, and how t hey relat e t o coloring. Armed wit h t his informat ion, we are now able t o argue more direct ly about vert ex connect ivity and t he immersion order. To simplify mat t ers, we shall adopt t he following convent ions for t he remainder of t his subsect ion: -
is at least five, denot es a t -immersion-crit ical graph, S denot es a minimum-cardinality vert ex cut set in C denot es a connect ed component of G \ S , G 1 denot es t he subgraph induced by C ∪ S , and G 2 denot es G \ C . t
G
G,
L e m m a 4 . E ver y t -im m er sion -cr it ical graph is 3-ver t ex-con n ect ed. P ro o f. Suppose ot herwise, as wit nessed by some G wit h S = { a , b} . We know from Lemma 3 t hat t he edge a b is not present in G . Let i ∈ { 1, 2} . By Lemma 1, t here must be a pat h, P i , wit h endpoint s a and b, whose vert ices lie complet ely
Graph Coloring and t he Immersion Order
399
wit hin G i . Lift ing t he edges of P 3 i t o form t he single edge a b, and t hen t aking t he subgraph induced by t he vert ices of G i , produces a graph H i properly immersed in G . It follows t hat H i is ( t − 1)-colorable. Because a b is present in H i , any such coloring of H i assigns diff erent colors t o a and b. But G i is a subgraph of H i . T hus, t here are ( t − 1)-colorings of G 1 and G 2 t hat each assign diff erent colors t o a and b. By t he Pat ching Lemma, t his ensures a ( t − 1)-coloring of G , a cont radict ion. ✷ −
Lemma 4 applies t o t -t opological-crit ical graphs as well. To see t his, not e t hat t he two pat hs defined in t he proof are vert ex-disjoint . An analog of Lemma 4 does not hold, however, if t he graph is only known t o be t -color-crit ical. Such graphs are guarant eed only t o be 2-vert ex-connect ed. A t -color-crit ical graph t hat is not 3-vert ex-connect ed can be const ruct ed as follows. Begin wit h a pair of non-adjacent vert ices, u and v , a copy of K t 1 and a copy of K t 2 . Connect u t o every vert ex but one in t he copy of K t 1 . Connect v t o t he remaining vert ex in t he copy of K t 1 . Now connect bot h u and v t o every vert ex in t he copy of K t 2 . Not e t hat t hese graphs are not t -immersion-crit ical. −
−
−
−
−
L e m m a 5 . I f | S | = 3, t hen G 1 an d G 2 adm it ( t t han on e color t o t he elem en t s of S .
−
1) -color in gs t hat assign m ore
{ u , v , w } , and consider t he case for G 1 . By Lemma 1, t here is a pat h between u and v in G 2 . Lift ing t his pat h and t aking t he subgraph induced by t he vert ices of G 1 produces a graph H properly immersed in G . Because G is t -immersion-crit ical, and because H cont ains t he edge u v , H must admit a ( t − 1)-coloring t hat assigns diff erent colors t o u and v . As a subgraph of H , G 1 can likewise be colored. A symmet rical argument handles t he case for G 2 . ✷
P ro o f. Let S =
What we have really just shown is t hat if G is only 3-vert ex-connect ed, t hen admit s a ( t − 1)-coloring t hat assigns diff erent colors t o any fixed pair of element s of S . T his raises t he possibility t hat a single coloring of G 1 may suffi ce, simult aneously assigning diff erent colors t o all t hree element s of S . We now show t hat t his cannot happen. It follows t hat t he same must t hen be t rue for G 2 . Let a and b denot e vert ices of G , and let c denot e a coloring of G in which c ( a ) = i = j = c ( b). If a and b belong t o t he same connect ed component of c i j , t hen t hey are connect ed by some Kempe chain P i j cont ained wit hin c i j . In t his event , we say t hat a and b are c -chain ed . G1
L e m m a 6 . I f | S | = 3, t hen n eit her G 1 n or G 2 adm it s a ( t assign s t hree diff eren t color s t o t he elem en t s of S .
−
1) -color in g t hat
Suppose ot herwise, as wit nessed by a ( t − 1)-coloring c of G 1 . Let S = { u , v , w } and assume, wit hout loss of generality, t hat c ( u ) = 1, c ( v ) = 2 and c ( w ) = 3. Let d denot e some ( t − 1)-coloring of G 2 . By Lemma 5 and t he Pat ching Lemma, it must be t hat d assigns exact ly two colors t o t he element s of S . So assume, again wit hout loss of generality, t hat d ( u ) = d ( v ). If u and v are not c -chained, t hen we can exchange colors 1 and 2 in c 12 ( v ) t o produce a ( t − 1)-coloring c of G 1 t hat assigns color 1 t o bot h u and v and leaves t he color
P ro o f S k e t c h .
′
400
F .N. Abu-Khzam and M.A. Langst on
of w set t o 3. T his means t hat t he rest rict ions of c and d t o S are equivalent . But now, by t he Pat ching Lemma, G is ( t − 1)-colorable, which is impossible. T hus it must be t hat u and v are c -chained by some P 12 in G 1 . T he proof proceeds by ident ifying P 13 and P 23 in a similar fashion. T hese chains are lift ed simult aneously, along wit h one more applicat ion of t he Pat ching Lemma. ✷ ′
Bolst ered by t he preceding Lemmas, we are now ready t o prove t hat minimum-cardinality vert ex cut set s of t -immersion-crit ical graphs have at least four element s. T he use of Kempe chains in Lemma 6 has been especially eff ect ive, so much so t hat we need only pat hs not chains in what follows. T h e o re m 2 . E ver y t -im m er sion -cr it ical graph is 4-ver t ex-con n ect ed. P ro o f. Suppose ot herwise, as wit nessed by some G wit h S =
{ u , v , w } . Let c and d denot e ( t − 1)-colorings of G 1 and G 2 , respect ively. By Lemmas 5 and 6, we rest rict our at t ent ion t o t he case in which bot h c and d assign exact ly two colors t o element s of S . Wit hout loss of generality, assume c ( u ) = c ( v ) and d ( u ) = d ( w ). By Lemma 1, t here is a pat h P 1 in G 1 whose endpoint s are u and w . Similarly, t here is a pat h P 2 in G 2 whose endpoint s are u and v . Lift ing P i and t aking t he graph induced by t he vert ices of G 3 i produces a graph H 3 i properly immersed in G . H 1 cont ains u v , and so must admit a ( t − 1)-coloring c t hat assigns diff erent colors t o u and v . G 1 is likewise colored by c . By Lemma 6, c cannot assign a t hird color t o w . Lest t he rest rict ions of c and d t o S be equivalent , it must be t hat c ( w ) = c ( v ). H 2 cont ains u w , and so must admit a ( t − 1)-coloring d t hat assigns diff erent colors t o u and w . G 2 is likewise colored by d . By Lemma 6, d cannot assign a t hird color t o v . But if d ( v ) = d ( u ), t hen t he rest rict ions of c and d t o S are equivalent . And if d ( v ) = d ( w ), t hen t he rest rict ions of c and d t o S are equivalent . T hus, under some pair of colorings of G 1 and G 2 , t he Pat ching Lemma ensures t hat G is ( t − 1)-colorable, a cont radict ion. ✷ −
−
′
′
′
′
′
′
′
′
′
′
′
′
3 .2
′
′
′
′
E d g e C o n n e c t iv it y
Because t he immersion order includes t he t aking of subgraphs, we know t hat t immersion-crit ical graphs are also t -color-crit ical. From t he work of [24] it follows t hat t hey are ( t − 1)-edge-connect ed. We now show t hat any t -immersion-crit ical graph ot her t han K t is in fact t -edge-connect ed. We begin a pair of well-known observat ions (see, for example, [27]). O b s e rv a t io n 4 . A m in im u m -cardin alit y edge cu t set separat es a graph in t o exact ly t w o con n ect ed com pon en t s. O b s e rv a t io n 5 . I f H is obt ain ed by delet in g t he edge u v from a t -color -cr it ical graph, t hen H is ( t − 1) -colorable an d, u n der an y ( t − 1) -color in g, u an d v are assign ed t he sam e color .
T he significance of Observat ion 5 rest s wit h t he next lemma, which plays an essent ial role in our edge-connect ivity argument s. T his lemma is probably also
Graph Coloring and t he Immersion Order
401
well known, alt hough it may not be formulat ed elsewhere in exact ly t he same way we st at e it here. L e m m a 7 . L et H be obt ain ed by delet in g t he edge u v from a t -color -cr it ical graph. L et c den ot e a ( t − 1) -color in g of H w it h c ( u ) = c ( v ) = 1. T hen v ∈ c 1 i ( u ) ∀ i ∈ { 2, 3, . . . , t − 1} . P ro o f. Let H and c be defined as st at ed. Suppose t he lemma is false, as wit -
nessed by some i wit h v ∈ / c 1 i ( u ). Exchanging colors 1 and i in c 1 i ( u ) produces c , anot her ( t − 1)-coloring of H . But t hen u and v are assigned diff erent colors under c , which is impossible. ✷ ′
′
Aided by t his informat ion about color-crit icality, we are now able t o argue more direct ly about edge connect ivity and t he immersion order. We shall adopt t he following convent ions for t he remainder of t his subsect ion: -
is at least 5, G denot es a t -immersion-crit ical graph, S denot es a minimum-cardinality edge cut set in G , C 1 and C 2 denot e t he two connect ed component s of G \ S , S 1 and S 2 denot e t he endpoint s of S cont ained in C 1 and C 2 , respect ively, u v denot es an element of S , wit h u ∈ S 1 and v ∈ S 2 , and H denot es G \ { u v } . t
L e m m a 8 . I f G is n ot t -edge-con n ect ed, t hen ever y ( t − 1) -color in g of H assign s eit her on e color t o S 1 an d all t − 1 color s t o S 2 or vice ver sa. P ro o f S k e t c h . Suppose G is not t -edge-connect ed. We know from [24] t hat S has cardinality t − 1. Let c denot e a ( t − 1)-coloring of H wit h c ( u ) = c ( v ) = 1. Lemma 7 ensures t hat v ∈ c 1 i ( u ) ∀ i ∈ { 2, 3, . . , t − 1} . T herefore u and v are t he endpoint s of t − 2 Kempe chains, where each chain is cont ained wit hin c 1 i ( u ) for some i . By Observat ion 1, t he chains are edge disjoint , and so each cont ains at least one dist inct element of S = S \ { u v } . T hus t here is a one-t oone correspondence between chains and element s of S . T his means t hat every element of S has an endpoint assigned color 1 by c . If c assigns only color 1 t o S 1 , t hen it must assign all t − 1 colors t o S 2 . Similarly, if c assigns all t − 1 colors t o S 1 , t hen it must assign only color 1 t o S 2 . T he only remaining case occurs if c assigns more t han one but fewer t han t − 1 colors t o S 1 . T his is handled wit h a cont radict ion-based argument and an applicat ion of Lemma 7. ✷ ′
′
′
T h e o re m 3 . A n y t -im m er sion -cr it ical graph ot her t han K
t
is t -edge-con n ect ed.
Suppose ot herwise, as wit nessed by some G , not isomorphic t o t hat is only ( t − 1)-edge-connect ed. We apply Lemma 8 and, wit hout loss of generality, let c denot e a ( t − 1)-coloring of H t hat assigns color 1 t o S 1 ∪ { v } . T hus all t − 1 colors are assigned t o S 2 . From here Kempe chains are applied t o show t hat K t 1 is immersed in C 2 using a model whose corners are t he element s P ro o f S k e t c h . K t,
−
402
of G
F .N. Abu-Khzam and M.A. Langst on
S 2 . Wit h anot her applicat ion of Lemma 8, a using a model whose corners are u ∪ S 2 . ✷
K t
is found t o be immersed in
C o ro lla ry 1 . I f G is t -im m er sion -cr it ical an d n ot K t , t hen δ ( G )
≥
t.
P ro o f. Immediat e from T heorem 3 and t he fact t hat δ ( G ) is an upper bound
on
G ’s
edge connect ivity. ✷
C o ro lla ry 2 . I f G is t -color -cr it ical w it h a ver t ex u of degree t im m er sed in G via a m odel w hose cor n er s are u ∪ N ( u ) .
−
1, t hen
K t is
P ro o f. Follows from t he proof of T heorem 3 by let t ing S be t he set of edges
incident on u . ✷ 4
C o n c lu s io n s
We not e t hat previous work on Ha j´os conject ure provides addit ional support ing evidence for bot h t he t = 5 and t = 6 cases. If our conject ure is t rue in t hese cases, t hen it has no eff ect on Ha j´os conject ure. T his is because a t -chromat ic graph may cont ain an immersed K t wit h or wit hout cont aining a t opological K t . On t he ot her hand, if our conject ure is false for eit her case, t hen it means t hat Ha j´os conject ure is also false for t hat case. T his is because a t -chromat ic graph wit hout an immersed K t must also be wit hout a t opological K t . T his would be quit e a revelat ion, given t hat Ha j´os conject ure for t ∈ { 5, 6} has remained open for roughly 60 years. Set t ling t he general case seems rat her foreboding. Perhaps t his view is unfairly influenced, however, by knowledge of t he long-st anding diffi culty of set t ling Hadwiger’s conject ure. Observe t hat Kempe chains are not vert ex disjoint . Yet t he minor order is inherent ly dependent on vert ex-disjoint pat hs. In t his we sense room for opt imism: t he immersion order is concerned only wit h edgedisjoint pat hs, and Kempe chains are indeed edge disjoint . Given t he vast array of applicat ions for coloring and t he immersion order, we believe t hat t he nat ure of t heir relat ionship warrant s cont inued st udy. R e fe r e n c e s 1. B´ela Bollob´a s. Extremal Graph T heor y. Academic P ress, 1978. 2. H. D. Boot h, R. Govindan, M. A. Langst on, and S. Ramachandramurt hi. Sequent ial and parallel algorit hms for K 4 immersion t est ing. Jour nal of Algor i thms, 30:344–378, 1999. 3. Cat lin. Ha j¨os graph-coloring conject ure: variat ion and count erexamples. JCT B , 26:268–274, 1979. 4. G. A. Dirac. A property of 4-chromat ic graphs and some remarks on crit ical graphs. J. London M ath. Soc. , 27:85–92, 1952. 5. P. Duchet and H. Meyniel. On Hadwiger’s number and t he st ability number. Annals of Di screte M ath. , 13:71–74, 1982. 6. P. Erd¨os and S. Fa jt lowicz. On t he conject ure of Ha j¨os. Combi nator i ca, 1:141–143, 1981.
Graph Coloring and t he Immersion Order
403
7. M. R. Fellows and M. A. Langst on. Nonconst ruct ive t ools for proving polynomialt ime decidability. Jour nal of the ACM , 35:727–739, 1988. 8. M. R. Fellows and M. A. Langst on. On well-part ial-order t heory and it s applicat ion t o combinat orial problems of VLSI design. SI A M Jour nal on Di screte M athemati cs, 5:117–126, 1992. 9. M. R. Fellows and M. A. Langst on. On search, decision and t he effi ciency of polynomial-t ime algorit hms. Jour nal of Computer and Systems Sci ences, 49:769– 779, 1994. ¨ 10. H. Hadwiger. Uber eine klassifikat ion der st reckenkomplexe. V i er telj ahr sschr . Natur for sch. Ges. Z¨ur i ch, 88:133–142, 1943. ¨ 11. G. Ha j¨os. Uber eine konst rukt ion nicht n-farbbarer graphen. W i ss. Z. M ar ti n L uther Uni v. Hal le-W i ttenberg M ath. Natur wi ss. Rei he, , 10:116–117, 1961. 12. F . Harary. Graph T heor y. Addison-Wesley, 1969. 13. K. Kawarabayashi. On t he connect ivity of minimal-count erexamples t o Hadwiger’ s conject ure, t o appear. 14. K. Kawarabayashi and B. Toft . Any 7-chromat ic graph has K 7 or K 4 4 as a minor. Combi nator i ca, t o appear. 15. A. B. Kempe. How t o color a map wit h four colours wit hout coloring adjacent dist rict s t he same color. Nature, 20:275, 1879. 16. N. G. Kinnersley. Immersion order obst ruct ion set s. Congressus Numeranti um , 98:113–123, 1993. 17. M. A. Langst on and B. C. P laut . Algorit hmic applicat ions of t he immersion order. Di screte M athemati cs, 182:191–196, 1998. 18. W . Mader. Homomorphies¨a t ze f¨u r graphen. M ath. Ann. , 178:154–168, 1968. 19. N. Robert son and P.D. Seymour. Graph minors XVI: Wagner’s conject ure. Jour nal of Combi nator i al T heor y, Ser i es B , t o appear. 20. N. Robert son, P.D. Seymour, and R. T homas. Hadwiger’ s conject ure for K 6 -free graphs. Combi nator i ca, 13:279–361, 1993. 21. T .L. Saaty and P.C. Kainen. T he Four -Color Problem . Dover P ublicat ions, Inc., 1986. 22. B. Toft . P rivat e communicat ion, 2001. 23. B. Toft . On separat ing set s of edges in cont ract ion-crit ical graphs. M ath. Ann. , 196:129–147, 1972. 24. B. Toft . On crit ical subgraphs of colour crit ical graphs. Di screte M ath. , 7:377–392, 1974. 25. B. Toft . Colouring, st able set s and perfect graphs. In R. Graham, M. Gr¨ot schel, and L. Lov´a sz, edit ors, Handbook of Combi nator i cs, volume 2, chapt er 4, pages 233–288. Elsevier Science B.V., 1995. 26. K. Wagner. Beweis einer abschw¨a chung der Hadwiger-vermut ung. M ath. Ann. , 153:139–141, 1964. 27. D. B. West . I ntroducti on to Graph T heor y. P rent ice Hall, 1996. 28. H. W hit ney and W .T . Tut t e. Kempe chains and t he four colour problem. Uti li tas M ath. , 2:241–281, 1972. ,
O pt im al M ST M aint enance for Transient D elet ion of E very N o de in P lanar G raphs ⋆
Carlo Gaibisso1 , Guido P roiet t i1 , 2 , and Richard B. Tan 3 1
Ist it ut o di Analisi dei Sist emi ed Informat ica “Ant onio Rubert i”, CNR, Viale Manzoni 30, 00185 Roma, It aly [email protected]. 2 Dipart iment o di Informat ica, Universit `a di L’Aquila, Via Vet oio, 67010 L’Aquila, It aly [email protected] 3 Depart ment of Comput er Science, Ut recht University, P adualaan 14, 3584 CH Ut recht , T he Net herlands, and Depart ment of Comput er Science, University of Sciences & Art s of Oklahoma, Chickasha, OK 73018, USA. [email protected].
Given a minimum spanning t ree of a 2-node connect ed, real weight ed, planar graph G = ( V , E ) wit h n nodes, we st udy t he problem of finding, for every node v ∈ V , a minimum spanning t ree of t he graph G − v (t he graph G deprived of v and all it s incident edges). We show t hat t his problem can be solved on a point er machine in opt imal linear t ime, t hus improving t he previous known O ( n · α ( n , n )) t ime bound holding for general sparse graphs, where α is t he funct ional inverse of Ackermann’s funct ion. In t his way, we obt ain t he same runt ime as for t he edge removal version of t he problem, t hus filling t he previously exist ing gap. Our algorit hm finds applicat ion in maint aining wireless networks undergoing t ransient st at ion failures. A b st r a c t .
P lanar Graphs, Minimum Spanning Tree, Transient Node Failures, Radio Networks Survivability. K e y w o r d s:
1
Int ro duct ion
Let G = ( V , E ) be a 2-node connect ed, undirect ed and real-weight ed planar graph, wit h n nodes and m = O ( n ) edges. Let T = ( V , E T ) denot e a m in im u m spa n n in g t ree (MST ) of G , t hat is, a spanning t ree of minimum t ot al edge weight . For any v ∈ V , let E ( v ) denot e t he subset of edges of E incident t o v , and let G − v = ( V \ { v } , E \ E ( v )). Not e t hat G − v is connect ed, since G is 2-node connect ed. In t his paper, we consider t he problem of finding, for every v ∈ V , an MST of G − v .
⋆
T his work has been part ially support ed by t he CNR-Agenzia 2000 P rogram, under Grant s No. CNRC00CAB8 and CNRG003EF 8, and by t he Research P roject REAL-W INE, part ially funded by t he It alian Minist ry of Educat ion, University and Research.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 404–414, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Opt imal MST Maint enance for Transient Delet ion
1.1
405
M ot ivat ion s
Our problem is mot ivat ed by t he following applicat ion: assume t hat V is a set of t hat must be int erconnect ed, t hrough a set E of pot ent ial lin ks between t he sit es, for which a planar embedding exist s. Any of t hese links e = { u , v } has a real weight c ( e) associat ed, represent ing t he inherent cost for communicat ing between u and v using e. T hen, an MST of G serves as a spanning co m m u n ica t io n n et w o r k of minimum cost . However, apart from it s cost , a communicat ion network must also be relia ble , and t herefore one should be ready t o maint ain t he connect ivity among t he sit es as soon as any network component (eit her a node or an edge) fails. Such a maint enance is generally accomplished by aiming at t he same opt imizat ion crit eria used for building t he original network. On t his basis, t he rep la cem en t communicat ion network will result in an MST of t he graph G now deprived of t he failed component . Since t he failed component is likely t o be repaired soon, t he replacement communicat ion network is just t emporary, and t he old, opt imal MST will short ly be rest ored. T herefore, under t hese assumpt ions, it makes sense t o st udy t he problem of dealing wit h t he failure of ever y arbit rary component , t o precomput e all t he individual replacement communicat ion networks.
n sit es
1.2
R e lat e d W ork
In t he last two decades, several result s along t his direct ion have been obt ained, especially for edge failures. In t his cont ext , it is easy t o see t hat a failing edge e ∈ E T has t o be replaced by a minimum-weight non-t ree edge forming a cycle wit h e in T . Such an edge is named a rep la cem en t ed ge for e. T he problem of finding all t he replacement edges of an MST was originally addressed by Tarjan [19], under t he guise of t he sen sit ivit y a n a ly sis of an MST , t hat is, how much t he weight of each individual edge in t he MST can be pert urbed before t he spanning t ree is no longer minimal. In his seminal paper, Tarjan considered t he case of a general graph G wit h n nodes and m edges, and solved t he problem on a point er machine in O ( m · α ( m , n )) t ime and space, where α ( m , n ) is t he funct ional inverse of t he Ackermann’s funct ion defined in [18]. Lat er on, Dixon et a l. [9] proposed an opt imal det erminist ic algorit hm —for which a t ight asympt ot ic t ime analysis could not be off ered— and a randomized linear t ime algorit hm, bot h running on a RAM. T hen, Boot h and West brook [1] present ed a linear t ime RAM algorit hm for finding all t he replacement MST s for t he edge failure case. Finally, a recent result by Buchsbaum et a l. [2] provides a linear-t ime MST verificat ion algorit hm for a point er machine. T his lat t er result allows t o ext end t hat cont ained in [1] t o a point er machine model. In a somewhat relat ed scenario, t he problem of finding all t he replacement MST s as a consequence of t he failure of each individual node was originally 2 st udied by Chin and Houck [4], who gave an O ( n ) t ime algorit hm. For sparse graphs, more precisely for
m
=
o
n
2
log
n
, t he (more general) offl ine algorit hm
for t he d y n a m ic MST problem given by Eppst ein [10] can be used t o devise a fast er O ( m log n ) t ime algorit hm. Subsequent ly, such a bound has been obt ained
406
C. Gaibisso, G. P roiet t i, and R.B. Tan
t hrough a diff erent t echnique from Das and Loui [8], who also have shown t hat if t he edge weight s are sort ed in advance, t hen t he problem can be solved in O ( m · α ( m , n )) t ime and space. Finally, Nardelli et a l. [15] have recent ly proposed an O (min( m · α ( n , n ) , m + n log n )) t ime and linear space point er machine algorit hm. For planar graphs, m = O ( n ), and t herefore t he algorit hm in [15] can be used t o solve our problem in O ( n · α ( n , n )) t ime. Summarizing, t here st ill exist s an effi ciency gap between t he edge and t he node failure case, bot h for t he general and t he planar case. 1.3
S u m m ary of O u r R e su lt s
In t his paper, we provide an opt imal linear-t ime algorit hm for t he node failure case. As a consequence, we get t he same t ime complexity as for t he edge failure case, t hus filling, for planar graphs, t he above ment ioned gap. Most remarkably, t his is done on a pure point er machine, wit hout using direct addressing t echniques provided by a RAM. From a diff erent viewpoint , our algorit hm can be revisit ed as a pseudo-dynamic algorit hm working for any specific sequence of n o n -o ver la p p in g t ransient node delet ions. Under t his perspect ive, our algorit hm has an O ( n ) preprocessing t ime, and deals in O ( k ) t ime wit h each MST updat ing and subsequent recovery induced by a t ransient node delet ion, where k denot es t he degree in G of t he current ly considered node. Furt hermore, a development of our t echnique makes it possible t o opt imally solve t he problem of finding all t he replacement E u clid ea n MST s (EMST ) of a planar set of point s of size n , one for each single and t emporary point delet ion. T his yields an applicat ion of our result in t he cont ext of survivability of ra d io n et w o r ks in t he 2-dimensional plane. Indeed, for radio networks, energy saving is a crit ical issue, and independent ly of t he communicat ion pat t ern t hat has t o be est ablished among t he st at ions, t he t ot al range allocat ion should be minimized. Unfort unat ely, most of t hese opt imizat ion problems are NP-hard, and t herefore approximat e solut ions must be adopt ed. In part icular, it t urns out t hat t he EMST provides a const ant -rat io approximat ion of a minimum-energy range assignment t o t he st at ions in order t o perform bot h broa d ca st in g (1-t o-all communicat ion) [7], and go ssip in g (all-t o-all communicat ion) [13], i.e., two of t he most popular rout ing schemes. Hence, our t echnique can be used t o re-est ablish t he connect ivity of a radio network undergoing non-overlapping t ransient st at ion failures. As far as we know, t his is t he first result which is expressly t ailored for dealing wit h fault -t olerance in 2-dimensional radio networks, since previous papers were only focused on eit her designing of redundant communicat ion prot ocols [16,14], or on t he linear case [11]. T he paper is organized as follows: in Sect ion 2 we give some preliminary definit ions, while in Sect ion 3 we describe t he algorit hm for solving t he problem, and we provide an analysis of bot h correct ness and complexity. In Sect ion 4, we present t he applicat ions t o survivability of radio networks. Finally, Sect ion 5 cont ains conclusions and list s some open problems.
Opt imal MST Maint enance for Transient Delet ion
2
407
P relim inaries
For basic graph t erminology, t he reader is referred t o [12]. Let r denot e an arbit rary node in G = ( V , E ). In t he following, t he MST T = ( V , E T ) of G will be considered as root ed in r . Let F = E \ E T be t he set of non-t ree edges of G . For any two node-disjoint subt rees T 1 and T 2 of T , let F ( T 1 , T 2 ) be t he set of non-t ree edges having one end-node in T 1 and t he ot her end-node in T 2 . Let us denot e by T ( v ) t he subt ree of T root ed at v , and by T ( v ) t he t ree T aft er t he removal of T ( v ). Let v 0 and v 1 , . . . , v k be t he parent and t he children of v in T , respect ively. Finally, let H v = { f ∈ F | f ∈ F ( T ( v i ) , T ( v j )) , 1 ≤ i , j ≤ k , i = j } , referred t o in t he following as t he set of h o r izo n t a l ed ges of v , and let U v = { f ∈ F | f ∈ F ( T ( v i ) , T ( v )) , 1 ≤ i ≤ k } , referred t o in t he following as t he set of u p w a rd s ed ges of v . A select ed h o r izo n t a l ed ge for T ( v i ) wit h respect t o T ( v j ) is an edge (if any) h i j ∈ F ( T ( v i ) , T ( v j )) of m in im u m weight . Similarly, a select ed u p w a rd s ed ge for T ( v i ) is defined as an edge (if any) u i ∈ F ( T ( v i ) , T ( v )) of m in im u m weight . Let H v′ ⊆ H v and U v′ ⊆ U v be t he set of select ed edges associat ed wit h t he subt rees root ed at v . It is easy t o see t hat an MST of G − v , say T G − v , can be comput ed t hrough t he comput at ion of an MST T v = ( V v , R v ) of t he graph ′ ′ G v = ( V v , H v ∪ U v ), where t he node set V v = { ν 0 , ν 1 , . . . , ν k } is obt ained by co n t ra ct in g each subt ree of T creat ed aft er t he removal of v (see Figure 1).
A node v in G , wit h t he associat ed set of upwards (dashed) and horizont al (dot t ed) edges, along wit h t heir weight s. W hen node v is removed, subt rees T ( v ) , T ( v 1 ) , . . . , T ( v ) are cont ract ed t o vert ices ν 0 , ν 1 , . . . , ν , respect ively, joined by t he select ed upwards and horizont al edges, t o form G . F ig. 1 .
k
k
v
T herefore TG −
v
= (V
\ { v} , E
T
\ { { v0, v } , { v , v1} , . . . , { v , vk } } ∪
R
v
),
(1)
where R v ⊆ H v′ ∪ U v′ is called t he set of rep la cem en t ed ges for v . T he All Nodes Replacement (ANR) problem wit h input G and T is t hat of finding T G − v (i.e., R v ) for every node v ∈ V .
408
3
C. Gaibisso, G. P roiet t i, and R.B. Tan
Solv ing t he ANR P roblem in P lanar G raphs
We first give a high-level descript ion of t he algorit hm, and t hen we present it in det ail. 3.1
H igh -Le ve l D e scrip t ion of t h e A lgorit h m
A high-level descript ion of our algorit hm is t he following. We consider all t he non-leaf nodes of T in any arbit rary order (if v is a leaf node, t hen t rivially R v = ∅ ), and we comput e an MST of G v , obt ained aft er t he select ion of t he horizont al and upwards edges of v , as defined above. T his select ion is t he key for t he effi ciency of our algorit hm, since, as we will show, t he select ed edges for all t he nodes in G can be comput ed in linear t ime, and moreover t he graph G v is planar, from which an MST of it can be comput ed in O ( | V v | ) t ime [3]. From t his, t he linearity of our algorit hm follows. 3.2
C om p u t in g E ffi cie nt ly t h e S e le ct e d E d ge s
As sket ched in t he previous sect ion, t he effi ciency problem lies in t he comput at ion of t he select ed edges. We st art by proving t he following: Le m m a 1. T h e select ed h o r izo n t a l ed ges fo r a ll t h e n o n -lea f n od es v ∈ be co m p u t ed in O ( n ) t im e a n d spa ce.
V ca n
S ket ch o f P roo f. By definit ion, each horizont al edge f = ( x , y ) is associat ed wit h just a u n iqu e node in V , corresponding t o t he lea st co m m o n a n cest o r in T of x , y , say l ca ( x , y ). Now, let v x and v y denot e t he children in T of l ca ( x , y ) on t he pat hs (if any) going from l ca ( x , y ) t o x and y , respect ively. It follows t hat f ∈ F ( T ( v x ) , T ( v y )), and t he horizont al edge h x y can be found by select ing t he minimum among all t he edges in F ( T ( v x ) , T ( v y )). Nodes l ca ( x , y ) , v x and v y for all t he non-t ree edges can be obt ained in O ( n ) t ime and space by slight ly modifying t he algorit hm proposed in [2], from which t he lemma follows. ⊓⊔
Concerning t he upwards edges, observe t hat each non-t ree edge might be a select ed upwards edge for several nodes. A diff erent approach is t herefore needed. It t urns out t hat for our purpose, we can make use of t he t echnique present ed in [15]. Essent ially, it consist s in t ransforming t he graph G int o a mult igraph ′ ′ G = ( V , E ) such t hat E = E T ∪ F , where F is obt ained from F as follows: let f = { x , y } ∈ F , and let l ca ( x , y ) , v x and v y be defined as above. Depending on l ca ( x , y ) , x , y , v x and v y , edge f is t ransformed, by maint aining it s weight , according t o t he following rules (not ice t hat x and y are int erchangeable): (i) (ii) (iii) (iv)
if l ca ( x , y ) = y , f is replaced by t he auxiliary edge f ′ = { x , v x } ; if v x = x and v y = y , f is replaced by t he auxiliary edge f ′ = { y , v y } ; if v x = x and v y = y , f disappears; ot herwise, f is replaced by t he auxiliary edges f ′ = { x , v x } and f { y , vy } .
′ ′
=
Opt imal MST Maint enance for Transient Delet ion
409
T he decisive property of t he above t ransformat ion is t hat it maint ains t he planarity, as shown in t he following: Le m m a 2. T h e m u lt igra p h
G
= ( V , E ) is p la n a r .
P roo f. Assume we are given an embedding of G in t he plane, say G ∗ , in which r
is t he uppermost node of t he out er face of G (such an embedding always exist s [12]). In t he sequel, we specify an order in which edges of F are replaced, and we show t hat by obeying such an order, G ∗ can be t ransformed int o a planar embedding of G . Let R f be t he region of G ∗ bounded by t he fundament al cycle f forms wit h T , ∀ f ∈ F . Let σ = f 1 , f 2 , . . . f | F | be any sequence of all t he edges in F such t hat eit her R f i ⊂ R f k , or R f i and R f k int ersect at most along t heir boundaries, ∀ i < k . Edges of F are t ransformed in t he same order t hey appear in σ . We will prove t hat it is always possible t o t ransform f i in such a way t hat t he associat ed auxiliary edges, if any, lie wit hin R f i wit hout int ersect ing any ot her edge. Trivially, our st at ement is t rue for i = 1, since no auxiliary edge have st ill been int roduced, and R f 1 does not cont ain any edge of F . Let us assume we succeeded in t ransforming f 1 , f 2 , . . . f i − 1 . We will show t hat our claim is t rue also for f i = ( x i , y i ). Let us assume f i is t ransformed according t o rule (iii). Ot her cases can be similarly t reat ed. By t he induct ive hypot hesis and by our assumpt ions on σ , any already int roduced auxiliary edge eit her lies wit hin R f i , or it is ext ernal t o it . Moreover, recall t hat auxiliary edges always connect a node t o some of it s ancest ors. Let us now assume it is not possible t o connect x i t o v x i (wit hin R f i ) wit hout aff ect ing t he planarity. T hen, by t he way σ is defined, it follows t hat it must exist an auxiliary edge f ′ = ( v , l ca ( x i , y i )), wit h v belonging t o R f i . Let us first analyze t he case in which f ′ has been int roduced according t o rule (i). T hen, f ′ replaced some edge f j , j < i , whose endpoint s are v and t he parent of l ca ( x i , y i ). By t he induct ive hypot hesis, f j must lie inside of R f i . But at t he same t ime, t he parent of l ca ( x i , y i ) must lie out side of R f i in G ∗ , due t o t he fact t hat r is t he upper-most node of such embedding, t hus cont radict ing t he fact G ∗ was a planar embedding. T he cases in which e has been int roduced by rules (ii) and (iv) can be t reat ed similarly, from which t he t hesis follows. ⊓⊔ From t he above result , t he following can be proved: Le m m a 3. T h e select ed u p w a rd s ed ges fo r a ll t h e n o n -lea f n od es v co m p u t ed in O ( n ) t im e a n d spa ce. ∈
V ca n be
P roo f. Once again, given a non-t ree edge f = { x , y } , nodes l ca ( x , y ) , v x and v y can be obt ained in O (1) amort ized t ime and space by slight ly modifying t he algorit hm proposed in [2]. T herefore, t he mult igraph G can be built in O ( n ) t ime and space. Now let v = r be an arbit rary non-leaf node (if v = r , t hen t rivially U v′ = ∅ ), having parent v 0 and children v 1 , . . . , v k in T . By definit ion, a select ed upwards edge u i ∈ F for t he subt ree T ( v i ), is an upwards edge of minimum weight among all t he non-t ree edges forming a fundament al cycle in T
410
C. Gaibisso, G. P roiet t i, and R.B. Tan
cont aining e = { v 0 , v } and e′ = { v , v i } . From t he t ransformat ion sket ched above, it follows t hat u i corresponds t o a minimum-weight edge u ′i ∈ F ′ forming a cycle wit h e′ (see [15] for t he det ails). T herefore, it follows t hat u ′i is a replacement edge for e′ in G . Hence, given t hat from Lemma 2 t he graph G is planar, t he runt ime for finding all t he replacement edges (and t herefore all t he select ed upwards edges) is linear [1]. ⊓⊔ 3.3
F in d in g A ll t h e R e p lace m e nt E d ge s
Once t he edges have been select ed, t o solve t he ANR problem we have t o comput e for every v ∈ V an MST of G v , whose set of edges corresponds t o R v . T his leads t o t he main result : T h e ore m 1. T h e ANR p ro blem fo r a n M S T o f a 2 -n od e co n n ect ed , rea lw eigh t ed , p la n a r gra p h w it h n n od es ca n be so lved o n a po in t er m a ch in e in O ( n ) t im e a n d spa ce. P roo f. From Lemmas 1 and 3, comput ing H v′ and U v′ for every v ∈ V ′ cost s O ( n ) t ime and space. Consider an arbit rary non-leaf node v ∈ V (if v is a leaf node in T , t hen t rivially R v = ∅ ). It remains t o analyze t he t ot al t ime needed t o comput e, for every v ∈ V ′ , an MST of G v . But G v is a minor of G , and t herefore it is planar [12]. Hence, an MST of G v can be comput ed in O ( | V v | ) t ime [3]. From t his and | V v | = O ( n ), t he t heorem follows. ⊓⊔ from t he fact t hat v∈ V
4
M anaging St at ion Failures in R adio N etworks
In t his sect ion we describe an applicat ion of our result s t o survivability of radio networks. We st art by proving t he following: T h e ore m 2. L et S be a set o f n po in t s in t h e 2 -d im en sio n a l E u clid ea n spa ce. L et = ( S , E T ) be a n E M S T o f S . T h en , t h e p ro blem o f fi n d in g a ll t h e rep la cem en t
T
E M S T s, a s a co n sequ en ce o f t h e rem o va l o f ea ch in d ivid u a l po in t in S , ca n be so lved o n a po in t er m a ch in e in O ( n ) t im e a n d spa ce. S ket ch o f P roo f. First of all, we can comput e in O ( n ) t ime t he Delaunay t riangulat ion of S , say D ( S ), as const rained by T , by looking at T as t o a degenerat e simple polygon [5]. D ( S ) plays t he role of t he planar graph in which t he EMST is embedded. However, diff erent ly from what has been previously described, whenever a point p is removed from S , t hen a set of addit ional edges, not current ly in D ( S ), must be t aken int o account for t he comput at ion of an EMST of S − p . More precisely, for a given point p ∈ S , let D p ( S ) be obt ained from D ( S ) by removing p and all it s incident edges. Hence, let S ( p ) denot e t he set of adjacent point s of p in D ( S ), and let D ( S ( p )) be t he const rained Delaunay t riangulat ion of S ( p ), which can be comput ed in O ( | S ( p ) | ) t ime [5]. T he set of edges in D ( S ( p )) and not in D ( S ) are called t he a d d it io n a l ed ges of p , say A p .
Opt imal MST Maint enance for Transient Delet ion
411
T hen, t he problem of finding all t he replacement EMST s can be solved by adopt ing t he same st rat egy as described in t he previous sect ion, wit h t he only furt her t rick of t aking int o account , whenever horizont al and upwards edges for any given point p are select ed, of t he associat ed addit ional edges A p (indeed, an addit ional edge might be cheaper t han t he one select ed from D ( S )). T his will clearly not aff ect t he overall t ime and space complexity, from which t he result follows. ⊓⊔ T he above result finds immediat e applicat ion t o guarant ee su r viva bilit y in radio networks undergoing t ransient st at ion failures. Indeed, assume we are given a set S = { s 1 , . . . , s n } of radio st at ions (i.e., point s) locat ed on t he Euclidean plane. A ra n ge a ssign m en t for S is a real funct ion R : S → R+ assigning t o each st at ion s i a range R ( s i ). Since it is commonly assumed t hat t he signal power falls as 1/ | s i − s j | κ , where κ ≥ 1 is a const ant paramet er depending on t he t ransmission environment , and given t hat in an ideal environment κ = 2 (see for example [17]), it follows t hat t he co m m u n ica t io n po w er needed t o support a range R ( s i ) is R ( s i ) 2 . Hence, t he co st of R can be defined as
2
R (s i ) .
C o st ( R ) = si
Given a range ) ≤ R ( s i ), and s j . T herefore, direct ed graph G R d (s i , s j
∈
S
assignment R for S , a st at ion s i rea ch es a st at ion s j if where d ( s i , s j ) denot es t he Euclidean dist ance between s i t he t ra n sm issio n gra p h induced by R over S is defined as a = ( S , A ) where
A
=
e
si ∈
= (s i , s j )
| si
reaches
sj
.
S
T hen, t he fundament al t rade-off t hat has t o be addressed by any resource allocat ion algorit hm in wireless networks is t hat of finding a range assignment of m in im u m co st such t hat t he corresponding t ransmission graph sat isfies a given property π . Among ot hers, t he following two combinat orial opt imizat ion problems play a crucial role in wireless networking: 1. Minimum-Energy Broadcast Routing (MEBR): Given a source node s ∈ S , find a minimum-cost range assignment R ∗ such t hat t he t ransmission graph G R ∗ cont ains a branching (direct ed spanning t ree) root ed at s ; 2. Minimum-Energy Complete Routing (MECR): Find a minimum-cost range assignment R ∗ such t hat t he t ransmission graph G R ∗ is st rongly connect ed. Unfort unat ely, it t urns out t hat t hey are bot h NP-hard (see [7] and [6], respect ively). However, bot h are approximable wit hin a const ant fact or, t hrough t he ( 2) comput at ion of an MST of t he co m p let e weight ed graph G S = ( S , E ), in which t he edge weight s are given by t he square of t he Euclidean dist ance between any pair of st at ions. More precisely, ranges are assigned as follows, respect ively:
412
C. Gaibisso, G. P roiet t i, and R.B. Tan
1. For t he MEBR-problem, direct t he comput ed MST from t he root t owards t he leaves, and assign t o each node a range equal t o t he Euclidean dist ance of t he fart hest children in t he direct ed MST ; 2. For t he MECR-problem, assign t o each node a range equal t o t he Euclidean dist ance of t he fart hest adjacent node in t he comput ed MST . In t his way, it t urns out t hat t he MEBR problem can be approximat ed wit hin 12 [20], while t he MECR problem can be approximat ed wit hin 2 [13]. Addit ionally, t he MST serves as an opt imal solut ion [13] for t he MinimumEnergy All-To-One Routing-problem, defined as follows: Given a source node s ∈ S , find a minimum-cost range assignment R ∗ such t hat t he t ransmission graph G R ∗ cont ains a branching orient ed t owards s . In t his case, it suffi ces t o direct t he comput ed MST t owards s , and t o assign t o each st at ion a range equal t o t he Euclidean dist ance from t he successor ont o t he pat h t owards s . As t he usefulness of t he MST st ruct ure for wireless networks has been est ablished, we can t urn our at t ent ion t owards t he problem of managing t ransient st at ion failures. More formally, t he problem we want t o solve is t he following: given a set of st at ions S in t he 2-dimensional space, and given a range assign( 2) ment R : S → R+ induced by an MST of G S , find for every s ∈ S an MST of ( 2) G S − s . We call t his t he All Stations Replacement (ASR) problem. T h e ore m 3. T h e ASR p ro blem ca n be so lved o n a po in t er m a ch in e in
O (n )
t im e a n d spa ce. ( 2)
P roo f. Since t he weight of an edge e = { s i , s j } in G S
is an increasing funct ion ( 2) of t he Euclidean dist ance of s i and s j , t hen an MST of G S coincides wit h an ( 2) EMST of t he point set individuat ed by S . T herefore, an MST of G S − s coincides wit h an EMST of S − s . Hence, t he t hesis follows from T heorem 2. ⊓⊔
5
C onclusions and Fut ure W ork
In t his paper we present ed an opt imal O ( n ) t ime algorit hm for solving t he ANR problem in planar graphs, which finds applicat ion in managing t ransient st at ion failures in radio networks. A nat ural open problem is t o ext end t he class of graphs for which t he linear bound holds. In a broader scenario, for general graphs, we ment ion t he problem of est ablishing a linear t ime algorit hm for finding all t he replacement MST s for t he edge failure case, alt hough t his problem seems t o be as diffi cult as comput ing an MST . Last , we plan t o ext end our result s concerning t he EMST t o higher dimensional spaces. A ckn ow le d ge m e nt s. T he aut hors t hank Claudio Gent ile and Paolo Vent ura for helpful discussions on t he t opic.
Opt imal MST Maint enance for Transient Delet ion
413
R eferences 1. H. Boot h and J . West brook, A linear algorit hm for analysis of minimum spanning and short est -pat h t rees of planar graphs, A lgor i thmi ca 1 1 (1994) 341–352. 2. A.L. Buchsbaum, H. Kaplan, A. Rogers and J . West brook, Linear-t ime point ermachine algorit hms for least common ancest ors, MST verificat ion, and dominat ors, Proc. of the 30th A nnual A CM Symposi um on T heor y of Computi ng ( ST OC’ 98), (1998) 279–288. 3. D. Cherit on and R.E. Tarjan, F inding minimum spanning t rees, SI A M J. Comput. , 5 (4) (1976) 724–742. 4. F . Chin and D. Houck, Algorit hms for updat ing minimal spanning t rees, J. Comput. System Sci . , 1 6 (3) (1978) 333–344. 5. F .Y.L. Chin, C.A. Wang, F inding t he const rained Delaunay t riangulat ion and const rained Voronoi diagram of a simple polygon in linear t ime, SI A M J. Comput. , 2 8 (2) (1998) 471–486. 6. A.E.F . Clement i, P. P enna and R. Silvest ri, Hardness result s for t he power range assignment problem in packet radio networks, Proc. of the T hi rd W or kshop on Randomi zati on, A pproxi mati on and Combi nator i al Opti mi zati on ( RA ND OM A PPROX ’ 99), Vol. 1671 of Lect ure Not es in Comput er Science, Springer, 197–208.
7. A.E.F . Clement i, P. Crescenzi, P. P enna, G. Rossi and P. Vocca, On t he complexity of comput ing minimum energy consumpt ion broadcast subgraphs, Proc. of the 18th A nnual Symposi um on T heoreti cal A spects of Computer Sci ence ( STA CS’ 01), Vol. 2010 of Lect ure Not es in Comput er Science, Springer, 121–131. 8. B. Das and M.C. Loui, Reconst ruct ing a minimum spanning t ree aft er delet ion of any node, A lgor i thmi ca 3 1 (2001) 530–547. Also available as T R UILU-ENG-952241 (ACT -136), University of Illinois at Urbana-Champaign, IL, 1995. 9. B. Dixon, M. Rauch and R.E. Tarjan, Verificat ion and sensit ivity analysis of minimum spanning t rees in linear t ime, SI A M J. Comput. , 2 1 (6) (1992) 1184–1192. 10. D. Eppst ein, Offl ine algorit hms for dynamic minimum spanning t ree problems, J. of A lgor i thms, 1 7 (2) (1994) 237–250. 11. C. Gaibisso, G. P roiet t i and R. Tan, Effi cient management of t ransient st at ion failures in linear radio communicat ion networks wit h bases, 2nd I nter nati onal W or kshop on A pproxi mati on and Randomi zed A lgor i thms i n Communi cati on Networ ks ( A RA CNE’ 01). Vol. 12 of P roceedings in Informat ics, Carlet on Scient ific, 37–54. 12. F . Harary, Graph theor y , Addison-Wesley, Reading, MA, 1969.
13. L.M. Kirousis, E. Kranakis, D. Krizanc and A. P elc, P ower consumpt ion in packet radio networks, Proc. of the 14th A nnual Symposi um on T heoreti cal A spects of Computer Sci ence ( STA CS’ 97), Vol. 1200 of Lect ure Not es in Comput er Science, Springer, 363–374. 14. E. Kranakis, D. Krizanc and A. P elc, Fault -t olerant broadcast ing in radio networks, 6th European Symposi um on A lgor i thms ( ESA ’ 98), Vol. 1461 of Lect ure Not es in Comput er Science, Springer-Verlag, 283–294. 15. E. Nardelli, G. P roiet t i and P. W idmayer, Maint aining a minimum spanning t ree under t ransient node failures, 8th European Symposi um on A lgor i thms ( ESA 2000) , Vol. 1879 of Lect ure Not es in Comput er Science, Springer, 346–355. 16. E. P agani and G.P. Rossi, Reliable broadcast in mobile mult ihop packet networks, T hi rd A nnual A CM / I EEE I nt. Conf. on M obi le Computi ng and Networ ki ng ( M OB I COM ’ 97), 34–42. 17. K. P ahvalan and A. Levesque, W i reless I nfor mati on Networ ks, W iley-Int erscience,
New York, 1995.
414
C. Gaibisso, G. P roiet t i, and R.B. Tan
18. R.E. Tarjan, Effi ciency of a good but not linear set union algorit hm, J. of the A CM , 2 2 (2) (1975) 215–225. 19. R.E. Tarjan, Applicat ions of pat h compression on balanced t rees, J. of the A CM , 2 6 (4) (1979) 690–715. 20. P.J . Wan, G. Calinescu, X.Y. Li and O. Frieder, Minimum-energy broadcast rout ing in st at ic ad hoc wireless networks, Proc. of the 20th A nnual Conference on Computer Communi cati ons ( I NFOCOM ’ 01), 1162–1171.
S ch e d u lin g B ro a d c a s t s w it h D e a d lin e s J ae-Hoon Kim 1 and Kyung-Yong Chwa 2 1
2
Depart ment of Comput er Engineering, P usan University of Foreign St udies, P usan 608-738, Korea, [email protected] Depart ment of Elect rical Engineering & Comput er Science, Korea Advanced Inst it ut e of Science and Technology, Taejon 305-701, Korea, [email protected]
We invest igat e t he problem of scheduling broadcast s in dat a delivering syst ems via broadcast , where a number of request s from several client s can be simult aneosly sat isfied by one broadcast of a server. Most of prior work has focused on minimizing t he t ot al flow t ime of request s. It assumes t hat once a request arrives, it will be held unt il sat isfied. In t his paper we are conserned wit h t he sit uat ion t hat client s may leave t he syst em if t heir request s are st ill unsat isfied aft er wait ing for some t ime, t hat is, each request has a deadline. T he problem of maximizing t he t hroughput , for example, t he t ot al number of sat isfied request s, is developed, and t here are given online algorit hms achieving const ant compet it ive rat ios. A b st r a c t .
1
In t ro d u c t io n
Broadcast ing is part icularly useful for delivering dat a t o a large populat ion. In t his environment , a server broadcast s dat a it ems t o client s and several client s can simult aneously receive an ident ical it em by one broadcast . T he use of broadcast t echnology is inherent in high-bandwidt h networks such as cable t elevision, sat ellit e, and wireless network. For example, in Hughes’ DirecP C syst em [11], client s make request s over phone lines and t he server sat isfies t he request s t hrough broadcast s via sat ellit e. In dat a broadcast ing, a server broadcast s dat a it ems over a broadcast channel where t he client s making request s for t he it ems “list en t o” t he channel. All wait ing request s for a it em are sat isfied when t he it em is t ransmit t ed on t he broadcast channel. Typically, t here have been proposed two models of broadcast ing, pu sh-based and pu ll-based . In push-based model, t he server delivers dat a using a pre-det ermined schedule based on est imat ed access profiles of dat a it ems and it is ignorant of act ual client request s. On t he ot her hand, in pull-based model, t he server is aware of act ual client request s and can int eract ively det ermine a broadcast schedule adjust ing t o newly arriving request s. In t his paper we concent rat e on t he pull-based model.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 415–424, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
416
J .-H. Kim and K.-Y. Chwa
To make dat a delivery syst ems more effi cient , it is needed a careful considerat ion of how t o schedule broadcast s for request s of various dat a it ems. In t he lit erat ure, prior work is limit ed t o t he problem of minimizing t he t ot al flow t ime [1,2,4,8], where t he flow t ime of a request is t he t ime elapsing between it s arrival t ime and it s complet ion t ime. It assumes t hat once a dat a request arrives, it will be held unt il sat isfied. But t his assumpt ion is not always available in pract ice. Act ually, client s may leave t he syst em if t heir request s are st ill unsat isfied aft er wait ing for some t ime. In t his paper we are concerned wit h such a sit uat ion. In part icular, we consider t he problem of maximizing t he t hroughput in which each request arrives wit h a weight and a deadline by which it should be sat isfied and t he sum of weight s of sat isfied request s is maximized. We will dist inguish between two cases; all dat a it ems are of uniform size, t hat is, each request for a dat a it em is served during t he same t ime, and dat a it ems are of variable size. Also we assume t hat t ime is discrete or con tin u ou s . In case t ime is discret e, any request for a dat a it em can be sat isfied in one t ime unit and new request s arrive only at each (int egral) t ime st ep. T his set t ing is not general because new request s may arrive while a dat a it em is broadcast ed by t he server. Such a case is called t hat t ime is cont inuous. For t he case of cont inuous t ime, we consider t he model t hat t he server can abort t he current broadcast for more valuable request s and lat er on, it st art s t he next broadcast of t he abort ed it em from t he beginning. It is diff erent from t he preem ptive model, where an abort ed it em can be resumed lat er from where it was int errupt ed. Under our model, client s wit h buff ers would be suffi cient t o receive only t he remaining part of it em in t he next broadcast of t he same it em unless it is over t he deadline. It may correspond t o t he restart model in t he job scheduling lit erat ure where t he scheduler can abort a current ly running job and rest art it from scrat ch lat er while meet ing it s deadline [12,13]. T he scheduling algorit hm used by t he server has no knowledge of request s in advance and makes decisions only wit h informat ion of request s having already arrived. In ot her words, t he set t ing is on lin e , and t he performance of an online algorit hm is compared wit h t hat of t he opt imal offl ine algorit hm. 1 .1
P re v io u s W o rk
Most of prior work has focused on reducing t he flow t imes of request s. T here are a lot of empirical st udies [2], et c., and in t he t heoret ical domain, t he problem of minimizing t he t ot al flow t ime was invest igat ed in [4,5,6,8]. In [8], t ime is discret e and t he sizes of it ems are of uniform. T he aut hors showed t hat no det erminist ic online algorit hm is O (1)-compet it ive and proposed several online algorit hms. For t he offl ine version, it was known in [5] t hat t he problem is NP -hard, and t he best known offl ine algorit hms guarant ee α 1 -speed ( 1 1 α )-approximat ion and 4-speed 1-approximat ion, respect ively, given in [6]. For t he case where request s require variable size it ems and t he schedule √is preempt ive, it was shown in [4] t hat any det erminist ic online algorit hm is Ω ( n )-compet it ive, where n is t he number of dist inct pages, and t here is an O (1)-speed O (1)-approximat ion online algorit hm. Also minimizing t he maximum flow t ime was st udied in [3]. −
Scheduling Broadcast s wit h Deadlines
417
For t he problem of maximizing t he t hroughput , very lit t le work is known. In [3], t hey ment ioned t hat t here is a polynomial t ime offl ine algorit hm t o det ermine if a broadcast schedule exist s in which all deadlines are met . T he work of [7] is closer t o ours, where t he ob ject ive is t o maximize t he service rat io, i.e., t he percent age of sat isfied request s. But t hey assumed a probability dist ribut ion of generat ed request s. Recent ly, we have found an independent work [9] t o st udy t he online version of broadcast scheduling for t he t hroughput maximizat ion like ours. In job scheduling lit erat ure, our work is closely relat ed t o t he in terval schedu lin g [10,14], where each job should be scheduled or reject ed as soon as it arrives, t hat is, each job has a tight dead lin e . In [10], no preempt ion is allowed and t he goal is t o maximize t he sum of lengt hs of accept ed jobs. T he aut hors showed t hat no O (log ∆ )-compet it ive det erminist ic online algorit hm exist s and proposed an O ((log ∆ ) 1+ ǫ )-compet it ive online algorit hm, where ∆ is t he rat io of maximum t o minimum lengt h of jobs. In [14], preempt ion is allowed, t hat is, a running job may be int errupt ed t o be lost , and weight s of jobs are given from a funct ion of t heir lengt hs sat isfying special condit ions. T he goal is t o maximize t he sum of weight s of complet ed jobs. T hey provided an online algorit hm guarant eeing t he compet it ive rat io of four and proved t hat t he rat io of four is best possible for all det erminist ic online algorit hms. 1 .2
O u r R e s u lt s
First , we st udy t he case t hat all dat a it ems are of uniform size in Sect ion 3 and 4. In case t ime is discret e, we show t hat t here is a 2-compet it ive online algorit hm and t he rat io of two is t ight for any det erminist ic online algorit hm. In case t ime is cont inuous, we can consider two types of request s; wit h t ight deadlines and wit h arbit rary deadlines. T ight deadline request s must be immediat ely served or reject ed when t hey arrive. T his is equivalent t o t he job scheduling problem st udied in [14], where a set of request s for a dat a it em arriving at a t ime st ep can correspond t o a job wit h a weight equal t o t he number of request s. It was shown in [14] t hat t here is a 4-compet it ive online algorit hm and it is best possible for any det erminist ic online algorit hm. For t he general case of arbit rary deadline √ request s, we propose a (3 + 2 2)-compet it ive online algorit hm. For t he case of variable size dat a it ems, we present lower bounds of t he compet it ive rat io of any det erminist ic online algorit hm in Sect ion 5.
2
M o d e l a n d D e fi n it io n s
T here are n possible dat a it ems P 1 , P 2 , · · · , P n , which are called pages . T he broadcast t ime of every page is eit her uniform, say one, or variable and each request for a page has a deadline by which it should be sat isfied by t he server and a posit ive weight . At a point in t ime, new request s for a page arrive, and whenever t he current broadcast is complet ed, t he server st art s t o supply t he next broadcast if t here are wait ing request s.
418
J .-H. Kim and K.-Y. Chwa
For a set A of request s for a page, we denot e t he t ot al of weight s of request s in A as A and call it t he valu e of A . In part icular, in case t he weight s of all request s are equal t o one, A represent s t he number of request s in A . In t his paper, w.l.o.g., we assume t hat t he weight of each request is equal t o one. (Not e t hat it is redundant t o assume t hat t he weight s are given arbit rarily since all analyses t hrough t he paper can derive t he same result s.) Let O P T denot e t he set of all request s which are sat isfied by t he opt imal offl ine algorit hm OP T . T hen O P T represent s t he performance of OP T . For t he case of discret e t ime, any page is broadcast ed during one t ime unit . At each t ime st ep t , new request s for various pages arrive and t he server (or t he scheduler) select s a page and broadcast s it . Aft er t he broadcast , at t ime t + 1, ot her new request s arrive. We will consider t his model in Sect ion 3, For t he case of cont inuous t ime, new request s for pages may arrive while a page is current ly broadcast ed. In t his model, we will use t he t erm of a job t o represent t he set of request s for a page and some t erminologies of job scheduling. T his will be invest igat ed for uniform size pages in Sect ion 4 and for variable size pages in Sect ion 5.
3
D is c re t e T im e
In t his sect ion we assume t hat t ime is discret e and any page can be broadcast ed during one t ime unit . We will begin wit h an invest igat ion of t he well-known algorit hm EDF (Earliest Deadline First ). At each t ime, EDF det ermines t he page which is required by t he request wit h t he earliest deadline as t he page t o be broadcast ed. If t here are several request s for dist inct pages having t he earliest deadline, t hen t he page wit h t he largest number of request s is chosen. Let m be t he largest possible number of request s for a page arriving at a t ime st ep. T hen we provide a worst -case inst ance against EDF as follows: Assume n ≤ m . At t ime 1, t here arrive m request s wit h t he deadline m t o require it per each of dist inct n − 1 pages and one request for t he ot her one page, say p , wit h deadline 1. T hen EDF serves such one request at t ime 1. At each t ime unt il m − 1, t he adversary gives one request for t he page p which should be immediat ely served. T hen EDF would sat isfy m − 1 request s unt il t ime m − 1 and m request s at t ime m . But OP T could sat isfy m ( n − 1) request s wit h large deadline unt il t ime n − 1 and m − n request s aft er n − 1. T hus t he compet it ive rat io is Ω ( n ). In case n > m , we can also show t hat t he compet it ive rat io is Ω ( m ). (min { n , m } ) -com petitive, where n an d m are the n u m ber of pages an d the largest possible n u m ber of requ ests for a page arrivin g at a tim e step, respectively .
T h e o r e m 1 . E D F is Ω
We consider an online algorit hm in which at each t ime t , a page wit h t he largest number of request s is chosen, called G reedy . Not e t hat Greedy makes a decision regardless of t he deadlines of request s. Here t ime is divided int o bu sy periods during which pages are broadcast ed by Greedy and id le periods during
Scheduling Broadcast s wit h Deadlines
419
which no page is broadcast ed. T hen for each busy period T i , we will compare t he performance of Greedy wit h t hat of OP T for all request s arriving in T i . Consider a busy period T and let J be t he set of all request s arriving in T . W.l.o.g., we assume t hat t he whole inst ance of problem is only J and Greedy result s in t he single busy period T . (T his has no eff ect on t he gain of Greedy but it is helpful for OP T .) Let T = [1..ℓ ]. All request s served by OP T aft er ℓ are also sat isfied by Greedy wit hin T , because t hey have deadlines aft er ℓ and so if not , t hey could be served by Greedy aft er ℓ . Let G D denot e t he set of all request s sat isfied by Greedy and let O P T = O P T \ G D . T hen from t he above argument , each job in O P T should be served by OP T wit hin T . For each t ime st ep t in T , we define a set O P T ( t ) of request s in O P T t hat are served by OP T at t ime t . Fix a t ime st ep t . T hen all request s in O P T ( t ) require an equal page and at t ime t , t hey are all alive in Greedy’s scheduling. Since Greedy chooses t o serve a page wit h t he largest number of request s at t ime t , we can see t hat O P T ( t ) ≤ G D ( t ) , where G D ( t ) represent s t he set of request s served by Greedy at t ime t . T herefore it follows t hat ℓ ℓ OPT = O P T (t ) ≤ G D ( t ) = G D . It ensures t hat Greedy t= 1 t= 1 is 2-compet it ive since O P T = O P T + O P T ∩ G D ≤ 2 · G D . ′
′
′
′
′
′
′
′
′
T h e o r e m 2 . G reedy is 2-com petitive.
In fact , we will show t hat t he compet it ive rat io of two is t ight for any det erminist ic online algorit hm. We have an inst ance of request s t o give a lower bound in which all request s have t he same deadline D , suffi cient ly large. Consider any det erminist ic online algorit hm A . W.l.o.g., we assume t hat A services request s for a page at each t ime st ep if t here are some wait ing request s. Init ially, at t ime 1, t here arrive D request s for dist inct pages each ot her and a request for a page p 1 is served by A . T hen at t ime 2, anot her request for p 1 arrives. Especially, at each t ime st ep between 2 and D , t he adversary generat es one request for t he same page as t he one select ed by A at t he previous t ime. T hus A can service D request s, one at each t ime, but O P T can do 2D − 1 request s, all given request s, by serving all exist ing request s for one of t he dist inct D pages at each t ime between 1 and D . T h e o r e m 3 . A n y determ in istic on lin e algorithm can n ot have a com petitive ra-
tio of less than two.
4
C o n t in u o u s T im e
In t his sect ion t he broadcast t ime of every page is also equal and t ime is cont inuous. So while a page is broadcast ed, new request s may arrive. T he request s for pages may have arbit rary deadlines. Here we will describe an online algorit hm A C . T here is a pool of request s t hat is prepared for t he ones which have already arrived but are not sat isfied by A C . Init ially, t he pool is empty. A C is act ivat ed only when new request s arrive or t he present broadcast service is complet ed. Let { 1, 2, · · · , n } denot e t he set of all exist ing pages. At any t ime t , assume t hat new
420
J .-H. Kim and K.-Y. Chwa
request s for a page i arrive and a page j is being broadcast ed. Let R be t he set of request s for t he page i which are eit her in t he pool at t ime t or one of t he newly arriving request s and R t he set of request s for t he page j being served at t . For i = j , if R ≥ C · R , where C ( > 1) is det ermined lat er, t hen request s in R are aborted and t hose in R are scheduled t o be served. Ot herwise, request s in R are rejected . For i = j , let R be t he subset of R in which request s can meet t heir deadlines if t hey are scheduled at t . If R ∪ R ≥ C · R , t hen request s in R are abort ed and t hose in R ∪ R are scheduled. Ot herwise, request s in R are reject ed. Also at any t ime t when a broadcast for a page is complet ed, A C det ermines t he page wit h t he largest number of request in t he pool as t he next page which it will broadcast . (If t here is a t ie, t hen A C chooses any one of such pages.) In part icular, when t he request s are abort ed or reject ed, t hey ent er int o t he pool, and when expiring in t he pool, t hey are t aken away from it . For simplicity, we will t erm a set of request s for a page a job. T he jobs are made only at part icular t imes, when new request s for a page arrive or a broadcast for a page is complet ed. At any t ime t when new request s for a page arrive, if t he page is diff erent from t hat current ly served, t hen a new job J is defined t o be t he set cont aining bot h t he newly arriving request s and all request s for t he page remaining in t he pool at t ime t , and ot herwise, J is defined t o be t he set cont aining bot h t he newly arriving request s and t he current ly served ones which can be scheduled at t meet ing t heir deadlines. Also it s weight and st art ing t ime are defined t o be t he value of t he set , t hat is, t he t ot al number of request s in t he set , and t he t ime t , respect ively. In A C , at t ime t , t he weight of t he job J , denot ed by w ( J ), is compared wit h t hat of t he current ly served job. Especially, t he job J may be scheduled by abort ing t he (current ly served) job t hat consist s of request s for t he same page. Also for any t ime t when a broadcast for a page is complet ed, a new job J is defined t o be t he set of request s for a page having t he largest value in t he pool, and it s weight and st art ing t ime are similarly defined. In A C , t he job J is scheduled at t ime t . Not e t hat any job in a feasible schedule of A C is scheduled at it s st art ing t ime. In part icular, we can regard A C as an online algorit hm wit h t he rest art because even if a job was abort ed while running, some request s which had been cont ained in it might be re-scheduled and sat isfied lat er. We consider a feasible schedule S of A C . Let J 1 , · · · , J m be t he jobs in S in non-decreasing order of t heir st art ing t imes s i , 1 ≤ i ≤ m . T hen each J i is served during [s i , s i + 1]. We will assign t o each J i a t ime int erval [α i , β i ]. Fix some job J i . From t he charact erist ics of A C , t here is a chain of jobs I 0i , · · · , I ℓ i such t hat I ji was abort ed by I ji 1 , where I 0i = J i . T hen we set α i t o be t he st art ing t ime of I ℓ i . If ℓ = 0, t hat is, t here is no job abort ed by J i , t hen set α i = s i . Also t here may be jobs reject ed by J i at t heir st art ing t imes and t hen we set β i t o be t he lat est st art ing t ime of t he reject ed jobs. If t here is no such a job, t hen set β i = s i . T hen it is t rivial t hat β i < s i + 1 ≤ α i + 1 . T hus we obt ain a part it ion P of t ime by t he int ervals [α i , β i ] and ( β i , α i + 1 ). ′
′
′
′ ′
′
′ ′
′
′
′ ′
−
L e m m a 1 . G iven the partition P = { [α i , β i ] | 1 ≤ i ≤ m } ∪ { ( β i , α i + 1 ) | 1 ≤ i ≤ m − 1} from a feasible schedu le of A C , n o requ est arrives du rin g ( β i , α i + 1 )
Scheduling Broadcast s wit h Deadlines an d there is n o requ est in the pool of A C du rin g [s i + 1, α i + 1 ) if s i + 1 < α where s i is the startin g tim e of the job determ in in g [α i , β i ].
421 i
+ 1,
Here we will merge t he int ervals [α i , s i + 1) int o one int erval if possible. From = 1, we st art t o merge as follows; wit h t he first [α j , s j + 1) sat isfying t hat s j + 1 < α j + 1 , t he int ervals [α 1 , s 1 + 1) , · · ·, [α j , s j + 1) are merged int o one, and part icularly, we define a new half int erval [γ 1 , δ 1 ) t o be [α 1 , s j + 1). Cont inuing t his process, we obt ain t he int ervals [γ k , δ k ). From Lemma 1, during [δ k , γ k + 1 ) elapsing between two consecut ive int ervals, A C is id le , t hat is, t here is no request which A C can serve. Also for t hese int ervals, t he following lemma holds. i
L e m m a 2 . For an y feasible schedu le O of a given in stan ce an d an y requ est r startin g to be served at a poin t du rin g [γ i , δ i ) in O , if r arrived before γ i , then it shou ld have been schedu led to com pletion by A C before δ i − 1 .
P roof. If r is such a request which arrived before γ i , t hen from Lemma 1, it act ually arrived before δ i 1 , and it has a deadline great er t han δ i 1 . So if r were not sat isfied by A C before δ i 1 , t hen it would be alive at δ i 1 . It is a cont radict ion. −
−
−
−
√
T h e o re m 4 .
A C
is (3 + 2 2) -com petitive.
P roof. We consider a feasible schedule
S of A C . Let J 1 , · · · , J m be t he jobs in in non-decreasing order of t heir st art ing t imes s i , 1 ≤ i ≤ m . T hen each J i is served during [s i , s i + 1]. From t he above st at ement , we assign t o each J i t he t ime int erval [α i , β i ], and also we obt ain t he merged int ervals [γ i , δ i ) , i = 1, · · · , µ . Fix an int erval [γ i , δ i ). T hen we also consider a feasible schedule O of OP T . Let O 1 , · · · , O n denot e t he set s of request s scheduled in O such t hat all request s in O j require t he same page and are served in [u j , u j + 1], where u j < u j + 1 . T hen we will say t hat O j overlaps wit h a t ime int erval [α , β ) if α ≤ u j < β . For t he int erval [γ i , δ i ), consider t he set s O p , · · · , O q which overlap wit h it . (T here may be O j ’s which overlap wit h some [δ i , γ i + 1 ), but it is easy t o see t hat all request s in such O j ’s should be scheduled by A C .) For a request in U i = ∪ qj = p O j , if it arrived before γ i , t hen by Lemma 2, it would have been complet ely served by A C . T hus from now on, we concent rat e on only t he request s in U i which arrive in [γ i , δ i ) and are not complet ely served by A C . Let R i denot e t he set of such request s. T hen we part it ion R i int o two subset s R 1i and R 2i . T he subset R 1i consist s of request s belonging, at least once, t o jobs which are scheduled but abort ed by A C in [γ i , δ i ), and R 2i request s belonging only t o jobs reject ed by A C in [γ i , δ i ). T hen it is easy t o see t hat each request in R i belongs t o eit her R 1i or R 2i , because it is at least cont ained in t he job generat ed at which it arrives in [γ i , δ i ). T he int erval [γ i , δ i ) consist s of consecut ive int ervals [α u , s u + 1) , · · · , [α v , s v + 1) which correspond t o jobs J u , · · · , J v , respect ively. Let I 0h , · · · , I ℓ hh be t he chain of jobs such t hat I jh was abort ed by I jh 1 , where I 0h = J h , j = 1, · · · , ℓ h , ℓh w ( I jh ) ≤ and h = u , · · · , v . T hen for h = u , · · · , v , we can show t hat j = 1 S
−
422 1
J .-H. Kim and K.-Y. Chwa
Since each request in R 1i belongs t o some I jh , it follows t hat R 1i ≤ w ( J j ). j = u C 1 Now, we t urn t o t he request s of R 2i . Not e t hat each O k , p ≤ k ≤ q , overlaps wit h one of t he int ervals [α j , s j + 1) , u ≤ j ≤ v . Fix an int erval [α j , s j + 1). T hen t here are det ermined t he set s O a , · · · , O b overlapping wit h it . W.l.o.g., assume t hat t he last set O b overlaps wit h t he int erval [s j , s j + 1). T hen t he ot her O k ’s cannot overlap wit h [s j , s j + 1). First , we consider t he request s in R 2i ∩ O b . Let t be t he lat est arrival t ime of request s in R 2i ∩ O b . At t ime t , A C checks a job J cont aining all request s in R 2i ∩ O b , and J is reject ed by A C . In case t ≥ α j , if J overlaps wit h [s j , s j + 1), i.e. , s j ≤ t < s j + 1, t hen J is reject ed by J j , t hat is, w ( J ) ≤ C · w ( J j ). Ot herwise, J is reject ed by some I kj ( k ≥ 1) of t he chain j j j I 0 , · · · , I ℓ ( I 0 = J j ). T hen, w ( J ) ≤ ( C1 ) k 1 w ( J j ). In case t < α j , all request s in i R 2 ∩ O b exist in t he pool of A C at α j and so t he number of t hem is less t han or equal t o w ( I ℓ j ) ≤ ( C1 ) ℓ w ( J j ). T hus we can see t hat R 2i ∩ O b ≤ C · w ( J j ). Next , we will bound t he value of R 2i ∩ ( ∪ bk = 1a O k ). Before proceeding, in t he following, we will also say t hat a set O k overlaps wit h a job J if s ≤ u k < s + 1, where s is t he st art ing t ime of J . Not e t hat O k , a ≤ k ≤ b − 1, overlap wit h jobs I hj , h = 1, · · · , ℓ , in t he chain. For each O k , a ≤ k ≤ b − 1, we define a job j I h ( k ) as t he job wit h t he lat est st art ing t ime among all such jobs overlapped C
−
1
1
w ( J h ).
v
−
−
−
wit h it . If O k overlaps wit h a job I hj , t hen t he ot her O l ’s cannot overlap wit h j j I h . So t he jobs I h ( k ) , a ≤ k ≤ b − 1, are diff erent from each ot her. In ot her words, for each O k , a ≤ k ≤ b − 1, t here is uniquely det ermined a job I hj ( k ) overlapped wit h it so t hat such jobs are diff erent from each ot her. Fix any R 2i ∩ O k , a ≤ k ≤ b − 1. As in t he previous, let t be t he lat est arrival t ime of request s in R 2i ∩ O k . In case t ≥ α j , at t ime t , a job J cont aining all request s in R 2i ∩ O k is checked by A C and it is reject ed by some job I hj , h ≥ h ( k ). So we can see t hat R 2i ∩ O k ≤ w ( J ) ≤ C · ( C1 ) h h ( k ) w ( I hj ( k ) ) ≤ C · w ( I hj ( k ) ). In case t < α j , since all request s in R 2i ∩ O k exist in t he pool of A C at α j , R 2i ∩ O k ≤ b 1 j j j b 1 w ( I ℓ ) ≤ w ( I h ( k ) ). T hus, R 2i ∩ ( ∪ k = a O k ) ≤ C · w ( I h ( k ) ) ≤ C C 1 w ( J j ). k= a It implies t hat R 2i ∩ ( ∪ bk = a O k ) ≤ ( C + C C 1 ) w ( J j ). T hus summing up over v [α j , s j + 1) , u ≤ j ≤ v , we can est ablish t hat R 2i ≤ ( C + C C 1 ) j = u w ( J j ). i ( R 1i + R ≤ AC + Consequent ly, O P T = O P T ∩ A C + i i C + 1 C 1 i w ( J ) = (1 + C + + C + ) ) A C . Let f (C ) = R 2 ) ≤ A C + ( i i C 1 C 1 C 1 C + 1 1 + C + C 1 . T hen put t ing f ( C ) = 0, we can see t hat f is minimized at √ C = 1+ 2. T hus, we obt ain t he result . −
−
−
−
−
−
−
−
−
′
−
5
V a ria b le S iz e P a g e s
In t his sect ion, pages have arbit rary sizes. First we show a lower bound of any det erminist ic online algorit hm. Lat er, even if t he online algorit hm uses a fast er broadcast server, it is shown t hat any online algorit hm wit h a const ant speed broadcast server cannot have a const ant compet it ive rat io. Here t he given lower
Scheduling Broadcast s wit h Deadlines
423
bounds can also be applied t o t he job scheduling problems in which t he online algorit hm can abort and rest art jobs. Let P be t he largest size of page and R be t he maximum number of request s for a page which arrive at a t ime inst ant . (Here t he smallest size of page is 1.) In √ t he following, all given request s have t ight deadlines. If R ≥ P , t hen at t ime 0, α request s for a page of size P arrive, where α = RP . Any online algorit hm A has t o serve t hem in order t o have a bounded compet it ive rat io. Immediat ely aft er, R request s for a page of size 1 arrive. If A reject s α request s already served and schedules R request s, t hen any request no longer arrives. Ot herwise, consecut ively, ot her R request s for a page of size 1 arrive. Cont inue t his argument unt il eit her A schedules R request s for a page of size 1 or A schedules α request s for a page of size P and reject s t he t ot al of R · P request s for a page of size 1. T hen in t he former case, t he opt imal (offl ine) algorit hm schedules α request s for √ a page of size P and t he compet it ive rat io is at least α RP ≥ P . In t he lat t er case, t he opt imal algorit hm schedules R · P request s for a page of size 1 and t he √ √ P . If R < P , t hen similarly, we can show compet it ive rat io is at least Rα PP ≥ √ t hat t he compet it ive rat io is at least min { PR , R } ≥ min { P , R } . √
T h e o r e m 5 . Let P be the largest size of page an d R be the m axim u m n u m ber
of requ ests for a page which arrive at a tim e in stan t. T hen an y √determ in istic on lin e algorithm can n ot have a better com petitive ratio than min { P , R } . T h e o r e m 6 . For an y con stan t s an d c , an y determ in istic on lin e algorithm u sin g an s -speed broadcast server can n ot be c -com petitive.
P roof. Given any const ant s and c , and assume t hat a det erminist ic online algo-
rit hm A is c -compet it ive on an s -speed broadcast server. T hen we consider two pages of large size P and small size 1, respect ively. At t ime 0, one request for t he page of size P , say r , arrives and it has t he t ight deadline, equal t o P . T hen t he online algorit hm A must schedule t he request r at some t ime t in [0, P ], ot herwise, A would not be compet it ive. At t ime t + 2Ps , t he adversary generat es w request s for t he page of size 1 wit h t he t ight deadline. If A does not schedule t he request s, t hen t he adversary consecut ively generat es w request s for t he page of size 1. T hus t he adversary can give a huge bundle of request s in [t + 2Ps , t + Ps ) if A does not abort r . But it leads t o a cont radict ion, because w can be chosen large enough t o sat isfy t hat 2Ps w > cP , i.e. , w > 2sc . So A will abort r and schedule some w request s for t he page of size 1. T hen t he adversary gives no request before A rest art s r . If A does not rest art r , t hen it leads t o a cont radict ion since P can be chosen large enough t o sat isfy t hat P > cw . T hus A will schedule r at some t ime t aft er t + 2Ps . Here not e t hat t − t ≥ 2Ps . T hen we can repeat t he above argument . Consequent ly, eit her A reject s r and schedules at most (2⌈ s ⌉ − 1) w request s for t he page of size 1 or A schedules r and k w request s for t he page of size 1, for some k , 1 ≤ k ≤ 2⌈ s ⌉ − 2. But in t he former case, t he adversary schedules t he request r for t he page of size P , and if P is chosen suffi cient ly large such t hat P > c (2⌈ s ⌉ − 1) w , t hen it derives a cont radict ion. In t he lat t er case, t he adversary schedules at least 2Ps w request s for t he page of ′
′
424
J .-H. Kim and K.-Y. Chwa
size 1. Since P > c (2⌈ s ⌉ − 1) w ≥ ck w , if w is chosen large enough t o sat isfy t hat 4sc > 2sc (1 + kPw ), t hen 2Ps w > c ( P + k w ), and it derives a cont radict ion.
w >
R e fe re n c e s [1] S. Aacharya and S. Mut hukrishnan. Scheduling on-demand broadcast s: new met rics and algorit hms. In A CM / I E E E I nter nati onal Conference on M obi le Computi ng and N etwor ki ng, pages 43–54, 1998. [2] D. Aksoy and M. Franklin. Scheduling for large scale on-demand dat a broadcast . In P roc. of I E E E I N F OCOM , pages 651–659, 1998. [3] Y. Bart al and S. Mut hukrishnan. Minimizing maximum response t ime in scheduling broadcast s. In P roc. of the E leventh A nnual A CM -SI A M Symposi um on D i screte A lgor i thms, pages 558–559, 2000. [4] J . Edmonds and K. P ruhs. Broadcast scheduling: when fairness is fine. In P roc. of the T hi r teenth A nnual A CM -SI A M Symposi um on D i screte A lgor i thms, pages 421–430, 2002. [5] T . Erlebach and A. Hall. Np-hardness of broadcast scheduling and inapproximability of single-source unsplit t able min-cost flow. In P roc. of the T hi r teenth A nnual A CM -SI A M Symposi um on D i screte A lgor i thms, pages 194–202, 2002. [6] R. Gandhi, S. Khuller, Y. A. Kim, and Y. C. Wan. Algorit hms for minimizing response t ime in broadcast scheduling. In P roc. of 9th I nter nati onal I nteger P rogrammi ng and Combi nator i al Opti mi zati on ( I P CO) Conference, volume 2337 of Lecture N otes i n Computer Sci ence ( L N CS) , pages 425–438. Springer-Verlag, 2002. [7] S. J iang and N. Vaidya. Scheduling dat a broadcast s t o “impat ient ” users. In P roc. of the A CM I nter nati onal W or kshop on D ata E ngi neer i ng for W i reless and M obi le A ccess, pages 52–59, 1999.
[8] B. Kalyanasundaram, K. P ruhs, and M. Velaut hapillai. Scheduling broadcast s in wireless networks. In P roc. of 8th A nnual E uropean Symposi um on A lgor i thms ( E SA ) , volume 1879 of Lecture N otes i n Computer Sci ence ( L N CS) , pages 290– 301. Springer-Verlag, 2000. [9] B. Kalyanasundaram and M. Velaut hapillai. Broadcast scheduling under deadline. privat e communicat ion, 2003. [10] R. Lipt on and A. Tomkins. Online int erval scheduling. In P roc. of the F i fth A nnual A CM -SI A M Symposi um on D i screte A lgor i thms, pages 302–311, 1994. [11] DirecP C Home P age. ht t p:/ / www.direcpc.com/ . [12] J . Sgall. Online scheduling. In Onli ne A lgor i thms: T he State of the A r t, eds. A . F i at and G . J. W oegi nger , volume 1442 of Lecture N otes i n Computer Sci ence ( L N CS) , pages 196–231. Springer-Verlag, 1998. [13] M. van den Akker, H. Hoogeven, and N. Vakhania. Rest art s can help in t he online minimizat ion of t he maximum delivery t ime on a single machine. In P roc. of 8th A nnual E uropean Symposi um on A lgor i thms ( E SA ) , volume 1879 of Lecture N otes i n Computer Sci ence ( L N CS) , pages 427–436. Springer-Verlag, 2000. [14] Gerhard J . Woeginger. On-line scheduling of jobs wit h fixed st art and end t imes. T heoreti cal Computer Sci ence, 130:5–16, 1994.
Im p rov e d C o m p e t it iv e A lg o rit h m s fo r O n lin e S ch e d u lin g w it h P a rt ia l J o b V a lu e s Francis Y.L. Chin ⋆ and St anley P.Y. Fung Depart ment of Comput er Science and Informat ion Syst ems, T he University of Hong Kong, Hong Kong. { chin,pyfung} @csis.hku.hk
T his paper considers an online scheduling problem arising from Quality-of-Service (QoS) applicat ions. We are required t o schedule a set of jobs, each wit h release t ime, deadline, processing t ime and weight . T he ob ject ive is t o maximize t he t ot al value obt ained for scheduling t he jobs. Unlike t he t radit ional model of t his scheduling problem, in our model unfinished jobs also get part ial values proport ional t o t heir amount s processed. We give a new non-t imesharing algorit hm GAP for t his problem for bounded m , where m is t he number of concurrent jobs or t he number of weight classes. T he compet it ive rat io is improved from 2 t o 1.618 (golden rat io) which is opt imal for m = 2, and when applied t o cases wit h m > 2 it st ill gives a compet it ive rat io bet t er t han 2, e.g. 1.755 when m = 3. We also give a new st udy of t he problem in t he mult iprocessor set t ing, giving an upper bound of 2 and a lower bound of 1.25 for t he compet it iveness. F inally, we consider resource augment at ion and show t hat O (log α ) speedup or ext ra processors is suffi cient t o achieve opt imality, where α is t he import ance rat io. We also give a t radeoff result between compet it iveness and t he amount of ext ra resources. A b st r a c t .
1
In t ro d u c t io n
We consider t he following online scheduling problem. Given a set of jobs, each job is charact erized by a 4-t uple ( r , d, p, w ) which are t he release t ime, deadline, processing t ime and weight (value per unit t ime of processing) respect ively. T he span of a job is t he t ime int erval [r , d ]. A job is active at t ime t if t ∈ [r , d ] and is not complet ely processed by t ime t . P reempt ion is allowed wit h no penalty, and t he goal is t o maximize t he t ot al value obt ained by processing t he jobs. In t he t radit ional model of t his problem, only jobs t hat are complet ed receive t heir values, and part ially processed jobs receive no value. Recent ly t here is a new model in which jobs t hat are part ially processed receive a part ial value proport ional t o t heir amount s processed [3,6,4,5]. T his model is more relevant in some problem domains, and is first described as a Quality-of-Service (QoS) problem concerning t he t ransmission of large images over a network of low bandwidt h [3]. T his is also relat ed t o a problem called im precise com putation in real-t ime
⋆
T his work is support ed by an RGC research grant .
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 425–434, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
426
F .Y.L. Chin and S.P.Y. Fung
syst ems [11], and has applicat ions in numerical comput at ion, heurist ic search, dat abase query processing, et c. J obs arrive online, i.e., no det ails of a job is known before it is released, and t he online scheduling algorit hm has t o made it s decisions based only on t he det ails of jobs already released. We assume all det ails of a job are known at t he t ime it is released. We judge t he performance of online algorit hms by t heir compet it ive rat ios [13]. An online algorit hm is c-com petitive if, for any inst ance of jobs, t he value produced by t he online algorit hm is at least 1/ c t hat of t he offl ine opt imal algorit hm. T ight bounds on t he compet it ive rat io are known for t he t radit ional model: √ bot h t he upper and lower bounds are (1 + α ) 2 [1,9], where α denot es t he im portan ce ratio , i.e., t he rat io of maximum t o minimum job weight s. For previous result s on t he part ial value model, Chang and Yap first gave 2-compet it ive algorit hms and a lower bound of 1.17 on t he compet it ive rat io [3]. T he upper bound was t hen improved t o e/ ( e − 1) ≈ 1. 58 [5,6]. T he lower bound was also improved t o 1.236 [6] and most recent ly t o 1.25 [5]. T he e/ ( e − 1)-compet it ive algorit hm makes use of tim esharin g, i.e., it allows more t han one job running on t he processor simult aneously, each at reduced speeds so t hat t he sum of processing speeds at any t ime does not exceed t he processor speed. Alt hough t imesharing can be simulat ed in non-t imesharing syst ems by alt ernat ing jobs at a very high frequency, t his may not be desirable since it incurs a high cost . In fact we proved t hat t imesharing does help: non-t imesharing algorit hms cannot be bet t er t han 1.618-compet it ive [5]. No non-t imesharing algorit hms are known t o have compet it ive rat io 2 − ǫ for const ant ǫ in general. However in pract ice t here may be addit ional cont raint s, e.g. t he job weight s may not vary t oo much, or fall int o fixed weight classes; or t he syst em would not be t oo overloaded, i.e., t oo many jobs released at a short period of t ime. We can use t hese informat ion t o devise bet t er algorit hms. In [4] we give an algorit hm which is (2 − 1/ (lg α + 2))-compet it ive1 . In Sect . 3 we consider t he case when t here are bounded number of concurrent act ive jobs, or bounded number of weight classes. Let m be t he bound on eit her one of t hese. A new online algorit hm GAP is proposed which is 1.618-compet it ive for m = 2 and is opt imal. T his new algorit hm, alt hough not opt imal for m > 2, gives a compet it ive rat io bet t er t han 2. All t he above result s are for t he single processor set t ing, and no previous result s for t his problem are known in t he mult iprocessor set t ing. In Sect . 4 we give a 2-compet it ive algorit hm and a lower bound of 1.25 for t he compet it iveness in t his case. Using resource augm en tation as a means of analyzing online algorit hms first appeared in [12] and [7]. T he idea is t o give t he online algorit hm more resources t o compensat e for it s lack of fut ure informat ion, and analyze t he t radeoff between t he amount of addit ional resources and improvement in performance. Since t hen, many problems are analyzed using t his approach. We give a new st udy of applying t he resource augment at ion analysis t o t his problem, by using eit her a 1
In t his paper lg denot es log t o base 2.
Improved Compet it ive Algorit hms for Online Scheduling
427
fast er processor or more processors. T he only known result is a lower bound of Ω (log log α ) speedup t o achieve opt imality (1-compet it iveness) [6], which applies t o bot h t he t radit ional and part ial value models. A 4⌈ lg α ⌉ upper bound for t he t radit ional model is known [10,8]. In Sect . 5 we give t he first upper bound result s for t he part ial value model. We also give a t radeoff result between t he amount of ext ra resources and t he improvement t o compet it ive rat io. Such t radeoff result s also exist for t he t radit ional model [7,10].
2
P re lim in a rie s
Let r ( q ) , d ( q ) and w ( q ) denot e t he release t ime, deadline and weight of a job respect ively. For an algorit hm A , let A ( t ) denot e t he job running by A at t ime t , and don eA ( q, t ) be t he amount of work done of job q by A by t ime t . Wit hout confusion, ‘ algorit hm’ and ‘ schedule’ are used int erchangeably. If no job is running on A at t ime t we call A ( t ) a n ull job. Let OP T denot e t he offl ine opt imal algorit hm. Let | | S | | denot e t he value of a schedule S . A schedule S is can on ical if for any two t imes t 1 and t 2 ( t 1 < t 2 ), t he following is sat isfied: if q1 = S ( t 1 ), and q2 = S ( t 2 ) is not null, t hen eit her (i) r ( q2 ) > t 1 , or (ii) q1 is not null and d ( q1 ) ≤ d ( q2 ). Int uit ively, it means t hat among t he act ive jobs at any t ime, S will eit her schedule t he one wit h t he earliest deadline, or discard it forever. We assume t ies on deadlines are always broken consist ent ly, for t he offl ine opt imal algorit hm and t he online algorit hm, so t hat we may assume no two deadlines are equal. It can be shown t hat OP T is canonical [6]. We bound t he compet it ive rat io of online algorit hms by employing a chargin g schem e similar t o t hat in [6]. Let A denot e an online algorit hm. We charge t he values of infinit esimally small t ime periods (i.e. t he ‘ value rat es’ or weight s) from OP T t o t hose in A . Let F : ℜ → ℜ be a funct ion mapping each t ime in OP T t o a t ime in A . For any t ime t , suppose q is t he job current ly running in OP T . If don eO P T ( q, t ) > don eA ( q, t ), F ( t ) = t . Ot herwise, find t he t ime u < t when don eO P T ( q, t ) = don eA ( q, u ), and F ( t ) = u . In bot h cases t he value rat e charged is w ( q ). It can be seen t hat all job values in OP T are charged under mapping F . At any t ime t , t here are at most two charges t o A (i.e. two t imes mapped t o t by F ), one from t ime t and anot her from a t ime lat er t han t . See Fig. 1. Define t he chargin g ratio at any t ime t t o be t he sum of values of t he charges made t o t over t he value A is get t ing at t ime t . If we can bound t he charging rat io at t ime t for all t , t his gives a bound on t he compet it ive rat io of A . q,
3
A n Im p rov e d N o n -t im e s h a rin g A lg o rit h m
No non-t imesharing algorit hms are known t o be bet t er t han 2-compet it ive for t he general case. In t his sect ion we give a non-t imesharing algorit hm t hat achieves an improved compet it ive rat io when t he number of concurrent jobs is bounded, or t he number of weight classes is bounded. An act ive job x dom in ates anot her act ive job y if w ( x ) ≥ w ( y ) and d ( x ) < d ( y ). An act ive job is dom in an t if no ot her act ive job dominat es it . Let w i denot e
428
F .Y.L. Chin and S.P.Y. Fung q 0
OPT
q i
doneOPT (q 0, t) > doneA (q 0 , t)
doneOPT (q i , t’) = done A (q i , t)
F(t) = t A
F(t’) = t
q i time = t F ig. 1 .
t’
Charging scheme.
t he weight of t he i -t h heaviest act ive dominant job at any t ime. Not e t hat no two act ive dominant jobs have equal weight . 3 .1
A lg o rit h m G A P
Suppose t here are at most m act ive dominant jobs at any moment , where m is known in advance. Lat er we will see t hat t his assumpt ion generalizes t he two condit ions ment ioned before (bounded number of concurrent jobs or bounded number of weight classes). Int uit ively, our algorit hm t ries t o find a suffi cient ly heavy job which, at t he same t ime, has a weight far away from ot her light er jobs. T his helps t o give a good charging rat io by avoiding jobs wit h similar weight s t o charge t o one point in t ime. Formally, algorit hm GAP uses a paramet er r > 1, which depends on m , and is t he unique posit ive real root of t he equat ion r = 1 + r 1 / ( m 1) . T he following t able shows some values of r and m . −
−
m r
2 3 4 5 10 20 1.618 1.755 1.819 1.857 1.930 1.965 ∞
2
When GAP is invoked, it first finds all act ive dominant jobs wit h weight s (1/ r ) w 1 ( w 1 is t he weight of t he current ly heaviest job). Call t his set S . Among jobs in S , find a job q such t hat , for any ot her act ive dominant job q wit h w ( q ) < w ( q ), we have w ( q ) / w ( q ) ≥ r 1 / ( m 1) . (Not e t hat q may not be in S ). Schedule q . (We will show t hat such a q always exist s. If t here are more t han one such q t hen schedule any one of t hem.) GAP is invoked again when some job is finished, reached it s deadline, or a new job arrives.
≥
′
′
3 .2
′
−
′
A n a ly s is
T h e o r e m 1 . For a system with at m ost m active dom in an t jobs at an y tim e, G A P is r -com petitive, where r the un ique positive real root of r = 1 + r − 1 / ( m − 1) .
P roof. We first show t hat t here must be a job t hat sat isfies t he above cri-
t eria t o be scheduled. Let w 1 , w 2 , ..., w p be t he weight s of t he act ive dominant jobs in S . If w i / w i + 1 ≥ r 1 / ( m 1) for some i in 1, 2, ..., p − 1, we are done. Hence suppose w 1 / w p < r ( p 1) / ( m 1) . If t here is no ot her act ive dominant job out side S , t hen t he job wit h weight w p can be scheduled. Ot herwise, let w p + 1 be t he weight of t he heaviest act ive dominant job out side S , −
−
−
Improved Compet it ive Algorit hms for Online Scheduling
429
p + 1 ≤ m . We have w p > r − ( p − 1) / ( m − 1) w 1 ≥ r − ( m − 2) / ( m − 1) w 1 and t hus w p / w p + 1 > r − ( m − 2) / ( m − 1) / (1/ r ) = r 1 / ( m − 1) . T herefore t he job wit h weight w p can be scheduled. By t he definit ion of S and t he way t he algorit hm works, we have t he following propert ies of GAP : for any job y picked by GAP, (1) w ( y ) ≥ w 1 / r (2) no ot her act ive dominant job x sat isfies r − 1 / ( m − 1) w ( y ) < w ( x ) ≤ w ( y ). We use t he charging scheme in Sect . 2. Suppose at t ime t , x , y are t he jobs running in OP T , GAP respect ively. We consider t he charges made t o job y . y may receive charges from x and/ or charges from y from a lat er t ime in OP T .
T here are t hree cases: Case 1. x does not charge t o y . In t his case charging rat io = w ( y ) / w ( y ) = 1. Case 2. Only x charges t o y . Since x must be act ive in GAP, and GAP always choose jobs wit hin 1/ r of t he maximum weight (P roperty (1)), we have charging rat io = w ( x ) / w ( y ) ≤ w ( x ) / ( w 1 / r ) ≤ r . – Case 3. Bot h x and y charge t o y . By definit ion of t he mapping F , bot h x and y should be act ive in GAP at t ime t . By canonical property of OP T , d ( x ) < d ( y ). T herefore w ( x ) < w ( y ), or else x dominat es y and y would not be scheduled in GAP. (i) if x is dominant in GAP, t hen by P roperty (2) of GAP, w ( x ) / w ( y ) ≤ r 1 / ( m 1) . (ii) if x is not dominant in GAP, t hen suppose z = x is t he ‘ next ’ (smaller-weight ) act ive dominant job aft er y . By P roperty (2) of GAP, w ( z ) / w ( y ) ≤ r 1 / ( m 1) , and we must have w ( x ) ≤ w ( z ) (because y and z are consecut ive dominant jobs, t here cannot be an act ive job wit h weight > w ( z ) and deadline < d ( y )), so again we have w ( x ) / w ( y ) ≤ r 1 / ( m 1) . In bot h cases, t he charging rat io = ( w ( x ) + w ( y )) / w ( y ) = 1 + w ( x ) / w ( y ) ≤ 1 + r 1 / ( m 1) .
– –
−
−
−
−
−
−
−
−
T herefore, in any case charging rat io ≤ max( r , 1 + r 1 / ( m 1) ). T his is minimized by set t ing r t o be t he root of r = 1 + r 1 / ( m 1) . In t his case, t he compet it ive rat io is r . ⊓⊔ −
−
−
−
T he above proof only uses t he assumpt ion t hat t here are at most m act ive dominant jobs at any t ime. Not e t hat whet her jobs are act ive/ dominant or not depends on how t he algorit hm schedules t hem, not just t he inst ance it self. T his is not desirable. However t he t heorem is st ill t rue for t he following models, which are more realist ic and generalized by t he above: C o r o l l a r y 1 . G A P is r -com petitive if ( i) at an y tim e t there are at m ost m jobs with t in their span ; or ( ii) there are at m ost m weight classes, i.e., all jobs are of weight w 1 , w 2 , ..., w m for som e fi xed w i ’s.
P roof. (i) aut omat ically implies t here are at most m act ive dominant jobs, while
(ii) means t here are at most m jobs having diff erent weight s at any t ime, t hus at most m act ive dominant jobs. ⊓⊔
430
F .Y.L. Chin and S.P.Y. Fung
In [5] it is proved t hat no non-t imesharing algorit hms are bet t er t han φ compet it ive, where φ ≈ 1. 618 is t he golden rat io, and t he const ruct ion is for m = 2. When m = 2, GAP chooses r t o be t he root of r = 1 + 1/ r , i.e. r = φ . T hus we have C o r o l l a r y 2 . G A P is an optim al n on -tim esharin g algorithm with com petitive ratio 1.618 when m = 2.
4
T h e M u lt ip ro c e s s o r C a s e
In t his sect ion, we consider t he part ial job value scheduling problem in a mult iprocessor set t ing. T he online algorit hm has M processors, and we compare it s performance wit h an offl ine opt imal algorit hm also having M processors. T hroughout t he paper we assume jobs are migrat ory, i.e., jobs on a processor can be swit ched t o ot her processors t o cont inue processing. First consider t he upper bound. For t he uniprocessor case, First Fit (i.e., always schedule t he heaviest job) is 2-compet it ive [3]. T he same holds t rue for t he mult iprocessor case, in which First Fit always schedules t he M heaviest jobs (if t here are less t han M act ive jobs, t hen some processors will idle). T h e o r e m 2 . In the m ultiprocessor settin g, F irstF it is 2-com petitive, an d this is
tight. P roof. We use t he charging scheme in Sect . 2. Suppose at t ime t , j 1 , ..., j M are
t he M jobs running on t he processors of First Fit , w ( j 1 ) ≥ w ( j 2 ) ≥ ... ≥ w ( j M ), and suppose q1 , ..., qM are jobs running on t he processors of t he offl ine opt imal algorit hm. Some of t he qi ’s may be t he same as some of t he j i ’s. Wit hout loss of generality assume j i = qi for i ∈ I ⊂ { 1, 2, ..., M } (reordering indices of qi ’s as necessary). Consider t he charges t o a cert ain t ime t . For t hose i ∈ I , j i can charge t o t ime t at most once. For t hose i ∈ I , qi eit her do not charge t o t ime t , or if t hey do, t hen we must have w ( qi ) ≤ w ( j M ) since t hey are unfinished but not chosen by First Fit . For t hese i ’s, j i may also charge t o t from a lat er t ime in OP T . T hus t he charging rat io is given by w (j i ) w ( qi ) + ( M − | I | ) w ( j M ) + i I i I c≤ M w (j i ) i= 1 M M w (j i ) + (M − | I | )w (j M ) w (j i ) + M w (j M ) i= 1 i= 1 = ≤ ≤ 2 M M w (j i ) w (j i ) i= 1 i= 1 ∈
∈
Consider t he following inst ance of jobs: M copies of (0, 2, 1, 1+ ǫ ), and M copies of (0, 1, 1, 1), where ǫ > 0 is very small. First Fit schedules all weight (1+ ǫ ) jobs and misses all weight -1 jobs, while OP T can schedule all of t hem. T hus t he compet it ive rat io ≥ ( M + M (1 + ǫ )) / ( M (1 + ǫ )) ≈ 2. ⊓⊔ Next we consider t he lower bound. In [5] we proved a randomized lower bound of 1.25 for t he uniprocessor case. Here we ext end t he result t o t he mult iprocessor case, wit h a proof similar t o t hat in [5].
Improved Compet it ive Algorit hms for Online Scheduling
431
T h e o r e m 3 . N o ran dom ized ( an d hen ce determ in istic) algorithm s can be better than 1.25-com petitive for an y M .
P roof. ( S ketch) We make use of Yao’s principle [14]. Basically, it enables us t o
find a lower bound of randomized algorit hms by finding a probability dist ribut ion of inst ances, such t hat we can bound t he rat io of t he expect ed offl ine opt imal value t o t he expect ed online value of t he best determ in istic algorit hm. T his rat io will t hen be a lower bound of randomized algorit hms (see [2]). Consider a set of n + 1 inst ances: J 1 = M copies of { (0, 1, 1, 1) , (0, 2, 1, 2) } J i = J i 1 ∪ M copies of { ( i − 1, i , 1, 2i 1 ) , ( i − 1, i + 1, 1, 2i ) } , for i = 2, ..., n J n + 1 = J n ∪ M copies of { ( n , n + 1, 1, 2n ) } We form a probability dist ribut ion of J i ’s wit h p i being t he probability of picking J i : p i = 1/ 2i for i = 1, 2, ..., n and p n + 1 = 1/ 2n . Clearly p i = 1. First consider t he offl ine opt imal value. It is easy t o see t hat | | O P T ( J i ) | | = (2 + 22 ... + 2i ) M + 2i 1 M = [2(2i − 1) + 2i 1 ]M for i = 1, 2, ..., n , and 2 n n n n | | O P T ( J n + 1 ) | | = (2 + 2 ... + 2 ) M + 2 M = [2(2 − 1) + 2 ]M . T hus −
−
−
E
n
2(2i
[| | O P T | | ] = i=
−
−
1
1) + 2i 2i
−
1
M
+
2(2n
1) + 2n
−
2n
= (
M
5n + 1) M 2
Fix a det erminist ic online algorit hm A . At any t ime int erval [i − 1, i ] where i is an int eger, A is faced wit h M heavier jobs and M or more light er jobs. Suppose it spends β i processor-t ime (t ot al amount of t ime available on all processors) on light er jobs in t his t ime int erval (and hence M − β i on heavier jobs). T he β i ’s complet ely det ermine t he value obt ained by t his algorit hm (on t hese inst ances). We can show t hat , for i = 1, 2, ..., n , ||A
( J i ) | | = [β
1
+ 2( M
−
β 1 )] + ...
+ [2i
−
n
−
1
β
1
i
+ 2i ( M n
−
β
i
)] + 2i β
i n
( J n + 1 ) | | = [β 1 + 2( M − β 1 )] + ... + [2 β n + 2 ( M − β n )] + 2 M 1 1 1 1 | | A (J 1 )| | + | | A ( J 2 ) | | + ... + | | A (J n )| | + | | A (J n + 1 )| | E [| | A | | ] = 2 4 2n 2n We can show t hat all coeffi cient s of β i ’s in E [| | A | | ] vanish. T hus E [| | A | | ] only depends on t he const ant t erms, and ||A
E
n
[| | A | | ] = i=
1
1 1 (2 + ... + 2i ) M + n (2 + ... + 2n + 2n ) M = (2n + 1) M 2i 2
5n / 2 + 1 5 [| | O P T | | ] = → as n is very large. T hus no randomized [| | A | | ] 2n + 1 4 algorit hms have compet it ive rat io bet t er t han 1.25. ⊓⊔ Hence
5
E
E
R e s o u rc e A u g m e n t a t io n
How much ext ra resources is required t o get 1-compet it ive algorit hms? In t his sect ion we give an algorit hm t hat requires 2⌈ lg α ⌉ ext ra resources t o achieve 1compet it iveness, in cont rast wit h t he Ω (log log α ) lower bound [6]. It is in parallel t o, but smaller t han, t he 4⌈ lg α ⌉ bound for t he t radit ional model [10,8].
432 5 .1
F .Y.L. Chin and S.P.Y. Fung Im p o rt a n c e R a t io =
2
We first consider t he case α = 2. We use EDF (Earliest Deadline First , i.e., always schedule t he job wit h t he earliest deadline) wit h a speed-2 processor (a speed-s processor is one which has speed s t imes t hat of a normal processor). = 2, E D F with a speed-2 processor is n ecessary an d suffi cien t to achieve 1-com petitiven ess.
T h e o r e m 4 . For α
P roof. We use a charging scheme almost ident ical t o t hat st at ed in Sect .
2. T he only diff erence is t hat , when don eO P T ( q, t ) < don eE D F ( q, t ) and don eO P T ( q, t ) = don eE D F ( q, u ) for u < t (i.e., charge from t t o u ), t he charges made t o t ime u is 2w ( q ), i.e., twice t he weight , t o account for t he diff erence in speeds between t he offl ine and online algorit hms. Suppose at t ime t , job q0 is running in OP T , q1 is running in EDF. Not e t hat EDF is get t ing a value of 2w ( q1 ) every unit t ime since it is running at speed-2. Consider t he charges t o t ime t , it consist s of a w ( q0 ) charge from t ime t and/ or a 2w ( q1 ) charge from a lat er t ime. – –
Case 1. q0 does not charge t o t . Charging rat io c ≤ (2w ( q1 )) / (2w ( q1 )) = 1. Case 2. q0 charges t o t . T hus q0 is unfinished at t ime t in EDF, t herefore q1 cannot be null. Suppose all job weight s are normalized t o be in t he range [1,2], t hen w ( q0 ) ≤ 2, w ( q1 ) ≥ 1. If t here are no ot her charges (from lat er t imes in OP T ), t hen c ≤ w ( q0 ) / (2w ( q1 )) ≤ 1. Suppose q1 charges from a lat er t ime u > t in OP T . Since OP T is canonical, d ( q0 ) ≤ d ( q1 ), t hus EDF should schedule q0 inst ead of q1 . T he only possibility is t hen q0 = q1 , but in t his case we st ill have c ≤ (2w ( q1 )) / (2w ( q1 )) = 1 since q0 cannot charge t o t at two diff erent t imes.
Since at any t ime c ≤ 1, we showed t hat EDF is 1-compet it ive. Consider using a speed-s processor wit h s < 2. Let s = 2 − δ , 0 < δ < 1 and 0 < ǫ < δ / (1 − δ ). Consider t he inst ance consist ing of a job (0, 2 + ǫ , 2 + ǫ , 2) and 4 copies of (0, 2, 1, 1). OP T get s a value of 4 + 2ǫ by execut ing t he heaviest job. Speed-s EDF get s a value of 2s + 2sǫ . T hen 2s + 2sǫ = 4 − 2δ + 4ǫ − 2δ ǫ = (4 + 2ǫ ) + 2ǫ − 2δ (1 + ǫ ). T his is smaller t han 4 + 2ǫ if 2ǫ < 2δ (1 + ǫ ), i.e. ǫ < δ / (1 − δ ). ⊓⊔ Due t o it s sequent ial nat ure, a job cannot be running on two processors simult aneously. T hus a speed-2 processor is more powerful t han two speed-1 processors, since it can simulat e two speed-1 processors by t imesharing but not vice versa. However, we st ill have t he following st ronger result , using ext ra processors inst ead of higher-speed processor t o achieve 1-compet it iveness. We again use EDF, i.e., t he two processors will schedule t he earliest -deadline and secondearliest -deadline job respect ively. Due t o space limit at ion we omit t he proof. T h e o r e m 5 . E D F with two speed-1 processors is 1-com petitive for α
= 2.
Improved Compet it ive Algorit hms for Online Scheduling 5 .2
433
G e n e ra l Im p o rt a n c e R a t io
In fact , t he proof of T heorem 4 can easily be generalized t o show t hat EDF wit h speed-s processor is α / s -compet it ive. T hus 1-compet it iveness can be achieved for general values of α by using a speed-α processor. However, we can do bet t er: t he following algorit hm G rouped-E D F part it ions t he weight ranges [1..α ] int o ⌈ lg α ⌉ 1 , 2 lg α ), classes, each having weight s in t he int erval [1, 2) , [2, 4), ..., [2 lg α [2 lg α , α ]. J obs in each class have import ance rat io at most 2. T he algorit hm assigns two speed-1 processors t o process jobs in each class using EDF. ⌊
⌊
⌋ −
⌊
⌋
⌋
T h e o r e m 6 . G rouped-E D F is 1-com petitive usin g
2⌈ lg α ⌉
speed-1 processors.
P roof. Let O P T i and E D F i be t he 1-processor opt imal and 2-processor EDF schedules for scheduling t he sub-inst ance consist ing of only t he i -t h class jobs, respect ively. By T heorem 5, | | O P T i | | ≤ | | E D F i | | for all i . We also have | | O P T | | ≤ | | O P T i | | because t he processors in each O P T i can always schedule at least t hat much obt ained by t he subset of jobs in OP T rest rict ed t o t hat class. T hus ||OP T || ≤ | | O P Ti | | ≤ ||E D Fi || = ||E D F ||. ⊓⊔
By using higher-speed processors and t imesharing t o simulat e mult iple processors, and by T heorem 4, we have: T h e o r e m 7 . G rouped-E D F is 1-com petitive with a speed- (2⌈ with ⌈ lg α ⌉ speed-2 processors.
lg α ⌉
) processor, or
An O (log α )-speed processor may not be pract ical. If we allow t imesharing, we can use a speed-s version of t he algorit hm MIX in [5] t o give a t radeoff between speedup and compet it ive rat io. T he proof is similar t o t he e/ ( e − 1)compet it iveness upper bound proof in [5] and is t herefore omit t ed. T h e o r e m 8 . T he speed- s version of M IX is
1/ (1 − e
−
s
) -com petitive.
A small amount of addit ional processing power can give very good compet it iveness result s, irrespect ive of α . For example, wit h s = 2 we have c = 1. 16, and wit h s = 5, c = 1. 00678, i.e. just 0.68% fewer t han t he opt imal value.
6
C o n c lu s io n
In t his paper we consider t he online scheduling problem wit h part ial job values, and give new result s in t he non-t imesharing case, t he mult iprocessor case, and t he resource augment at ion analysis. Some quest ions remain open. Most import ant ly, we do not know whet her t here are non-t imesharing algorit hms wit h compet it ive rat io bet t er t han 2. Anot her problem is about t he exact speedup required for achieving 1-compet it iveness: bot h t he t radit ional and part ial value models have bounds Ω (log log α ) and O (log α ). Would t heir t rue bounds be different ? (T he part ial value model seems ‘ easier’: it has 2-compet it ive algorit hms whereas t here is a lower bound of 4 in t he t radit ional model [1].)
434
F .Y.L. Chin and S.P.Y. Fung
R e fe re n c e s 1. S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunat han, L. Rosier, D. Shasha and F . Wang, On t he Compet it iveness of On-line Real-t ime Task Scheduling, RealT i m e Syst em s 4, 125–144, 1992. 2. A. Borodin and R. El-Yaniv, O n li n e C om put at i on an d C om pet i t i ve A n alysi s, Cambridge University P ress, New York, 1998. 3. E. Chang and C. Yap, Compet it ive Online Scheduling wit h Level of Service, P r oceedi n gs of 7t h A n n ual I n t er n at i on al C om put i n g an d C om bi n at or i cs C on fer en ce, 453–462, 2001. 4. F . Y. L. Chin and S. P. Y. Fung, Online Scheduling wit h P art ial J ob Values and Bounded Import ance Rat io, P r oceedi n gs of I n t er n at i on al C om put er Sym posi um , 787–794, 2002. 5. F . Y. L. Chin and S. P. Y. Fung, Online Scheduling wit h P art ial J ob Values: Does T imesharing or Randomizat ion Help? t o appear in A lgor i t hm i ca . 6. M. Chrobak, L. Epst ein, J . Noga, J . Sgall, R. van St ee, T . T ich´y and N. Vakhania, P reempt ive Scheduling in Overloaded Syst ems, preliminary version appeared in P r oceedi n gs of 29t h I n t er n at i on al C ol loqi um on A ut om at a, L an guages an d P r ogr am m i n g, 800–811, 2002. 7. B. Kalyanasunaram and K. P ruhs, Speed is as P owerful as Clairvoyance, J our n al of t he A C M 47(4), 617–643, 2000. 8. C.-Y. Koo, T .-W . Lam, T .-W . Ngan and K.-K. To, Ext ra P rocessors versus Fut ure Informat ion in Opt imal Deadline Scheduling, P r oceedi n gs of 15t h A C M Sym posi um on P ar al leli sm i n A lgor i t hm s an d A r chi t ect ur es, 133–142, 2002. 9. G. Koren and D. Shasha, D o v e r : An Opt imal On-line Scheduling Algorit hm for Overloaded Uniprocessor Real-t ime Syst ems, SI A M J our n al on C om put i n g 24, 318–339, 1995. 10. T .-W . Lam and K.-K. To, P erformance Guarant ee for Online Deadline Scheduling in t he P resence of Overload, P r oceedi n gs of 12t h A n n ual A C M -SI A M Sym posi um on D i scr et e A lgor i t hm s, 755–764, 2001. 11. J . W . S. Liu, K.-J . Lin, W .-K. Shih, A. C.-S. Yu, J .-Y. Chung and W . Zhao, Algorit hms for Scheduling Imprecise Comput at ions, I E E E C om put er 24(5), 58–68, 1991. 12. C. A. P hilips, C. St ein, E. Torng and J . Wein, Opt imal T ime-crit ical Scheduling via Resource Augment at ion, P r oceedi n gs of 29t h A n n ual A C M Sym posi um on T heor y of C om put i n g, 140–149, 1997. 13. D. Sleat or and R. Tarjan, Amort ized Effi ciency of List Updat e and P aging Rules, C om m un i cat i on s of t he A C M 28(2), 202–208, 1985. 14. A. C.-C. Yao, P robabilist ic Comput at ions: Toward a Unified Measure of Complexity, P r oceedi n gs of 18t h I E E E Sym posi um on Foun dat i on s of C om put er Sci en ce, 222–227, 1977.
M a jority Equilibrium for P ublic Facility A llo cat ion ( P relim inary Version) Lihua Chen 1 , Xiaot ie Deng2 , Qizhi Fang3 , and Feng T ian 4 1
2
Guanghua School of Management , P eking University, [email protected] Depart ment of Comput er science, City University of Hong Kong, [email protected] 3 Depart ment of Mat hemat ics, Ocean University of China, [email protected] 4 Inst it ut e of Syst ems Science, Chinese Academy of Sciences
In t his work, we consider t he public facility allocat ion problem decided t hrough a vot ing process uner t he ma jority rule. A locat ions of t he public facility is a ma jority rule winner if t here is no ot her locat ion in t he network where more t han half of t he vot ers would have be closer t o t han t he ma jority rule winner. We develop fast algorit hms for int erest ing cases wit h nice combinat orial st ruct ures. We show t hat t he general problem, where t he number of public facilit ies is more t han one and is consider part of t he input size, is NP -hard. F inally, we discuss ma jority rule decision making for relat ed models.
A b st r a c t .
1
Int ro duct ion
Ma jority rule is arguably t he most favorit e decision making mechanism for public aff airs. Informally, a ma jority equilibrium solut ion has t he property t hat no ot her solut ions would please more t han half of t he vot ers in comparison t o it . On t he ot her hand, it is well known t hat a ma jority equilibrium may not always exist as shown in t he famous Condorcet paradox where t hree agent s have t hree diff erent orders of preferences, A > B > C , B > C > A , C > A > B among t hree alt ernat ives A , B and C . In t his work we are int erest ed in comput at ional aspect for t he exist ence of a ma jority equilibrium in public decision making. We focus on t he public facility locat ion problem. Demange reviewed cont inuous and discret e spacial models of collect ive choice, aiming at charact erizat ion of t he locat ion problem of public services as a result of public vot ing process [1]. To facilit at e a rigorous st udy of t he relat ed problem, Demange proposed four types of ma jority equilibrium solut ions (call Condorcet Winners) and discussed corresponding result s [10,8] concerning condit ions for t heir exist ences. We consider a weight ed version of t he discret e model of Demange, represent ed by a network G = (( V, w ) , ( E , l )) linking communit ies t oget her. For each i ∈ V , w ( i ) represent s t he number of vot ers reside at i . For each e ∈ E , l ( e) represent s t he
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 435–444, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
436
L. Chen et al.
dist ance between two ends of t he road e = ( i , j ) t hat connect ing t he two communit ies i and j . T he locat ion of a public facility such as library, community cent er, et c., is t o be det ermined by t he public via a vot ing process under t he ma jority rule. We consider a special type of ut lity funct ion: each member of t he community is int erest ed in minimizing t he dist ance of it s locat ion t o t hat of t he public facility. While each desires t o have t he public facility t o be close t o it self, t he desicion has t o be agreed upon by a ma jority of t he vot es. Following Demange [1], a locait on x ∈ V is a st rong (resp. weak) Condorcet winner if, for any y ∈ V , t he t ot al weight of vert ices t hat is closer t o x t han t o y is more (resp. no less) t han t he t ot al weight of vert ices t hat is closer t o y t han t o x . Similarly, it is a quasi-Condorcet winner if we change “closer t o x t han” t o “closer t o x t han y or of t he same dist ance t o x as y ”. Of t he four types of ma jority winner, st rong Condorcet winner is t he most rest rict ive of all, and weak quasi-Condorcet winner is t he lest rest rict ive one and t he ot her two are inbetween t hem. For discret e models considered by Romero [10], Hansen and T hisse [8], it was known t hat , t he order induced by st rict ma jority relat ion (t he weak Condorcet order) in a t ree is t ransit ive. T herefore, a weak Condorcet winner in any t ree always exist s. In addit ion, Demange ext ended t he exist ence condit ion of a weak Condorcet winner t o all single peaked orders on t rees [2]. Our st udy will focus on t he algorit hmic and complexity aspect of Condorcet Winner, and discuss t rees and cycles as well as t he cact us graph, t hat is, a connect ed graph in which each block is an edge or a cycle. Schummer and R.V. Vohra has recent ly st udied t he public facity locat ion following t he same net work mode [11]. P ublic decision making process in t heir discussion is based on st rat egy-proof on t o rules. Our st udy dist inguishes from previous work in our focus in algorit hmic issues. Recent ly, t here has been a growing research eff ort in re-examinat ion of concept s in humanity and social sciences via comput at ional complexity approach, e.g., cooperat ive games [9,5], organizat ional st ruct ure [6], arbit rage [3,4], as well as general equilibrium [7]. In Sect ion 2, we int roduce t he formal formulat ion of t he public facility locat ion problem wit h a single facility in a network. Obviously, enumerat ing t hrough all n locat ions allows us t o have a polynomial t ime algorit hm t o find a ma jority equilibrium locat ion. T he issue here is how t o improve t he t ime complexity. In part icular, we are int erest ed in classify t he types of networks for which a Condorcet winner can be found in linear t ime. As a warm-up example, we present t he solut ion for t rees in Sect ion 3. We present a linear algorit hm for finding t he weak quasi-Condorcet winners of a t ree wit h vert ex-weight and edge-lengt h funct ions (T heorem 1); and prove t hat in t he case, t he weak quasi-Condorcet point s are t he point s which minimize t he t ot al weight -dist ance t o t he individuals’ locat ions (T heorem 2). In Sect ion 4, we give a suffi cient and necessary condit ion for a point t o be a weak quasi-Condorcet point for cycles in t he case t he edge-lengt h funct ion is a const ant , and present a much more int erest ing linear t ime algorit hm. In Sect ion 5, we present an NP -hard proof for finding a ma jority equilibrium solut ion when t he number of public facilit ies is t aken as t he input size, not a const ant . We conclude wit h remarks and discussion on relat ed issues in Sect ion 6.
Ma jority Equilibrium for P ublic Facility Allocat ion
2
437
D efinit ion
In [1], Demange surveys and discusses some spat ial models of collect ive choice, and some result s concerning t he t ransit ivity of t he ma jority rule and t he exit ence of a ma jority winner. Following [1], let S = { 1, 2, · · ·, n } be a society, t hat is a set of n individuals, and X a set of alt ernat ives (or choice space). Each individual i has a preference order, denot ed ≥ i , on X . T he n -t uple ( ≥ i ) i S is called t he profi le of t he society. We associat e wit h every profile ( ≥ i ) i S on X t hree relat ions on X : for every x, y ∈ X , (1) x R y if and only if | { i ∈ S : x > i y } | ≥ | { i ∈ S : y > i x } | . (2) x P y if and only if | { i ∈ S : x > i y } | > | { i ∈ S : y > i x } | . (3) x Q y if and only if | { i ∈ S : x > i y } | > n2 . Given S , X and profile ( ≥ i ) i S on X , an alt ernat ive x in X is called: (1) W eak qu asi-C on dorcet win n er if for every y ∈ X dist inct of x , ∈
∈
∈
|{
i
|{
i
∈
S :y >
n
i
x}
| ≤
≥ i
y}
| ≥
2
i.e. S :x ∈
n
2
;
.
(2) S t ron g qu asi-C on dorcet win n er if for every y |{
i ∈
S :y >
i
x}
|
i y} | ≥ | { i ∈ S : y > i x } |. (4) S t ron g C on dorcet win n er if for every y ∈ X dist inct of x , x P y holds; T hat is, |{ i ∈ S : x > i y} | > | { i ∈ S : y > i x } |. In t his paper, we consider t he public facility locat ion problem wit h a single facility in a graph. First we int roduce some definit ion and not at ion. Let G = ( V, E ) be a undirect ed graph of order n wit h a weight funct ion w t hat assigns t o each vert ex v of G a posit ive weight w ( v ), and a lengt h funct ion l t hat assigns t o each edge e of G a posit ive lengt h l ( e). If P is a chain of G , t hen we denot e by l ( P ) t he sum of lengt hs of all edges of P . We denot e by d G ( u , v ) t he lengt h of a short est chain joining two vert ices u and v in G , and call it dist an ce bet ween u w ( v ). In part icular, if R = V , an d v in G . For any R ⊆ V , we set w ( R ) = v R we writ e w ( G ) inst ead of w ( V ). A vert ex v of G is said t o be pen dan t if v has exact one neighbor in G . Now, for each v i ∈ V , v i has a preference order on V induced by t he dist ance on G . We denot e t he order by ≥ i . T hat is, we have x ≥ i y if and only if ∈
438
L. Chen et al.
dG (vi , x )
≤ d G ( v i , y ) for any two vert ices x and y of G . T he following definit ion is a ext ension of t hat given in [1]
D e fi n i t i o n . Given a graph G = ( V, E ) and profile ( ≥ i ) v i ∈ v 0 in V is called:
(1) W eak qu asi-C on dorcet win n er , if for every u w ({ vi
V :u > ∈
i
v0 } )
w ({ vi ∈
V :u >
i
V : v0 > ∈
i
u} )
≥
w (G )
v0 } )
i
u } ) > w ({ vi
V dist inct of v 0 , ∈
;
V dist inct of v 0 , ∈
V :u > ∈
(4) S t ron g C on dorcet win n er , if for every u w ({ vi
;
2
(2) S t ron g qu asi-C on dorcet win n er , if for every u
∈
on V , a vert ex
V dist inct of v 0 , ∈
w (G ) ≤
V
∈
i
v0 } ).
V dist inct of v 0 , V :u >
i
v0 } ).
In t his paper, we will only consider t he algorit hm for finding weak quasiCondorcet winner of a t ree, a cycle and, more generally, a cact us graph. T he propert ies and algorit hms for ot her t hree types of Condorcet winners can be discussed by t he similar way. R e m a r k . Let G = ( V, E ) be a connect ed graph of order n wit h a weight funct ion w t hat assigns t o each vert ex of G a weight w ( v ), and a lengt h funct ion l t hat assigns t o each edge of G a lengt h l ( e). For each vert ex u , set sG ( u ) = w (v )dG (u , v ). v∈
V
D e fi n i t i o n . A vert ex u 0 is called a bary cen t er if s G ( u 0 ) = min v ∈
3
V
sG ( v ) .
Weak Quasi-C ondorcet W inner of a Tree
Romero, Hansen and T hisse point ed out t hat t he family of orders induced by a dist ance on a t ree guarant ees t he t ransit ivity of P , which implies t he exist ence of a weak Condorcet winner. Furt hermore. t he weak Condorcet point s are t he point s which minimize t he t ot al dist ance t o t he individuals’ locat ions (see [1]). In t his sect ion, we propose a linear algorit hm for finding t he weak quasiCondorcet winners of a t ree wit h vert ex-weight and edge-lengt h funct ions (T heorem 1); and prove t hat in t he case, t he weak quasi-Condorcet point s are t he point s which minimize t he t ot al weight -dist ance t o t he individuals’ locat ions
Ma jority Equilibrium for P ublic Facility Allocat ion
439
(T heorem 2). In fact , t he conclusions of t he two t heorems hold also for t he weak Condorcet winner. Given a vert ex v 0 ∈ V , for any vert ex u , we define t he set of qu asi-frien d vert ices of v 0 F G (v0 , u ) = { v : dG (v , v0 ) ≤ dG (v , u )} , and t he set of host ile vert ices of v 0 H G (v0 , u ) =
{
v : dG (v , v0 ) >
dG (v , u )} .
By t he definit ion of weak quasi-Condorcet winner, we know t hat a vert ex v 0 of G is a weak quasi-Condorcet winner of G , if for any vert ex u = v 0 of G , w ( F G ( v 0 , u ))
w ( H G ( v 0 , u )) .
≥
T h e o re m 1 . E very t ree has on e weak qu asi-C on dorcet win n er , or t wo adjacen t weak qu asi-C on dorcet win n ers. W e can fi n d it or t hem in lin ear t im e. P r o o f. Let T = ( V, E ) be a t ree of order n and let w ( v ) and l ( e) be t he weight funct ion and lengt h funct ion on V and E , respect ively. We prove t he t heorem by induct ion on n .
When n = 1, t he conclusion is t rivial. When n = 2, we set T = ( { u , v } , u v ). If w ( u ) = w ( v ), assuming, wit hout loss of generality, t hat w ( u ) < w ( v ), t hen it is easy t o see t hat v is a unique weak quasi-Condorcet winner of T . If w ( u ) = w ( v ), t hen bot h of u and v are weak quasi-Condorcet winners of T . Now suppose t hat n ≥ 3. Let u 1 , u 2 , · · ·, u k , k ≥ 2, be all t he pendant vert ices of T . Assume, wit hout loss of generality, t hat u 1 is t he vert ex wit h minimum weight among t hese pendant vert ices. Hence w ( u 1 ) < 21 w ( T ). Let u 1 v 1 be t he corresponding pendant edge. Denot e T = T − u 1 , and define t he weight funct ion w on T as follows. if v = v 1 ; w (u 1 ) + w (v1 ), w (v ) = w (v ), if v = v 1 . ∗
∗
∗
∗
Not e t hat F ( u 1 , v 1 ) = { u 1 } and H ( u 1 , v 1 ) = V ( G ) − { u 1 } . Because w ( u 1 ) < ) , we have w ( F ( u 1 , v 1 )) < w ( H ( u 1 , v 1 )), and hence u 1 is not a weak quasiCondorcet winner of T . 1 w (T 2
We show t he following C l a i m . If v 0 is a weak quasi-Condorcet winner of T ∗ , t hen v 0 is also a weak quasi-Condorcet winner of T . P r o o f o f C l a i m . Not ice t hat for any vert ex u = u 1 , dT (u , v1 ) = dT ∗ (u , v1 ) and d T ( u , u 1 ) = d T ( u , v 1 ) + l ( u 1 v 1 ). T hus,
(1) v 1 ∈ F T ( v 0 , u ) if and only if v 1 and only if v 1 ∈ H T ∗ ( v 0 , u ). ∈
F T ∗ ( v 0 , u ); Similarly, v 1 ∈
H T ( v 0 , u ) if
440
L. Chen et al.
(2) If v 1 ∈ F T ∗ ( v 0 , u ), t hen u 1 ∈ F T ( v 0 , u ); Similarly, if v 1 ∈ H T ∗ ( v 0 , u ), t hen u 1 ∈ H T ( v 0 , u ) (3) w ( F T ∗ ( v 0 , u )) = w ( F T ( v 0 , u )); w ( H T ∗ ( v 0 , u )) = w ( H T ( v 0 , u )) . By t he definit ion of weak quasi-Condorcet winner, if v 0 is a weak quasi-Condorcet winner of T , t hen w ( F T ∗ ( v 0 , u )) ≥ w ( H T ∗ ( v 0 , u )) . T hus w ( F T ( v 0 , u )) ≥ w ( H T ( v 0 , u )) . T hat is v 0 is also a weak quasi-Condorcet winner of T . T heorem 1 follows from Claim. A linear t ime algorit hm follows easily from t he proof. ∗
∗
∗
∗
∗
T h e o r e m 2 . L et T be a t ree. T hen v 0 is a weak qu asi-C on dorcet win n er of T if an d on ly if v 0 is a bary cen t er of T . P r o o f. Let T 1 , T 2 , · · ·, T k be t he subt rees of T − v 0 and let u i be t he (unique) vert ex of T i adjacent t o v 0 , ( i = 1, 2, · · ·, k ). Obviously, F T ( v 0 , u i ) = V ( T ) − V ( T i ) , H T ( v 0 , u i ) = V ( T i ) , ( i = 1, 2, · · ·, k ). (1) By t he definit ion of weak quasi-Condorcet winner, we get t hat v 0 is a weak quasi-Condorcet winner of T if and only if for each i = 1, 2, · · ·, k , w ( V ( T ) − V ( T i )) ≥ w ( T i ), i.e., w ( T i ) ≤ 12 w ( T ).
For i = 1, 2, · · · , k , set T i = T
−
V ( T i ), It is easy t o see t hat
s T ( v 0 ) = s T ( v 0 ) + s T i ( u i ) + w ( T i ); i
sT ( u i ) = sT ( v 0 ) + sT i ( u i ) + w ( T i ) . i
(2) By t he definit ion of barycent er, we get t hat v 0 is a barycent er of T if and only if for each i = 1, 2, · · · , k , w ( T i ) ≤ w ( T i ), i.e., w ( T i ) ≤ 12 w ( T ). From (1) and (2), we get t he conclusion of T heorem 2.
4
Weak Quasi-C ondorcet W inner of a C y cle
Recall t hat for a given vert ex v 0 ∈ V and any vert ex u , we denot e by F G ( v 0 , u ) t he set of quasi-friend vert ices of v 0 , t hat is, F G (v0 , u ) =
{
v : dG (v , v0 )
≤
dG (v , u )} .
Suppose t hat C n = v 1 v 2 · · · v n v 1 is a cycle of order n . We denot e by C [v i , v j ] t he sub-chain v i v i + 1 · · · v j of C n , and call it ( j − i + 1) -in t erval. Lem m a 1. L et C 2 r − 1 = v 1 v 2 · · · v 2 r − 1 v 1 be a cy cle of order 2r − 1. S u ppose t hat l ( e) = 1 for an y edge e. T hen v r is a weak qu asi-C on dorcet win n er of C 2 r − 1 if an d on ly if t he weight of each r -in t erval con t ain in g v r is at least 21 w ( C 2 r − 1 ) . T hat is, r
+ i− 1
w (vk ) k
=i
≥
1 w (C 2r 2
−
1 ),
i = 1, 2, ·
· ·,
r.
(1)
Ma jority Equilibrium for P ublic Facility Allocat ion
441
P r o o f. By t he definit ion of weak quasi-Condorcet winner , v r is a weak quasi-Condorcet winner of C 2 r 1 if and only if for any v j , j = r , −
w ( F C ( v r , v j ))
1 w (C 2r 2
≥
−
1 ).
(2)
We will show t hat (1) is equivalent t o (2). For convenience, we set C = C 2 r 1 . −
r is even. Suppose t hat r = 2m . It is easy t o see t hat for t = 1, 2, · · ·, m − 1,
C ase 1.
F C (vr , v2t − 1 ) = F C (vr , v2t ) = F C (vr , v2m
−
1)
= { vr , vr + 1 , ·
F C (vr , v2m
+ 1)
= { v1 , v2 , ·
{
vm
· ·,
· ·,
+t
v2r −
1}
+ t + 1 , · · ·,
vr + m
{
vt −
· ·,
(b 1 )
2m
+ 1,
m
r is odd. Suppose t hat r = 2m Similar t o Case 1, we have
For t = 1, 2, ·
· ·,
m
3)
1,
−
vt −
m
+ 2 , · · ·,
vt −
−
−
m
1
+r}
.
(d 1 )
cont aining v r .
1.
= { vm , vm + 1 , ·
· ·,
vm
+r}
;
(a 2 )
2,
−
F C (vr , v2t ) = F C (vr , v2t + 1 ) = F C (vr , v2m
(a 1 )
(c1 )
C ase 2.
−
;
;
T he set s of (a 1 ) − (d 1 ) are exact ly all t he r -int ervals of C 2 r
F C (vr , v1 ) = F C (vr , v4m
+ t − 1}
vr } ;
By t he symmet ry, for t = m + 1, m + 2, · F C (vr , v2t ) = F C (vr , v2t + 1 ) =
, vm
−
2)
F C (vr , v2m ) =
= { vr , vr + 1 , · {
v1 , v2 , ·
· ·,
{
vm
· ·,
+t
v2r −
, vm 1}
+ t + 1 , · · ·,
vr + m
+ t − 1}
;
;
(c2 )
vr } ;
(d 2 )
By t he symmet ry, for t = m + 1, m + 2, · F C (vr , v2t − 1 ) = F C (vr , v2t ) =
{
vt −
(b 2 )
m
· ·,
2m
+ 1,
vt −
2,
−
m
+ 2 , · · ·,
T he set s of (a 2 ) − (e2 ) are exact ly all t he r -int ervals of C 2 r
vt −
−
1
m
+r}
;
(e2 )
cont aining v r .
Similarly, we get t he following: Lem m a 2. L et C 2 r = v 1 v 2 · · ·v 2 r v 1 be a cy cle of order 2r . S u ppose t hat l ( e) = 1 for an y edge e. T hen v r is a weak qu asi-C on dorcet win n er of C 2 r − 1 if an d on ly if t he weight of each r -in t erval con t ain in g v r is at least 12 w ( C 2 r ) . T hat is, r
+ i− 1
wk k
=i
≥
1 w (C 2r ), 2
i = 1, 2, ·
· ·,
r.
(3)
442
L. Chen et al. P r o o f. We will show t hat (3) is equivalent t o (2). For convenience, we set C = C 2 r . C a s e 1 . r is even. Suppose t hat r = 2m . For t = 1, 2, · · ·, m − 1,
F C (vr , v2t − 1 ) = F C (vr , v2t ) = F C (vr , v2m
{
{
vm
+t
vm
+t
, vm
1)
−
, vm
+ t + 1 , · · ·,
+ t + 1 , · · ·,
= { vr , vr + 1 , ·
· ·,
= { v1 , v2 , ·
vr } ;
vr + m
vr + m
v2r −
;
+ t − 1}
+ t − 1,
(a 3 )
vr + m
+t}
;
(a 3 ) ′
;
1}
(b 3 )
By t he symmet ry, F C (vr , v2m
For t = m + 1, m + 2, ·
+ 1) · ·,
F C (vr , v2t ) =
2m
−
1,
vt −
m
+ 1,
vt −
m
{
F C (vr , v2t + 1 ) = F C (vr , v4m ) =
{ {
vt −
+ 1,
vm , vm
· ·,
(c3 )
+ 2 , · · ·,
m
vt −
vt −
+ 2 , · · ·,
m
+ 1 , · · ·,
vm
m
+r
vt −
m
, vt − +r}
m
+ r + 1}
′
;
(d 3 )
;
(d 3 )
;
+r}
(e3 )
T he set s of (a 3 ) − (e3 ) are exact ly all t he r -int ervals of C 2 r cont aining v r . (If fact , t he set s of (a 3 ) and (d 3 ) are unnecessary, because t he condit ion (3) will be sat isfied for all t he set s of (a 3 ) and (d 3 ) as long as t he same condit ion (3) is sat isfied for all t he set s of (a 3 ) and (d 3 )). ′
′
′
′
C a s e 2 . r is odd. Suppose t hat r = 2m For t = 1, 2, · · ·, m − 1,
F C (vr , v2t − 1 ) = F C (vr , v2t ) =
{
{
vm
vm
+t
+ t − 1,
, vm
vm
{
F C (vr , v2t + 1 ) = F C (vr , v4m
−
2)
vt − {
m
+ 1,
vt −
vt −
+ 1,
m
, vm
+ t + 1 , · · ·,
By t he symmet ry, for t = m , m + 1, · F C (vr , v2t ) =
+t
· ·,
m
vt −
2m
+ t + 1 , · · ·,
vr + m −
+ 2 , · · ·, m
= { vm , vm + 1 , ·
1.
−
+ t − 1}
;
(a 4 ) ′
+ t − 1}
;
(a 4 )
+r}
;
(b 4 )
2, vt −
m
+ 2 , · · ·,
vt −
· ·,
−
vm
vr + m
+r
1}
m
.
+r
, vt −
m
+ r + 1}
;
′
(b 4 ) (c4 )
T he set s of (a 4 ) − (c4 ) are exact ly all t he r -int ervals of C 2 r cont aining v r . (If fact , t he set s of (a 4 ) and (b 4 ) are unnecessary, because t he condit ion (3) will be sat isfied for all t he set s of (a 4 ) and (b 4 ) as long as t he same condit ion (3) is sat isfied for all t he set s of (a 4 ) and (b 4 )). By Lemmas 1 and 2, we get t he following main result concerning cycles: ′
′
′
′
T h e o r e m 3 . L et C n be a cy cle of order n . S u ppose t hat l ( e) = 1 for an y edge e. T hen v ∈ V ( C n ) is a weak qu asi-C on dorcet win n er of C n if an d on ly if t he weight of each ⌊ n +2 1 ⌋ -in t erval con t ain in g v is at least 12 w ( C n ) .
Ma jority Equilibrium for P ublic Facility Allocat ion C o ro lla ry 1 . L et C n be a cy cle of order n . S u ppose t hat C n [p, q] is a in t erval of C . I f
w (u ) < u ∈
C n [p , q ]
⌊
443 n
+1 ⌋ 2
-
1 w (C n ), 2
t hen t he in t erval C n [p, q] con t ain s n o weak qu asi-C on dorcet win n er of C n . C o ro lla ry 2 . L et C n be a cy cle of order n . S u ppose t hat u 1 , u 2 ∈ V ( C n ) are t he t wo weak qu asi-C on dorcet win n ers of C n . I f d C n ( u 1 , u 2 ) ≤ d C n ( u 2 , u 1 ) , t hen each vert ex of C n [u 1 , u 2 ] is a weak qu asi-C on dorcet win n er of C n . P r o o f. Ot herwise, assume t hat v ∈ C n [u 1 , u 2 ] is not a weak quasi-Condorcet winner of C n . T hus by T heorem 3, t here exist s a ⌊ n +2 1 ⌋ -int erval C n [v 1 , v 2 ] of C n cont aining v such t hat 1 w (C n ). w (v ) < 2 v∈
C n [v 1 , v 2 ]
Since d C n ( u 1 , u 2 ) ≤ d C n ( u 2 , u 1 ), we have d C n ( u 1 , u 2 ) ≤ ⌊ n2 ⌋ , and hence eit her u 1 ∈ C n [v 1 , v 2 ] or u 2 ∈ C n [v 1 , v 2 ], which cont radict s t hat u 1 and u 2 are t he two weak quasi-Condorcet winners of C n . As a direct ed consequence of Corollary 2, we get C o ro lla ry 3 .
L et C n = v 1 v 2
· · ·
v n v 1 be a cy cle of order n . I f v 1 an d v ⌊
n+ 2 2 ⌋
are t he weak qu asi-C on dorcet win n ers of C n , t hen each vert ex of C n is a weak qu asi-C on dorcet win n er of C n . C o ro lla ry 4 . L et S be t he set of all t he weak qu asi-C on dorcet win n ers of a cy cle. I f S = ∅ t hen t he su bgraph in du ced by S is con n ect ed.
Wit h T heorem 3, we obt ain a linear t ime algorit hm easily.
5
C om plex ity Issues for P ublic Lo cat ion in G eneral N etworks
In general, t he problem can have various ext ensions. T here may be a number of public facilit ies t o be allocat ed during one vot ing process. T he community network may be of general graphs. T he public facilit ies may be of t he same type, or t hey may be of diff erent types. T he ut ility funct ions of t he vot ers may be of diff erent forms. Our discussion in t his sect ion will t ake such variat ions int o considerat ion. However, in our discret e model, we keep t he rest rict ion t hat t he public facilit ies will be locat ed at nodes of t he graph. We have t he following general result : T h e o r e m 4 . I f t here are a bou n ded con st an t n u m ber of pu blic facilit ies t o be locat ed at on e vot in g process u n der t he m ajorit y ru le, a C on dorcet win n er ( of an y of t he fou r t y eps) can be com pu t ed in poly n om ial t im e. T he problem is N P -hard if t he n u m ber of pu blic facilit ies t o be locat ed is n ot a con st an t bu t con sidered as t he in pu t size.
444
6
L. Chen et al.
R em arks and D iscussion
In t his work, we apply comput at ional complexity approach t o t he st udy of public facility locat ion problem decided via a vot ing process under t he ma jority rule. Our st udy follows t he network model t hat has been applied t o t he st udy of similar problems in economics [10,8,11]. We prove t he general problem t o be NP -hard and est ablish effi cient algorit hms t o int erest ing networks as used in t he st udy of st rat egy-proof model for public facility locat ion problem [11]. Our mat hemat ical result s depend on underst anding of combinat orial st ruct ures of underlying networks. Many problems open up from our st udy. First t he decision problem of t he ma jority rule equilibrium. It is not very diffi cult t o problem t he solut ion t o be NP -hard in discret e equilibrium problems. T he decision problem is harder. T he only inst ance we know of is one recent result for t he decision problem for general equilibrium [7]. Secondly, t he complexity st udy for ot her rules for public facility locat ion is very int erest ing and deserves furt her st udy. T hird, it would be int erest ing t o ext end our st udy t o ot her areas and problems of public decision making process. A c k n o w l e d g e m e n t . T he work described in t his paper was support ed by a
grant from Hong Kong RGC (CityU 1081/ 02E).
R eferences 1. G. Demange, Spat ial Models of Collect ive Choice, in Locat ional Analysis of P ublic Facilit ies, (eds. J . F .T hisse and H. G. Zoller), Nort h-Holland P ublishing Company, 1983. 2. G. Demange, Single P eaked Orders on a Tree, M at h. Soc. Sci . 3 (1982), pp.389–396. 3. X. Deng, Z. Li and S. Wang, On Comput at ion of Arbit rage for Market s wit h Frict ion, L ect u r e N ot es i n C om pu t er Sci en ce 1 8 5 8 (2000), pp. 310–319. 4. X. Deng, Z.F . Li and S. Wang, Comput at ional Complexity of Arbit rage in Frict ional Security Market . Int ernat ional J ournal of Foundat ions of Comput er Science, Vol. 13, No.5, (2002), 681–684. 5. X. Deng and C. P apadimit riou, On t he Complexity of Cooperat ive Game Solut ion Concept s, M at hem at i cs of O per at i on s R esear ch 1 9 (2)(1994), pp. 257–266. 6. X. Deng and C. P apadimit riou, Decision Making by Hierarchies of Discordant Agent s, M at hem at i cal P r ogr am m i n g 8 6 (2)(1999), pp.417–431. 7. X. Deng, C. P apadimit riou and S. Safra, On Complexity of Equilibrium. ST OC 2002, May, 2002, Mont real, Canada, pp.67–71. 8. P. Hansen and J .-F . T hisse, Out comes of Vot ing and P lanning: Condorcet , Weber and Rawls Locat ions, J ou r n al of P u bli c E con om i cs 1 6 (1981), pp.1–15. 9. N. Megiddo, “Comput at ional Complexity and t he game t heory approach t o cost allocat ion for a t ree,” M a t h em a t i cs o f O p er a t i o n s R esea r ch 3, pp. 189–196, 1978. 10. D. Romero, Variat ions sur l’eff et Condorcet , T h`ese de 3`eme cycle, Universit´e de Grenoble, Grenoble, 1978. 11. J . Schummer and R.V. Vohra, St rat egy-proof Locat ion on a Network, J ou r n al of E con om i c T heor y 1 0 4 (2002), pp.405–428.
O n C o n s t ra in e d M in im u m P s e u d o t ria n g u la t io n s G u¨ nt er Rot e1 ⋆ , Cao An Wang2 ⋆ ⋆ , Lusheng Wang3 ⋆ ⋆
⋆
, and Yinfeng Xu 4 †
1
2
Inst it ut f¨u r Informat ik, Freie Universit ¨a t Berlin, Takust raße 9, D-15195 Berlin, Germany, [email protected] Depart ment of Comput er Science, Memorial University of Newfoundland, St . J ohn’s, NF LD, Canada A1B 3X8, [email protected] 3 Depart ment of Comput er Science, City University of Hong Kong, Kowloon, Hong Kong, P.R. China, [email protected] 4 School of Management , Xi’an J iaot ong University, Xi’an, 710049, P.R. China, [email protected]
In t his paper, we show some propert ies of a pseudot riangle and present t hree combinat orial bounds: t he rat io of t he size of minimum pseudot riangulat ion of a point set S and t he size of minimal pseudot riangulat ion cont ained in a t riangulat ion T , t he rat io of t he size of t he best minimal pseudot riangulat ion and t he worst minimal pseudot riangulat ion bot h cont ained in a given t riangulat ion T , and t he maximum number of edges in any set t ings of S and T . We also present a linear-t ime algorit hm for finding a minimal pseudot riangulat ion cont ained in a given t riangulat ion. We finally st udy t he minimum pseudot riangulat ion cont aining a given set of non-crossing line segment s. A b st r a c t .
1
I n t ro d u c t io n
A p s e u d o t r ia n gle is a simple p olygon wit h exact ly t hree vert ices where t he inner angle is less t han π , see F igure 1. T hese t hree vert ices are called co r n e r s . T he b oundary is comp osed of t hree pieces of nonconvex chains, where t he nonconvex chain has eit her a reflex inner angle at each inner vert ex or is a single edge (t he degenerat e case). A p s e u d o t r ia n gu la t io n of a p oint set S is a part it ion of t he ⋆
⋆ ⋆ ⋆ ⋆ ⋆
†
Research by G u¨ nt er Rot e was part ly support ed by t he Deut sche Forschungsgemeinschaft (DFG) under grant RO 2338/ 2-1. T he work of Cao An Wang is support ed by NSERC grant OP G0041629. Lusheng Wang is fully support ed by a grant from t he Research Grant s Council of t he Hong Kong Special Administ rat ive Region, China [P roject No. CityU 1087/ 00E]. T he work of Yinfeng Xu is support ed by NSFC(19731001) and NSFC(70121001) for excellent group project . T he init ial collaborat ion between Yinfeng Xu and G u¨ nt er Rot e on t his paper was sponsored by t he graduat e program “Graduiert enkolleg A l gor i t hm i sche D i skr et e M at hem at i k ” of t he Deut sche Forschungsgemeinschaft (DFG), grant GRK219/ 3, when Yinfeng Xu visit ed Berlin.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 445– 454 , 2003. c Sp r in ger -Ver la g B er lin H eid elb er g 2003
446
G. Rot e et al.
x
2
x1
x3
(a)
(b) F i g . 1 . (a) Some typical pseudot riangles. Vert ices x 1 , x 2 , x 3 are corners, and t he t hree right -hand side cases are degenerat e cases of pseudot riangle. (b) A pseudot riangulat ion of 10 point s.
int erior of t he convex hull of S int o a set of pseudot riangles. T his geomet ric st ruct ure plays an imp ort ant role in planning collision-free pat hs among p olyhedral obst acles [4] and in planning non-colliding rob ot arm mot ion [2,5]. P revious research on t his t opic was mainly concent rat ed on t he prop ert ies and algorit hms for minimum pseudot riangulat ion of a given p oint set or a set of convex ob ject s. In t hose cases, t he edges of pseudot riangulat ions are chosen from t he complet e edge set of t he p oint set . It is nat ural t o consider some const raint on t he choice of edges. Our work mainly invest igat es t he prop ert ies of t he minimal pseudot riangulat ions const rained t o b e a s u bs e t of a given t riangulat ion, t he minimum pseudot riangulat ions const rained t o b e a s u pe r s e t of a given set of noncrossing line segment s, and on algorit hms t o find t hese pseudot riangulat ions. T his invest igat ion is mot ivat ed in some applicat ions t hat one may compromise a minimal pseudot riangulat ion by a fast er const ruct ion algorit hm, or t he environment may b e const rained by a set of disjoint obst acles. For example, t he pap er [1] invest igat es degree b ounds for minimum pseudot riangulat ions which are const rained by some given subset of edges. In order t o find a minimal pseudot riangulat ion const rained in a given t riangulat ion, one must b e able t o ident ify t he edges t o b e removed. In Sect ion 3, we show a st ruct ural prop erty for t hese edges (T heorem 2). T his prop erty allows us t o design a linear-t ime algorit hm for finding a minimal pseudot riangulat ion, which is present ed in Sect ion 5. In cont rast t o t he pseudot riangulat ion of a set S of n p oint s, where all minimum pseudot riangulat ions of S have t he same cardinality, viz. 2n − 3 edges [5], t he size of t he minimum pseudot riangulat ion const rained in a given t riangulat ion T dep ends not only on n , but on T .
On Const rained Minimum P seudot riangulat ions
447
We invest igat e t he p ossible sizes of minimal and minimum pseudot riangulat ions in Sect ion 4. We show t hat t he rat io of t he sizes of t he b est and t he worst minimum pseudot riangulat ion const rained in some T against t he size of t he minimum pseudot riangulat ion t riangulat ion of S can vary from 1 t o 23 . T he ab ove b ound is opt imal asympt ot ically. Furt hermore, t he size of a ‘ minimal’ pseudot riangulat ion const rained in a t riangulat ion dep ends on t he sequence of const ruct ion of pseudot riangles. (In a minimal pseudot riangulat ion, each pseudot riangle has b een expanded int o it s limit , a furt her expansion will violat e t he definit ion of pseudot riangle. A minimal pseudot riangulat ion may not b e minimum wit h resp ect t o all p ossible pseudot riangulat ions const rained in t hat t riangulat ion.) We show t hat t he rat io of t he size of t he smallest minimal pseudot riangulat ion and t he size of t he largest minimal pseudot riangulat ion const rained in a same t riangulat ion can vary from 1 t o 23 . It is known t hat t he size of minimum pseudot riangulat ion const rained on any set t ing of S and T is at least 2n − 3. We show t hat t he m a x im u m numb er of edges in such pseudot riangulat ions is b ounded by 3n − 8. In Sect ion 6, we st udy t he pseudot riangulat ions which co n t a in a given set L of noncrossing line segment s. Int erest ingly, we find t hat t he size of a minimum pseudot riangulat ion for L dep ends only on t he numb er of reflex vert ices of L . T he proof uses an algorit hm for const ruct ing such a minimum pseudot riangulat ion. F inally, we discuss some op en quest ions.
2
P re lim in a rie s
We shall first give some definit ions. A t r ia n gu la t io n T of a planar p oint set S is a maximal planar st raight -line graph wit h S as vert ices. We assume t hroughout t he pap er t hat t he p oint s of S lie in general p osit ion, i.e., no t hree p oint s lie on a line, and all angles are diff erent from π . Let T ′ b e a subgraph of T . For a vert ex p ∈ S define α ( p ) b e t he largest angle at p b etween two neighb oring edges incident t o p . A vert ex p in T ′ is called a re fl e x p oint if α ( p ) ≥ π in T ′ . A m in im u m pseudot riangulat ion of a p oint set is one wit h t he smallest numb er of edges. It is known t hat t he numb er of edges in any minimum pseudot riangulat ion of n p oint s is 2n − 3, see [5]. We now prove some prop ert ies for a t riangulat ed pseudot riangle. Let p b e a pseudot riangle, T ( p ) b e a t riangulat ion of p . Let T ( p ) − p denot e t he remainder of T ( p ) aft er t he removal of t he edges of p . T he d u a l gra p h of T ( p ) is defined as usual: Each node in t he graph corresp onds t o a t riangle face in T ( p ), and two nodes det ermine an edge of t he graph if t he corresp onding t riangles share an edge. A s t a r -c h a in consist s of t hree simple chains sharing a common end-node. L e m m a 1 . T h e d u a l o f a n y t r ia n gu la t io n o f a p s e u d o t r ia n gle is a s im p le c h a in o r a s t a r -c h a in .
P roo f. See F igure 2a for an illust rat ion. Each int erior edge of t he t riangulat ion
of a pseudot riangle must span on two diff erent chains by t he nonconvexity of
448
G. Rot e et al.
(a)
(b)
(a) Diff erent shapes of t he dual graph in Lemma 1. (b) T he edges of in Lemma 2.
F ig. 2 .
T
(p ) −
p
it s t hree chains. T his implies t hat t hese int erior edges can form at most one t riangle. T he lemma follows. ⊓⊔ L e m m a 2 . L e t T ( p ) be a t r ia n gu la t io n o f a p s e u d o t r ia n gle p . T h e re is a pe r fec t m a t c h in g be t w ee n t h e ed ge s in T ( p ) − p a n d t h e re fl e x v e r t ice s o f p , w h ic h m a t c h e s ea c h ed ge t o o n e o f it s v e r t ice s .
P roo f. By Lemma 1, t he edges of T ( p )
− p form eit her a t ree which cont ains exact ly one corner of p or a graph wit h a single cycle, which is formed by a t riangle, see F igure 2b. In t he first case, we choose t he corner as a root and direct all edges of T ( p ) − p away from t he root . T hen every reflex vert ex will have one edge of t he t ree p oint ing t owards it , t hus est ablishing t he desired one-t o-one corresp ondence b etween t he edges and t he reflex vert ices. If T ( p ) − p cont ains a t riangle, we orient t he edges of t he t riangle cyclically, in any direct ion, and we orient all ot her edges away from t he cycle. Again, every reflex vert ex has one edge of t he t ree p oint ing t owards it . (In fact , t he mat ching b etween edges and reflex vert ices is unique up t o reorient ing t he cent ral t riangle.) ⊓⊔
We can ext end t he st at ement of t he Lemma 2 from a single pseudot riangle t o a pseudot riangulat ion. T h e o r e m 1 . L e t T be a t r ia n gu la t io n o f a po in t s e t S , a n d le t P
⊆ T be a p s e u d o t r ia n gu la t io n o f S . T h e n t h e re is a pe r fec t m a t c h in g be t w ee n t h e ed ge s in T − P a n d t h e re fl e x v e r t ice s o f P , w h ic h m a t c h e s ea c h ed ge t o o n e o f it s t w o v e r t ice s .
P roo f. Every reflex vert ex of P b elongs t o exact ly one pseudot riangle in which it is a reflex vert ex. T hus, we can simply apply Lemma 2 t o each pseudot riangle of P separat ely. ⊓⊔
T he following st at ement is imp ort ant for our charact erizat ion of minimal pseudot riangulat ions in T heorem 2. L e m m a 3 . L e t p be a p s e u d o t r ia n gle , a n d le t E
be a n o n e m p t y s e t o f ed ge s in s id e p w h ic h pa r t it io n p in t o s m a lle r p s e u d o t r ia n gle s . T h e n o n e o f t h e fo llo w in g t w o ca s e s h o ld s :
(a) (b)
E is a t r ia n gle . E co n t a in s a n ed ge e s u c h t h a t E
t r ia n gle s .
−
e s t ill pa r t it io n s p in t o s m a lle r p s e u d o -
On Const rained Minimum P seudot riangulat ions
449
P roo f. Every edge in E connect s two diff erent reflex side chains of p . If | E | ≥ 4, t hen E cont ains at least two edges which connect t he same pair of reflex side chains of p . We choose among all t hese edges t he edge e which is incident wit h t he pseudot riangle cont aining t he common corner of t hese chains. Removing e will join two pseudot riangles int o a new face which is b ounded by p ort ions of two reflex chains and a single edge b etween t hese chains. Hence t his face is a pseudot riangle, and e is t he desired edge for Case (b) of t he lemma. We are left wit h t he case t hat E cont ains at most t hree edges. T his case can b e t reat ed by an element ary case analysis. ⊓⊔
3
M in im a l P s e u d o t ria n g u la t io n s
Let T denot e a t riangulat ion of S and let P T denot e a pseudot riangulat ion const rained in T , i.e., P T ⊆ T . A pseudot riangulat ion P T is m in im a l (denot ed by P mT a l ) if no prop er subset of P T is a pseudot riangulat ion. P T is called m in im u m (denot ed by P mT u m ) if it cont ains t he smallest numb er of edges over all p ossible pseudot riangulat ions const rained in T . For simplicity, we use ‘const rained pseudot riangulat ion P T ’ as pseudot riangulat ion const rained in a given t riangulat ion T . T he definit ion of a minimal t riangulat ion involves a st at ement ab out all subset s of edges. T he following t heorem shows t hat is is suffi cient t o check only a linear numb er of prop er subset s t o est ablish t hat a pseudot riangulat ion is minimal. T h e o re m 2 ( C h a ra c t e riz a t io n o f m in im a l p s e u d o t ria n g u la t io n s ) .
A p s e u d o t r ia n gu la t io n P is m in im a l if a n d o n ly if – t h e re is n o ed ge e ∈
P su ch that P
– t h e re is n o t r ia n gu la r fa ce
{
−
e is a p s e u d o t r ia n gu la t io n , a n d
e1 , e2 , e3 } ∈
P
su ch that P
−
{
e1 , e2 , e3 }
is a
p s e u d o t r ia n gu la t io n . ⊂ P is a pseudot riangulat ion which is a prop er subset of P . We have t o show t hat some edge or t riangle of P can b e removed. Let p b e a pseudot riangle face of P ′ which cont ains some edges E of P − P ′ . T hese edges sub divide p int o pseudot riangles, and we can apply Lemma 3 t o p . We eit her get an edge whose removal yields a pseudot riangulat ion, or E is a t riangle, whose removal merges 4 faces of P int o p . ⊓⊔
P roo f. It is clear t hat t he condit ion is necessary. Now, supp ose t hat P
4
′
R a t io o f t h e S iz e s o f P s e u d o t ria n g u la t io n s
In t his sect ion, we show some relat ionships among t he sizes of T , P pseudot riangulat ion), P mT a l (minimal P T in T ), P mT u m (minimum P m u m ( S ) (minimum pseudot riangulat ion of t he p oint set S ).
T
P
(const rained in T ), and
T
450
G. Rot e et al.
T h e o r e m 3 . L e t S be a s e t o f n po in t s in ge n e ra l po s it io n a n d T be a t r ia n gu la t io n o f S . T h e n u m be r o f ed ge s in P mT u m is a t m o s t 3n − 8, fo r n ≥ 5. T h e re a re in fi n it e ly m a n y v a lu e s o f n fo r w h ic h a t r ia n gu la t io n e x is t s w h e re P mT u m h a s 3n − 12 ed ge s .
T hree st eps of t he induct ive const ruct ion in T heorem 3. T he t hree edges of t he dot t ed cent ral t riangle can be removed.
F ig. 3 .
P roo f. Supp ose t hat If k vert ices lie on t he convex hull of S , every t riangulat ion
has 3n − k − 3 edges, and every pseudot riangulat ion P (in fact , any noncrossing set of edges) has at most 3n − k − 3 edges. T his follows from Euler’s relat ion. T hus, when k ≥ 5, t he upp er b ound follows. It is easy t o check t hat when n ≥ 5 and k is 3 or 4, we can always remove at least 5 − k edges and st ill obt ain a pseudot riangulat ion. A family of t riangulat ions which show t he lower b ound is given in F igure 3. T he numb er of vert ices is a mult iple of 3 and k = 6. T he inst ances are const ruct ed induct ively, by removing t he cent ral t riangle and sub dividing t he result ing pseudot riangle as shown in F igure 3. T he new p oint s are slight ly twist ed ab out t he cent er in order t o obt ain a p oint set in general p osit ion, and t o ensure t hat t he “direct pat hs” which lead from t he cent er t o t he vert ices of t he out er hexagon make zigzag t urns. T he only edge set which one can remove is t he cent ral t riangle. T he result ing pseudot riangulat ion has 3n − 12 edges. One can check by insp ect ion, using T heorem 2, t hat it is a minimal pseudot riangulat ion. Since t here was only one way t o obt ain a pseudot riangulat ion as a subgraph of T , it is t he unique minimal pseudot riangulat ion. Hence, is is also a minimum pseudot riangulat ion. ⊓⊔ T
We have an example of a minimum pseudot riangulat ion wit h n = 41 vert ices and 3n − 8 edges. We b elieve t hat t he upp er b ound of 3n − 8 is t ight for infinit ely many values of n . T h e o re m 4 .
(a) T h e re a re ca s e s o f
T
S a n d T s u c h t h a t t h e s iz e o f T a n d P m u m ,
a n d a ll o t h e r p s e u d o t r ia n gu la t io n s P
T
a re t h e s a m e .
(b) T h e ra t io be t w ee n t h e s iz e s o f t w o d iff e re n t m in im a l co n s t ra in ed p s e u d o t r ia n gu la t io n s in a giv e n t r ia n gu la t io n is be t w ee n 23 a n d 32 . T h e s e bo u n d s a re a s y m p t o t ica lly t igh t . (c) T h e ra t io o f t h e s iz e o f t h e m in im u m p s e u d o t r ia n gu la t io n o f S a n d t h e m in im u m p s e u d o t r ia n gu la t io n co n s t ra in ed in T is be t w ee n 1 a n d 23 , w h ic h is
On Const rained Minimum P seudot riangulat ions
451
a s y m p t o t ica lly t igh t . T h e s a m e bo u n d h o ld s fo r t h e s iz e o f t h e m in im a l co n s t ra in ed p s e u d o t r ia n gu la t io n in T . P roo f. T he b ounds on t he rat ios follow from t he fact t hat a pseudot riangulat ion
of n p oint s has b etween 2n − 3 and 3n − 6 edges. We omit t he det ailed general proofs t hat t he b ounds are t ight in t his version of t he pap er, but we show some typical t ight inst ances in F igure 4.
(b)
(a) F ig. 4 .
Examples for t he proof of T heorem 4
(a) T he t riangulat ion T in F igure 4(a) is obt ained by p ert urbing a t riangular grid so t hat t he sides bulge. One can check by insp ect ion, using T heorem 2, t hat it is a minimal pseudot riangulat ion, and hence also a minimum pseudot riangulat ion in T . (b) In t he t riangulat ion of F igure 4(b) we can obt ain a minimal t riangulat ion wit h 3n − 18 edges by removing t he five dot t ed edges in t he cent er, or we can get anot her minimal t riangulat ion wit h 2n − 2 edges by removing t he edges in t he shaded funnels. (c) T he example of F igure 3 in T heorem 3 is a minimum and minimal pseudot riangulat ion P T ( S ) wit h 3n − 12 edges. A minimum pseudot riangulat ion of S has always 2n − 3 edges. ⊓⊔
5
C o n s t ru c t in g a M in im a l P s e u d o t ria n g u la t io n in a T ria n g u la t io n
In t he following, we shall present a linear-t ime greedy algorit hm t o const ruct a minimal pseudot riangulat ion in a given t riangulat ion T . By T heorem 2, we just need t o check whet her we can remove a single edge or a t riangle and keep a pseudot riangulat ion. If t his is t he case, we remove t he edge or t riangle and cont inue wit h t he result ing pseudot riangulat ion. T he following lemma explains how t o carry out t his t est effi cient ly. Lem m a 4. P
−
(a) L e t
P
be a p s e u d o t r ia n gu la t io n a n d e ∈
P
be a n ed ge . T h e n
e is a p s e u d o t r ia n gu la t io n if a n d o n ly if t h e re m o v a l o f e c rea t e s a n e w
452
G. Rot e et al.
re fl e x v e r t e x , in o t h e r w o rd s , if o n e e n d po in t o f e is n o t re fl e x in P a n d re fl e x in P − e . (b) L e t P be a p s e u d o t r ia n gu la t io n a n d { e 1 , e 2 , e 3 } ∈ P be a t r ia n gu la r fa ce in P . T h e n P − { e 1 , e 2 , e 3 } is a p s e u d o t r ia n gu la t io n if a n d o n ly if t h e re m o v a l o f t h e t r ia n gle m a k e s a ll t h ree v e r t ice s re fl e x , o r m o re p rec is e ly , if t h e t h ree v e r t ice s o f { e 1 , e 2 , e 3 } a re n o t re fl e x in P a n d re fl e x in P − { e 1 , e 2 , e 3 } . P roo f. Removing an edge or a t riangle creat es a new face from merging two or
four pseudot riangles, resp ect ively. We have t o check whet her t his new face cont ains 3 convex vert ices. T he proof follows easily by count ing t he convex angles incident t o t he aff ect ed vert ices, b efore and aft er removing t he edge or t he t riangle. (It also follows t hat in case (a), only o n e endp oint of e can b e a n e w reflex vert ex in P − e .) ⊓⊔ Comput at ionally, t he condit ions of Lemma 4 can b e checked very easily. For example, let e = a b b e an edge in a pseudot riangulat ion P . Let α 1 and α 2 b e t he two angles incident t o e at a , and let β 1 and β 2 b e t he two corresp onding angles at b. T hen P − e is a pseudot riangulat ion if and only if α 1 < π , α 2 < π , and α 1 + α 2 > π , or if β 1 < π , β 2 < π , and β 1 + β 2 > π . T he condit ion can b e similarly formulat ed for t he removal of a t riangle (Lemma 4(b)). T hus, for a given edge or t riangle, it can b e checked in const ant t ime whet her it can b e removed. T he algorit hm for const ruct ing a minimal pseudot riangulat ion now works as follows. We call an edge or a t riangle re m o v a ble if it sat isfies t he condit ion of Lemma 4(a) or (b), resp ect ively. We st art wit h t he given t riangulat ion. T he algorit hm maint ains a list of all re m o v a ble ed ge s , which is init ialized in linear t ime by scanning all edges. W hen a removable edge exist s, we simply remove t his edge, and up dat e t he list of removable edges. T he removal of an edge e = a b may aff ect t he removability st at us of at most four edges of t he current pseudot riangulat ion P (namely, t he two neighb oring edges at a and at b ). T hese edges can b e checked in const ant t ime. We rep eat t his procedure unt il t he list of removable edges b ecomes empty. Now we check if t here is any removable t r ia n gle according t o t he condit ion of Lemma 4(b), and we remove it . One can easily show t hat t he removal of a t riangle cannot creat e a new removable edge or a new removable t riangle. T hus we can simply scan all faces of P sequent ially, in linear t ime. In t he end we obt ain a pseudot riangulat ion wit hout removable edges or t riangles, which is a minimal pseudot riangulat ion, by T heorem 2. T T h e o r e m 5 . T h e a lgo r it h m p rod u ce s a m in im a l p s e u d o t r ia n gu la t io n P m al of a
giv e n t r ia n gu la t io n T in lin ea r t im e .
6
⊓⊔
C o n s t ru c t in g a P s e u d o t ria n g u la t io n C o n t a in in g a G iv e n S e t o f E d g e s
In t his sect ion, we find a minimum pseudot riangulat ion which co n t a in s a given set L of non-crossing line segment s. T he basic idea is t o maint ain t he set of
On Const rained Minimum P seudot riangulat ions
453
reflex vert ices of t he given st raight -line graph G ( S , L ) as an invariant when we add ext ra edges t o L t o build t he pseudot riangulat ion of L [3]. T h e o r e m 6 . Fo r a n y n o n c ro s s in g s e t o f lin e s egm e n t s L , t h e re is a p s e u d o -
t r ia n gu la t io n T L′ ( S ) ⊇
L w h ic h h a s t h e s a m e s e t o f re fl e x v e r t ice s a s G ( L , S ) .
P roo f. We prove t his by gradually adding edges t o t he set L unt il we get a
pseudot riangulat ion. F irst we add all convex hull edges t o L . T his does not change t he set of reflex vert ices. T hen t he edge set L part it ions t he int erior of t he convex hull int o faces, which can b e considered indep endent ly. So let us consider a single face F , see F igure 5. T he b oundary of F has one comp onent B which is t he ext erior b oundary of F , and p ossibly several ot her comp onent s inside F . Not e t hat B is a single cycle of edges when we walk along t he b oundary of F inside B , alt hough t his cycle may visit t he same edge twice (from two diff erent sides) or it may visit a vert ex several t imes. Nevert heless, we t reat B as if it were a simple p olygon.
x3 x2 A1
A3
A2
x1 F ig. 5 .
We will sub divide following st eps:
Illust rat ion for t he proof of t he T heorem 6.
F
int o pseudot riangles by rep eat edly carrying out t he
–
Select a corner x 1 on B and walk clockwise along B unt il we find t he next two corners x 2 and x 3 on B . ( B must cont ain at least 3 corners.) We denot e t he pat h from x 1 via x 2 t o x 3 along B by A 1 , and t he remaining part of B by A 2 . By A 3 , we denot e t he (p ossibly empty) set of int erior comp onent s of t he b oundary of F , see F igure 5.
–
F ind t he short est pat h S from x 1 t o x 3 in F which is homot opic t o t he pat h A 1 from x 1 t o x 3 . In ot her words, we put a st ring from x 1 along x 2 t o x 3 and pull t he st ring t aut , regarding B and t he comp onent s inside F
454
G. Rot e et al.
as obst acles. In ot her words, we t ake t hat short est pat h from which separat es A 1 from A 2 ∪ A 3 . It is clear t hat t his pat h (a) (b) (c) (d) (e)
S
x1
to
x3
in
F
consist s of t he following pieces:
an init ial piece following some part of B from x 1 t owards x 2 , t urning left ; a connect ing line segment t hrough t he int erior of F ; some part of t he b oundary of t he convex hull of A 2 ∪ A 3 , t urning right ; a connect ing line segment t hrough t he int erior of F ; and a final piece following some part of B from x 2 t o x 3 , t urning left .
Any of t he pieces (a), (c), and (e) may b e missing. If (c) is missing, t hen t here is of course only one connect ing segment inst ead of (b) and (d). It follows t hat t he region t hat is cut off by t his pat h (on t he left side of S ) is a pseudot riangle t hat cont ains no p oint s inside. It may happ en t hat S consist s of a single reflex chain from x 1 t o x 3 along B . In t his case, F was an empty pseudot riangle, and we are done wit h F . Ot herwise, we cont inue t his procedure wit h t he remaining part of F . It is also clear t hat no edge of S will dest roy a reflex vert ex. Being a geodesic pat h, S will only go t hrough reflex vert ices (b esides t he endp oint s x 1 and x 3 ), and it will make left t urns when passing around a comp onent t hat is on t he left side, and similarly for right t urns. ⊓⊔ T he following immediat e consequence of t he t heorem ext ends t he known result s for L = ∅ , where r = n . C o r o l l a r y 1 . E v e r y m in im u m p s e u d o t r ia n gu la t io n o f a po in t s e t S w it h n po in t s co n t a in in g a giv e n s e t L o f ed ge s w it h r re fl e x v e r t ice s h a s 2n − r − 2 p s e u d o t r ia n gle s a n d 3n − r − 3 ed ge s . ⊓⊔
7
C o n c lu s io n
Several problems remain for furt her st udy. How t o find t he minimum pseudot riangulat ion const rained in T ? Is t his problem NP -hard? – St udy minimum pseudot riangulat ions sub ject t o some ot her const raint s. – How t o find t he minimum-weight pseudot riangulat ion?
–
R e fe re n c e s 1. Aichholzer O., Hoff mann M., Speckmann B., and T ´ot h C. D., ‘Degree bounds for const rained pseudo-t riangulat ions’, in preparat ion. 2. Kirkpat rick D., Snoeyink J ., and Speckmann B., ‘Kinet ic collision for simple polygons’, in P r oc. 16t h A n n . Sy m p. on C om pu t at i on al G eom et r y , 2000, pp. 322–329. 3. P occhiola M. and Vegt er G., ‘Topologically sweeping visibility complexes via pseudot riangulat ions’, D i scr et e an d C om pu t at i on al G eom et r y 1 6 (1996), 419–453. 4. P occhiola M. and Vegt er G., ‘T he visibility complex’, I n t er n at i on al J ou r n al on C om pu t at i on al G eom et r y an d A ppl i cat i on s 6 (1996), 279–308. 5. St reinu I., ‘A combinat orial approach t o planar non-colliding robot arm mot ion planning’, P r oc. 41st A n n . Sy m p. F ou n d. C om pu t . Sci . (FOCS), 2000, pp. 443–453.
P a irw is e D a t a C lu s t e rin g a n d A p p lic a t io n s ⋆ Xiaodong Wu 1 ⋆ ⋆ , Danny Z. Chen 2 ⋆ ⋆ ⋆ , J ames J . Mason 3 , and St even R. Schmid 3 1
Depart ment of Comput er Science, University of Texas-P an American, Edinburg, T X 78539, USA FAX: 956-384-5099, [email protected] 2 Depart ment of Comput er Science and Engineering, University of Not re Dame, Not re Dame, IN 46556, USA [email protected] 3 Depart ment of Aerospace and Mechanical Engineering, University of Not re Dame, Not re Dame, IN 46556, USA { James.J.Mason.12,Steven.R.Schmid.2} @nd.edu
Dat a clust ering is an import ant t heoret ical t opic and a sharp t ool for various applicat ions. It s main ob ject ive is t o part it ion a given dat a set int o clust ers such t hat t he dat a wit hin t he same clust er are “more” similar t o each ot her wit h respect t o cert ain measures. In t his paper, we st udy t he pairwise dat a clust ering problem wit h pairwise similarity/ dissimilarity measures t hat need not sat isfy t he t riangle inequality. By using a crit erion, called t he m i ni m um nor m ali zed cut , we model t he pairwise dat a clust ering problem as a graph part it ion problem. T he graph part it ion problem based on minimizing t he normalized cut is known t o be NP -hard. We present a ((4 + o (1)) ln n )-approximat ion polynomial t ime algorit hm for t he minimum normalized cut problem. We also give a more effi cient algorit hm for t his problem by sacrificing t he approximat ion rat io slight ly. Furt her, our scheme achieves a ((2 + o (1)) ln n )approximat ion polynomial t ime algorit hm for comput ing t he sparsest cut s in edge-weight ed and vert ex-weight ed undirect ed graphs, improving t he previously best known approximat ion rat io by a const ant fact or.
A b st r a c t .
1
In t ro d u c t io n
Dat a clust ering is a fundament al problem and a sharp t ool for applicat ions such as informat ion ret rieval, dat a mining, comput er vision, pat t ern recognit ion, biomedical informat ics, and st at ist ics. It s main ob ject ive is t o part it ion a given dat a set int o clust ers such t hat t he dat a wit hin t he same clust er are “more” ⋆
⋆
⋆ ⋆
⋆
⋆
T his research was support ed in part by t he 21st Cent ury Research and Technology Fund from t he St at e of Indiana. T he work of t his aut hor was support ed in part by t he Comput ing and Informat ion Technology Cent er, and by t he Faculty Research Council, University of Texas-P an American, Edinburg, Texas, USA. T he work of t his aut hor was support ed in part by t he Nat ional Science Foundat ion under Grant s CCR-9623585 and CCR-9988468.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 455–466, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
456
X. Wu et al.
similar t o each ot her wit h respect t o cert ain measures. T his problem has been int ensively st udied (e.g., see [11,23]). T he wide variety of applicat ions precludes any single mat hemat ical formulat ion of t he general dat a clust er problem. Furt hermore, many st raight forward formulat ions (e.g., as opt imizat ion problems) are NP -hard. T he problem of opt imally clust ering a dat a set usually occurs in one of two diff erent forms depending on t he dat a represent at ions. One kind of approaches focuses on part it ioning dat a in met ric spaces, which recent ly received a lot of at t ent ion. In part icular, several combinat orial measures of clust ering quality have been invest igat ed. T hese include m in im u m d ia m e t e r , k -ce n t e r , k -m ed ia n , k -m ea n s , and m in im u m su m (e.g., see [1,9,17,22,4,2]). Charikar e t a l. [7] and Guha e t a l. [15] also st udied t his problem in t he dynamic set t ings. All t hese algorit hms assume t hat t he input dat a set is in a met ric space. However, in a large number of applicat ions arising from comput er vision [25], pat t ern recognit ion [16], and gene clust ering [5], t he only available informat ion about t he t arget dat a set is a similarity/ dissimilarity measure between pairwise dat a. T hese pairwise measures even need not sat isfy t he t riangle inequality. Hence, t here is anot her kind of approaches, referred t o as pa ir w ise d a t a c lu st e r in g , for handling dat a set s wit h pairwise measures. Formally, we define t he pairwise dat a clust ering problem as follows: Given = ( D , N , W , C ), where D is a set of dat a, N ⊆ D × D is a set of dat a pairs, + W : N → R measures t he similarity/ dissimilarity of each dat a pair in N , and C is a set of clust ering crit eria, part it ion t he dat a set D int o several clust ers such t hat t he crit eria in C are opt imized. Unlike dat a clust ering in met ric spaces, it seems t hat fewer result s on pairwise dat a clust ering are known [16,5,3,17,25]. Aslam e t a l. [3] used t he idea t hat t he neighbors of each dat um are more reliable in deciding it s clust er and some st at ist ical models t o clust er dat a. Kannan e t a l. [17] proposed a bicrit eria based on t he conduct ance of a graph t o evaluat e a clust ering.
P
In t his paper, we st udy pairwise dat a clust ering in a somewhat general set t ing. We model an input dat a set as an undirect ed graph G such t hat it s vert ices represent t he dat a it ems and it s edges represent t he dat a pairs in N whose weight s are defined by W . Not e t hat t he t riangle inequality need not hold on G . We consider a clust ering crit erion, called t he m in im u m n o r m a lized c u t . T his crit erion is not only int erest ing t heoret ically, but is also capable of delivering impressive clust ering result s in applicat ions such as image segment at ion and pat t ern recognit ion [25]. We will focus on part it ioning t he dat a set int o two clust ers (of course, one can recursively apply our part it ion algorit hms t o obt ain more clust ers, if needed), wit h each clust er corresponding t o a subset of vert ices in t he graph. T hus, we formulat e t his pairwise dat a clust ering problem as a graph part it ion problem, as follows. M in im izin g t h e n o rm alize d cu t : Given an n -vert ex, m -edge undirect ed graph G = ( V, E ), each edge e ∈ E having a non-negat ive weight w ( e), find a n o r m a lized c u t C ⊆ E whose removal part it ions V int o two disconnect ed set s S and S¯ ( S ∪ S¯ = V ), such t hat
P airwise Dat a Clust ering and Applicat ions α (S ) =
cut ( S, S¯ ) assoc( S, V )
+
457
cut ( S, S¯ )
¯ V) assoc( S,
w ( e) is t he sum of edge weight s of t he is minimized, where cut ( S, S¯ ) = e C cut C , and assoc( A , V ) = V is t he ( u , v ) E , u A , v V w ( u, v ) for a subset A ⊆ t ot al weight of edges in E between t he vert ices in A and all vert ices of G . α ( S ) is called t he n o r m a lized -c u t co st for t he cut C . Not e t hat comput ing a minimum normalized cut in G is NP -complet e [25]. Our main result s are summarized as follows. – For t he minimum normalized cut problem, a ((4 + o(1)) ln n )-approximat ion algorit hm in polynomial t ime, and furt her, for any ǫ > 0, a ((4(1 + ǫ ) + ˜ ( 12 m 2 ) t ime, where O˜ ( · ) hides a o(1)) ln n )-approximat ion algorit hm in O ǫ poly-logarit hmic fact or. – A ((2 + o(1)) ln n )-approximat ion polynomial t ime algorit hm for comput ing a sparsest cut in an edge-weight ed and vert ex-weight ed undirect ed graph, improving Garg e t a l. ’s approximat ion rat io [13] by nearly a fact or of 4. To our best knowledge, no previous provably good approximat ion polynomial t ime algorit hms for t he minimum normalized sum problem were known. P revious work on t he minimum normalized cut is mainly concerned wit h t he image segment at ion problem. Shi and Malik [25] developed a heurist ic approach for t he minimum normalized cut problem, but no provable quality is known for t heir approach. Our algorit hms are based on a graph const ruct ion t hat allows t he applicat ion of t he sparsest cut algorit hm. However, inst ead of direct ly applying t he algorit hms in [13,21], we judiciously exploit t he st ruct ures of t he region growing t echnique [13] and make use of t he credit scheme in [13,21], t hus yielding a bet t er approximat ion rat io for not only t he minimum normalized cut but also t he sparsest cut . Furt her, by using Karakost as’s maximum concurrent flow algorit hm [18], a more effi cient algorit hm for t he normalized cut is achieved while sacrificing t he approximat ion rat io only slight ly. We should also ment ion some ot her closely relat ed work. Given a graph wit h non-negat ive edge weight s and k commodit ies, s i and t i being t he source and sink for commodity i and each commodity being associat ed wit h a demand d ( i ), t he m a x im u m co n c u r re n t fl o w problem seeks t o find t he largest λ such t hat t here is a mult icommodity flow which rout es λ d ( i ) unit s of commodity i simult aneously in G . Leight on and Rao’s seminal work on t he p rod u c t m u lt ico m m od it y fl o w problem [21] (a special case of t he maximum concurrent flow problem) shows t hat t he rat io of t he capacity of a cut t o t he demand of t he cut is wit hin Θ (log n ) t imes t he max-flow. T his work has led t o an array of provably good approximat ion algorit hms for a wide variety of NP -hard problems, including t he spa r se st c u t s, ba la n ced c u t s , and se pa ra t o r s . Garg e t a l. [13] used a region growing t echnique on graphs and obt ained an (8 ln n )-approximat ion algorit hm for t he sparsest cut problem, improving Leight on and Rao’s algorit hm [21] by a const ant fact or. By using t he region growing t echnique in [13] t oget her wit h t he spreading met rics, Even e t a l. [10] achieved O (ln n )-approximat ion algorit hms for ρ -se pa ra t o r s , bba la n ced c u t s , and k -ba la n ced c u t s . We omit t he proofs of some lemmas due t o t he space limit . ∈
∈
∈
∈
458
2
X. Wu et al.
Im p ro v in g G a rg e t t h e S p a rs e s t C u t
a l. ’
s A p p ro x im a t io n A lg o rit h m fo r
Our approximat ion algorit hm for t he normalized cut is based on our improved sparsest cut algorit hm. In t his sect ion, we present our ((2 + o(1)) ln n )approximat ion polynomial t ime algorit hm for t he sparsest cut , improving Garg e t a l. ’s approximat ion rat io [13] by nearly a fact or of 4. Given an n -vert ex, m -edge undirect ed graph G = ( V, E ), each edge e (resp., vert ex v ) of G having a non-negat ive weight w ( e) (resp., w ( v )), t he spa r se st c u t p ro ble m seeks a cut C ⊂ E whose removal part it ions V int o two disconnect ed set s S and S¯ ( S ∪ S¯ = V ), such t hat t he spa r sit y β ( S ) for C (or S ), wit h w ( e) e C β (S ) = w (v ) w (v ) · v S¯ v S ∈
∈
∈
is minimized. Garg e t a l. [13] gave an (8 ln n )-approximat ion sparsest cut algorit hm. However, we are able t o do bet t er. By judiciously choosing t he paramet ers for t he region growing t echnique and using Garg a t e l. ’s approach [13], we can obt ain a ((2 + o(1)) ln n )-approximat e sparsest cut in G . T he sphere growing procedure present ed in t his sect ion is similar t o t he region growing procedure in [13]; t he diff erences are t he paramet ers used in t he volume definit ion and t he upper bound on t he radii of spheres (t o be defined precisely lat er). Our algorit hm achieves a t ight er upper bound t han t hat in [13] for t he t ot al weight of t he cut s produced by our sphere growing procedure, which leads t o a bet t er approximat ion rat io. In addit ion, unlike [13] (in which an approximat e fl u x is comput ed, and t hen an approximat e sparsest cut is induced from t he flux), we comput e t he desired approximat e sparsest cut direct ly. Int uit ively, t he main idea of our algorit hm for t he sparsest cut , similar t o t hat in [13,21], is as follows. We first assign a le n gt h t o each edge in t he graph G by using a linear programming; t his defines a lower bound for t he sparsest cut . T hen, based on t he assigned edge lengt hs, a set B of disjoint “spheres” in G is generat ed by our S p h e re G ro w in g procedure. We prove t hat eit her t here exist s a sphere in t he set B which gives t he desired sparse cut , or t he set B enables us t o choose a vert ex of G from which anot her sphere can be grown for t he desired sparse cut . 2 .1
Lin e ar P ro g ram m in g R e lax at io n s
By assigning a non-negat ive edge lengt h d ( e) t o each edge e ∈ E , we formulat e a linear programming relaxat ion for t he sparsest cut problem on G , as follows: ( L P ) min w ( e) · d ( e) e∈ E
w ( u ) · w ( v ) · d ist G ( u, v )
s. t . u ,v ∈ V
∀
e∈
E , d ( e)
≥
0,
≥
1
P airwise Dat a Clust ering and Applicat ions
459
where d ist H ( u, v ) denot es t he dist ance between vert ices u and v in a subgraph H of G wit h respect t o t he met ric induced by d ( · ). Act ually, (LP ) is a dual of t he maximum mult icommodity concurrent flow problem. Let τ denot e t he v a lu e of t he opt imal solut ion d ( · ) for t he linear program (LP ) (i.e., τ = w ( e) · d ( e)), and β denot e t he sparsity of t he sparsest cut e E in G . Obviously, we have t he following lemma. ∗
∈
Le m m a 1 . [2 1 , 1 3 ] τ 2 .2
≤
β
∗
.
S p h e re G row in g
Based on t he edge lengt hs in { d ( e) | e ∈ E } from t he linear programming relaxat ion, we present in t his subsect ion our approximat ion algorit hm for t he sparsest cut problem. T he algorit hm is based on a sp h e re gro w in g procedure for finding “good” cut s in graphs t hat have “nearly” const ant diamet ers. ( 1 ) A ssig n in g Vo lu m e s As in [10,13], t he volumes assigned t o spheres t hat grow around vert ices in t he graph define t he c red it s t hat are associat ed wit h t he spheres in order t o pay for t he cost of t he cut . Our definit ion of volume as in [10], is a lit t le diff erent from t hat of [13] in order t o improve t he approximat ion bounds. D e fi n it io n 1 . A sp h e re N ( v, r ) in a su bgra p h G ′ = ( V ′ , E ′ ) o f G w it h t h e m e t r ic d ( · ) t h a t gro w s fro m a v e r t e x v ∈ V ′ w it h a ra d iu s r is d e fi n ed by N ( v, r ) { u
V′ ∈
|
d ist G ′ ( u, v ) < r } ,
w h e re d ist G ′ ( u, v ) is t h e u -t o - v sh o r t e st pa t h le n gt h in G ′ w it h re spec t t o t h e ed ge le n gt h s d ( · ) .
For convenience, denot e by E ( v, r ) t he set of edges whose two end vert ices are bot h in N ( v, r ), and C ( v, r ) t he set of edges cut t ing N ( v, r ) from V − N ( v, r ). Let w ( C ( v, r )) be e C ( v , r ) w ( e). Now, we define t he volume of a sphere N ( v, r ), denot ed by vol ( v, r ). ∈
D e fi n it io n 2 . [1 0 ] τ vol ( v, r ) n ln + n
e∈ E ( v , r )
w ( e) d ( e) +
e x
= (x , y ) ∈ ∈ N (v , r )
C
(v
, r
)
w ( e) ( r
−
d ist G ′ ( v, x ))
( 2 ) T h e S p h e re G row in g P ro ce d u re
Next , we discuss t he sphere growing procedure and an import ant lemma t hat specifies t he upper bound of t he sphere radii. T his procedure t akes as input a subgraph G = ( V , E ) of G and a given edge lengt h funct ion d ( · ). It runs Dijkst ra’s single-source short est pat h algorit hm [8] from an arbit rary vert ex v ∈ V t o obt ain a sphere N ( v, r ), such t hat t he rat io R between w ( C ( v, r )) and vol ( v, r ) (i.e., R = wv(oCl ((vv ,,rr )) ) ) is logarit hmic wit h respect t o n . Figure 1 illust rat es t he procedure, called S p h e re G ro w in g . T he st opping condit ion of our SphereGrowing √ 2 W ln( n ln n + 1) · ( 2 ln( n ln n + 1) + 1), procedure is R ≥ δ , where δ = 2 ′
′
′
′
√
460
X. Wu et al.
¼
¼
¼
¼
Ü Î Ë
¾¾
Ü Î Ë ¼
¼
¾
¼
¼
Ô
¼
¼
¼
¼
¾
¼
¼
F ig. 1 .
T he sphere growing procedure.
where W denot es t he t ot al sum of vert ex weight s in G . Not e t hat δ is a key paramet er t o t he sphere growing t echnique t hat det ermines t he upper bound of t he sphere radii produced and hence aff ect s t he approximat ion rat io for t he sparsest cut . Our choice of δ is diff erent from [13], which leads t o a bet t er approximat ion rat io. Le m m a 2 . SphereGrowing p rod u ce s a sp h e re N ( v, r ) in G ′ = ( V ′ , E ′ ) w it h √ √
r
( 2 ln( n ln n + 1) + 1) 2 · (1 + ln1n ) · τ , t h e n t h e re e x ist s a sp h e re N ( v q , r q ) su c h t h a t w ( N ( v q , r q )) ≥ √
1+
2·
√
1+
√ W ln ( n ln n + 1)
.
Based on Lemma 4, let N ( v q , r q ) be a sphere wit h w ( N ( v q , r q )) ≥ √ W . T hen we grow a sphere cent ered at t he vert ex v q in G . But , 2·
ln ( n ln n + 1)
we do not check t he w h ile -loo p condit ion in procedure S p h e re G ro w in g , and t erminat e t he growing process once all vert ices of G are included in t he sphere. If we sort t he vert ices of G in t he increasing order of t heir dist ances from v q , say as v 0 , v 1 , . . . , v n 1 (wit h v 0 = v q ), and let r i denot e d ist G ( v q , v i ) for i = 0, 1, . . . , n − 1, t hen N ( v q , r i ) = N ( v q , r i 1 ) ∪ { v i } . Not e t hat N ( v q , r 0 ) = { v q } , N ( v q , r n 1 ) = V , and r q may not be in t he set { r i | 0 ≤ i ≤ n − 1} . We now show one of t he cut s in { C ( v q , r i ) | 0 ≤ i ≤ n − 1} is “good”, as st at ed precisely in Lemma 5. ′
−
′
′
′
−
′
′
−
′
Le m m a 5 . T h e re e x ist s a n in d e x t ∈ { 0, 1, . . . , n √ ( 2 ln( n ln n + 1) + 1) 2 · (1 + ln1n ) · τ .
1} su c h t h a t β ( N ( v q , r t )) ′
−
≤
P ro o f. We prove t his by making a cont radict ion t o t he key const raint of (LP ), i.e., u , v ∈ V w ( u ) · w ( v ) · d ist G ( u, v ) ≥ 1. For t his purpose, we assume t hat for √ each i = 0, 1, . . . , n − 1, β ( N ( v q , r i′ )) > κ , where κ = ( 2 ln( n ln n + 1) + 1) 2 · (1 + ln1n ) · τ . By observing t hat d ist G ( u, v ) ≤ d ist G ( v q , u ) + d ist G ( v q , v ) and each unordered pair of u and v appears in u , v ∈ V w ( u ) · w ( v ) exact ly once, and recalling w ( u ), we get t hat W = u∈ V w ( v ) · d ist G ( v q , v ) . (1) w ( u ) · w ( v ) · d ist G ( u, v ) ≤ W · v∈ V u ,v ∈ V
Let N ( v q , r h ) be t he smallest sphere in t he sphere chain N ( v q , r 0 ) ⊂ N ( v q , r 1 ) ⊂ · · · ⊂ N ( v q , r n 1 ) t hat cont ains t he sphere N ( v q , r q ). Obviously, N ( v q , r h ) may be a superset of N ( v q , r q ) because some vert ices in N ( v q , r h ) may have been removed before growing t he sphere N ( v q , r q ) by using procedure S p h e re G ro w in g . √ ′
′
′
′
′
−
′
√
T hus, we have r h ′
≤
r q . Based on Lemma 2, r q < √ ′
rh
h , w ( N ( v q , r i )) ≥ w ( N ( v q , r h )) ≥ w ( N ( v q , r q )). w (N (v ,r ′ )) i= 1
j = 0
i= 1
′
′
′
′
q
′
i
T hus, by Lemma 4, w ( N ( v q , r i )) ′
t hat h < i
≤
n
−
≥
W
√
√
1+
2
ln ( n ln n + 1)
. Hence, for every i such
1, we have
w ( N¯ ( v q , r i′ ))
0, we can first obt ain a met ric d ǫ ( · ) for (LP ) wit h a solut ion value τ ǫ ≤ (1 + ǫ ) τ . Applying our algorit hm based on t he met ric d ǫ ( · ), we can t hen find a subset S ⊆ V whose sparsity is β (S )
≤
(2 + o(1)) ln n · τ ǫ
≤
(2 + o(1)) ln n · (1 + ǫ ) · τ
≤
(2(1 + ǫ ) + o(1)) · ln n · β
∗
.
Based on Lemma 7, we obt ain t he following corollary. C o ro llary 1 . G iv e n a n y ǫ > 0, a ((4(1+ ǫ ) + o(1)) ln n ) -a p p ro x im a t e n o r m a lized ˜ ( 12 m 2 ) t im e . c u t ca n be co m p u t ed in O ǫ
4
A p p lic a t io n s
In t his sect ion, we discuss an image segment at ion problem arising in comput er vision. Our pairwise dat a clust ering algorit hm can be applied t o t his problem t o achieve a new approximat ion result . Our basic scheme for solving t his problem consist s of t hree key st eps: 1) build a weight ed undirect ed graph G from t he image; 2) use our normalized cut algorit hm t o part it ion G int o two subgraphs G 1 and G 2 ; 3) recursively part it ion t he subgraphs if necessary. Our algorit hmic framework is likely t o be applicable t o ot her problems, such as gene clust ering. We leave t he det ails of applicat ions in our full version of t his paper. A ckn ow le d g m e nt s. T he aut hors are very grat eful t o Dr. L. Fleischer, Operat ions Research, Carnegie Mellon University, Dr. G. Even, Depart ment of Elect rical Engineering, Tel Aviv University, Dr. E´ . Tardos, Depart ment of Comput er Science, Cornell University, and Dr. P. Klein, Depart ment of Comput er Science, Brown University, for t heir helpful discussions on t he maximum concurrent flow problem.
P airwise Dat a Clust ering and Applicat ions
465
R e fe re n c e s 1. P. Agarwal and C. P rocopiuc, Exact and Approximat ion Algorit hms for Clust ering, P roc. of A C M -SI A M SO D A , 1998. 2. V. Arya, N. Garg, R. Khandekar, V. P andit , A. Meyerson, and K. Munagala, Local Search Heurist ics for k -median and Facility Locat ion P roblems, P roc. of A C M ST O C , 2001, 21–29. 3. J . Aslam, A. Leblanc, and C. St ein, A New Approach t o Clust ering, P roc. of W A E , 2000. 4. Y. Bart al, M. Charikar, and D. Raz, Approximat ing Min-Sum k -clust ering in Met ric Spaces, P roc. of A C M ST O C , 2001, 11–22. 5. A. Ben-Dor and Z. Yakhini, Clust ering Gene Expression P at t erns, P roc. of A C M R E C O M B , 1999, 33–42. 6. D. Bienst ock, J anuary 1999. Talk at Oberwolfach, Germany. 7. M. Charikar, C. Chekuri, T . Feder, and R. Motwani, Increment al Clust ering and Dynamic Informat ion Ret rieval, P roc. of A C M ST O C , 1997, 626–635. 8. T .H. Cormen, C. E. Leiserson, and R. L. Rivest , I nt roduct i on t o A lgor i t hm s, McGraw-Hill, 1990. 9. P. Drineas, A. Frieze, R. Kannan, S. Vempala, and V. Vinay, Clust ering in Large Graphs and Mat rices, P roc. of A C M -SI A M SO D A , 1999. 10. G. Even, J . Naor, S. Rao, and B. Schieber, Fast Approximat e Graph P art it ioning Algorit hms, SI A M J . C om put i ng, 28(1999), 2187–2214. 11. B. Everit t , C lust er A nalysi s, Oxford University P ress, 1993. 12. N. Garg and J . K¨onemann, Fast er and Simpler Algorit hms for Mult icommodity F low and Ot her Fract ional P acking P roblems, P roc. 39t h I E E E F O C S, 1998, 300– 309. 13. N. Garg, V. V. Vazirani, and M. Yannakakis, Approximat e Max-F low Min(Mult i)Cut T heorems and T heir Applicat ions, SI A M J . C om put i ng, 25(1996), 235– 251. 14. S. Guat t ery and G. Miller, On t he P erformance of Spect ral Graph P art it ioning Met hods, P roc. of A C M -SI A M SO D A , 1995, 233–242. 15. S. Guha, N. Mishra, R. Motwani, and L. O’Callaghan, Clust ering Dat a St reams, P roc. of I E E E F O C S, 2000. 16. T . Hofmann and J . Buhmann, P airwise Dat a Clust ering by Det erminist ic Annealing, I E E E T rans. on P at t er n A nalysi s and M achi ne I nt el li gence, 19(1997), 1–14. 17. R. Kannan, S. Vempala, and A. Vet t a, On Clust erings — Good, Bad and Spect ral, P roc. of I E E E F O C S, 2000. 18. G. Karakost as, Fast er Approximat ion Schemes for Fract ional Mult icommodity F low P roblems, P roc. 13t h A C M -SI A M SO D A , 2002, 166–173. ´ Tardos, Fast er Approximat ion Algorit hms 19. P. Klein, S. P lot kin, C. St ein, and E. for t he Unit Capacity Concurrent F low P roblem wit h Applicat ions t o Rout ing and F inding Sparse Cut s, SI A M J . on C om put i ng, 23(1994), 466–487. ´ Tardos, and S. Tragoudas, Fast 20. T . Leight on, F . Makedon, S. P lot kin, C. St ein, E. Approximat ion Algorit hms for Mult icommodity F low P roblems, J . of C om put er and Syst em Sci ences, 50(1995), 228–243. 21. T . Leight on and S. Rao, Mult icommodity Max-F low Min-Cut T heorems and T heir Use in Designing Approximat ion Algorit hms, J . of t he A C M , 46(1999), 787–832. 22. J . Mat ousek, On Approximat e Geomet ric k -clust ering, D i scret e and C om put at i onal G eom et r y , 24(2000), 61–84.
466
X. Wu et al.
23. B. Mirkin, M at hem at i cal C lassi fi cat i on and C lust er i ng, Kluwer Academic P ublishers, 1996. 24. F . Shahrokhi and D. Mat ula, T he Maximum Concurrent F low P roblem. J . of t he A C M , 37(1990), 318–334. 25. J . Shi and J . Malik, Normalized Cut s and Image Segment at ion, I E E E T rans. on P at t er n A nalysi s and M achi ne I nt el li gence, 22(8) (2000), 888–905.
C ov e rin g a S e t o f P o in t s w it h a M in im u m N u m b e r o f T u rn s Michael J . Collins University of New Mexico and Sandia Nat ional Laborat ories Albuquerque NM [email protected], [email protected]
⋆
Given a finit e set of point s in Euclidean space, we can ask what is t he minimum number of t imes a piecewise-linear pat h must change direct ion in order t o pass t hrough all of t hem. We prove some new upper and lower bounds for a rest rict ed version of t his problem in which all mot ion is ort hogonal t o t he coordinat e axes. A b st r a c t .
1
In t ro d u c t io n
T here are a variety of sit uat ions in which t he cost associat ed wit h a pat h (t aken, say, by a robot or by some mechanical device) should t ake int o account t he number of t imes t his pat h changes direct ion. In a very general set t ing, we are given a finit e set C of point s in Euclidean space t hrough which a pat h P must t ravel, and can ask what is t he minimum t ot al curvat ure of P . Here we consider a combinat orial version of t he problem, in which all mot ion of P is parallel t o one of t he coordinat e axes and all point s of C have int eger coordinat es. We t hen seek t o minimize t he number of ninety-degree t urns or “corners” in P . Even when rest rict ed t o two dimensions, many variant s of t he minimumt urn problem are known t o be NP -complet e, alt hough effi cient const ant -fact or approximat ion algorit hms exist [1,5]. T he t hree-dimensional version, which is a special case of “discret e milling”, has been less st udied. In t his paper we present opt imal pat hs and lower bounds for various families of set s C in two and t hree dimensions. We use t he following not at ion. T he set of int egers from a t o b inclusive is denot ed [a , b]. We define t he li n k le n gt h of a piecewise-linear pat h P , denot ed s ( P ), as t he number of line segment s (called “links”) which make up t he pat h. A s pa n n i n g pa t h (also called a co v e r i n g t o u r ) of C is a pat h which passes t hrough all point s of C . T he minimum link lengt h of all spanning pat hs of C is denot ed s ( C ) and is called t he link lengt h of C . We can also t hink of t his as one plus t he minimum number of t imes we must change direct ion in order t o move t hrough all t he given point s. Not e t hat we count a 180-degree t urn as two t urns; if a pat h P goes from ( x , y , z ) t o ( x , y , z ) and t hen t o ( x , y , z ), we say t hat t here is a ′
⋆
′ ′
Sandia is a mult iprogram laborat ory operat ed by Sandia Corporat ion, a Lockheed Mart in Company, for t he Unit ed St at es Depart ment of Energy’s Nat ional Nuclear Security Administ rat ion under cont ract DE-AC04-94AL85000.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 467–474, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
468
M.J . Collins
link of lengt h zero in between 1 , st art ing and ending at ( x , y , z ) and “moving” in t he X or Y direct ion. We cat egorize links by t he direct ion in which t hey move; a link from ( x , y , z ) t o ( x , y , z ) is called an X -link, similarly t here are Y - and Z -links. T he le n gt h of a link ℓ is t he number of point s in C covered by ℓ and not covered by any previous link of P ; for our purposes t his is a far more useful concept t han t he geomet ric lengt h of t he line segment . Given a subset of links A in P , we define A + ( A ) t o be t he set of successors (predecessors) of t he links in A . Not e t hat we do not prohibit P from int ersect ing it self, nor do we prohibit it from t ouching some grid point s not in C . ′
′
−
2
T h re e -D im e n s io n a l G rid s
2 .1
A Low e r B o u n d fo r t h e C u b e
We define G r , s , n t o be t he t hree-dimensional regular grid wit h dimensions r × s × n , i.e. G r , s , n = [1, r ] × [1, s ] × [1, n ] or any t ranslat ion t hereof. We first consider t he case of a cube, r = s = n . In spit e of it s geomet ric simplicity, and in spit e of t he fact t hat t he analogous two-dimensional problem is rat her easy, det ermining s ( G n , n , n ) remains an open problem. A t rivial lower bound is n 2 , since t here are n 3 point s t o cover and each link has lengt h at most n . To get a bet t er lower bound, we must demonst rat e t hat in any pat h some links must be short er; indeed we could t hink of t he problem as maximizing t he average lengt h of a link. Our fundament al t ool is t he following lemma: Le m m a 1 . S u p po s e t h a t a s pa n n i n g pa t h
P o f G n , n , n h a s t pa i r w i s e - d i s j o i n t s e t s o f li n k s S 1 , . . . , S t s u c h t h a t , f o r ea c h i , S i co n t a i n s α i n 2 li n k s a n d ea c h s u c h li n k h a s le n gt h a t m o s t β i n . T h e n w e h a v e
s (P
)
≥
t
(1 + α i
i
(1 − β
i
)) n 2
.
(1)
=1
P roo f . 2For each i , t he links in set S i can α i n links in t hese set s cover a t ot al (1 − α i β i ) n 3 point s need at least (1 − α iβ i + α i ) n 2 = (1 + α i (1 − β i )) n 2
cover α i β i n 3 point s, so t he at most 3 α i β i n point s. T he remaining of α i β i ) n 2 links, for a t ot al of (1 − links. ⊓ ⊔
To find such set s S i , we make use of t he observat ion t hat a link which covers point s near t he cent er of t he cube must be followed by a link of bounded lengt h. Let n be odd (t he case of even n is similar) and t ranslat e G n , n , n so t hat (0, 0, 0) is at t he cent er. Define a nest ed sequence of cubes Q i for 1 ≤ i ≤ ( n − 1) / 2 by Q i = [− i , i ] × [− i , i ] × [− i , i ]. Now we can prove Le m m a 2 . I n a n y s pa n n i n g pa t h o f o f li n k s S i f o r Qi. 1
1
≤
i
≤
(n
−
Gn
,n ,n
t h e re m u s t be pa i r w i s e - d i s j o i n t s e t s S i i n t e r s ec t s
1) / 2 o f s i z e 8i , s u c h t h a t ea c h li n k o f
Assuming of course t hat z ′ is not between from ( x , y , z ) t o ( x , y , z ′ ′ ).
z
and
z
′′
; ot herwise we just have one link
Covering a Set of P oint s wit h a Minimum Number of Turns
469
P roo f . By induct ion. (0, 0, 0). T he claim is
We include a set S 0 cont aining a single link t hrough t rivial for i = 1; at least 9 links are needed t o cover a 3 cube. So suppose we have set s S 1 , · · ·, S k 1 ; t hese set s cont ain
3× 3×
−
k −
1
8i = 4k 2
1+ i
−
4k + 1
(2)
=1
links which t oget her cover at most (4k 2 − 4k + 1)(2k + 1) point s of Q k . But cont ains (2k + 1) 3 point s, so it cont ains at least (2k + 1) 3
−
(4k 2
4k + 1)(2k + 1) = 8k (2k + 1)
−
Qk
(3)
point s not covered by ∪ ki = 11 S i . Since no one link can cover more t han 2k + 1 point s of Q k , t here must be at least 8k ot her links int ersect ing Q k ; t hese can be t he members of S k . ⊓⊔ −
Now each link of S i+ has lengt h at most ( n + 1) / 2 + i . For suppose a link ℓ ∈ S i goes from ( x , y , z ) t o ( x , y , z ). We must have | x | ≤ i , | y | ≤ i . T hen say ℓ + goes from ( x , y , z ) t o ( x , y , z ). It s lengt h is at most | x − x | which is at most ( n + 1) / 2 + i . Applying lemma 1 direct ly t o t he set s S i+ gives s ( G n , n , n ) ≥ 76 n 2 − O ( n ) [2]. To obt ain a st ronger bound, not e t hat each S i has 8i predecessors as well as 8i successors, whose lengt hs are also bounded by ( n + 1) / 2 + i . Of course we cannot simply replace α i n 2 = 8i by α i n 2 = 16i in t he applicat ion of lemma 1, because we might be count ing some links twice; a link ℓ could be t he successor of somet hing in S i and also t he predecessor of somet hing in S j . But we observe t hat t he lengt h of such a link can be bound even more t ight ly: such a link has lengt h at most i + j + 1. To prove t his, first not e t hat wit h no loss of generality we may assume i ≤ j and t hat ℓ st art s at ( x , y , z ) wit h max( | x | , | y | ) ≤ i and moves in t he X direct ion t o ( x , y , z ). If | x − x | > i + j + 1 t hen | x | > j , but since ℓ + cannot move in t he X direct ion it could not pass t hrough Q j . So let S i have σ i successors t hat are n o t t he predecessors of anyt hing in ∪ j S j , and similarly π i predecessors t hat are not t he successors of anyt hing ∪ j S j . Furt hermore let qi j be t he number of links wit h predecessor in S i and successor in S j . T hen we have σ i = 8i − q 1 j ( n 1) / 2 i j (4) q π i = 8i − 1 j ( n 1) / 2 j i . ′
′
′
′
′
′
T he set s count ed by σ i , π i , and lemma 1; s ( G n , n , n ) is at least n
2
+
(σ
i
+ π
i
)(1 −
i
′
qi j
≤
≤
−
≤
≤
−
are pairwise disjoint , so we can apply
+ ( n + 1) / 2 n
′
)+
qi j
(1 −
i
+
j n
+ 1
)
.
(5)
To obt ain a lower bound on t he link lengt h, we seek t he smallest possible value for (5). It looks like we have t o opt imize over all possible choices for qi j ;
470
M.J . Collins
but if we use (4) t o eliminat e σ qi j cancel, and (5) becomes s (G n
T he sum in (6) is
5 2 n 6
,n ,n
+
)
i
≥
O ( n ),
and
3n 2
π
from (5), we find t hat all t erms involving
i
2
−
i
+ ( n + 1) / 2 n
.
(6)
t hus we obt ain
T h e o re m 1 . s (G n
8i
,n ,n
)
≥
=
4 2 n 3
−
O (n )
(7)
T he best known upper bound (which is conject ured t o be opt imal) is 32 n 2 + O ( n ) which comes from a spanning pat h described in [4] and illust rat ed in Fig. 1. We fix a direct ion (say t he Z axis), and t he pat h is formed by first spiraling around t he out er part of t he cube in each XY plane unt il a box of size n2 × n2 × n remains in t he cent er. T hese remaining point s are t hen covered by moving up and down along t he Z axis. To see t he mot ivat ion for t his, first not e t hat in two dimensions we have s ( G n , n ) = 2n − 1 [4]. But t here are two ent irely diff erent ways t o achieve t he opt imal value, as illust rat ed in Fig. 2: a spiral pat h in which t he lengt h of successive links gradually decreases from n t o 1, and a back-and-fort h pat h t hat alt ernat es between long and short links. So t he pat h of Fig. 1 spirals n / 4 t imes in each XY plane, at which point t he lengt h of a link has decreased t o n / 2; t hen it swit ches t o a back-and-fort h mot ion in which t he average lengt h of a link is n / 2. T herefore we call t his pat h t he “hybrid” pat h.
F ig. 1 .
Conject ured opt imal pat h for
Gn
,n ,n
We not e t hat t heorem 1 is almost cert ainly not t he best possible. We would not expect it is really possible for every link count ed by qi j t o have lengt h i + j + 1; furt hermore, it should be possible t o choose set s S i t hat have size great er t han 8i . We also not e t hat not hing in our proof really hinges on t he fact t hat we have one cont inuous pat h; we act ually have a lower bound on covering G n , n , n
Covering a Set of P oint s wit h a Minimum Number of Turns
471
wit h a set of loops. In our definit ion of link-lengt h we do not act ually require t hat P must loop back and end at t he same point where it began; but adding t his requirement would increase t he link-lengt h by at most t hree, so it does not mat t er in t his cont ext .
F ig. 2 .
2 .2
T wo diff erent opt imal pat hs
O p t im a l P a t h s fo r N o n -c u b ic G rid s
We now consider more general G r , s , n . Wit hout loss of generality let r ≤ s ≤ n . It is clear t hat s ( G r , s , n ) ≤ 2r s − 1, since we can cover all point s by moving up and down along t he Z axis. We might expect t hat t his is opt imal when n is suffi cient ly large, and t his is indeed t he case. T h e o re m 2 . I f r s
≤
n , then s (G r , s , n
) = 2r s
1
−
(8)
Suppose t here exist s a spanning pat h P wit h s ( P ) < 2r s − 1. T hen t here must be at least one “column” { x } × { y } × [1, n ], none of whose point s is covered by a Z -link. We need n links in t he X and Y direct ions t o cover t hese point s; furt hermore no such link could be a successor of anot her, so t here must be at least anot her n − 1 links in P . T herefore we must have 2n − 1 < 2r s − 1, or simply n < r s . ⊓⊔
P roo f .
Now consider r = s = γ n for some fixed γ t o t his case. First observe t hat , given set s lemma 1, we have s (G γ
n ,γ n ,n
)
≥
γ
2
n
2
+
n
2
1. We can generalize t heorem 1 which sat isfy t he condit ions of
< Si
t
( α i
i
(1 − β
i
))
.
(9)
=1
Now for 1 ≤ i ≤ γ n 2+ 1 , we can define S i precisely as before; t he link lengt h is bounded by somet hing very similar t o (5), t he diff erence being t hat t he first
472
M.J . Collins
t erm is γ 2 n 2 and t he sums run from 1 t o as before t o obt ain
γ n
(γ
s (G γ
n ,γ n ,n
)
≥
3γ
2
n
2
−
+1 . 2
n −
We can eliminat e t he qi j exact ly
1) / 2
2
8i i
i
+ ( n + 1) / 2 n
=1
(10)
which gives t he desired generalizat ion of t heorem 1: T h e o re m 3 . s (G γ
n ,γ n ,n
)
≥
(2γ
2
−
2 γ 3
3
)n 2
−
O (n )
(11)
For γ > 12 , we can apply t he idea of t he hybrid pat h, spiraling in t he XYplane unt il t he lengt h of each link is down t o n2 . T his means spiraling 2 γ 4 1 n t imes and yields an upper bound of (2γ − 12 ) n 2 . We conject ure t hat t hese pat hs are opt imal. Not e t hat t his conject ure would imply a much st ronger result t han t heorem 2, namely t hat s ( G r , s , n ) = 2r s − 1 whenever s ≤ n / 2. T his is because in order for t he hybrid pat h t o be opt imal, it s coverage of t he cent ral port ion G n / 2 , n / 2 , n must be opt imal. −
2 .3
LP -R e la x a t io n B o u n d s fo r S m a ll G rid s
We have used t he AMP L modeling language [3] t o develop a linear-programming relaxat ion of t he minimum-t urn problem on G r , s , n . T here is a variable for each possible link, i.e. for each ordered pair of point s diff ering in only one coordinat e. T he const raint s require t hat each point be covered at least once and t hat t he number of links ent ering a point equals t he number of links leaving it . We did not include subt our-eliminat ion const raint s. For values of n up t o 19 we have verified t hat t he link-lengt h of G n , n , n is at least 32 n 2 , as expect ed. At n = 19 t his LP t ook about eight een hours t o solve wit h cplex on a SUN workst at ion.
3
O p t im a l P a t h s fo r S o m e T w o -D im e n s io n a l C o n fi g u ra t io n s
We now consider some two-dimensional configurat ions, let t ing G nm denot e a rect angular grid [1, m ]× [1, n ]. In t his cont ext we speak of “horizont al” and “vert ical” links. Not e t hat s ( G nm ) = 2 min( m , n ) − 1 is a special case of t heorem 2. We can generalize t his t o a disjoint union of two rect angles. Let C be G 1 ∪ G 2 wit h G i = G hv ii . Assume first t hat t he project ions of G 1 , G 2 ont o t he axes are disjoint (say G 1 = [1, v 1 ] × [1, h 1 ] and G 2 = [a , a + v 2 ] × [b, b + h 2 ] wit h a > v 1 , b > h 1 ). Not e t hat any spanning pat h of C must cont ain eit her h i horizont al links or v i vert ical links int ersect ing G i : wit hout h i such horizont al links, t here must be a row cont aining no horizont al link and t hus covered ent irely by v i vert ical links. To find s ( C ) we consider each case separat ely. Suppose for inst ance t hat h 1 horizont al links int ersect G 1 and v 2 vert ical links int ersect G 2 . T hen we claim t he pat h must have at least 2 max( h 1 , v 2 ) + min( h 1 , v 2 ) − 1 links in t ot al. To
Covering a Set of P oint s wit h a Minimum Number of Turns
473
see t his, not e t hat each link has two endpoint s at which it is adjacent t o ot her links; not e furt her t hat each of t he v 2 vert ical links can be adjacent t o at most one of t he h 1 horizont al links and vice-versa. So say h 1 ≥ v 2 , t hen even if each of t he v 2 vert ical links is adjacent t o one of t he horizont al links, we st ill have at least 2h 1 − 2 endpoint s at which new links are needed beyond t he ones already count ed (t he − 2 is t o account for t he st art and end point s). T his requires at least h 1 − 1 new links, giving t he claimed lower bound. And t his bound is in fact achievable as suggest ed by Fig. 3. So considering all possibilit ies we have t he following t heorem: T h e o re m 4 . G i v e n s (C )
C
a s d e fi n ed a bo v e ,
= min(
2 min( h 1 + h 2 , v 1 + v 2 ) 2 max( h 1 , v 2 ) + min( h 1 , v 2 ) 2 max( h 2 , v 1 ) + min( h 2 , v 1 )
− − −
1, 1, 1)
(12) .
T he first t erm corresponds t o covering each G i in t he same direct ion — in eff ect covering t he ent ire ( h 1 + h 2 ) × ( v 1 + v 2 ) rect angle t hat cont ains t he two smaller rect angles.
F ig. 3 .
Covering two disjoint rect angles
An almost ident ical result holds for two disjoint rect angles t hat do overlap in one dimension; let us say an overlap of widt h d along t he x-axis, so G 1 = [1, v 1 ] × [1, h 1 ] and G 2 = [v 1 − d + 1, v 1 + v 2 − d ] × [b, b + h 2 ] wit h b > h 1 . As before suppose t hat h 1 horizont al links int ersect G 1 and v 2 vert ical links int ersect G 2 . T he diff erence is t hat now it seems t hat some horizont al links could be adjacent t o vert ical links at bot h endpoint s because of t he overlap. But in fact we can disregard t his case. Consider t he subset of G 1 t hat is not underneat h G 2 , i.e. t he part wit h x-coordinat e less t han v 1 − d + 1. If we have h 1 horizont al links int ersect ing t his subset , t hen exact ly as before we can say t hat a link in one direct ion can adjoin only one link in t he ot her direct ion. Ot herwise we have a row of t he subset not t ouched by any horizont al link, which forces anot her v 1 − d vert ical links and we are back t o t he case of covering t he bounding rect angle. T he only change from t he previous case is t hat t he first t erm should be 2 min( h 1 + h 2 , v 1 + v 2 − d ) − 1.
474
M.J . Collins
Let
Rn
be t he t riangular region { ( x , y )
T h e o re m 5 . s ( R n ) =
3 n − 2
∈
n
Gn
:x +
y
≤
n
+ 1} . We have
1
P roo f . T his number of links is achievable by t he L-shaped pat h indicat ed in Fig. 4. Now for a given spanning pat h P , let r be t he largest value such t hat t he r longest rows of R all cont ain horizont al links. Wit h no loss of generality we can assume r ≥ n2 (ot herwise t here would be a row of widt h r > n2 covered ent irely by vert ical links, and by rot at ion we get t he desired sit uat ion). T his gives us r horizont al links and n − r vert ical links; t hey are sit uat ed so t hat a vert ical link can be adjacent t o a horizont al link only at one endpoint . T hus we have 2r endpoint s at which furt her links must be added, requiring r − 1 furt her links for ⊓⊔ a t ot al of n + r − 1 ≥ 32 n − 1.
F ig. 4 .
Opt imal pat h for a t riangle
Similar argument s can be used t o det ermine t he exact link-lengt h of ot her simple two-dimensional configurat ions.
R e fe re n c e s 1. E. Arkin, M. A. Bender, E. Demaine, S. P. Feket e, J . S. B. Mit chell, and S. Set hia, “Opt imal Covering Tours wit h Turn Cost s”, P r oceedi n gs of t he 12t h A n n u al A C M SI A M Sy m posi u m on D i scr et e A l gor i t hm s ( SO D A ) , pp. 138–147, 2001 2. M. Collins and B. Moret , “Improved Lower Bounds for t he Link Lengt h of Rect ilinear Spanning P at hs in Grids”, I n f or m at i on P r ocessi n g L et t er s 6 8 (1998), pp. 317–319 3. R. Fourer, D. M. Gay, and B. W . Kernighan, A M P L : A M odel i n g L an gu age f or M at hem at i cal P r ogr am m i n g, Boyd and Fraser, Danvers, MA, 1993 4. E. Kranakis, D. Krizanc, and L. Meert ens, “Link Lengt h of Rect ilinear Hamilt onian Tours on Grids”, A r s C om bi n at or i a 3 8 (1994), p. 177. 5. C. St ein and D. P. Wagner, “Approximat ion Algorit hms for t he Minimum Bends Traveling Salesman P roblem”, P r oceedi n gs of I P C O 2001, L N C S 2081 , p. 406
A re a -E ffi c ie n t O rd e r-P re s e rv in g P la n a r S t ra ig h t -L in e D raw in g s o f O rd e re d T re e s ⋆ Ashim Garg and Adrian R usu Depart ment of Comput er Science and Engineering University at Buff alo Buff alo, NY 14260 { agarg,adirusu} @cse.buffalo.edu
Ordered t rees are generally drawn using order-preserving planar st raight -line grid drawings. We t herefore invest igat e t he arearequirement s of such drawings, and present several result s: Let T be an ordered t ree wit h n nodes. T hen: – T admit s an order-preserving planar st raight -line grid drawing wit h O ( n log n ) area. – If T is a binary t ree, t hen T admit s an order-preserving planar st raight -line grid drawing wit h O ( n log log n ) area. – If T is a binary t ree, t hen T admit s an order-preserving upwar d planar st raight -line grid drawing wit h opt i m al O ( n log n ) area. We also st udy t he problem of drawing binary t rees wit h user-specified arbit rary aspect rat ios. We show t hat an ordered binary t ree T wit h n nodes admit s an order-preserving planar st raight -line grid drawing Γ wit h widt h O ( A + log n ), height O (( n / A ) log A ), and area O (( A + log n )( n / A ) log A ) = O ( n log n ), where 2 ≤ A ≤ n is any user-specified number. Also not e t hat all t he drawings ment ioned above can be const ruct ed in O ( n ) t ime. A b st ract .
1
In t ro d u c t io n
An ordered t ree T is one wit h a presp ecified count erclockwise ordering of t he edges incident on each node. Ordered t rees arise commonly in pract ice. E xamples of ordered t rees include binary search t rees, arit hmet ic expression t rees, BSP t rees, B-t rees, and range-t rees. An order-preservin g drawin g of T is one in which t he count erclockwise ordering of t he edges incident on a node is t he same as t heir presp ecified ordering in T . A plan ar drawin g of T is one wit h no edge-crossings. An u pward drawin g of T is one, where each node is placed eit her at t he same y -coordinat e as, or at a higher y -coordinat e t han t he y -coordinat es of it s children. A st raight -lin e drawin g of T is one, where each edge is drawn as a single line-segment . A grid drawin g of T is one, where each node is assigned int eger x - and y -coordinat es.
⋆
Research support ed by NSF CAREER Award IIS-9985136 and NSF CISE Research Infrast ruct ure Award No. 0101244.
T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 475–486, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
476
A. Garg and A. Rusu
Ordered t rees are generally drawn using order-preserving planar st raight -line grid drawings, as any undergraduat e t ext b ook on dat a-st ruct ures will show. An upward drawing is desirable b ecause it makes it easier for t he user t o det ermine t he parent -child relat ionships b et ween t he nodes. We invest igat e t he area-requirement of t he order-preserving planar st raight line grid drawings of ordered t rees, and present several result s: Let T b e an ordered t ree wit h n nodes. We show t hat T admit s an order-preserving planar st raight -line grid drawing wit h O ( n log n ) area, O ( n ) height , and O (log n ) widt h, which can b e const ruct ed in O ( n ) t ime. e s u l t 2 : If T is a binary t ree, t hen we show st ronger result s: R e s u l t 2 a : T admit s an order-preserving planar st raight -line grid drawing wit h O ( n log log n ) area, O (( n / log n ) log log n ) height , and O (log n ) widt h, which can b e const ruct ed in O ( n ) t ime. R e s u l t 2 b : T admit s an order-preserving u pward planar st raight -line grid drawing wit h opt im al O ( n log n ) area, O ( n ) height , and O (log n ) widt h, which can b e const ruct ed in O ( n ) t ime.
R e su lt 1 :
R
An imp ort ant issue is t hat of t he aspect rat io of a drawing D . Let E b e t he smallest rect angle, wit h sides parallel t o x and y -axis, resp ect ively, enclosing D . T he aspect rat io of D is defined as t he rat io of t he larger and smaller dimensions of E , i.e., if h and w are t he height and widt h, resp ect ively, of E , t hen t he asp ect rat io of D is equal t o max { h , w } / min { h , w } . It is imp ort ant t o give t he user cont rol over t he asp ect rat io of a drawing b ecause t his will allow her t o fit t he drawing in an arbit rarily-shap ed window defined by her applicat ion. It also allows t he drawing t o fit wit hin display-surfaces wit h predefined asp ect rat ios, such as a comput er-screen and a sheet of pap er. We consider t he problem of drawing binary t rees wit h arbit rary asp ect rat io, and prove t he following result : Let T b e a binary t ree wit h n nodes. Let 2 ≤ A ≤ n b e any usersp ecified numb er. T admit s an order-preserving planar st raight -line grid drawing Γ wit h widt h O ( A + log n ), height O (( n / A ) log A ), and area O (( A + log n )( n / A ) log A ) = O ( n log n ), which can b e const ruct ed in O ( n ) t ime.
R e su lt 3 :
Also not e t hat [3] shows an n -node binary t ree t hat requires Ω ( n ) height and Ω (log n ) widt h in any order-preserving upward planar grid drawing. Hence, t he O ( n ) height and O (log n ) widt h achieved by R esult 2b is opt imal in t he worst case. Table 1 compares our result s wit h t he previously known result s.
2
D e fi n it io n s
We assume a 2-dimensional Cart esian space. We assume t hat t his space is covered by an infinit e rect angular grid, consist ing of horizont al and vert ical channels. A left -corn er drawing of an ordered t ree T is one, where no node of T is t o t he left of, or ab ove t he root of T . T he m irror-im age of T is t he ordered t ree
Area-Effi cient Order-P reserving P lanar St raight -Line Drawings
477
Bounds on t he areas and aspect rat ios of various kinds of planar st raight -line grid drawings of an n -node t ree. Here, α and ǫ are user-defined const ant s, such t hat 0 ≤ α < 1 and 0 < ǫ < 1. [a , b ] denot es t he range a . . . b .
T a b le 1 .
Tree T ype Special Balanced Trees such as Red-black Binary
General
Drawing T ype Upward Order-preserving Upward Non-order-preserving Upward Order-preserving Non-upward Non-order-preserving Non-upward Order-preserving Non-upward Order-preserving
Area O
Aspect Rat io
( n (log log n ) 2 ) O
n/
log2 n
Reference [6]
( n log log n ) ( n log log n ) / log2 n [6] O ( n log n ) [1, n / log n ] [1] 1+ 1 O (n ) n [2] O ( n log n ) n / log n t his paper −
ǫ
ǫ
α
[4] (n ) n [2] O ( n log n ) [1, n / log n ] t his paper 2 O ( n log log n ) ( n log log n ) / log n t his paper 1+ 1 O (n ) n [2] O ( n log n ) n / log n t his paper O
O
(n )
[1, n ]
1+
ǫ
1−
ǫ
ǫ
−
ǫ
obt ained by reversing t he count erclockwise order of edges around each node. Let R b e a rect angle wit h sides parallel t o t he x - and y -axis, resp ect ively. T he height ( widt h ) of R is equal t o t he numb er of grid-p oint s wit h t he same x -coordinat e ( y -coordinat e) cont ained wit hin R . T he area of R is equal t o t he numb er of grid-p oint s cont ained wit hin R . T he en closin g rect an gle E of a drawing D is t he smallest rect angle wit h sides parallel t o t he x - and y -axis covering t he ent ire drawing. T he height h , widt h w , and area of D is equal t o t he height , widt h, and area, resp ect ively, of E . T he aspect rat io of D is equal t o max { h , w } / min { h , w } . A su bt ree root ed at a node v of an ordered t ree T is t he maximal t ree consist ing of v and all it s descendent s. A part ial t ree of T is a connect ed subgraph of T . A spin e of T is a pat h v 0 v 1 v 2 . . . v m , where v 0 , v 1 , v 2 , . . . , v m are nodes of T , t hat is defined recursively as follows (see F igure 1): is t he same as t he root of T ; is t he child of v i , such t hat t he subt ree root ed at v i + 1 has t he maximum numb er of nodes among all t he subt rees t hat are root ed at t he children of v i .
– v0
– vi + 1
3
D raw in g B in a ry T re e s
We now give our drawing algorit hm for const ruct ing order-preserving planar upward st raight -line grid drawings of binary t rees. In an ordered binary t ree, each node has at most t wo children, called it s left and right children, resp ect ively. Our drawing algorit hm, which we call A lgorit hm B T -O rdered-D raw , uses t he divide-and-conquer paradigm t o draw an ordered binary t ree T . In each recursive st ep, it breaks T int o several subt rees, draws each subt ree recursively, and t hen
478
A. Garg and A. Rusu
(a)
(b)
(a) A binary t ree T wit h spine v 0 v 1 . . . v 13 . (b) T he order-preserving planar upward st raight -line grid drawing of T const ruct ed by A lgor i t hm B T -O r der ed-D r aw .
F ig . 1 .
combines t heir drawings t o obt ain an upward left -corner drawing D ( T ) of T . We now give t he det ails of t he act ions p erformed by t he algorit hm t o const ruct D ( T ). Not e t hat during it s working, t he algorit hm will designat e some nodes of T as eit her left -kn ee , right -kn ee , ordin ary -left , ordin ary -right , swit ch-left or swit ch-right nodes (for an example, see F igure 2): 1. Let P = v 0 v 1 v 2 . . . v m b e a spine of T . Define a n on -spin e node of T t o b e one t hat is not in P . 2. Designat e v 0 as a left -kn ee node. 3. for i = 0 t o m do (see F igure 2) Dep ending up on whet her v i is a left -kn ee , right -kn ee , ordin ary -left , ordin ary -right , swit ch-left , or swit ch-right node, do t he following: a) v i is a left -kn ee n ode: If v i + 1 has a left child, and t his child is not v i + 2 , t hen designat e v i + 1 as a swit ch-right n ode , ot herwise designat e it as an ordin ary -left n ode . R ecursively const ruct an upward left -corner drawing of t he subt ree of T root ed at t he non-spine child of v i . b) v i is an ordin ary -left n ode: If v i + 1 has a left child, and t his child is not v i + 2 , t hen designat e v i + 1 as a swit ch-right n ode , ot herwise designat e it as an ordin ary -left n ode . R ecursively const ruct an upward left -corner drawing of t he subt ree of T root ed at t he non-spine child of v i . c) v i is a swit ch-right n ode: Designat e v i + 1 as a right -kn ee node. R ecursively const ruct an upward left -corner drawing of t he subt ree of T root ed at t he non-spine child of v i . d) v i is a right -kn ee, ordin ary -right , or swit ch-left n ode: Do t he same as in t he cases, where v i is a left -knee, ordinary-left , or swit ch-right node, resp ect ively, wit h “left ” exchanged wit h “right ”, and inst ead
Area-Effi cient Order-P reserving P lanar St raight -Line Drawings
479
of const ruct ing an upward left -corner drawing of t he subt ree T i of T root ed at t he non-spine child of v i , we recursively const ruct an upward left -corner drawing of t he m irror im age of T i . 4. Let G b e t he drawing wit h t he maximum widt h among t he drawings const ruct ed in St ep 3. Let W b e t he widt h of G . 5. P lace v 0 at t he origin. 6. for i = 0 t o m do (see F igures 2 and 3) Let H i b e t he horizont al channel corresp onding t o t he node placed lowest in t he drawing of T const ruct ed so far. Dep ending up on whet her v i is a left -kn ee , right -kn ee , ordin ary -left , ordin ary -right , swit ch-left or swit ch-right node, do t he following: a) v i is a left -kn ee n ode: If v i + 1 is t he only child of v i , t hen place v i + 1 on t he horizont al channel H i + 1 and one unit t o t he right of v i (see F igure 3(a)). Ot herwise, let s b e t he child of v i diff erent from v i + 1 . Let D b e t he drawing of t he subt ree root ed at s const ruct ed in St ep 3. If s is t he right child of v i , t hen place D such t hat it s t op b oundary is at t he horizont al channel H i + 1 and it s left b oundary is one unit t o t he right of v i ; place v i + 1 one unit b elow D and one unit t o t he right of v i (see F igure 3(b)). If s is t he left child of v i , t hen place v i + 1 one unit b elow and one unit t o t he right of v i (see F igure 3(a)) (t he placement of D will b e handled by t he algorit hm when it will consider a swit ch-right node lat er on). b) v i is an ordin ary -left n ode: Since v i is an ordinary-left node, eit her v i + 1 will b e t he only child of v i , or v i will have a right child s , where s = v i + 1 . If v i + 1 is t he only child of v i , t hen place v i + 1 one unit b elow v i in t he same vert ical channel as it (see F igure 3(c)). Ot herwise, let s b e t he right child of v i . Let D b e t he drawing of t he subt ree root ed at s const ruct ed in St ep 3. P lace D one unit b elow and one unit t o t he right of v i ; place v i + 1 on t he same horizont al channel as t he b ot t om of D and in t he same vert ical channel as v i (see F igure 3(d)). c) v i is a swit ch-right n ode: Not e t hat , since v i is a swit ch-right node, it will have a left child s , where s = v i + 1 . Let v j b e t he left -knee node of P closest t o v i in t he subpat h v 0 v 1 . . . v i of P . v j is called t he closest left -kn ee an cest or of v i . P lace v i + 1 one unit b elow and W + 1 unit s t o t he right of v i . Let D b e t he drawing of t he subt ree root ed at s const ruct ed in St ep 3. P lace D one unit b elow v i such t hat s is in t he same vert ical channel as v i (see F igure 3(e)). If v j has a left child s ′ , which is diff erent from v j + 1 , t hen let D ′ b e t he drawing of t he subt ree root ed at s ′ const ruct ed in St ep 3. P lace D ′ one unit b elow D such t hat s ′ is in t he same vert ical channel as v i (see F igure 3(f)). d) v i is a right -kn ee, ordin ary -right , or swit ch-left n ode: T hese cases are t he same as t he cases, where v i is a left -knee, ordinary-left , or swit chright node, resp ect ively, except t hat “left ” is exchanged wit h “right ”, and t he left -corner drawing of t he mirror image of t he subt ree root ed
480
A. Garg and A. Rusu
(a)
(b)
F i g . 2 . (a) A binary t ree T wit h spine v 0 v 1 . . . v 12 . (b) A schemat ic diagram of t he drawing D ( T ) of T const ruct ed by A lgor i t hm B T -O r der ed-D r aw . Here, v 0 is a left knee, v 1 is an ordinary-left , v 2 is a swit ch-right , v 3 is a right -knee, v 4 is an ordinaryright , v 5 is a swit ch-left , v 6 is a left -knee, v 7 is a swit ch-right , v 8 is a right -knee, v 9 is an ordinary-right , v 10 is a swit ch-left , v 11 is a left -knee, and v 12 is an ordinary-left node. For simplicity, we have shown D 0 , D 1 , . . . , D 9 wit h ident ically sized boxes but in act uality t hey may have diff erent sizes.
(a)
(b)
(c)
(d)
(e)
(f)
(a,b) P lacement of v , v + 1 , and D in t he case when v is a left -knee node: (a) is t he only child of v or s is t he left child of v , (b) s is t he right child of v . (c,d) P lacement of v , v + 1 , and D in t he case when v is an ordinary-left node: (c) v + 1 is t he only child of v , (d) s is t he right child of v . (e,f) P lacement of v , v + 1 , D , and D in t he case when v is a swit ch-right node. (e) v does not have a left child, (f) v has a left child s . Here, D is t he drawing of t he subt ree root ed at s . F ig . 3 .
i
vi+ 1
i
i
i
i
i
i
i
i
i
i
i
′
i
i
j
′
i
j
′
at t he non-spine child of v i , const ruct ed in St ep 3, is first flipp ed left t o-right and t hen is placed in D ( T ). To det ermine t he area of D ( T ), not ice t hat t he widt h of D ( T ) is equal t o W + 3 (see t he definit ion of W given in St ep 3). From t he definit ion of a spine, it follows easily t hat t he numb er of nodes in each subt ree root ed at a non-spine node of T is at most n / 2, where n is t he numb er of nodes in T . Hence, if we denot e by w ( n ), t he widt h of D ( T ), t hen, W ≤ w ( n / 2), and so, w ( n ) ≤ w ( n / 2) + 3. Hence,
Area-Effi cient Order-P reserving P lanar St raight -Line Drawings
481
w ( n ) = O (log n ). T he height of D ( T ) is t rivially at most n . Hence, t he area of D ( T ) is O ( n log n ). It is easy t o see t hat t he Algorit hm can b e implement ed such t hat it runs in O ( n ) t ime. [3] has shown a lower b ound of Ω ( n log n ) for order-preserving planar upward st raight -line grid drawings of binary t rees. Hence, t he upp er b ound of O ( n log n ) on t he area of D ( T ) is also opt imal. We t herefore get t he following t heorem: T h e o r e m 1 . A bin ary t ree wit h n n odes adm it s an order-preservin g u pward
plan ar st raight -lin e grid drawin g wit h height at m ost n , widt h O (log n ) , an d opt im al O ( n log n ) area, which can be con st ru ct ed in O ( n ) t im e.
We can also const ruct a non-upward left -corner drawing D ′ ( T ) of T , such t hat D ′ ( T ) has height O (log n ) and widt h at most n , by first const ruct ing a left -corner drawing of t he mirror image of T using Algorit hm B T -O rdered-D raw , t hen rot at ing it clockwise by 90◦ , and t hen flipping it right -t o-left . T his gives Corollary 1. C o r o l l a r y 1 . U sin g A lgorit hm BT -Ordered-Draw , we can con st ru ct in O ( n ) t im e, a n on -u pward left -corn er order-preservin g plan ar st raight -lin e grid drawin g of an n -n ode bin ary wit h area O ( n log n ) , height O (log n ) , an d widt h at m ost n .
4
D raw in g G e n e ra l T re e s
In a general t ree, a node may have more t han t wo children. We now briefly describ e our algorit hm for const ruct ing a (non-upward) order-preserving planar st raight -line grid drawing of a general t ree T , which we call A lgorit hm O rderedD raw (for det ails, see t he full pap er [5]). T his algorit hm is similar t o t he A lgorit hm B T -O rdered-D raw present ed in Sect ion 3. Like A lgorit hm B T -O rderedD raw , it also const ruct s a left -corner drawing D ( T ) of it s input t ree T recursively by split t ing T int o many subt rees T 1 , T 2 , . . . , T k , where each T i is a t ree root ed at a non-spine child of a spine node of T , recursively const ruct ing a drawing of each T i , and t hen st acking t hese drawings one-ab ove-t he-ot her t o const ruct D ( T ) (see F igure 4). D ( T ) is const ruct ed as follows: Let v 0 v 1 v 2 . . . v m b e a spine of T . E ach spine node v i of T is designat ed as a left -kn ee , right -kn ee , swit chleft , or swit ch-right node as follows: v 0 is designat ed as a left -kn ee node. For each i , where 0 ≤ i ≤ v m − 1 , v i + 1 is designat ed as a swit ch-right ( swit ch-left , left -kn ee , right -kn ee , resp ect ively) node if v i is a left -kn ee ( right -kn ee , swit ch-left , swit ch-right , resp ect ively) node. For each v i , where 0 ≤ i ≤ m − 1, it does t he following: For simplicit y, assume t hat v i has at least one non-spine child t hat precedes v i + 1 , and at least one non-spine child t hat follows v i + 1 in t he count erclockwise order of children of v i (t he algorit hm can b e easily modified t o handle t he cases when v i + 1 is t he first and/ or t he last child of v i in t his count erclockwise order). Let c1 , c2 , . . . , cq , v i + 1 , cq+ 1 , . . . , cp b e t he count erclockwise order of t he children of v i . cp is called t he last child of v i . If v i is a left -kn ee or swit ch-right node ( right -kn ee or swit ch-left node), t hen it recursively const ruct s a left -corner drawing D j of t he subt ree T j (image of t he subt ree T j ) root ed at each cj (see F igure 4).
482
A. Garg and A. Rusu
(a)
(b)
(a) A t ree T wit h spine v 0 v 1 . . . v 5 . (b) A schemat ic diagram of t he drawing ( T ) of T const ruct ed by Algorit hm O r der ed-D r aw . Here, v 0 and v 4 are left -knee nodes, v 1 and v 5 are swit ch-right nodes, v 2 is a right -knee node, and v 3 is a swit ch-left node. For simplicity, we have shown D 0 , D 1 , . . . , D 9 wit h ident ically sized boxes but in act uality t hey may have diff erent sizes. F ig . 4 . D
Let W b e t he maximum widt h of t he drawings of t he subt rees root ed at all t he non-spine children of all t he spine nodes. If v i is a swit ch-right node (for example, node v 1 in F igure 4), t hen v i + 1 is placed one unit b elow v i and at horizont al dist ance W + 1 from it . D 1 , D 2 , . . . , D q , D q+ 1 , . . . , D p are placed one-ab ove-t he-ot her in t hat order, separat ed by unit vert ical dist ance, such t hat t heir left b oundaries are at unit horizont al dist ance from v i t o it s right , and t op b oundary of D q is at t he same horizont al channel as v i + 1 . If v i is a right -kn ee node (for example, node v 2 in F igure 4), D 1 , . . . , D q are placed one-b elow-t he-ot her in t hat order, separat ed by unit vert ical dist ance, such t hat t heir right b oundaries are at unit horizont al dist ance from v i t o it s left , and t he t op b oundary of D 1 is one unit b elow t he sub drawing of D ( T ) consist ing of t he subspine v 0 v 1 . . . v i − 1 and t he drawings of t he subt rees root ed at t he non-spine children of t he spine nodes v 0 , v 1 , . . . , v i − 1 . v i + 1 is placed one unit t o t he left of v i and at t he same horizont al channel as t he b ot t om b oundary of D q . D q+ 1 , . . . , D p are placed one-b elow-t he-ot her in t hat order, separat ed by unit vert ical dist ance, such t hat t heir right b oundaries are at unit horizont al dist ance from v i t o it s left , and t he t op b oundary of D q+ 1 is one unit b elow t he drawing of t he image of t he subt ree root ed at t he last child of v i + 1 . T he placement of D 1 , D 2 , . . . , D p when v i is a swit ch-left or left -kn ee node is analogous t o t he case where v i is a swit ch-right or right -kn ee node, resp ect ively. J ust as for A lgorit hm B T -O rdered-D raw , we can show t hat t he widt h w ( n ) of D ( T ) sat isfies t he recurrence: w ( n ) ≤ w ( n / 2) + 3. Hence, w ( n ) = O (log n ). T he height of D ( T ) is t rivially at most n . Hence, t he area of D ( T ) is O ( n log n ). T h e o r e m 2 . A t ree wit h n n odes adm it s an order-preservin g plan ar st raight -
lin e grid drawin g wit h O ( n log n ) area, O (log n ) widt h, an d height at m ost n , which can be con st ru ct ed in O ( n ) t im e.
Area-Effi cient Order-P reserving P lanar St raight -Line Drawings
5
483
D raw in g B in a ry T re e s w it h A rb it ra ry A s p e c t R a t io
Let T b e a binary t ree. We show t hat , for any user-defined numb er A , where 2 ≤ A ≤ n , we can const ruct an order-preserving planar st raight -line grid drawing of T wit h O (( n / A ) log A ) height and O ( A + log n ) widt h. T hus, by set t ing t he value of A , user can cont rol t he asp ect rat io of t he drawing. T his result also implies t hat we can const ruct such a drawing wit h area O ( n log log n ) by set t ing A = log n . Our algorit hm combines t he approach of [1] for const ruct ing non-upward non-order-preserving drawings of binary t rees wit h arbit rary asp ect rat io wit h our approach for const ruct ing order-preserving drawings given in Sect ion 3. L e m m a 1 ( G e n e r a l i z a t i o n o f L e m m a 3 o f [1 ]) . S u ppose A >
1, an d f is a
fu n ct ion su ch t hat : A , t hen f ( n )
≤
– if n > A , t hen f ( n )
≤
– if n
≤
wit h n ∗ + n + + n ′ ′ T hen , f ( n ) < 6n / A
−
≤
1; an d f ( n ∗ ) + f ( n + ) + f ( n ′ ′ ) + 1 for som e n ∗ , n + , n ′ ′ n.
≤
n− A
2 for all n > A .
An order-preserving planar st raight -line grid drawing of a binary t ree T is called a feasible drawin g if t he root of T is placed on t he left b oundary and no node of T is placed b et ween t he root and t he upp er-left corner of t he enclosing rect angle of t he drawing. Not e t hat a left -corner drawing is also a feasible drawing. We now describ e our algorit hm, which we call A lgorit hm B D A A R , for drawing a binary t ree T wit h arbit rary asp ect rat io. Let m b e t he numb er of nodes in T . Let 2 ≤ A ≤ m b e any numb er given as a paramet er t o A lgorit hm B D A A R . Like Algorit hm B T -O rdered-D raw of Sect ion 3, A lgorit hm B D A A R is also a recursive algorit hm. In each recursive st ep, it also const ruct s a feasible drawing of a subt ree T ′ of T . If T ′ has at most A nodes in it , t hen it const ruct s a left -corner drawing of T ′ using Corollary 1 such t hat t he drawing has widt h at most n and height O (log n ), where n is t he numb er of nodes in T ′ . Ot herwise, i.e., if T ′ has more t han A nodes in it , t hen it const ruct s a feasible drawing of T ′ as follows: 1. Let P = v 0 v 1 v 2 . . . v q b e a spine of T ′ . 2. Let n i b e t he numb er of nodes in t he subt ree of T ′ root ed at v i . Let v k b e t he vert ex of P wit h t he smallest value for k such t hat n k > n − A and n k + 1 ≤ n − A (since T ′ has more t han A nodes in it and n 0 , n 1 , . . . , n q is a st rict ly decreasing sequence of numb ers, such a k exist s). 3. for each i , where 0 ≤ i ≤ k − 1, denot e by T i , t he subt ree root ed at t he nonspine child of v i (if v i does not have any non-spine child, t hen T i is t he empt y t ree, i.e., t he t ree wit h no nodes in it ). Denot e by T ∗ and T + , t he subt rees root ed at t he non-spine children of v k and v k + 1 , resp ect ively, denot e by T ′ ′ , t he subt ree root ed at v k + 1 , and denot e by T ′ ′ ′ , t he subt ree root ed at v k + 2 (if v k and v k + 1 do not have non-spine children, and k + 1 = q, t hen T ∗ , T + , and T ′ ′ ′ are empt y t rees). For simplicit y, in t he rest of t he algorit hm, we assume t hat T ∗ , T + , T ′ ′ ′ , and each T i are non-empt y. (T he algorit hm can b e easily modified t o handle t he cases, when T ∗ , T + , T ′ ′ ′ , or some T i ’s are empt y).
484
A. Garg and A. Rusu
4. P lace v 0 at origin. 5. We have t wo cases: – k = 0: R ecursively const ruct a feasible drawing D ∗ of T ∗ . R ecursively const ruct a feasible drawing D + of t he mirror image of T + . R ecursively const ruct a feasible drawing D ′ ′ ′ of t he mirror image of T ′ ′ ′ . Let s 0 b e t he root of T ∗ and s 1 b e t he root of T + . T ′ is drawn as shown in F igure 5(a,b,c,d). If s 0 is t he left child of v 0 , t hen place D ∗ one unit b elow v 0 wit h it s left b oundary aligned wit h v 0 (see F igure 5(a,c)). If s 0 is t he right child of v 0 , t hen place D ∗ one unit ab ove and one unit t o t he right of v 0 (see F igure 5(b,d)). Let W ∗ , W + , and W ′ ′ ′ b e t he widt hs of D ∗ , D + , and D ′ ′ ′ , resp ect ively. v 1 is placed in t he same horizont al channel as v 0 t o it s right at dist ance max { W ∗ + 1, W + + 1, W ′ ′ ′ − 1} from it . Let B 0 and C 0 b e t he lowest and highest horizont al channels, resp ect ively, occupied by t he sub drawing consist ing of v 0 and D ∗ . If s 1 is t he left child of v 1 , t hen flip D + left -t o-right and place it one unit b elow B 0 and one unit t o t he left of v 1 (see F igure 5(a,b)). If s 1 is t he right child of v 1 , t hen flip D + left -t o-right , and place it one unit ab ove C 0 and one unit t o t he left of v 1 (see F igure 5(c,d)). Let B 1 b e t he lowest horizont al channel occupied by t he sub drawing consist ing of v 0 , D ∗ , v 1 and D + . F lip D ′ ′ ′ left -t o-right and place it one unit b elow B 1 such t hat it s right b oundary is aligned wit h v 1 (see F igure 5(a,b,c,d)). – k > 0: For each T i , where 0 ≤ i ≤ k − 1, const ruct a left -corner drawing D i of T i using Corollary 1. R ecursively const ruct feasible drawings D ∗ and D ′ ′ of t he mirror images of T ∗ and T ′ ′ , resp ect ively. T ′ is drawn as shown in F igure 6(a,b,c,d). If T 0 is root ed at t he left child of v 0 , t hen D 0 is placed one unit b elow and wit h t he left b oundary aligned wit h v 0 . If T 0 is root ed at t he right child of v 0 , t hen D 0 is placed one unit ab ove and one unit t o t he right of v 0 . E ach D i and v i , where 1 ≤ i ≤ k − 1, are placed such t hat : • v i is in t he same horizont al channel as v i − 1 , and is one unit t o t he right of D i − 1 , and • if T i is root ed at t he left child of v i , t hen D i is placed one unit b elow v i wit h it s left b oundary aligned wit h v i , ot herwise (i.e., if T i is root ed at t he right child of v i ) D i is placed one unit ab ove and one unit t o t he right of v i . Let B k − 1 and C k − 1 b e t he lowest and highest horizont al channels, resp ect ively, occupied by t he sub drawing consist ing of v 0 , v 1 , v 2 , . . . , v k − 1 and D 0 , D 1 , D 2 , . . . , D k − 1 . Let d b e t he horizont al dist ance b et ween v 0 and t he right b oundary of t he sub drawing consist ing of v 0 , v 1 , v 2 , . . . , v k − 1 and D 0 , D 1 , D 2 , . . . , D k − 1 . Let W ∗ and W ′ ′ b e t he widt hs of D ∗ and D ′ ′ , resp ect ively. v k is placed t o t he right of v k − 1 in t he same horizont al channel as it , such t hat t he horizont al dist ance b et ween v k and v 0 is equal t o max { W ′ ′ − 1, W ∗ + 1, d + 1} . If T ∗ is root ed at t he left -child of v k , t hen D ∗ is flipp ed left -t o-right and placed one unit b elow B k − 1 and one unit left of v k (see
Area-Effi cient Order-P reserving P lanar St raight -Line Drawings
(a)
(b)
(c)
(d)
F i g . 5 . Case k = 0: (a) s 0 is t he left child of v 0 and s 1 is t he left child of v 1 . (b) t he right child of v 0 and s 1 is t he left child of v 1 . (c) s 0 is t he left child of v 0 and t he right child of v 1 . (d) s 0 is t he right child of v 0 and s 1 is t he right child of v 1 .
(a)
(b)
(c)
485
s0 s1
is is
(d)
Case k > 0: Here k = 4, s 0 , s 1 , and s 3 are t he left children of v 0 , v 1 , and v 3 respect ively, s 2 is t he right child of v 2 , T 0 , T 1 , T 2 , and T 3 are t he subt rees root ed at v 0 , v 1 , v 2 , and v 3 respect ively. Let s 4 be t he root of T . (a) s 4 is left child of v 4 . (b) s 4 is t he right child of v 4 . F ig . 6 .
∗
F igure 6(a,b)). If T ∗ is root ed at t he right -child of v k , t hen D ∗ is flipp ed left -t o-right and placed one unit ab ove C k − 1 and one unit t o t he left of v k (see F igure 6(c,d)) . Let B k b e t he lowest horizont al channel occupied by t he sub drawing consist ing of v 1 , v 2 , . . . , v k , and D 1 , D 2 , . . . , D k − 1 , D ∗ . D ′ ′ is flipp ed left -t o-right and placed one unit b elow B k , such t hat it s right b oundary is aligned wit h v k (see F igure 6(b,d)). Let m i b e t he numb er of nodes in T i , where 0 ≤ i ≤ k − 1. From Corollary 1, t he height of each D i is O (log m i ) and widt h at most m i . Tot al numb er of nodes in t he part ial t ree consist ing of T 0 , T 1 , . . . , T k − 1 and v 0 , v 1 , . . . , v k − 1 is at most A − 1. Hence, t he height of t he sub drawing consist ing of D 0 , D 1 , . . . , D k − 1 and v 0 , v 1 , . . . , v k − 1 is O (log A ) and widt h is at most A − 1 (see F igure 6).
486
A. Garg and A. Rusu
Supp ose T ′ , T ∗ , T + , T ′ ′ , and T ′ ′ ′ have n , n ∗ , n + , n ′ ′ , and n ′ ′ ′ nodes, resp ect ively. If we denot e by H ( n ) and W ( n ), t he height and widt h of t he drawing of T ′ const ruct ed by Algorit hm B D A A R , t hen: H ( n ) = H ( n ∗ ) + H ( n + ) + H ( n ′ ′ ′ ) + 1 if n > A and k = 0
= H ( n ∗ ) + H ( n + ) + H ( n ′ ′ ′ ) + O (log A ) H ( n ) = H ( n ∗ ) + H ( n ′ ′ ) + O (log A ) if n > A and k > 0 H ( n ) = O (log A ) if n
≤
A
Since n ∗ , n + , , n ′ ′ , n ′ ′ ′ ≤ n − A , from Lemma 1, it follows t hat H ( n ) = O (log A )(6n / A − 2) = O (( n / A ) log A ). Also we have t hat : W ( n ) = max { W ( n ∗ ) + 2, W ( n + ) + 2, W ( n ′ ′ ′ ) } W ( n ) = max { A , W ( n ∗ ) + 2, W ( n ′ ′ ) } W (n )
≤
A
if n
≤
if n > A and k = 0
if n > A and k > 0
A
Since, n ∗ , n + , n ∗ ≤ n / 2, and n ′ ′ , n ′ ′ ′ ≤ n − A < n − 1, we get t hat W ( n ) ≤ max { A , W ( n / 2) + 2, W ( n − 1) } . T herefore, W ( n ) = O ( A + log n ). We t herefore get t he following t heorem: 2 ≤ A ≤ n be an y n u m ber. T adm it s an order-preservin g plan ar st raight -lin e grid drawin g wit h widt h O ( A + log n ) , height O (( n / A ) log A ) , an d area O (( A + log n )( n / A ) log A ) = O ( n log n ) , which can be con st ru ct ed in O ( n ) t im e.
T h e o r e m 3 . L et T be a bin ary t ree wit h n n odes. L et
Set t ing A = log n , we get t hat : n -n ode bin ary t ree adm it s an order-preservin g plan ar st raight -lin e grid drawin g wit h area O ( n log log n ) , which can be con st ru ct ed in O ( n ) t im e. C o ro lla ry 2 . A n
R e fe re n c e s 1. T . Chan, M. Goodrich, S. R. Kosara ju, and R. Tamassia. Opt imizing area and aspect rat io in st raight -line ort hogonal t ree drawings. C om put . G eom . T heor y A ppl. , 23:153–162, 2002. 2. T . M. Chan. A near-linear area bound for drawing binary t rees. In P r oc. 10t h A C M -SI A M Sym posi um on D i scr et e A lgor i t hm s ( SO D A ) , pages 161–168, 1999. 3. A. Garg, M. T . Goodrich, and R. Tamassia. P lanar upward t ree drawings wit h opt imal area. I n t er n at . J . C om put . G eom . A ppl. , 6:333–356, 1996. 4. A. Garg and A. Rusu. St raight -line drawings of binary t rees wit h linear area and arbit rary aspect rat io. In G r aph D r awi n g ( G D ’ 02), volume 2528 of L ect ur e N ot es i n C om put er Sci en ce, pages 320–331. Springer-Verlag, 2002. 5. A. Garg and A. Rusu. Area-effi cient order-preserving planar st raight -line drawings of ordered t rees. Technical Report 2003-05, Depart ment of Comput er Science and Engineering, University at Buff alo, Buff alo, NY, 2003. 6. C.-S. Shin, S. Kim, S.-H. Kim, and K.-Y. Chwa. Area-effi cient algorit hms for st raight -line t ree drawings. C om put . G eom . T heor y A ppl. , 15:175–202, 2000.
Bounds for Convex Crossing N umbers Farhad Shahrokhi 1⋆ , Ondrej S´y kora2⋆ ⋆ , L aszlo A . Sz´ekely 3⋆ and I mrich Vrt ’o4†
⋆ ⋆
,
1
D ep ar t m ent of C om p u t er Sci en ce, U n i v er si t y of N or t h T ex as P.O B ox 13886, D ent on , T X , 76203-3886, U SA 2 D ep ar t m ent of C om p u t er Sci en ce, L ou ghb or ou gh U n i v er si t y L ou ghb or ou gh , L ei cest er sh i r e L E 11 3T U , T h e U n i t ed K i n gd om 3 D ep ar t m ent of M at h em at i cs, U n i v er si t y of Sou t h C ar ol i n a C ol u m b i a, SC 29208, U SA 4 D ep ar t m ent of I n for m at i cs, I n st i t u t e of M at h em at i cs Sl ovak A cad em y of Sci en ces Du ´ b r av sk ´a 9, 841 04 B r at i sl ava, Sl ovak R ep u b l i c
A bst ract . A conv ex d r aw i n g of an n -v er t ex gr ap h G = ( V, E ) i s a d r aw i n g i n w h i ch t h e v er t i ces ar e p l aced on t h e cor n er s of a conv ex n− gon i n t h e p l an e an d each ed ge i s d r aw n u si n g on e st r ai ght l i n e segm ent . W e d er i v e a gen er al l ow er b ou n d on t h e nu m b er of cr ossi n gs i n any conv ex d r aw i n gs of G , u si n g i sop er i m et r i c p r op er t i es of G . T h e r esu l t i m p l i es t h at conv ex d r aw i n gs for m any gr ap h s, i n cl u d i n g t h e p l an ar 2-d i m en si on al gr i d on n v er t i ces h av e at l east Ω ( n l og n ) cr ossi n gs. M or eov er , for any gi v en ar b i t r ar y d r aw i n g of G w i t h c cr ossi n gs i n t h e p l an e, w e con st r u ct 2 a conv ex d r aw i n g w i t h at m ost O ( ( c + v ∈ V dv ) l og n ) cr ossi n gs, w h er e dv i s t h e d egr ee of v .
1
I nt roduct ion
T hroughout t his paper G = ( V, E ) denot es an n -vert ex graph. L et dv be t he degree of any v ∈ V . A drawing of G = ( V, E ) is a one-t o-one placement of t he vert ices int o t he plane and represent at ion of edges pq wit h cont inuous curves, whose endpoint s are t he point s corresponding t o p and q, and do not pass t hrough any ot her vert ex point . A crossing is a common int erior point for t wo edges of G. We will consider only t he drawings in which any t wo edges have at most one common point , edges wit h a common endpoint do not cross, and no t hree edges cross at t he same point . L et cr( G) denot e t he crossing number of G, i.e. t he minimum number of crossings of it s edges over all possible drawings of G in t he plane. A lt hough t he concept of crossing numbers has played a crucial role in ⋆
T h i s r esear ch w as su p p or t ed by t h e N SF gr ant C C R 9988525. T h i s r esear ch w as su p p or t ed by t h e E P SR C gr ant G R / R 37395/ 01. ⋆ ⋆ ⋆ T h i s au t h or w as v i si t i n g t h e N at i on al C ent er for B i ot ech n ol ogy I n for m at i on , N L M , N I H , w i t h t h e su p p or t of t h e O ak R i d ge I n st i t u t e for Sci en ce an d E d u cat i on . T h i s r esear ch w as su p p or t ed by t h e N SF cont r act 007 2187. ⋆ ⋆
†
T h i s r esear ch w as su p p or t ed by t h e V E G A gr ant N o. 02/ 3164/ 23.
T . W ar now and B . Zhu ( E ds.) : COCOON 2003, L N CS 2697, pp. 487–495, 2003. c Spr i nger -Ver l ag B er l i n H ei del b er g 2003
488
F . Sh ah r ok h i et al .
set t ling many problems in combinat orial and comput at ional geomet ry [10,12,4], many int erest ing problems involving crossing numbers t hemselves, remain unresolved or even unt ouched. A n import ant applicat ion area of crossing numbers is graph drawing as number of crossings in visualized graphs infl uence aest het ics and readabilit y of graphs [5,13]. A rectilinear drawing of G is a drawing in which each edge is drawn using a single st raight line segment . A convex drawing of G is a rect ilinear drawing in which t he vert ices are placed in t he corners of a convex n -gon, see Fig.1. 6
4
5
5
3
4
2 6
2
1 0
3
0
1
2
0
3
1
4
5
6
F ig. 1. A gr ap h an d i t s conv ex an d on e-p age d r aw i n gs
L et cr( G) and cr ∗ ( G) denot e t he rect ilinear crossing number and t he convex crossing numbers of G, respect ively. Convex crossing numbers or out erplanar crossing numbers were fi rst int roduced by K ainen [8] in connect ion wit h t he book t hickness problem. Clearly cr( G) ≤ cr( G) ≤ cr ∗ ( G). I n part icular, it is well known t hat cr( K 8 ) = 18 < cr( K 8 ) = 19. I n t erms of t he k -page crossing number ν k [15,14], it is obvious t hat cr ∗ ( G) = ν 1 ( G) for every graph G. A main result in t his paper is a general lower bound on t he convex crossing number. One can observe using Euler’s formula t hat , cr ∗ ( G) ≥ m − 2n . Conse-
B ou n d s for C onv ex C r ossi n g N u m b er s
489
3
1 quent ly, cr ∗ ( G) ≥ 27 · mn 2 , for m ≥ 3n , using st andard met hods such as t hose 2 in [14]. M oreover, it is well known t hat cr( G) = Ω ( B 2 ( G) − v ∈ V dv ), and 2 d ), where B ( G ) is t he size of (1 / 3, 2/ 3) hence cr ∗ ( G) = Ω ( B 2 ( G) − v∈ V v edge separat or in G. Our lower bound, present ed here, involves isoperimet ric propert ies of G, and is much st ronger t han t he above lower bound in cert ain cases. bound we exhibit classes of graphs for which Using our lower 2 d ) log n . A surprising consequence is t hat any concr ∗ ( G) = Ω (cr( G) + v∈ V v vex drawing of an n -vert ex 2-dimensional grid (which is a planar graph), has Ω ( n log n ) crossings in any convex drawing. We also derive a general upper bound on cr ∗ ( G). I n part icular, given any arbit rary drawing of G wit h c crossings in t he plane, we const ruct a convex 2 drawing wit h O(( c + v ∈ V dv ) log n ) crossings. M oreover, if t he original drawing is represent ed as a planar graph, where crossings are represent ed as vert ices wit h degree four, t hen our const ruct ion only t akes O(( c + n ) log n ) t ime t o det ermine t he order in which t he vert ices of G appear on t he convex n -gon. Previously B ienst ock and D ean [2] had proved t hat cr( G) = O( ∆ · cr 2 ( G)), where ∆ denot es t he maximum degree of improved t heir result in [15] by showing G. We 2 2 d ) log n ), where dv denot es t he degree of t hat cr ∗ ( G) = O((cr( G) + v∈ V v v ∈ V . Very recent ly, Even et al. [7], proved t hat for every degree bounded graph cr ∗ ( G) = O((cr( G) + n ) log n )). Our new upper bound ext ends t he const ruct ion in [7] from degree bounded graphs t o arbit rary graphs, and improves our previous bound in [15] by a log n fact or. T he upper bound is t ight , wit hin a const ant mult iplicat ive fact or, for many int erest ing graphs including grids, and hence it can not be improved in general. Our upper bound implies t hat 2 ∗ if m ≥ 4n , and ∆ = O(( m n ) ), t hen, cr ( G) = O(cr( G) log n ), and t herefore, cr( G) = O(cr( G) log n ). T hus, when G is “ semi-regular” and not t oo sparse, cr ∗ ( G) is a good approximat ion for bot h cr( G) and cr( G).
2
Lower Bound
We say t hat G sat isfi es an f ( x )-edge isoperimet ric inequalit y if for any k -vert ex subset U of V, and k ≤ n/ 2, t here are at least f ( k ) edges bet ween U and V − U . D efi ne t he diff erence funct ion of f , denot ed by ∆ f as
∆ f ( i ) = f ( i + 1) − f ( i ) for any i = 0, 1, ..., n − 1. Next , we derive a general lower bound for t he number of crossings in convex drawings of G.
T heorem 1. Assume t hat G = ( V, E ) sat isfies an f ( x ) -edge isoperimet ric inequality so t hat ∆ f is posit ive and decreasing t ill n/ 2.
∗
cr ( G) ≥
⌊ n2 ⌋ n 8
−1
j=1
f ( j )( ∆ f ( j ) − ∆ f ( j + 1)) −
1 |E ( G) |f (3) − 2
v∈ V
d2v .
490
F . Sh ah r ok h i et al .
P roof. We prove t he t heorem for odd n . We ext end f by f ( x ) = 0 for x < 0. L et D be a convex drawing of G. W it hout loss of generalit y we may assume t hat vert ices in D are placed on t he perimet er of t he unit circle in equidist ant posit ions. L abel t he vert ices by 0, 1, 2, ..., n − 1. For simplicit y we will oft en ident ify a vert ex wit h it s corresponding int eger and all comput at ion will be t aken modulo n . A dd new edges bet ween i and i + 1 for i = 0, 1, ..., n − 1 in D if t hey are not already t here, and not e t hat t hey produce no crossings. For u, v ∈ V defi ne t he dist ance bet ween t hem, denot ed by l ( u, v), t o be min { |u − v|, n − |u − v|} , see Fig.2.
10 11
9 8
12
13
7
0
6
1
5
2
4 3
F ig. 2. A conv ex d r aw i n g of a 14-v er t ex gr ap h . E .g. l en gt h of t h e ed ge 0,8 i s 6.
For any uv ∈ E , let c( u, v) denot e t he number of crossings of t he edge uv wit h ot her edges in D , and observe t hat c( u, v) ≥ f ( l ( u, v) − 1) − du − dv . We conclude t hat
c( D ) =
1 2
c( u, v) ≥
1 2
f ( l ( u, v) − 1) −
uv∈ E
=
uv∈ E
1 2
( f ( l ( u, v) − 1) − du − dv )
uv∈ E
1 2
d2v .
(1)
v∈ V
We say t hat edge uv ∈ E in t he drawing D covers a vert ex i if t he unique short est pat h bet ween u and v (using only t he edges on t he boundary of t he
B ou n d s for C onv ex C r ossi n g N u m b er s
491
convex n− gon) cont ains i . (Not e t hat when uv covers i , we may have i = u or i = v.) For any edge e = uv and any vert ex i defi ne loadu ,v ( i ), (see Fig.3) as
∆ f loadu ,v ( i ) =
|u − v | 2 |u − v | 2
∆ f
− |i − u| − |v − i |
if e covers i and |i − u| < |v − i |, if e covers i and |i − u| ≥ |v − i |,
0
ot herwise.
u=0 load =f (4)−f (3)
v=6 load =f (4)−f (3) 5 load =f (3)−f (2)
1 load =f (3)−f (2) 2 load =f (2)−f (1)
4 load =f (2)−f (1) 3 load =f (1)−f (0)
F ig. 3. L oad s on t h e n od es cov er ed by t h e ed ge uv
I t is easy t o see t hat for any uv ∈ l (u ,v ) 2
⌈
E, ⌉
∆ f ( j ) ≤ 2f
loadu ,v ( i ) ≤ 2 Not e t hat for x ≥ 4, (2), and (1) t hat 1 4
x 2
(2)
+ 1 ≤ x − 1. We conclude using t he above inequalit y,
1 2
loadu ,v ( i ) ≤
uv∈ E i ∈ V
≤
+ 1 .
2
j=0
i∈ V
l ( u, v)
f
uv∈ E
1 1 |E ( G) |f (3) + 2 2
l ( u, v) 2
+ 1
f ( l ( u, v) − 1)
uv∈ E
≤
1 |E ( G) |f (3) + c( D ) + 2
v∈ V
d2v .
(3)
492
F . Sh ah r ok h i et al .
and hence will t ry t o bound from below t he sum involving loads. L et i ∈ V . For 0 ≤ s < n/ 2, defi ne E i ,s t o be t he set of all edge uv ∈ E covering vert ex i in D such t hat eit her l ( i , u) ≤ s or l ( i , v) ≤ s. Not e t hat for any i ∈ V , and any uv ∈ E i ,s , loadu ,v ( i ) ≥ ∆ f ( s). L et n s denot e i ∈ V |E i ,s |. For any s < n/ 2, we have
s
loadu ,v ( i )
loadu ,v ( i ) = i ∈ V j = 0 uv∈ E i ,j − E i ,j
i ∈ V uv∈ E i ,s
− 1
s
loadu ,v ( i )
loadu ,v ( i ) +
=
j = 1 i ∈ V uv∈ E i ,j − E i ,j
i ∈ V uv∈ E i ,0
− 1
s
≥ n 0 ∆ f (0) +
( nj − nj − 1 ) ∆ f ( j ) , j=1
where t he last inequalit y is obt ained by observing t hat t he number of t erms in t he sum i∈ V u v ∈ E i , j − E i , j − 1 loadu ,v ( i ), is n j − n j − 1 , and each t erm is at least ∆ f ( j ). I t follows t hat
s− 1
n j ( ∆ f ( j ) − ∆ f ( j + 1)) ,
loadu ,v ( i ) ≥ j=1
i ∈ V uv∈ E i ,s
since n j is a nondecreasing funct ion of j . We also have for all j < n/ 2,
nj ≥
1 nf ( j ) . 2
To see t his consider any j consecut ive int egers i , i + 1, ..., i + j − 1. T hen at least f ( j ) edges leave t his j -set , and t hose edges must cover eit her i or i + j − 1. We conclude t hat i ∈ V uv∈ E
l oadu , v ( i ) =
i ∈ V uv∈ E
i,
⌊
l oadu , v ( i ) ≥ n 2
⌋
⌊ n2 ⌋ − 1 n 2
f ( j ) ( ∆ f ( j ) − ∆ f ( j + 1) ) .
j=1
T his fi nishes t he proof, using (3).
⊓ ⊔
C orollary 1. Let G be an N × N grid. T hen for suffi cient ly large n = N 2 cr ∗ ( G) = Ω ( n log n ) .
√ P roof. A ccording t o B ollob´as and L eader [3], f ( x ) = 2x, for x ≤ n/ 2, for t he N × N grid. T heorem (1) and some st andard calculat ions give t he result . ⊔⊓
B ou n d s for C onv ex C r ossi n g N u m b er s
3
493
U pper Bound
T heorem 2. plane wit h c crossings, t hen a convex drawing If G is drawn in t he of G wit h O ( c + v ∈ V d2v ) log n crossings can be const ruct ed. Moreover, if t he original drawing is properly represent ed as a plane embedding of a planar graph, t hen t he order in which t he vert ices of G appear in t he in t he convex drawing can be det ermined in O ( c + n ) log n t ime. P roof. Consider any drawing of G in t he plane wit h c crossings and let t he set ˆ , on t he of crossings be denot ed by C . Const ruct a planar graph denot ed by G ˆ = V ∪ C by insert ing vert ices of degree 4 at t he crossings. vert ex set V ˆ all vert ices are placed on a Recall Fig.1 t hat in a one-page drawing of G st raight line l and any edge is drawn using a half circle above t he line [15]. ˆ wit h T he crucial part of t he proof is t o const ruct a one-page drawing of G O(( c+ v ∈ Vˆ d2v ) log n ) crossings. We t hen modify t his drawing t o obt ain a convex drawing of G by placing t he vert ices in V on t he corners of a convex n -gon in t he plane in t he order t hat t hey appear on t he st raight line l , and t hen drawing each edge ab ∈ E by one st raight line segment bet ween a and b. I t is easy t o see t hat t he number of crossing in t his drawing is t he same as it was in t he one-page drawing. ˆ we will fi rst const ruct a part it ion t ree T To obt ain t he desired drawing of G ˆ . T he root of T corresponds t o G ˆ , and any non-leaf node in T corresponds [15] of G ˆ wit h at least 2 vert ices. To describe t he t ree, it is suffi cient t o a subgraph of G ˆ , denot ed by G ˆ 1 and t o indicat e how t o const ruct t he left and right children of G ˆ 2 , respect ively; t he procedure recursively ext ends it self t o t he ent ire t ree. G d2 ˆ , where dv is t he A ssign a weight of w( v) = v 2 , t o any vert ex v of V dy
y ∈ Vˆ
ˆ . Recall a well known t heorem of Gazit and M iller [6] t hat any degree of v in G ˆ G has a (1/ 3, 2/ 3) edge separat or of size at most
d2v ,
1.6 v ∈ Vˆ
if for all v, w( v) ≤ 2/ 3. ˆ . A pply t he t heorem • Case 1. A ssume t hat w( v) ≤ 2/ 3 for any vert ex v ∈ V cit ed above t o fi nd an (1/ 3, 2/ 3) edge separat or of size at most
1.6
d2v .
v ∈ Vˆ
ˆ 1 and G ˆ 2 t o be t he t wo component s of G ˆ on t he vert ex set s V ˆ 1 and Now defi ne G ˆV2 , respect ively, t hat are t he obt ained by t he removal of t he (1/ 3,2/ 3) separat or. ˆ wit h w( v) ≥ 2/ 3. D efi ne G ˆ 1 and • Case 2. A ssume t hat t here is a vert ex v in G ˆ ˆ ˆ ˆ G2 t o be t he component s of G on t he vert ex set s V1 and V2 , respect ively which ˆ 1 = v and V ˆ2 = V ˆ − { v} . are obt ained by removing all edges incident t o v. T hus V
494
F . Sh ah r ok h i et al .
ˆ is obt ained by placing a one-page drawing of G ˆ1 A one-page drawing of G ˆ 2 , and t hen drawing t he removed edges t o t he left of a one-page drawing of G ˆ 1 and G ˆ 2 as half circles bet ween t he corresponding vert ices. L et b( G ˆ) (bet ween) G ˆ 1 and t he ot her end denot e t he number of edges t hat have one end point in G ˆ 2 . Similarly, defi ne b( G ˆ i ), i = 1, 2. I t follows from cases 1 and 2 and point in G t he recursive defi nit ion t hat
ˆ ) ≤ 1.6 b( G
d2v ,
v ∈ Vˆ
and
ˆ i ) ≤ 1.6 b( G
d2i ,v ,
v ∈ Vˆ i
ˆ i in G ˆ i , i = 1, 2. I t follows t hat V 2 v ∈ Vˆ d2v ˆ , b( Gi ) ≤ 1.6
where di ,v denot es t he degree of v ∈
3
ˆ ) denot e t he maximum number of edges t hat go above any i = 1, 2. L et S( G ˆ . Similarly, defi ne S( G ˆ i ), i = 1, 2. vert ex in t he obt ained one-page drawing of G A lso not e t hat , ˆ ) ≤ b( G ˆ ) + max { S( G ˆ 1 ) , S( G ˆ 2) } , S( G and t herefore ˆ) = O S( G
d2v
.
v ∈ Vˆ
ˆ ) and c( G ˆ i ) denot e t he number of crossings in t he one-page drawing Now let c( G ˆ ˆ for G, and for Gi , i = 1, 2, respect ively. Observe t hat ˆ ) ≤ c( G ˆ 1 ) + c( G ˆ 2 ) + 2b( G ˆ ) S( G ˆ ), c( G and t hus ˆ ) ≤ c( G ˆ 1 ) + c( G ˆ 2 ) + O( c( G
d2v ) .
v ∈ Vˆ
T his implies t he upper bound, since t he dept h of t he part it ion t ree is claimed 2 logarit hmic in d , and hence in n , and t he sum of t he square of degrees is v v superaddit ive over t he subgraphs. To fi nish t he proof assume t hat t he planar ˆ is given. T hen, t he claim regarding t he t ime complexit y follows from graph G t he fact t hat comput ing t he edge separat ors in [6] can be done in t he linear t ime for any planar graph, and hence t he part it ion t ree T can be const ruct ed in O(( c + n ) log n ) t ime. ⊓⊔
B ou n d s for C onv ex C r ossi n g N u m b er s
495
R eferences 1. S. B h at t , an d F .T . L ei ght on , A fr am ew or k for sol v i n g V L SI l ay ou t p r ob l em s, J. Comput. System Sci. , 28 ( 1984) , 300–331. 2. D . B i en st ock , an d N . D ean , N ew r esu l t s on t h e r ect i l i n ear cr ossi n g nu m b er an d p l an e em b ed d i n g, J. Graph T heor y, 16 ( 1992) , 389–398. 3. B . B ol l ob ´a s, an d I . L ead er , E d ge-i sop er i m et r i c i n equ al i t i es i n t h e gr i d , Combinatorica, 11 ( 1991) , 299–314. 4. T . K . D ey, I m p r ov ed b ou n d s for p l an ar k -set s an d r el at ed p r ob l em s, Discrete and Computational Geometr y, 19 ( 1998) , 373–382. 5. J . D i B at t i st a, P. E ad es, R . T am assi a, an d I . G . T ol l i s, G r ap h D r aw i n g. A l gor i t h m s for t h e V i su al i zat i on of G r ap h s, P r ent i ce H al l , 1999, 432 p p . 6. H . G azi t , an d G . M i l l er , P l an ar sep ar at or s an d E u cl i d ean n or m , Algorithms, Proc. I nt. Symp. SI GAL ’90, L N C S 450, 1990, 338–347. 7. G . E v en , S. G u h a, an d B . Sch i eb er , I m p r ov ed ap p r ox i m at i on s of cr ossi n gs i n gr ap h d r aw i n gs an d V L SI l ay ou t ar eas, ST OC, 2000, 296–305. ( Fu l l v er si on t o ap p ear i n SI C O M P.) 8. P. C . K ai n en , T h e b ook t h i ck n ess of a gr ap h I I , Congressus Numerantium, 71 ( 1990) , 121–132. 9. F . T . L ei ght on , Complexity I ssues in VLSI , M I T P r ess, 1983. 10. L . A . Sz´ek el y, C r ossi n g nu m b er p r ob l em s an d h ar d E r d ˝o s p r ob l em s i n d i scr et e geom et r y, Combinatorics, Probability, and Computing, 6 ( 1998) , 353–358. 11. J . P ach , an d P. K . A gar w al , Combinatorial Geometr y, W i l ey & Son s, N Y , 1995. 12. J . P ach , J . Sp en cer , an d G . T ´o t h , N ew b ou n d s for cr ossi n g nu m b er s, Discrete and Computational Geometr y, 24 ( 2000) , 623–644. 13. H . P u r ch ase, W h i ch aest h et i c h as t h e gr eat est eff ect on hu m an u n d er st an d i n g?, i n : P r oc. Symposium on Graph Drawing, GD’97, L ect u r e N ot es i n C om p u t er Sci en ce 1353 ( Sp r i n ger , 1997) , 248–261. 14. F . Sh ah r ok h i , O . S´y k or a, L . A . Sz´ek el y, an d I . V r t ’ o, C r ossi n g nu m b er s: b ou n d s an d ap p l i cat i on s, i n : I ntuitive Geometr y, B ol y ai Soci et y M at h em at i cal St u d i es 6 , ( I . B ´a r a ´ ny an d K . B ¨o r o ¨ czk y, ed s.) , A kad´em i a K i ad ´o , B u d ap est , 1997, 179–206. 15. F . Sh ah r ok h i , O . S´y k or a, L . A . Sz´ek el y, an d I . V r t ’ o, T h e b ook cr ossi n g nu m b er of gr ap h s, J. Graph T heor y, 21 ( 1996) , 413–424.
On Spectral Graph Drawing Yehuda Koren Dept. of Computer Science and Applied Mathematics The Weizmann Institute of Science, Rehovot, Israel [email protected]
Abstract. The spectral approach for graph visualization computes the layout of a graph using certain eigenvectors of related matrices. Some important advantages of this approach are an ability to compute optimal layouts (according to specific requirements) and a very rapid computation time. In this paper we explore spectral visualization techniques and study their properties. We present a novel view of the spectral approach, which provides a direct link between eigenvectors and the aesthetic properties of the layout. In addition, we present a new formulation of the spectral drawing method with some aesthetic advantages. This formulation is accompanied by an aesthetically-motivated algorithm, which is much easier to understand and to implement than the standard numerical algorithms for computing eigenvectors.
1
Introduction
A graph G ( V , E ) is an abstract structure that is used to model a relation E over a set V of entities. Graph drawing is a standard means for visualizing relational information, and its ultimate usefulness depends on the readability of the resulting layout, that is, the drawing algorithm’s ability to convey the meaning of the diagram quickly and clearly. To date, many approaches to graph drawing have been developed [4,8]. There are many kinds of graph-drawing problems, such as drawing di-graphs, drawing planar graphs and others. Here we investigate the problem of drawing undirected graphs with straight-line edges. In fact, the methods that we utilize are not limited to traditional graph drawing and are also intended for general low dimensional visualization of a set of objects according to their pair-wise similarities (see, e.g., Fig. 2). We have focused on spectral graph drawing methods, which construct the layout using eigenvectors of certain matrices associated with the graph. To get some feeling, we provide results for three graphs in Fig. 1. This spectral approach is quite old, originating with the work of Hall [6] in 1970. However, since then it has not been used much. In fact, spectral graph drawing algorithms are almost absent in the graph-drawing literature (e.g., they are not mentioned in the two books [4,8] that deal with graph drawing). It seems that in most visualization research the spectral approach is difficult to grasp in terms of aesthetics. Moreover, the numerical algorithms for computing the eigenvectors do not possess an intuitive aesthetic interpretation. We believe that the spectral approach has two distinct advantages that make it very attractive. First, it provides us with an exact solution to the layout problem, whereas almost all other formulations result in an NP-hard problem, which can only be approximated. The second advantage is computation speed. Spectral drawings can be computed T. Warnow and B. Zhu (Eds.): COCOON 2003, LNCS 2697, pp. 496–508, 2003. c Springer-Verlag Berlin Heidelberg 2003
On Spectral Graph Drawing
497
extremely fast as we have shown in [9]. This is very important because the amount of information to be visualized is constantly growing exponentially.
(a)
(b)
(c)
Fig. 1. Drawings obtained from the Laplacian eigenvectors. (a) The 4970 graph. |V | = 4970, |E | = 7400. (b) The 4elt graph. |V | = 15606, |E | = 45878. (c) The Crack graph. |V | = 10240, |E | = 30380.
Spectral methods have become standard techniques in algebraic graph theory; see, e.g., [3]. The most widely used techniques utilize eigenvalues and eigenvectors of the adjacency matrix of the graph. More recently, the interest has shifted somewhat to the spectrum of the closely related Laplacian. In fact, Mohar [11] claims that the Laplacian spectrum is more fundamental than this of the adjacency matrix. Related areas where the spectral approach has been popularized include clustering [13], partitioning [12], and ordering [7]. However, these areas use discrete quantizations of the eigenvectors, unlike graph drawing, which employs the eigenvectors without any modification. Regarding this aspect, it is more fundamental to explore properties of graph-related eigenvectors in the framework of graph drawing. In this paper we explore the properties of spectral visualization techniques, and provide different explanations for their ability to draw graphs nicely. Moreover, we have modified the usual spectral approach. The new approach uses what we will call degreenormalized eigenvectors, which have aesthetic advantages in certain cases. We provide an aesthetically-motivated algorithm for computing the degree-normalized eigenvectors. Our hope is that this will eliminate the vagueness of spectral methods and will contribute to their recognition as an important tool in the field of graph-drawing and informationvisualization.
2
Basic Notions
A graph is usually written G ( V , E ) , where V = { 1 . . . n } is the set of n nodes, and E is the set of edges. Each edge i , j is associated with a non-negative weight w i j that reflects the similarity of nodes i and j . Thus, more similar nodes are connected
498
Y. Koren
with “heavier" edges. Henceforth, we will assume w i j = 0 for any non-adjacent pair of nodes. Let us denote the neighborhood of i by N ( i ) = { j | i , j ∈ E } . The degree of d ef w i j . Throughout the paper we have assumed, without loss node i is d e g ( i ) = j N (i) of generality, that G is connected, otherwise the problem we deal with can be solved independently for each connected component. The adjacency-matrix of the graph G is the symmetric n × n matrix A G , where ∈
A
0
G ij
=
i = j
i, j = 1, . . . , n.
w i j i = j
We will often omit the G in A G . The Laplacian is another symmetric n × by L G , where L
G ij
d eg ( i ) i =
=
−
wij
n
matrix associated with the graph, denoted
j
i, j = 1, . . . , n.
i = j
Again, we will often omit the G in L G . The Laplacian is positive semi-definite, and its d ef only zero eigenvalue is associated with the eigenvector 1 n = ( 1 , 1 , . . . , 1 ) T ∈ Rn . The usefulness of the Laplacian stems from the fact that the quadratic form associated with it is just a weighted sum of all pairwise squared distances: Lemma 1. Let L be an n
×
n x
Laplacian, and let x
T
wij (xi
Lx =
−
∈
Rn . Then 2
xj ) .
i< j
The proof of this lemma is direct. Throughout the paper we will use the convention 0 = λ 1 < λ 2 ≤ . . . ≤ λ n for the eigenvalues of L , and denote the corresponding real orthonormal eigenvectors by √ v1 = ( 1 / n ) · 1 n , v2 , . . . , vn . Let us define the degrees matrix as the n × n diagonal matrix D that satisfies D i i = d e g ( i ) . Given a degrees matrix, D , and a Laplacian, L , then a vector u and a scalar µ are termed generalized eigen-pairs of ( L , D ) if L u = µ D u . Our convention is to denote the generalized eigenvectors of ( L , D ) by α · 1 n = u 1 , u 2 , . . . , u n , with corresponding generalized eigenvalues 0 = µ 1 < µ 2 · · · µ n . (Thus, L u i = µ i D u i , i = 1 , . . . , n .) To uniquely define u 1 , u 2 , . . . , u n , we require them to be D -normalized: so u Ti D u i = 1 , i = 1 , . . . n . We term these generalized eigenvectors the degree normalized eigenvectors. It can be shown (see Appendix A) that all the generalized eigenvalues are real non-negative, and that all the degree normalized eigenvectors are D -orthogonal, i.e. u Ti D u j = 0 , ∀ i = j .
3
Spectral Graph Drawing
The earliest spectral graph-drawing algorithm was that of Hall [6]; it uses the low eigenvectors of the Laplacian. Henceforth, we will refer to this method as the eigen-projection method. A few other researchers utilize the top eigenvectors of the adjacency matrix instead of those of the Laplacian. E.g., the work of [10], which uses the adjacency matrix
On Spectral Graph Drawing
499
eigenvectors to draw molecular graphs. Recently, eigenvectors of a modified Laplacian were used in [1] for the visualization of bibliographic networks. In fact, for regular graphs of uniform degree d eg , the eigenvectors of the Laplacian equal those of the adjacency matrix, but in a reversed order, because L = d eg · I − A , and adding the identity matrix does not change eigenvectors. However, for non-regular graphs, use of the Laplacian is based on a more solid theoretical basis, and in practice also gives nicer results than those obtained by the adjacency matrix. Hence, we will focus on visualization using eigenvectors of the Laplacian. 3.1
Derivation of the Eigen-Projection Method
We will introduce the eigenprojection method as a solution to a minimization problem. We begin by deriving a 1-D drawing, and then we show how to draw in more dimensions. Given a weighted graph G ( V , E ) , we denote its 1-D layout by x ∈ Rn , where x ( i ) is the location of node i . We take x as the solution of the following constrained minimization problem d ef 2 m in E (x ) = wij (x(i) − x(j )) (1) x
i ,j
given: V a r ( x )
=
∈
E
1,
n 2 (x(i) − x ¯ ) , where V a r ( x ) is the variance of x , defined as usual by V a r ( x ) = n1 i= 1 and where x¯ is the mean of x . The energy to be minimized, E ( x ) , strives to make edge lengths short. Since the sum is weighted by edge-weights, “heavy" edges have a stronger impact and hence will be typically shorter. The constraint V a r ( x ) = 1 requires that the nodes be scattered in the drawing area, and prevents an overcrowding of the nodes at the same point. Note that the choice of variance 1 is arbitrary, and simply states the scale of the drawing. We could equally have chosen a constraint of the form V a r ( x ) = c . In this way, if x 0 is the √ optimal solution of variance 1, then c · x 0 is the optimal solution of variance c . Such a representation of the problem reminds the force-directed graph drawing approach (see [4,8]), where the energy to be minimized replaces the “attractive forces", and the variance constraint takes the role of the “repulsive forces". The energy and the constraint are invariant under translation (ensure that for every α : E ( x ) = E ( x + α · 1 n ) , V a r ( x ) = V a r ( x + α · 1 n ) ). We eliminate this degree of n freedom by requiring that the mean of x is 0, i.e. i = 1 x ( i ) = x T · 1 n = 0 . This is very convenient since now the variance can be written in a simple form: V a r ( x ) = n1 x T x . To simplify the notation we will change the scale, and require the variance to be n1 , which n is equivalent to x T x = x (i)2 = 1. i= 1 T Using Lemma 1, we can2 write the energy in a matrix form: E ( x ) = x L x = w i j · ( x ( i ) − x ( j ) ) . Now the desired 1-D layout, x , can be described as the i ,j E solution of the constrained minimization problem
∈
m in x
T
(2)
Lx
x
given: x T
x = 1
in the subspace: x T
· 1n =
0.
500
Y. Koren
Let us substitute B = I in Claim A (in Appendix A), to obtain the optimal solution the second smallest eigenvector of L . To achieve a 2-D drawing, we need to compute an additional vector of coordinates, y . Our requirements for y are the same as those that we required from x , but in addition there must be no correlation between y and x , so that the additional dimension will provide us with as much new information as possible1 . Since x and y are centered, we simply have to require that y T · x = y T · v 2 = 0 . Hence y is the solution of the constrained minimization problem
x = v2 ,
m in y
T
(3)
Ly
y
given: y T
y = 1
in the subspace: y T
· 1n =
0, y
T
·
v2 = 0 .
Again, use Claim A so that the optimal solution is y = v 3 , the third smallest eigenvector of L . In order to obtain a k -D drawing of the graph, we take the first coordinate of the nodes to be v 2 , the second coordinate to be v 3 , and in general, we define the i -th coordinate of the nodes by v i + 1 .
4
Drawing Using Degree-Normalized Eigenvectors
In this section we introduce a new spectral graph drawing method that associates the coordinates with some generalized eigenvectors of the Laplacian. Suppose that we weight nodes by their degrees, so the mass of node i is its degree — d e g ( i ) . Now if we take the original constrained minimization problem (2) and weight sums according to node masses, we get the following degree-weighted constrained minimization problem (where D is the degrees matrix) m in x
T
(4)
Lx
x
given: x T
Dx = 1
in the subspace: x T
D 1n = 0.
Substitute B = D in Claim A to obtain the optimal solution x = u 2 , the second smallest generalized eigenvector of ( L , D ) . Using the same reasoning as in Subsection 3.1, we obtain a k -D drawing of the graph, by taking the first coordinate of the nodes to be u 2 , the second coordinate to be u 3 , and in general, we define the i -th coordinate of the nodes by u i + 1 . We will show by several means that using these degree-normalized eigenvectors is more natural than using the eigenvectors of the Laplacian. In fact Shi and Malik [13] have already shown that the degree-normalized eigenvectors are more suitable for the problem of image segmentation. For the visualization task, the motivation and explanation are very different. 1
The strategy to require no correlation between the axes is used in other visualization techniques like Principal Components Analysis [15] and Classical Multidimensional Scaling [15].
On Spectral Graph Drawing
501
In order to gain some intuition on (4), we shall rewrite it in the equivalent form: xT L x m in x
(5)
xT D x
in the subspace: x T
D 1n = 0.
It is straightforward to show that a solution of (4) is also a solution of (5). In problem (5) the denominator moderates the behavior of the numerator, as we are showing now. The numerator strives to place those nodes with high degrees at the center of the drawing, so that they are in proximity to the other nodes. On the other hand, the denominator also emphasizes those nodes with high degrees, but in the reversed way: it strives to enlarge their scatter. The combimation of these two opposing goals, helps in making the drawing more balanced, preventing a situation in which nodes with lower degrees are overly separated from the rest nodes. Another observation is that degree-normalized eigenvectors unify the two common spectral techniques: the approach that uses the Laplacian and the approach that uses the adjacency matrix. To see this, use the fact that L = D − A and write L u = µ D u as ( D − A ) u = µ D u . By changing sides, we get A u = ( 1 − µ ) D u . Thus, the generalized eigenvectors of ( L , D ) are also the generalized eigenvectors of ( A , D ) , with a reversed order. In this way, when drawing with degree normalized eigenvectors, we can take either the low generalized eigenvectors of the Laplacian, or the top generalized eigenvectors of the adjacency matrix, without affecting the result. The degree-normalized eigenvectors are also the (non-generalized) eigenvectors of the matrix D 1 A . This can be obtained by left-multiplying the generalized eigenequation A x = µ D x by D 1 , obtaining the eigen-equation −
−
D
− 1
A x = µx.
(6)
Note that D 1 A is known as the transition matrix of a random walk on the graph G . Hence, the degree-normalized eigen-projection uses the top eigenvectors of the transition matrix to draw the graph. Regarding drawing quality, for graphs that are close to being regular, we have observed not much difference between drawing using eigenvectors and drawing using degree-normalized eigenvectors. However, when there are marked deviations in node degrees, the results are quite different. This can be directly seen by posing the problem as in (5). Here, we provide an alternative explanation based on (6). Consider the two edges e 1 and e 2 . Edge e 1 is of weight 1, connecting two nodes, each of which is of degree 10. Edge e 2 is of weight 10, connecting two nodes, each of which is of degree 100. In the Laplacian matrix, the entries corresponding to e 2 are 10 times larger than those corresponding to e 1 . Hence we expect the drawing obtained by the eigenvectors of the Laplacian, to make the edge e 2 much shorter than e 1 (here, we do not consider the effect of other nodes that may change the lengths of both edges). However, for the transition matrix in (6), the entries corresponding to these two edges are the same, hence we treat them similarly and expect to get the same length for both edges. This reflects the fact that the relative importance of these two edges is the same, i.e. 110 . In many kinds of graphs numerous scales are embedded, which indicates the existence of dense clusters and sparse clusters. In a traditional eigen-projection drawing, −
502
Y. Koren
dense clusters are drawn extremely densely, while the whole area of the drawing is used to represent sparse clusters or outliers. This is the best way to minimize the weighted sum of square edge lengths, while scattering the nodes as demanded. A better drawing would allocate each cluster an adequate area. Frequently, this is the case with the degree normalized eigenvectors that adjust the edge weights in order to reflect their relative importance in the related local scale. For example, consider Fig. 2, where we visualize 300 odors as measured by an electronic nose. Computation of the similarities between the odors is given in [2]. The odors are known to be classified into 30 groups, which determine the color of each odor in the figure. Figure 2(a) shows the visualization of the odors by the eigenvectors of the Laplacian. As can be seen, each of the axes shows one outlying odor, and places all the other odors about at the same location. However, the odors are nicely visualized using the degree normalized eigenvectors, as shown in Fig. 2(b).
1 0.8 0.8
0.6
0.6
0.4
0.4
0.2 0
0.2
−0.2
0
−0.4 0
0.2
0.4
0.6
0.8
−0.5
1
0
(a)
0.5
1
(b)
Fig. 2. Visualization of 300 odor patterns as measured by an electronic nose. (a) A drawing using the eigenvectors of the Laplacian. (b) A drawing using the degree-normalized eigenvectors.
5 An Optimization Process An attractive feature of the degree-normalized eigenvectors is that they can be computed by an intuitive algorithm, which is directly related to their aesthetic properties. This is unlike the (non generalized) eigenvectors, which are computed using methods that are difficult to interpret in aesthetic terms. Now we will derive the algorithm. Differentiating E ( x ) with respect to x ( i ) gives ∂ ∂x E( i ) = 2 j N ( i ) w i j ( x ( i ) − x ( j ) ) . Equating this to zero and isolating x ( i ) we get ∈
x(i) =
j ∈
N (i)
wij x(j )
.
d eg ( i )
Hence, when allowing only node i to move, the location of i that minimizes E ( x ) is the weighted centroid of i ’s neighbors.
On Spectral Graph Drawing
503
This induces an optimization process that iteratively puts each node at the weighted centroid of its neighbors (simultaneously for all nodes). The aesthetic reasoning is clear. A rather impressive fact is that when initialized with a vector D -orthogonal to 1 n , this algorithm converges in the direction of a non-degenerate degree-normalized eigenvector of L . More precisely, it converges either in the direction of u 2 or that of u n . We can prove this surprising fact by observing that the action of putting each node at the weighted centroid of its neighbors is equivalent to multiplication by the transition matrix — D 1 A . Thus, the process we have described can be expressed in a compact form as the sequence −
x0 xi+
= 1
=
random vector, s.t. D
− 1
x T0 D 1 n = 0
Axi .
This process is known as the Power-Iteration [5]. In general, it computes the “dominant" eigenvector of D 1 A , which is the one associated with the largest-in-magnitude eigenvalue. In our case, all the eigenvectors are D -orthogonal to the “dominant" eigenvector — 1 n , and also the initial vector, x 0 , is D -orthogonal to 1 n . Thus, the series converges in the direction of the next dominant eigenvector, which is either u 2 , which has the largest positive eigenvalue, or u n , which possibly has the largest negative eigenvalue. (We assume that x 0 is not D -orthogonal to u 2 or to u n , which is nearly always true for a randomly chosen x 0 ) In practice, we want to ensure convergence to u 2 (avoiding convergence to u n ). We use the fact that all the eigenvalues of the transition matrix are in the range [ − 1 , 1 ] . Now it is possible to shift the eigenvalues by adding the value 1 to each of them, so that they are all positive, thus preventing convergence to an eigenvector with a large negative eigenvalue. This is done by working on the matrix I + D 1 A instead of the matrix D 1 A . In this way the eigenvalues are in the range [ 0 , 2 ] , while eigenvectors are not changed. In fact, it would be more intuitive to scale the eigenvalues to the range [ 0 , 1 ] , so we will actually work with the matrix 12 ( I + D 1 A ) . If we use our initial “intuitive" notions, this means a more careful process. In each iteration, we put each node at the average between its old place and the centroid of its neighbors. Thus, each node absorbs its new location not only from its neighbors, but also from its current location. The full algorithm for computing a k -D drawing is given in Fig. 3. To compute a degree-normalized eigenvector u j , we will use the principles of the power-iteration and the D -orthogonality of the eigenvectors. Briefly, we pick some random x , such that x is D -orthogonal to u 1 , . . . , u j 1 , i.e. x T D u 1 = 0 , . . . , x T D u j 1 = 0 . Then, if 1 1 1 x T D u j = 0 , it can be proved that the series 2 ( I + D 1 A ) x , ( 2 ( I + D 1 A ) ) 2 x , ( 2 ( I + 1 3 D A ) ) x , . . . converges in the direction of u j . Note that in theory, all the vectors in this series are D -orthogonal to u 1 , . . . , u j 1 . However, to improve numerical stability, our implementation imposes the D -orthogonality to previous eigenvectors in each iteration. The power iteration algorithm produces vectors of diminishing (or exploding) norms. Since we are only interested in convergence in direction, it is customary to re-scale the vectors after each iteration. Here, we will re-scale by normalizing the vectors to be of length 1. −
−
−
−
−
−
−
−
−
−
504
Y. Koren
Function SpectralDrawing (G – the input graph, k – dimension) % This function computes u 2 , . . . , u k , the top (non-degenerate) eigenvectors of D const ǫ ← 1 0 − 7 % tolerance
for i
.
2
←
uˆ i
A
to k do random % random initialization
=
uˆ i
−1
←
uˆ uˆ
i i
do ui
uˆ i ←
% D -Orthogonalize against previous eigenvectors:
for j ui
1
to i
ui
−
= ←
− u u
T i T j
do
1
D u
j
D u
j
uj
end for % multiply with 12 ( I +
for j
=
1
uˆ i ( j )
to n do 1
←
D
2
·
ui (j ) +
−1
):
A
k
∈
N
(j ) w
j k
ui (k)
d eg ( j )
end for uˆ i ←
while uˆ i ui ←
uˆ uˆ
·
i i
% normalization
ui < 1
−
ǫ
% halt when direction change is negligible
uˆ i
end for return u 2 , . . . , u k Fig. 3. The algorithm for computing degree-normalized eigenvectors
The convergence rate of this algorithm when computing u i is dependent on the ratio 1 . In practice, we embedded this algorithm in a multi-scale construction, resulting in extremely fast convergence. The multi-scale ascheme is explained in [9]. µi/ µi+
6 A Direct Characterization of Spectral Layouts So far, we have derived spectral methods as solutions of optimization problems, or as a limit of a drawing process. In this section we characterize the eigenvectors themselves, in a rather direct manner, to clarify the aesthetic properties of the spectral layout. Once again the degree-normalized eigenvectors will appear as the more natural way for spectral graph drawing. As we have seen, the quadratic form E ( x ) = w i j ( x ( i ) − x ( j ) ) 2 , which i ,j E motivates spectral methods, is tightly related to the aesthetic criterion that calls for placing each node at the weighted centroid of its neighbors. When the graph is connected, it can be strictly achieved only by the degenerate solution that puts all nodes at the same location. Hence, to incorporate this aesthetic criterion into a graph drawing algorithm, it should be modified appropriately. Presumably the earliest graph drawing algorithm, formulated by Tutte [14], is based on placing each node on the weighted centroid of its neighbors. To avoid the degenerate
∈
On Spectral Graph Drawing
505
solution, Tutte arbitrarily chose a certain number of nodes to be anchors, i.e. he fixed their coordinates in advance. Those nodes are typically drawn on the boundary. This, of course, prevents the collapse; however it raises new problems, such as which nodes should be the anchors, how to determine their coordinates, and why after all such an anchoring mechanism should generate nice drawings. An advantage of Tutte’s method is that in certain cases, it can guarantee achieving a planar drawing. Tutte treats in different ways the anchored nodes and the remaining nodes. Whereas the remaining nodes are located exactly at the centroid of their neighbors, nothing can be said about anchored nodes. In fact, in several experiments we have seen that the anchored nodes are located quite badly. Alternatively, we do not use different strategies for dealing with two kinds of nodes, but rather, we treat all the nodes similarly. The idea is to gradually increase the deviations from centroids of neighbors as we move away from the origin (that is the center of the drawing). This reflects the fact that central nodes can be placed exactly at their neighbors’ centroid, whereas boundary nodes must be shifted outwards. More specifically, node i , which is located in place x ( i ) , is shifted from the center toward the boundary by the amount of µ · |x ( i ) | , for some µ > 0 . Formally, we request the layout x to satisfy, for every 1 i n x(i)
j
N (i) ∈
wij x(j )
=
−
µ
·
x(i) .
d eg ( i )
Note that the deviation from the centroid is always toward the boundary, i.e. toward + ∞ for positive x ( i ) and toward − ∞ for negative x ( i ) . In this way we prevent a collapse at the origin. We can represent all these n requests compactly in a matrix form, by writing D
− 1
L x = µx .
Left-multiplying both sides by D , we obtain the familiar generalized eigen-equation L x = µD x .
We conclude with the following important property of degree-normalized eigenvectors: Proposition 1. Let u be a generalized eigenvector of ( L , D ) , with associated eigenvalue µ . Then, for each i , the exact deviation from the centroid of neighbors is u(i)
j ∈
N (i)
wij u(j )
−
=
µ
·
u(i) .
d eg ( i )
Note that the eigenvalue µ is a scale-independent measure of the amount of deviation from the centroids. This provides us with a fresh new interpretation of the eigenvalues that is very different from the one given in Subsection 3.1, where the eigenvalues were shown as the amount of energy in the drawing. Thus, we deduce that the second smallest degree-normalized eigenvector produces the non-degenerate drawing with the smallest deviations from centroids, and that the third smallest degree-normalized eigenvector is the next best one and so on. Similarly, we can obtain a related result for eigenvectors of the Laplacian:
506
Y. Koren
Proposition 2. Let v be an eigenvector of L , with associated eigenvalue λ . Then, for each i , the exact deviation from the centroid of neighbors is v(i)
j ∈
N (i)
wij v(j )
−
=
λ
· d eg ( i )
− 1
·
v(i) .
d eg ( i )
Hence for eigenvectors of the Laplacian, the deviation between a node and the centroid of its neighbors gets larger as the node’s degree decreases.
7
Discussion
In this paper we have presented a spectral approach for graph drawing, and justified it by studying three different viewpoint for the problem. The first viewpoint describes a classical approach for achieving graph layouts by solving a constrained energy minimization problem. This is much like force directed graph drawing algorithms (for a survey refer to [4,8]). Compared with other force-directed methods, the spectral approach has two major advantages: (1) Its global optimum can be computed efficiently. (2) The energy function contains only O ( | E | ) terms, unlike the O ( n 2 ) terms appearing in almost all the other force-directed methods. A second viewpoint shows that the spectral drawing is the limit of an iterative process, in which each node is placed at the centroid of its neighbors. This viewpoint does not only sharpen the nature of spectral drawing, but also provides us with an aestheticallymotivated algorithm. This is unlike other algorithms for computing eigenvectors, which are rather complicated and far from having an aesthetic interpretation. We have also introduced a third viewpoint, showing that spectral methods place each node at the centroid of its neighbors with some well defined deviation. This new interpretation provides an accurate and simple description of the aesthetic properties of spectral drawing. Another contribution of our paper is the introduction of a new spectral graph drawing algorithm, using what we have called degree-normalized eigenvectors. We have shown that this method is more natural in some aspects, and has aesthetic advantages for certain kinds of data.
References 1. U. Brandes and T. Willhalm, “Visualizing Bibliographic Networks with a Reshaped Landscape Metaphor", Proc. 4th Joint Eurographics – IEEE TCVG Symp. Visualization (VisSym ’02), pp. 159–164, ACM Press, 2002. 2. L. Carmel, Y. Koren and D. Harel, “Visualizing and Classifying Odors Using a Similarity Matrix", Proceedings of the ninth International Symposium on Olfaction and Electronic Nose (ISOEN’02), IEEE, to appear, 2003. 3. F.R.K. Chung, Spectral Graph Theory, CBMS Reg. Conf. Ser. Math. 92, American Mathematical Society, 1997. 4. G. Di Battista, P. Eades, R. Tamassia and I.G. Tollis, Graph Drawing: Algorithms for the Visualization of Graphs, Prentice-Hall, 1999. 5. G.H. Golub and C.F. Van Loan, Matrix Computations, Johns Hopkins University Press, 1996.
On Spectral Graph Drawing
507
6. K. M. Hall, “An r -dimensional Quadratic Placement Algorithm", Management Science 17 (1970), 219–229. 7. M. Juvan and B. Mohar, “Optimal Linear Labelings and Eigenvalues of Graphs", Discrete Applied Math. 36 (1992), 153–168. 8. M. Kaufmann and D. Wagner (Eds.), Drawing Graphs: Methods and Models, LNCS 2025, Springer Verlag, 2001. 9. Y. Koren, L. Carmel and D. Harel, “ACE: A Fast Multiscale Eigenvectors Computation for Drawing Huge Graphs", Proceedings of IEEE Information Visualization 2002 (InfoVis’02), IEEE, pp. 137–144, 2002. 10. D.E. Manolopoulos and P.W. Fowler, “Molecular Graphs, Point Groups and Fullerenes", J. Chem. Phys. 96 (1992), 7603–7614. 11. B. Mohar, “The Laplacian Spectrum of Graphs", Graph Theory, Combinatorics, and Applications 2 (1991), 871–898. 12. A. Pothen, H. Simon and K.-P. Liou, “Partitioning Sparse Matrices with Eigenvectors of Graphs", SIAM Journal on Matrix Analysis and Applications, 11 (1990), 430–452. 13. J. Shi and J. Malik, “Normalized Cuts and Image Segmentation", IEEE Transactions on Pattern Analysis and Machine Intelligence, 22 (2000), 888–905. 14. W. T. Tutte, “How to Draw a Graph", Proc. London Math. Society 13 (1963), 743–768. 15. A. Webb, Statistical Pattern Recognition, Arnold, 1999.
A Solution of Constrained Quadratic Optimization Problems In this appendix we study a certain kind of constrained optimization problem, whose solution is a generalized eigenvector. We use two matrices: (1) A — an n × n real symmetric positive-semidefinite matrix. (2) B — an n × n diagonal matrix, whose diagonal entries are real-positive. (In fact, it is enough to require that matrix B is positive-definite.) We denote the generalized eigenvectors of ( A , B ) by u 1 , u 2 , . . . , u n , with corresponding eigenvalues 0 λ 1 λ 2 · · · λ n . Thus, A u i = λ i B u i , i = 1 , . . . , n . To uniquely define u 1 , u 2 , . . . , u n , we require them to be B -normalized, i.e. u Ti B u i = 1 , i = 1 , . . . , n . 1 Clearly, for every 1 i n , B 2 u i and λ i are an eigen-pair of the matrix 1 1 1 1 B 2 A B 2 . Note that B 2 A B 2 is a symmetric positive-semidefinite. Thus, all the eigenvalues are real non-negative, and all the generalized eigenvectors are B -orthogonal, i.e. u Ti B u j = 0 , ∀ i = j . Now we define a constrained optimization problem −
−
−
m in x
T
−
(7)
Ax
x
given: x T
Bx = 1
in the subspace: x T
B u1 = 0, . . . , x
Claim. The optimal solution of problem 7 is x λ k.
=
uk
T
B uk −
1
=
0.
, with an associated cost of x T
Ax =
Proof. By using the B -orthogonality u 1 , . . . , u n , we can decompose every x ∈ Rn of n as a linear combination where x = α i u i . Moreover, since x is constrained to be i= 1 B -orthogonal to u 1 , . . . , u k 1 , we can restrict ourselves to linear combinations of the n α i ui . form x = i= k −
508
Y. Koren
We use the constraint x T B x n T x
1 =
T
Bx = α
i
=
B
ui
α
i= k
n
α
i ui α
j
i
ui
n
α
α
i= k j = k
i
T
i α
j
α
i
B ui
=
i= k
n
ui B uj =
2
α
i= k j = k
n
ui
i= k
n
B uj =
n
=
i= k
n
=
to obtain n
1
i
.
i= k
The last equation stems from the B -orthogonality of u 1 , u 2 , . . . , u n , and from defining these vectors B -normalized. as n Hence, i = k α i2 = 1 (a generalization of Pythagoras’ Law). Now, we expand the quadratic form x T A x x
T
n
Ax = α
n
α
=
T
n
α
i
ui
α
i
λ
i
B ui
α i= k j = k
i
α
j
λ
i
ui α
i
A ui
=
(8)
i= k
n
n
n
α
=
i
ui α
λ
k
j
λ
B uj =
i
i= k j = k
n
i
T
i= k
n
α
n
=
i= k
i= k
=
λ
n
ui
i
i= k
A
ui
i
i= k
T
n
ui B uj = α i= k
2
i
λ
i
n
α
2
i
=
λ
k
.
i= k
Thus, for any x that satisfies the constraints, we have x T k , we can deduce that the minimizer is x = u k .
Ax
λ
k
. Since u Tk
A uk = ⊓⊔
O n a C o n je c t u r e o n W ie n e r I n d ic e s in C o m b in a t o r ia l C h e m is t r y Yih-En Andrew Ban 1 , Sergei Bespamyat nikh 2 , and Nabil H. Must afa 3 1
2
Depart ment of Biochemist ry, Duke University, Durham, NC, USA. Depart ment of Comput er Science, University of Texas at Dallas, T X, USA. 3 Depart ment of Comput er Science, Duke University, Durham, NC, USA. { aban, nabil} @cs.duke.edu, [email protected]
Drugs and ot her chemical compounds are oft en modeled as polygonal shapes called t he m olecu lar gr aph , which can be a pat h, a t ree, or in general any graph. An indicat or defined over t his molecular graph, t he W i en er i n dex , has been shown t o be st rongly correlat ed t o various chemical propert ies of t he compound. T he W iener index conject ure for t rees st at es t hat for any int eger n (except for a finit e set ), one can find a t ree wit h W iener index n . In t his paper, we present progress t owards proving t his conject ure by present ing a 4-paramet er family of t rees t hat we show experiment ally t o affi rm t he W iener index conject ure for very large values of n . Given an int eger n , we also present effi cient algorit hms for finding t he t ree whose W iener index is n . A b st ract .
1
I n t r o d u c t io n
Drugs and ot her chemical compounds are oft en modeled as various polygonal shapes — pat hs, t rees, graphs et c. Each vert ex in t he polygonal pat h or t ree represent s an at om of t he molecule, and covalent bonds between at oms are represent ed by edges between t he corresponding vert ices. T his polygonal shape derived from a chemical compound is oft en called it s m o lec u la r gra p h . As t he geomet ry of prot eins play an import ant role in det ermining t he funct ion of t he prot ein, so can t he t opological propert ies of t he molecular graphs of chemical compounds be correlat ed t o t heir chemical propert ies. For some t ime now, t he biochemical community has been using t opological indices in an at t empt t o correlat e a compounds molecular graph wit h experiment ally gat hered dat a regarding t he compounds charact erist ics. Usage of t opological indices in biology and chemist ry began in 1947 when chemist Harold Wiener developed t he most widely known t opological descript or, t he Wiener index, and used it t o det ermine physical propert ies of types of alkanes known as paraffi ns[13]. In general, t opological indices are one of t he oldest and most widely used descript ors in quant it at ive st ruct ure act ivity relat ionships: Quant it at ive st ruct ure act ivity relat ionships (QSAR) is a popular comput at ional biology paradigm in modern drug design [11]. It at t empt s t o encode biological act ivity such as inhibit ion or act ivat ion int o numerical measures by correlat ion of mass amount s of dat a from an init ial screening of hundreds or t housands T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 509–518, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
510
Y.-E.A. Ban, S. Bespamyat nikh, and N.H. Must afa
of candidat e drug compounds. T he dat a is mapped int o a st ruct ural “act ivity space” consist ing of various descript ors wit h t he hope t hat t hese spaces capt ure or est imat e propert ies of chemical compounds. Const ruct ions of new drugs t hen proceed by not ing t he desired act ivity spaces and creat ing new compounds which occupy t hose regions of space. Amongst t he t opological indices used as descript ors in QSAR, t he Wiener index is by far t he most popular index, as it has been shown t hat t he Wiener index has a st rong correlat ion wit h t he chemical propert ies of t he compound [4]. T herefore, t o const ruct a compound wit h a cert ain property correlat ed t o some Wiener index, t he ob ject ive becomes t o build subst ruct ures in t he t arget chemical compound giving t he compound t hat Wiener index. T his in t urn leads t o t he following import ant problem: given a Wiener index, find a compound wit h t hat Wiener index. An overwhelming ma jority of t he chemical applicat ions of t he Wiener index deal wit h chemical compounds t hat have acyclic organic molecules. T he molecular graphs of t hese compounds are t rees [7]. T herefore most of t he prior work on Wiener indices deals wit h t rees, relat ing t he st ruct ure of various t rees t o t heir Wiener indices (asympt ot ic bounds on t he Wiener indices of cert ain families of t rees, expect ed Wiener indices of random t rees et c.). For t hese reasons, we concent rat e on t he Wiener indices of t rees as well (see Dobrynin e t a l. [3] for a survey). 1 .1
P ro b le m D e fi n it io n
D e fi n it io n 1 ( W ie n e r In d e x ) . G iv e n a n u n d irec t ed gra p h G = ( V, E ) , d e n o t e by d ( v i , v j ) t h e le n gt h o f t h e sh o r t e st pa t h be t w ee n t w o d ist in c t v e r t ice s v i , v j ∈ V . T h e W ie n e r in d e x W ( G ) is d e fi n ed a s
d( vi , vj )
W (G ) = i
(1)
j > i
In t his paper, we will present result s on t he Wiener index problems where t he graph G is a t ree. While t he case of graphs has been solved, a ma jor conject ure in t his area is whet her every posit ive int eger is t he Wiener index of some t ree. C o n jec t u re 1 ( W ie n e r In d e x C o n je c t u re [6 , 1 0 ]) . Except for some finit e set , every posit ive int eger is t he Wiener index of some t ree.
Towards t his goal, we present a family of t rees and design fast effi cient algorit hms for t he Inverse Wiener problem, defined as follows [8]. P ro ble m 1 ( In v e rs e W ie n e r P ro b le m , P = ) . Given an int eger n , const ruct a
t ree whose Wiener index is n . An algorit hm for solving t he problem P = can be used t o verify t he above conject ure — t he algorit hm for problem P = can be applied n t imes t o verify t he conject ure up t o any int eger n . However, t here can be a fast er algorit hm, and so we int roduce t he following problem.
On a Conject ure on W iener Indices in Combinat orial Chemist ry
511
P ro ble m 2 ( In v e rs e W ie n e r C ov e rin g P ro b le m , P ≤ ) . Given an int eger n , for every i ≤ n const ruct a t ree wit h Wiener index i .
1 .2
P re v io u s W o rk
T he Wiener index for general graphs can be comput ed in t ime O ( | V | 2 log | V | + | E | | V | ) using any all-pairs short est pat hs algorit hm. For t rees, alt hough t he number of edges is O ( n ), t he number of pairs of vert ices is st ill O ( n 2 ). However, t he Wiener index of a t ree can be comput ed in O ( n ) t ime, t hrough a plet hora of comput at ional met hods [2,12]. T he inverse Wiener problem is easily solvable for graphs: given an int eger n , t here always exist s a graph G such t hat W ( G ) = n , and it is comput able in const ant t ime. T his was shown by Goldman e t a l. [6]. However, once t he graph is rest rict ed t o t rees, Goldman e t a l. not e t hat t he problem becomes complicat ed and t he complexity is unknown. In fact , t he complexity of t his quest ion is left unsolved in Gut man and Yeh [8], and conject ured t hat apart from a finit e set , all int egers do have corresponding t rees wit h t he required Wiener indices. Lat er Lepovi´c and Gut man [10] present ed an exhaust ive search algorit hm t hat verifies t his conject ure up t o int eger 1206, st ill leaving t he Inverse Wiener conject ure open. Goldman e t a l. at t empt t o solve P = by defining a recurrence relat ion on Wiener indices of t rees by using dynamic programming t o const ruct t rees from smaller subt rees. Using t heir algorit hm, t hey are able t o verify t he above conject ure for int egers up t o 10,000. However, t he Inverse Wiener conject ure remains open. 1 .3
O u r R e s u lt s
We present progress t owards proving t he Wiener index conject ure by experiment ally showing t hat searching all possible t rees is not necessary — a small paramet erized subset suffi ces. More specifically, we present a family of t rees, F , and several effi cient algorit hms for t he problem P = using a decomposit ion by sort ed sequences in t ime O ( n k ), where k is a decomposit ion paramet er. We present empirical result s on t he effi ciency of t his algorit hm, indicat ing t hat t his algorit hm is o rd e r s of magnit ude fast er. Finally, we present several effi cient algorit hms for t he problem P ≤ , and give empirical result s showing t hat it is fast er √ by a fact or of O ( n ) t han t he naive implement at ion.
2
F a m ily o f T r e e s
First , we st at e t hat given a t ree T = ( V, E ), one can assign int eger weight s t o t he edges of t he t ree such t hat t he sum of t he edge weight s is exact ly t he Wiener index of t he t ree. Le m m a 1 ( D o b ry n in w e igh t s w ( e) fo r ea c h e
[3 ]) . G iv e n a t ree T = ( V, E ) , o n e ca n a ssign w ( e) . E su c h t h a t W ( T ) = e∈ E
e t a l. ∈
512
Y.-E.A. Ban, S. Bespamyat nikh, and N.H. Must afa
Define T k ( r 1 , . . . , r k ) be a t ree of o rd e r k where V =
{
s1 , . . . , sk }
∪
t 11 , . . . , t 1r 1 , . . . , t k1 , . . . , t kr k
( s i , s i + 1 ) , 1 ≤ i ≤ ( k − 1) } ∪ { ( t jl , s j ) , 1 ≤ j ≤ k , 1 ≤ l ≤ r j } . r i + k . Tree T k is t hus defined by k paramet ers r i , i = Not e t hat m = | V | = i 1 . . . k . It can be shown t hat t he Wiener index of T k is: E =
W
{
(T k (r 1 , . . .
, r k ))
=
k −1 i= 1
i k ( (r j ) + i ) · ( ( r j ) + ( k − i )) j=1
j = i+ 1
+ (m −
k
)( m − 1)
Le m m a 2 . T h e W ie n e r in d e x o f a t ree o f o rd e r k ca n be co m p u t ed in O ( k ) t im e .
i k r . Numbers X i and Yi can be Proof. Let X i = r , and Yi = j = i+ 1 j j = 1 j comput ed in O ( k ) t ime, for all 1 ≤ i ≤ k in an increment al fashion. Hence W ( T k ( r 1 , . . . , r k )) can be comput ed O ( k ) t ime. We omit det ails, but we have verified t hat int egers up t o 108 , except for a few numbers, can be represent ed as W ( T k ), for some k , leading us t o st at e t he following. C o n jec t u re 2 . Except a set S 1 (Table 1) of 56 numbers be represent ed by W ( T k ).
≤
193, all int egers can
Act ually, our experiment s indicat e t hat all numbers n , 103 ≤ n ≤ 108 , can be present ed by W ( T k ), where k ≤ 5. However, it seems t hat t he Wiener indices of t he t rees T k , k ≤ 4, do not cover all int egers (except a finit e set ). Based on t he above result s, we st rengt hen conject ure 2 by replacing t he infinit e family of t rees T k by a single family of t rees for k = 5. C o n jec t u re 3 . Except a set S 2 (Table 1) of 102 numbers be represent ed by W ( T 5 ).
≤
557, all int egers can
We recall Lagrange’s T heorem in number t heory, t hat every int eger can be represent ed as a sum of four squares [9]. For example, t he polynomial for t he Wiener index (in t erms of r i ) for T 5 ( r 1 , . . . , r 5 ) consist s o n ly of quadrat ic and linear t erms. T hat gives t he int uit ion t hat a properly chosen four paramet er family of t rees might be suffi cient t o represent any Wiener index. One way t o remove one paramet er would be t o impose a const raint on t he funct ion W ( T 5 ). Aft er some experiment at ion, we discovered t hat t he const raint r 1 = r 5 st ill allows for t he represent at ion of all int egers t est ed as Wiener indices, except for a cert ain finit e set . Consider t he family of t rees T 5 ( r 1 , . . . , r 5 ) such t hat r 1 = r 5 . We denot e t his family of t rees by F ( · ), where F ( r 1 , r 2 , r 3 , r 4 ) = T 5 ( r 1 , r 2 , r 3 , r 4 , r 1 ). T hen simplifying t he Wiener formula for W ( T 5 ( r 1 , . . . , r 5 )) gives, W ( F ( r 1 , r 2 , r 3 , r 4 )) = r 1 · (8r 1 + 8r 2 + 8r 3 + 8r 4 + 28)
+ r 2 · ( r 2 + 3r 3 + 4r 4 + 11) + r 3 · ( r 3 + 3r 4 + 10) + r 4 · ( r 4 + 11) + 20.
(2)
On a Conject ure on W iener Indices in Combinat orial Chemist ry
C o n jec t u re 4 . Except a set S 3 (Table 1) of 181 numbers be represent ed by W ( F ).
3
≤
513
1177, all int egers can
A lg o r it h m fo r t h e P r o b le m P =
In t his sect ion we present algorit hms for finding t rees whose Wiener index is n , given t he int eger n as input t o t he algorit hm. First , observe t hat t he value of each r i is bounded in t erms of n . C la im . Given an int eger n , any t ree T of family F ( r 1 , r 2 , r 3 , r 4 ) wit h W ( T ) = n √ n. must have 0 ≤ r i ≤
Recall t hat each t ree in F ( · ) is defined by four paramet ers r 1 , r 2 , r 3 and r 4 . Given n , t he ob ject ive is t o find a t ree T ∈ F ( · ) such t hat W ( T ) = n . We call t he set of all 4-t uples ( r 1 , r 2 , r 3 , r 4 ) t he co n fi gu ra t io n spa ce of W ( F ( · )). To find a given int eger n , we want t o search t his configurat ion space. T he st raight forward way of comput ing F ( · ) is t o exhaust ively t raverse t his configurat ion space, i.e. it erat e over all possible r i ’s, and comput e W ( T ) for each 4-t uple. By t he above Claim, t he running t ime is O ( n 2 ). However, on examining Equat ion 2, one finds t hat t he equat ion is monot one in all paramet ers r i . T herefore, a fast algorit hm is as follows. It erat e over all values of r 1 , r 2 , and r 3 . So suppose t hat r 1 , r 2 and r 3 are some fixed const ant s, say c1 , c2 and c3 respect√ ively. Perform t he binary search over t he sequence n , t o find if W ( T ) = n for some value of r 4 . T he W ( F ( c1 , c2 , c3 , r 4 )), 0 ≤ r 4 ≤ running t ime t herefore reduces t o O ( n 3 / 2 log n ). T he running t ime can be furt her reduced t o O ( n 3 / 2 ) using Frederickson and J ohnson’s searching t echnique [5]. 3 .1
D e c o m p o s it io n U s in g S o rt e d S e q u e n c e s
We now analyze t he st ruct ure of Equat ion 2 more closely and use it t o present an even more effi cient algorit hm for our problem. T he first t hing t o not e is t he symmet ry of t he equat ion between r 2 and r 4 , i.e. r 1 “cont ribut es” equally t o (t he coeffi cient s of) r 2 and r 4 , and similarly r 3 “cont ribut es” equally t o (t he coeffi cient s of) r 2 and r 4 . T herefore, inst ead of fixing r 1 and r 2 as before and t rying t o find r 3 and r 4 values more effi cient ly, we fix r 1 = c1 , r 3 = c3 . As explained above, t his is crucial since r 1 and r 3 cont ribut e symmet rically t o r 2 and r 4 . T hen W ( F ( c1 , r 2 , c3 , r 4 )) = r 2 · (8c1 + r 2 + 3c3 + 11) + r 4 · (8c1 + r 4 + 3c3 + 11)
+ 4r 2 r 4 + K ( c1 , c3 ) = ( r 2 + r 4 ) · (8c1 + 3c3 + 11) + r 22 + r 42 + 4r 2 r 4 + K ( c1 , c3 ) = ( r 2 + r 4 ) · (8c1 + 3c3 + 11) + ( r 2 + r 4 ) 2 + 2r 2 r 4 + K ( c1 , c3 ) where K ( c1 , c3 ) = ( c23 + 8c21 ) + (8c1 c3 ) + (28c1 + 10c3 ) + 20 is a const ant .
514
Y.-E.A. Ban, S. Bespamyat nikh, and N.H. Must afa
Le m m a 3 . G iv e n in t ege r s r 2 , r 4 , s 2 , s 4 , c1 , d 1 , c3 , d 3 , W ( F ( c1 , r 2 , c3 , r 4 ))
≥
W ( F ( c1 , s 2 , c3 , s 4 )) = ⇒ W ( F ( d 1 , r 2 , d 3 , r 4 ))
if r 2 + r 4
≥
s 2 + s 4 a n d 8( d 1
−
c1 ) + 3( d 3
−
W ( F ( d 1 , s 2 , d 3 , s 4 ))
≥
c3 )
0.
≥
Proof. Assume t hat W ( F ( c1 , r 2 , c3 , r 4 )) ≥ W ( F ( c1 , s 2 , c3 , s 4 )). We will show t hat t he increment in t he Wiener index for t he configurat ion ( c1 , r 2 , c3 , r 4 ) is larger t han t he increment for t he configurat ion ( c1 , s 2 , c3 , s 4 ), i.e. W ( F ( d 1 , r 2 , d 3 , r 4 ))
−
W ( F ( c1 , r 2 , c3 , r 4 ))
≥
W ( F ( d 1 , s 2 , d 3 , s 4 ))
( r 2 + r 4 )(8d 1 + 3d 3 + 11 − 8c1
−
3c 3
−
11)
−
W ( F ( c1 , s 2 , c3 , s 4 ))
≥
( s 2 + s 4 )(8d 1 + 3d 3 + 11 − 8c1 ( r 2 + r 4 )(8( d 1
−
c1 ) + 3( d 3
Since 8( d 1 − c1 ) + 3( d 3 − c3 )
≥
−
c3 ))
≥
( s 2 + s 4 )(8( d 1
0, and ( r 2 + r 4 )
≥
−
−
3c3
−
11)
c1 ) + 3( d 3
−
c3 ))
( s 2 + s 4 ), t he proof follows.
We now use Lemma 3 t o ident ify large subset s of t he configurat ion space t hat can be searched t o find a specific element much more effi cient ly. Set r 1 = r 3 = 0. Define w (( a, b)) = W ( F (0, a, 0, b)) and c(( a, b)) = a + b. Let √ P = pi = ( a i , bi ) | 0 ≤ a i , bi ≤ n be sort ed by w ( · , · ). T hen t he sequence of | P | = n pairs represent s t he Wiener indices of all possible pairs of paramet ers r 2 and r 4 . Let P ′ = pi 1 , . . . , pi k be t he longest subsequence of P such t hat t he sequence C ( P ′ ) = c( pi 1 ) , . . . , c( pi k ) is increasing. P ′ can be found in t ime O ( n log log n ) [1]. Not e t hat two condit ions hold for any two element s pi j , pi j ′ ∈ P ′ such t hat i j ≤ i j ′ , ( i ) w ( pi j ) ≤ w ( pi j ′ ) and ( i i ) c( pi j ) ≤ c( pi j ′ ). Le m m a 4 . G iv e n t h e su bsequ e n ce P ′ d e sc r ibed a bo v e , a n d a n in t ege r n su c h t h a t n = W ( F ( r 1 , a, r 3 , b)) , w h e re t h e v a lu e s o f r 1 a n d r 3 a re k n o w n , o n e ca n fi n d t h e v a lu e s o f a a n d b in O (log n ) t im e .
Proof. Not e t hat in t he previous algorit hm, we used t he binary search over one variable or used Frederickson and J ohnson’ s t echnique t o avoid t he binary search, √ but we had t o perform Ω ( n ) comput at ions t o find r 2 = a and r 4 = b. Now we will show t hat if t he subset of configurat ion space sat isfies cert ain crit eria, like P ′ , t hen we can search in O (log n ) st eps. We need t o find a and b such t hat W ( F ( r 1 , a, r 3 , b)) = n where ( a, b) ∈ P ′ . Not e t hat P ′ is increasing in bot h W ( F (0, a i , 0, bi )) and in C ( P ′ ). Take any two pairs pi j = ( a i j , bi j ) and pi j ′ = ( a i j ′ , bi j ′ ) of P ′ , j ≤ j ′ . T hen a i j + bi j ≤ a i j ′ + bi j ′ from ( i i ) above, and for any posit ive r 1 and r 3 , 8( r 1 − 0) + 3( r 3 − 0) ≥ 0. T hus t he condit ions of Lemma 3 are sat isfied and W ( F (0, a i j , 0, bi j ))
≤
W ( F (0, a i j ′ , 0, bi j ′ )) = ⇒ W ( F ( r 1 , a i j , r 3 , bi j ))
≤
W ( F ( r 1 , a i j ′ , r 3 , bi j ′ ))
On a Conject ure on W iener Indices in Combinat orial Chemist ry w ( a i j , bi j )
≤
w ( a i j ′ , bi j ′ ) = ⇒
W ( F ( r 1 , a i j , r 3 , bi j ))
515
W ( F ( r 1 , a i j ′ , r 3 , bi j ′ ))(3)
≤
Equat ion 3 st at es t hat t he Wiener index of t he 4-t uple ( r 1 , a i j , r 3 , bi j ) will always be less t han t he Wiener index of ( r 1 , a i j ′ , r 3 , bi j ′ ) if j ≤ j ′ , rega rd le ss of t he value of r 1 and r 3 . T herefore we can do binary search since we have P ′ sort ed by W ( F (0, a i , 0, bi )) already. We only know t hat t he order of t he pairs is preserved, alt hough t he values of w ( · ) have changed (since t he values of r 1 and r 3 have changed). At each st ep of t he binary search we have t o recomput e w ( · ) for each pair, and proceed accordingly. Now t he algorit hm can be complet ed. Set r 1 = r 3 = 0, and comput e t he set P in t ime O ( n log n ) by sort ing all t uples (0, r 2 , 0, r 4 ) by t heir Wiener indices. Now find t he largest increasing subsequence of P in t he ordered sequence C ( P ). T his subsequence sat isfies t he two propert ies, i.e. increasing wit h respect t o W ( P ) and C ( P ). From Lemma 3, t he order of t his subsequence would remain unchanged wit h varying values of r 1 and r 3 . We st ore t his subsequence as an ordered sequence of pairs P 1 . Now it erat ively ext ract largest increasing subsequence P i in round i t ill t he last round k . St ore t hese ordered set s P = { P 1 , . . . , P k } . √ Now, we vary t he values of r 1 and r 3 from 1 t o n . Since we don’t know which sequence could cont ain n , we have t o search in all k sequences. In each sequence we do binary search as in Lemma 4, achieving t he worst case t ot al t ime √ O ( n k log n ). Not e t hat k ≤ n — we can always define P = { P 1 , . . . , P √ n } , √ where P i = { ( i , 1) , . . . , ( i , n ) } . T hen, from t he monot onicity of t he funct ion F ( · ), each P i is an increasing sequence in t he Wiener index. Again, using Frederickson and J ohnson’s mat rix searching t echnique, t he running t ime can be improved t o O ( n k log log n ) t ime. We omit det ails, and conclude t he following. T h e o re m 1 . G iv e n a n in t ege r n , o n e ca n fi n d ( if t h e y e x ist ) in t ege r s c1 , c2 , c3 a n d c4 su c h t h a t W ( F ( c1 , c2 , c3 , c4 )) = n in t im e O ( n k log log n ) , w h e re k is a d eco m po sit io n pa ra m e t e r .
Wiener Index vs. Runtime
9
40000 35000
# F calls
8
Binary Search Sequence Decomposition
x 10
200
7
180
30000
6
160
25000
5
140
20000
4
120
15000
3
100
10000
2
80
5000
1 0
0 0
20000
40000
60000 80000 Wiener Index
100000
120000
140000
60 0
2
4
6
10
40
0
2
5
4
6
8
10 5
x 10 push sweep jump
(a)
8
x 10 push sweep jump
(b)
F i g . 1 . (a) F igure showing t he running t imes for problem P = measured by t he number of calls t o F (·), (b) T he graphs of T pu sh , T sw eep , T j u m p (left ) and t he rat ios T n a i v e versus t he funct ions (right ).
516
Y.-E.A. Ban, S. Bespamyat nikh, and N.H. Must afa
We compare our algorit hm (wit hout using Frederickson and J ohnson t echnique), denot ed SequenceDecomposition, wit h t he binary search algorit hm, denot ed as Algorit hm BinarySearch. We run t he above two algorit hms for t he inverse Wiener problem for Wiener indices n = 1000, 2000, . . . , 140, 000. For each n , we measure t he t he running t ime by count ing t he number of calls t o W ( F ( · )) of bot h Algorit hm BinarySearch, and Algorit hm SequenceDecomposition. T he result s are shown in Figure 1 (a). As expect ed, t he running t ime for various int egers n varies quit e a lot (since some searches are lucky t o find t he number easily) but on t he whole it can be easily seen t hat BinarySearch makes many more calls t o W ( F ( · )) t han SequenceDecomposition.
4
A lg o r it h m fo r t h e P r o b le m P ≤
T he problem P ≤ for our class of t rees F ( · ) is as follows: given an int eger n , for every int eger 0 ≤ m ≤ n , comput e t he configurat ion ( a 1 , a 2 , a 3 , a 4 ) such t hat W ( F ( a 1 , a 2 , a 3 , a 4 )) = m . Of course, problem P ≤ can be solved by n calls t o problem P = , yielding a O ( n 2 k ) t ime algorit hm, and wit h t he worst case running t ime of O ( n 5 / 2 ). However, t he problem P ≤ can be solved in O ( n 2 √) t ime by comput ing W ( F ( · )) for n , i = 1, . . . , 4. For each t uple, every t uple a = ( a 1 , a 2 , a 3 , a 4 ), where 0 ≤ a i ≤ we mark off t he int eger W ( F ( · )) in an array. Aft er all t uples have been comput ed, t he locat ions in t he array not marked indicat e int egers not represent able. As before, we will measure t he running t ime of t he algorit hm by t he number of ( n − 20) / 8, a i ≤ calls t o t he funct ion. Using Equat ion 2 we can bound a 1 ≤ √ n − 20, i = 2, 3, 4. T herefore t he complexity of t he naive algorit hm is bounded √ √ by ⌊ ( n − 20) / 8⌋ · ⌊ n − 20⌋ 3 . For large n , t his is approximat ely n 2 / (2 2) and we denot e it as T n a i v e ( n ). Our goal is t o design an algorit hm t hat solves P ≤ using a subst ant ially smaller number of comput at ions of W ( F ( · )). T he first idea is t o make a bound for a t hat furt her rest rict s t he search space. We will call our new algorit hm as p u sh a lgo r it h m . T he algorit hm will sequent ially t ry t o cover int egers in increasing order. Let √
s( a ) = ⌈
2(2a 1 + a 2 + a 3 + a 4 + 7/ 2) ⌉
and let m be t he smallest number whose expression W ( F ( · )) = m is not comput ed yet . T he value of s can be bounded from below. Le m m a 5 . I f W ( F ( a )) = m t h e n s ( a ) >
√
m.
Proof. T he lemma follows from t he fact t hat W ( F ( a )) < 2(2a 1 + a 2 + a 3 + a 4 + 7/ 2) 2 . We prove t he inequality
−
2(2a 1 + a 2 + a 3 + a 4 ) 2 − W ( F ( a )) ≥ 0 a 1 (8a 1 + 8a 2 + 8a 3 + 8a 4 + 28) + a 2 (4a 2 + 4a 3 + 4a 4 + 14)
−
a 2 (3a 2 + a 3 + 3) + a 3 (3a 3 + a 4 + 4) + a 4 (3a 4 + 3) + 9/ 2 > 0
−
+ a 3 (4a 3 + 4a 4 + 14) + a 4 (4a 4 + 14) + 49/ 2 − W ( F ( a ))
≥
0
On a Conject ure on W iener Indices in Combinat orial Chemist ry T a b le 1 . S1
S2
S3
517
Table present ing t he various set s of int egers relat ed t o t he conject ures.
2, 3, 5, 6, 7, 8, 11, 12, 13, 14, 15, 17, 19, 21, 22, 23, 24, 26, 27, 30, 33, 34, 37, 38, 39, 41, 43, 45, 47, 51, 53, 55, 60, 61, 69, 72, 73, 77, 78, 83, 85, 87, 89, 91, 99, 101, 106, 113, 117, 129, 133, 147, 157, 159, 173, 193 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 45, 47, 49, 51, 53, 54, 55, 57, 58, 60, 61, 64, 69, 72, 73, 77, 78, 81, 83, 85, 87, 89, 91, 93, 97, 99, 101, 106, 113, 114, 117, 129, 133, 137, 141, 143, 145, 147, 149, 157, 159, 165, 173, 189, 193, 205, 213, 217, 219, 229, 249, 265, 281, 285, 301, 309, 325, 357, 373, 389, 417, 433, 557 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 60, 61, 64, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 81, 83, 85, 87, 89, 90, 91, 92, 93, 94, 97, 99, 101, 102, 106, 107, 110, 113, 114, 115, 117, 118, 120, 121, 124, 127, 129, 130, 131, 133, 137, 141, 142, 143, 145, 147, 149, 157, 159, 160, 165, 173, 174, 175, 177, 183, 189, 193, 194, 197, 203, 205, 208, 213, 214, 217, 219, 226, 227, 229, 235, 241, 242, 249, 257, 265, 267, 269, 270, 275, 281, 285, 288, 295, 301, 309, 311, 325, 327, 330, 335, 337, 349, 357, 373, 389, 393, 403, 405, 417, 419, 433, 435, 461, 467, 481, 484, 501, 527, 529, 533, 545, 557, 565, 575, 613, 657, 701, 729, 747, 757, 837, 857, 935, 1061, 1177
T he algorit hm searches for t he solut ion of W ( F ( a )) = m , m ≤ n in increasing order of s ( a ). Let M be t he current value of s ( a ). T he algorit hm enumerat es all t uples a so t hat s ( a ) = M . Let m 0 be t he smallest number not represent able as W ( F ()) 1 . By Lemma 5, if t here is solut ion for W ( F ( a ))√ = m 0 t hen M must √ be great er t han m 0 . If current value of M is at most m 0 , we increase M √ t o ⌊ m 0 ⌋ . We implement ed t he push algorit hm and t est ed it for n = 106 . Let T p u s h ( n ) be t he number of comput at ions of W ( F ( · )). T he number of comput at ions T p u s h is essent ially quadrat ic, see Figure 1(b). However, not ice t hat t he push algorit hm demonst rat es a speedup fact or of 42 versus T n a i v e . T he second algorit hm we implement ed, sw ee p a lgo r it h m , sweeps t uples a according t o t he increasing sum a 1 + a 2 + a 3 + a 4 . T he sweep algorit hm runs fast er t han t he push algorit hm. T he rat io T n a i v e ( n ) / T s w e e p ( n ) is approximat ely 66, as illust rat ed in Figure 1(b). We implement ed anot her algorit hm t hat we call ju m p a lgo r it h m . T he idea is t o sweep t uples a lexicographically and skip t uples t hat do not produce new numbers. We maint ain t he smallest number m 0 whose represent at ion is not yet found. Suppose t hat a 1 = c1 , a 2 = c2 and a 3 = c3 are fixed const ant s and t he algorit hm st art s search for a 4 . Let f denot e t he funct ion f ( a 4 ) = W ( F ( c1 , c2 , c3 , a 4 )). f is monot one and t he equat ion f ( a 4 ) = m 0 is quadrat ic. By solving t his quadrat ic equat ion, we can find t he largest value a ∗4 so t hat f ( a ∗4 ) is at most m 0 . T hen a 4 √ ∗ t akes values from a 4 t o n . T he experiment s show t hat 1. for n < 105 , t he sweep algorit hm is fast er t han ot hers, and 2. for n ≥ 105 , t he jump algorit hm is fast er t han ot hers, and 1
Not e t hat
m 0
must be great er t han 1177 since 1177 is not represent able as
W
( F (·)).
518
Y.-E.A. Ban, S. Bespamyat nikh, and N.H. Must afa
3. t he speedup of t he jump algorit hm wit h respect t o t he naive algorit hm grows wit h n . We did a non-linear fit of t he dat a using t he Levenberg-Marquardt algorit hm and t he running t ime of t he jump algorit hm fit s t he polynomial equat ion 1. 5841n 1 . 51474 . T he asympt ot ic st andard errors of t he fit are 0.000655467 for t he exponent and 0.0141145 for t he coeffi cient , indicat ing an accurat e fit . T he jump algorit hm allows us t o verify Conject ure 4 up t o 108 . T he running t ime is 4.6 days on 360Mhz SGI MIP S R12K. We est imat e t hat t he sweep and naive algorit hms would need 82.1 days and 14.1 years, respect ively.
R e fe r e n c e s 1. Bespamyat nikh, S., and Segal, M. Enumerat ing longest increasing subsequences and pat ience sort ing. I n f or m . P r ocess. L et t . 76 , 1-2 (2000), 7–11. 2. Dankelmann, R. Comput ing t he average dist ance of an int erval graph. I n f or m at i on P r ocessi n g L et t er s 48 (1993), 311–314. 3. Dobrynin, A. A., Ent ringer, R., and Gut man, I. W iener index of t rees: T heory and applicat ions. A ct a A ppli can dae M at hem at i cae 66 (2001), 211–249. 4. Est rada, E., and Uriart e, E. Recent advances on t he role of t opological indices in drug discovery research. C u r r en t M edi ci n al C hem i st r y 8 (2001), 1573–1588. 5. Frederickson, G. N., and J ohnson, D. B. Generalized select ion and ranking: sort ed mat rices. SI A M J ou r n al of C om pu t i n g 13 , 1 (1984), 14–30. 6. Goldman, D., Ist rail, S., Lancia, G., and P iccolboni, A. Algorit hmic st rat egies in combinat orial chemist ry. In P r oc. 11t h A C M - SI A M Sy m pos. D i scr et e A lgor i t hm s (2000), pp. 275–284. 7. Gut man, I., and P olansky, O. E. M at hem at i cal con cept s i n or gan i c chem i st r y . Springer-Verlag, Berlin, 1986. 8. Gut man, I., and Yeh, Y. T he sum of all dist ances in bipart it e graphs. M at h. Slovaca 45 (1995), 327–334. 9. Ireland, K. F ., and Rosen, M. I. A classi cal i n t r odu ct i on t o m oder n n u m ber t heor y . Springer-Verlag, New York, 1990. 10. Lepovi´c, M., and Gut man, I. A collect ive property of t rees and chemical t rees. J . C hem . I n f . C om pu t . Sci . 38 (1998), 823–826. 11. Mart in, Y. C. 3D QSAR. current st at e, scope, and limit at ions. P er spect . D r u g D i scover y D es. 12 (1998), 3–32. 12. Mohar, B., and P isanski, T . How t o comput e t he wiener index of a graph. J ou r n al of M at hem at i cal C hem i st r y 2 (1988), 267–277. 13. W iener, H. St ruct ural det erminat ion of paraffi n boiling point s. J . A m er . C hem . Soc. 69 (1947), 17–20.
D ouble D igest R evisit ed: Complexity and A pproximability in t he P resence of N oisy D at a Mark Cieliebak 1 , St ephan Eidenbenz2 , and Gerhard J. Woeginger 3 1
I nst it ut e of T heoret ical Comput er Science, ET H Zurich,
[email protected] 2
B asic and A pplied Simulat ion Science (CCS-5), L os A lamos N at ional L aborat ory † ,
[email protected] 3
Facult y of M at hemat ical Sciences, U niversit y of T went e and D epart ment of M at hemat ics and Comput er Science, T U Eindhoven,
[email protected]
A bst ract . We revisit t he Double Digest problem, which occurs in sequencing of large D N A st rings and consist s of reconst ruct ing t he relat ive posit ions of cut sit es from t wo diff erent enzymes: we fi rst show t hat Double Digest is st rongly NP–complet e, improving upon previous result s t hat only showed weak NP–complet eness. Even t he (experiment ally more meaningful) variat ion in which we disallow coincident cut sit es t urns out t o be st rongly NP–complet e. I n a second part , we model errors in dat a as t hey occur in real–life experiment s: we propose several opt imizat ion variat ions of Double Digest t hat model part ial cleavage errors. We t hen show APX–complet eness for most of t hese variat ions. I n a t hird part , we invest igat e t hese variat ions wit h t he addit ional rest rict ion t hat conincident cut sit es are disallowed, and we show t hat it is NP–hard t o even fi nd feasible solut ions in t his case, t hus making it impossible t o guarant ee any approximat ion rat io at all.
1
I nt roduct ion
Double digest experiment s are a st andard approach t o const ruct physical maps of DNA. Given a large DNA molecule, which for our purposes is an unknown st ring over t he alphabet { A, C, G, T } , t he object ive is t o find t he locat ions of markers, i.e., occurrences of short subst rings such as GAAT T C, on t he DNA. Physical maps are required e.g. in DNA sequencing in order t o det ermine t he sequence of nucleot ides ( A, C, G, and T ) of large DNA molecules, since current sequencing met hods allow only t o sequence DNA fragment s wit h t ens of t housands of nucleot ides, while a DNA molecule can have up t o 108 nucleot ides. In double digest experiment s, two enzymes are used t o cleave t he DNA molecule. An enzyme is a prot ein t hat cut s a DNA molecule at specific pat t erns, t he rest rict ion sit es. For inst ance, t he enzyme EcoRI cut s at occurrences of t he pat t ern GAAT T C. Under appropriat e experiment al condit ions, an enzyme †
L A –U R–03:0532; work done while at ET H Zurich
T . W ar now and B . Zhu ( E ds.) : COCOON 2003, L N CS 2697, pp. 519–527, 2003. c Spr i nger -Ver l ag B er l i n H ei del b er g 2003
520
M . Cieliebak, S. Eidenbenz, and G.J. Woeginger
cleaves at all rest rict ion sit es in t he DNA. T his process is called (full) digestion. Double digest experiment s work in t hree st ages: First , clones (copies) of t he unknown DNA st ring are digest ed by an enzyme A ; t hen a second set of clones is digest ed by anot her enzyme B ; and finally a t hird set of clones is digest ed by a mix of bot h enzymes A and B , which we will refer t o as C . T his result s in t hree mult iset s of DNA fragment s. T he lengt hs of t hese fragment s (i.e., t heir number of nucleot ides) are t hen measured for each mult iset by using gel elect rophoresis, a st andard t echnique in molecular biology. T his leaves us wit h t hree mult iset s of dist ances (t he number of nucleot ides) between all adjacent rest rict ion sit es, and t he object ive is t o reconst ruct t he original ordering of t he fragment s in t he DNA molecule, which is t he Double Digest problem. More formally, t he Double Digest problem can be defined as follows, where sum( S) denot es t he sum of t he element s in a set S, and dist ( P ) is t he set of all dist ances between two neighboring point s in a set P of point s on a line:
D efinit ion 1 ( Double Digest) . Given three multisets A, B and C of positive integers with sum( A ) = sum( B ) = sum( C ) , are there three sets P A , P B and P C of points on a line, each starting in 0, such that dist ( P A ) = A, dist ( P B ) = B and dist ( P C ) = C, and such that P A ∪ P B = P C ? For example, given mult iset s A = { 5, 15, 30} , B = { 2, 12, 12, 24} and C = { 2, 5, 6, 6, 7, 24} as an inst ance of Double Digest, t hen P A = { 0, 5, 20, 50} , P B = { 12, 14, 26, 50} and P C = { 5, 12, 14, 20, 26, 50} is a feasible solut ion (t here may exist more solut ions). Due t o it s import ance in molecular biology, t he Double Digest problem has been t he subject of int ense research since t he first successful rest rict ion sit e mappings in t he early 1970’s [1,2]. T he Double Digest problem is NP–complet e [3], and several approaches including exponent ial algorit hms, heurist ics, addit ional experiment s or comput er–assist ed int eract ive st rat egies have been proposed (and implement ed) in order t o t ackle t he problem [4,5,6,7,8]. T he number of feasible maps for a Double Digest inst ance can be charact erized by using alt ernat ing Eulerian pat hs in appropriat e graph classes and can be exponent ial in t he number of fragment s [3,9,10,11]. For a survey, see [12] and [13]. T he double digest experiment is usually carried out wit h two enzymes t hat cut at diff erent rest rict ion sit es. A majority of all possible enzyme pairings of t he more t han 3000 known enzymes are pairs wit h such disjoint cut t ing behavior. On t he ot her hand, some result s in t he lit erat ure rely on enzymes t hat cut at t he same sit e in some cases (coincidences) [10]. In part icular, NP–hardness of t he Double Digest problem has so far only been shown using enzymes t hat allow for coincidences [3,12,14]. Indeed, such enzyme pairs exist , for example enzymes HaeI I I and BalI. However, having two enzymes t hat are guarant eed t o always cut at disjoint sit es seems more nat ural and might lead – at least int uit ively – t o easier reconst ruct ion problems. For example, such inst ances always fulfill |C| = |A| + |B |− 1 (where |S| denot es t he cardinality of set S). To reflect t hese diff erent types of experiment s, we define t he Disjoint Double Digest problem, which is equivalent t o t he Double Digest problem wit h t he addit ional requirement t hat t he two enzymes may never cut at t he same sit e, or, equivalent ly, t hat P A
D ouble D igest Revisit ed: Complexit y and A pproximabilit y
521
and P B are disjoint except for t he first point (which is 0) and t he last point (which is sum( A )). T he NP–hardness result s for Double Digest in t he lit erat ure [3,12,14] rely on reduct ions from weakly NP–complet e problems (namely Partition). As a first set of result s in t his paper, we prove in Sect ion 2 t hat bot h Double Digest and Disjoint Double Digest are act ually NP–complet e in t he st rong sense by proposing reduct ions from 3–Partition. In a second part of t he paper, we model reality more closely by t aking int o account t hat double digest dat a usually cont ains errors. A partial cleavage error occurs when an enzyme fails t o cut at a rest rict ion sit e where it is supposed t o cut ; t hen one large fragment occurs in t he dat a inst ead of t he two (or even more) smaller fragment s. Ot her error types, such as fragment length errors, missing small fragments, and doublets occur as well (see [5,7,6,14]), but we will focus on part ial cleavage errors. T hey can occur for many reasons, e.g. improper react ion condit ions or inaccurat e DNA concent rat ion (see e.g. [15] for a list of possible causes). A part ial cleavage error occurs e.g. when an enzyme fails t o cut at a sit e where it is supposed t o cut in t he first (or second) st age of t he double digest experiment , but t hen does cut at t his sit e in t he t hird phase (where it is mixed wit h t he ot her enzyme). Such an error usually will make it impossible t o find a solut ion for t he corresponding Double Digest inst ance. In fact , only P A ∪ P B ⊆ P C can be guarant eed for any solut ion. Vice–versa, if an enzyme cut s only in t he first (or second) phase, but fails t o cut in t he t hird phase, t hen we can only guarant ee P C ⊆ P A ∪ P B . In t he presence of errors, usually t he dat a is such t hat no exact solut ions can be expect ed. T herefore, opt imizat ion crit eria are necessary in order t o compare and gauge solut ions. We will define opt imizat ion variat ions of t he Double Digest problem t aking int o account diff erent opt imizat ion crit eria; our object ive will be t o find good approximat ion algorit hms. An opt imal solut ion for a problem inst ance wit h no errors will be a solut ion for t he Double Digest problem it self.1 T hus, t he opt imizat ion problem cannot be comput at ionally easier t han t he original Double Digest problem, and (st rong) NP–hardness result s for Double Digest carry over t o t he opt imizat ion problem. A st raight -forward opt imizat ion crit erion for Double Digest is t o minimize t he absolut e number of part ial cleavage errors in a solut ion, i.e., t o minimize e( P A , P B , P C ) := |( P A ∪ P B ) − P C | + |P C − ( P A ∪ P B ) | (recall t hat |S| is t he cardinality of set S). Here, point s in ( P A ∪ P B ) − P C correspond t o errors where enzyme A or B failed t o cut in t he t hird phase of t he experiment , and point s in P C − ( P A ∪ P B ) correspond t o errors where eit her enzyme A or B failed t o cut in t he first resp. second phase. Unfort unat ely, t he corresponding opt imizat ion problem Minimum Absolute Error Double Digest in which we t ry t o find point set s P A , P B and P C such t hat e( P A , P B , P C ) is minimum cannot be approximat ed wit hin any finit e approximat ion rat io (unless P = NP), as a polynomial-t ime algorit hm guarant eeing a finit e approximat ion rat io could be used t o solve t he NP–complet e Double Digest problem in polynomial-t ime. 1
Of course, t his only holds if t he opt imizat ion crit erion is well–designed.
522
M . Cieliebak, S. Eidenbenz, and G.J. Woeginger
We obt ain a more sensible opt imizat ion crit erion as follows: If we add |A| + |B | + |C| as an off set t o t he number of errors, we obt ain an opt imizat ion crit erion which t urns t he absolut e number of errors int o a measure relat ive t o t he input size. T he corresponding opt imizat ion problem is defined as follows:
D efinit ion 2 ( Minimum Relative Error Double Digest) . Given three multisets A, B and C of positive integers with sum( A ) = sum( B ) = sum( C ) , find three sets P A , P B and P C of points on a line, each starting in 0, such that dist ( P A ) = A, dist ( P B ) = B and dist ( P C ) = C, and such that r ( P A , P B , P C ) := |A| + |B | + |C| + e( P A , P B , P C ) is minimum. Inst ead of count ing t he number of errors, measuring t he t ot al size of a solut ion is an opt imizat ion crit erion t hat seems very nat ural, even if it does not model cleavage errors exact ly. In t his case, we want t o minimize t he t ot al number of point s in a solut ion, i.e., we minimize |P A ∪ P B ∪ P C |. T his yields t he Minimum Point Double Digest problem, which is defined anologous t o Minimum Relative Error Double Digest except for t he minimizat ion crit erion. We show in Sect ion 3 t hat Minimum Relative Error Double Digest and Minimum Point Double Digest are APX–hard (i.e., t here exist s a const ant ε > 0 such t hat no polynomial–t ime algorit hm can guarant ee t o find approximat e solut ions t hat are at most a fact or 1 + ε off t he opt imum solut ion, unless P = NP) by proposing gap–preserving reduct ions2 from Maximum Tripartite Matching, using Maximum 4–Partition as an int ermediary problem. We also analyze a st raight –forward approximat ion algorit hm t hat works for bot h problems and t hat achieves an approximat ion rat io of 2 for Minimum Relative Error Double Digest and a rat io of 3 for Minimum Point Double Digest. For each opt imizat ion problem, a variat ion can be defined where t he enzymes may only cut at disjoint rest rict ion sit es (analogous t o Disjoint Double Digest). T he corresponding opt imizat ion problems are called Minimum Disjoint Relative Error Double Digest and Minimum Disjoint Point Double Digest. In Sect ion 4, we show t hat – rat her surprisingly – t hey are even harder t o solve t han t he unrest rict ed problems: it is NP–hard t o even find feasible solut ions. We est ablish t his result by showing t hat t he problem of disjoint ly arranging two given set s of numbers is already NP–hard. T his arrangement problem – which we call Disjoint Ordering – is a subproblem t hat every algorit hm for any Disjoint Double Digest variat ions has t o be able t o solve; t hus, no finit e approximat ion rat io can be achieved for our opt imizat ion variat ions of Disjoint Double Digest (unless P = NP). Moreover, t he same result would also hold for ot her opt imizat ion crit eria, since t he proof depends only on t he disjoint ness requirement . In Sect ion 5, we conclude wit h direct ions for fut ure research. Due t o space limit at ions, we only give proof sket ches in t his ext ended abst ract for most of our result s; det ailed proofs will be given in t he full paper.
2
For an int roduct ion t o gap–preserving reduct ions, see [16].
D ouble D igest Revisit ed: Complexit y and A pproximabilit y
2
523
St rong NP–Complet eness of (Disjoint) Double Digest
In t his sect ion, we show st rong NP–complet eness for t he decision problems Double Digest and Disjoint Double Digest. We present reduct ions from 3– Partition 3n, which is defined as follows: Given 3n int egers q1 , . . . , q3n and int eger h wit h i = 1 qi = nh and h4 < qi < h2 for all 1 ≤ i ≤ 3n , are t here n disjoint t riples of qi ’s such t hat each t riple sums up t o h? T he 3–Partition problem is NP–complet e in t he st rong sense [17]. First , we ext end t he NP–complet eness result from [3] for t he Double Digest problem.
Lemma 3. Double Digest is strongly NP–complete. Proof. We reduce 3–Partition t o Double Digest as follows: Given an inst ance q1 , . . . , q3n and h of 3–Partition, let ai = ci = qi for 1 ≤ i ≤ 3n , and let bj = h for 1 ≤ j ≤ n . T hen t he t hree (mult i-)set s of ai ’s, bj ’s and ci ’s build an inst ance of Double Digest. If t here is a solut ion for t he 3–Partition inst ance, t hen t here exist n disjoint t riples of qi ’s (and ai ’s as well) such t hat each t riple sums up t o h. St art ing from 0, we arrange t he dist ances ai on a line such t hat each t hree ai ’s t hat belong t o t he same t riple are adjacent . T he same ordering is used for t he ci ’s. T his yields a solut ion for t he Double Digest inst ance. On t he ot her hand, if t here is a solut ion for t he Double Digest inst ance, say P A , P B and P C , t hen t here exist n subset s of ci ’s such t hat each subset sums up t o h, since each point in P B must occur in P C as well, and all adjacent point s in P B have dist ance h. T hese n subset s yield a solut ion for t he 3–Partition inst ance. ⊓ ⊔
Lemma 4. Disjoint Double Digest is strongly NP–complete. Proof (sketch). We show st rong NP–hardness by reducing 3–Partition t o Dis 3n joint Double Digest. Given an inst ance of 3–Partition, let s = i = 1 qi and t = ( n + 1) · s. Let ai = qi for 1 ≤ i ≤ 3n , a ˆ j = 2t for 1 ≤ j ≤ n − 1, bj = h + 2t for 1 ≤ j ≤ n − 2, ˆbk = h + t for 1 ≤ k ≤ 2, ci = qi for 1 ≤ i ≤ 3n , and cˆ j = t for 1 ≤ j ≤ 2n − 2. Let A consist of t he ai ’s and a ˆ j ’s, and B and C be defined accordingly. T hen A, B and C are our inst ance of Disjoint Double Digest. Given a solut ion for t he 3–Partition inst ance, we assume w.l.o.g. t hat t he qi ’s (and t hus t he ai ’s and ci ’s) are ordered such t hat t he t hree element s of each t riple are adjacent . T he arrangement shown in t he figure below yields a solut ion for t he Disjoint Double Digest inst ance. For t he opposit e direct ion, let P A , P B and P C be a solut ion for t he Disjoint Double Digest inst ance. Each two adjacent point s in P B diff er by h (plus t or 2t ), and so do n + 1 point s in P C . Hence, t here must be n subset s of ci ’s t hat each sum up t o h, yielding a solut ion for t he 3–Partition inst ance.
524
M . Cieliebak, S. Eidenbenz, and G.J. Woeginger
a1 a2 a3
a ˆ1
a4 a5 a6
a ˆ2
a7 a8 a9
a ˆ3
a1 0 a1 1 a1 2 A
ˆb1
b1
ˆb2
b2
B c1 c2 c3
cˆ 1
cˆ 2
c4 c5 c6
cˆ 3
cˆ 4
c7 c8 c9
cˆ 5
cˆ 6
c1 0 c1 1 c1 2 C
h
3
⊓ ⊔
A pproximability of Minimum Relative Error Double Digest and Minimum Point Double Digest
In t his sect ion, we show t hat Minimum Relative Error Double Digest and Minimum Point Double Digest are bot h APX–hard, and we propose a st raight –forward approximat ion algorit hm t hat achieves an approximat ion rat io of 3 respect ively 2 for t he two problems. For t he proof of APX-hardness, we int roduce a maximizat ion variat ion of t he well–known 4–Partition problem [17] which is defined as follows:
D efinit ion 5 ( Maximum 4–Partition) . Given an integer h and a multiset 4n Q = { q1 , . . . , q4n } of 4n integers with i = 1 qi = nh and h5 < qi < h3 , find a maximum number of disjoint subsets S1 , . . . , Sm ⊆ Q such that the elements in each set Si sum up to h. While Maximum 4–Partition may be an int erest ing problem per se, we are mainly int erest ed in it as an int ermediary problem on our way t o proving APX–hardness for our opt imizat ion variat ions of Double Digest.
Lemma 6. Maximum 4–Partition is APX–hard. Proof (sketch). T he lemma follows from t he original reduct ion from Maximum Tripartite Matching t o 4–Partition given in [17, pages 97–99], if analyzed as a gap-preserving reduct ion. ⊓ ⊔ Lemma 7. Minimum Point Double Digest is APX–hard. Proof (sketch). We propose a gap–preserving reduct ion from Maximum 4– Partition t o Minimum Point Double Digest. For a given Maximum 4– Partition inst ance I , consist ing of Q and h, we const ruct an inst ance I ′ of Minimum Relative Error Double Digest as follows: Let A = C = Q, and let B cont ain n t imes t he element h. Let OP T denot e t he size of an opt imum solut ion for I , and let OP T ′ denot e t he size of an opt imum solut ion for I ′ . T hen we have: if OP T ≥ n , t hen OP T ′ ≤ 4n + 1, and if OP T < (1 − ε ) n for a small const ant ε > 0, t hen OP T ′ > (4 + 2ε ) n + 1. T hese two implicat ions describe t he reduct ion as gap-preserving and t hus est ablish t he result . ⊓ ⊔
D ouble D igest Revisit ed: Complexit y and A pproximabilit y
525
Lemma 8. Minimum Relative Error Double Digest is APX–hard. Proof (sketch). T he proof uses t he same reduct ion as in Lemma 7 wit h slight ly modified implicat ions. ⊓ ⊔ A st raight –forward approximat ion algorit hm for our two problems simply arranges all dist ances from A, B and C on a line in a random fashion, st art ing at 0. If we analyze t his algorit hm as an approximat ion algorit hm for Minimum Point Double Digest, we see t hat t his will result in a solut ion wit h at most |A| + |B | + |C| − 1 point s; on t he ot her hand, an opt imum solut ion will always use at least max( |A|, |B |, |C|) + 1 point s. T hus, t his t rivial approximat ion algorit hm achieves an approximat ion rat io of 3 for Minimum Point Double Digest. T he same algorit hm yields an approximat ion rat io of 2 for Minimum Relative Error Double Digest.
4
NP–hardness of Finding Feasible Solut ions for Opt imizat ion Variat ions of Disjoint Double Digest
In t his sect ion, we show for all Double Digest opt imizat ion variat ions in which we disallow coincidences t hat t here cannot be a polynomial–t ime approximat ion algorit hm wit h finit e approximat ion rat io, unless P = NP. We achieve t his by showing t hat even finding feasible solut ions for t hese problems is NP–hard. To t his end, we int roduce t he decision problem Disjoint Ordering which is defined as follows:
D efinit ion 9 ( Disjoint Ordering) . Given two multisets A and B of integers with sum( A ) = sum( B ) , find two sets P A and P B of points on a line, starting in 0, such that dist ( P A ) = A, dist ( P B ) = B , and such that P A and P B are disjoint except for the first and the last point. Lemma 10. Disjoint Ordering is NP–complete. Proof (sketch). Obviously, Disjoint Ordering is in NP. To show NP-hardness, we reduce 3–Partition t o it . Given an inst ance q1 , . . . , q3n and h of 3– Partition, we const ruct an inst ance of Disjoint Ordering as follows. Let ai = qi for 1 ≤ i ≤ 3n , a ˆ j = h for 1 ≤ j ≤ n + 1, bi = h + 2 for 1 ≤ i ≤ n , and ˆbj = 1 for 1 ≤ j ≤ ( n + 1) · h − 2n . Let A consist of t he ai ’s and a ˆ j ’s, and let B consist of t he bi ’s and ˆbj ’s. T hen sum( A ) = sum( B ) = (2n + 1) · h. In t he full proof, we show t hat t he following arrangement makes t he reduct ion work: for A , blocks of t hree ai ’s are separat ed by one a ˆ j , and for B , each two ˆ bi ’s are separat ed by a block of h − 2 dist ances bj (wit h t he remaining ˆbj ’s at t he beginning and end). ⊓ ⊔ We reduce Disjoint Ordering t o Minimum Disjoint Relative Error Double Digest as follows: Let A and B be an inst ance of Disjoint Ordering. We ” const ruct ” an inst ance of Minimum Disjoint Relative Error Double Digest by simply let t ing set s A and B be t he same set s, and set C be t he
526
M . Cieliebak, S. Eidenbenz, and G.J. Woeginger
empty set . If an approximat ion algorit hm for Minimum Disjoint Relative Error Double Digest finds a feasible solut ion for t his inst ance, t his yields immediat ely a solut ion for t he Disjoint Ordering inst ance, since any solut ion feasible solut ion for Minimum Disjoint Relative Error Double Digest must arrange t he element s from A and B in a disjoint fashion. T he same argument applies for Minimum Disjoint Point Double Digest, and for any ot her (reasonable) opt imizat ion variat ion of Disjoint Double Digest since t he reduct ion is t ot ally independent of t he opt imizat ion crit erion. T hus, we have:
Lemma 11. No polynomial–time approximation algorithm can achieve a finite approximation ratio for Minimum Disjoint Relative Error Double Digest, Minimum Disjoint Point Double Digest, or any other (reasonable) optimization variation of Disjoint Double Digest, unless P = NP.
5
Conclusion
In t his paper, we showed t hat Double Digest and Disjoint Double Digest are st rongly NP–complet e; in a second part , we defined several opt imizat ion variat ions of Double Digest t hat model part ial cleavage errors, proved APX–hardness for Minimum Relative Error Double Digest and Minimum Point Double Digest, and analyzed st raight –forward approximat ion algorit hms for t hese problems t hat achieve const ant approximat ion rat ios. In a last set of result s, we showed for Double Digest opt imizat ion variat ions where conincidences are not allowed t hat even finding feasible solut ions is NP–hard. While our approximability result s are t ight for all Disjoint Double Digest variat ions, our result s leave considerable gaps regarding t he exact approximability t hreshold for Minimum Relative Error Double Digest and Minimum Point Double Digest, which present challenges for fut ure research. In a different direct ion of fut ure research, opt imizat ion variat ions of Double Digest t hat model t he t hree ot her error types (i.e., fragment lengt h, missing small fragment s, and doublet s) or even combinat ions of diff erent error types should be defined and st udied. On a met a–level of arguing, it seems unlikely t hat an opt imizat ion variat ion t hat models part ial cleavage errors and some of t he ot her error types could be any easier t han t he problems t hat model only part ial cleavage errors, but t here is a possibility t hat some error types might off set each ot her in a cleverly defined opt imizat ion problem.
R eferences 1. Smit h, H .O., W ilcox, K .W .: A rest rict ion enzyme from hemophilus infl uenza. I . Purifi cat ion and general propert ies. Journal of M olecular B iology 51 (1970) 379– 391 2. D anna, K .J., N at hans, D .: Specifi c cleavage of simian virus 40 D N A by rest rict ion endonuclease of hemophilus infl uenzal. Proc. of t he N at ional A cademy of Sciences U SA 68 (1971) 2913–2917
D ouble D igest Revisit ed: Complexit y and A pproximabilit y
527
3. Goldst ein, L ., Wat erman, M .S.: M apping D N A by st ochast ic relaxat ion. A dvances in A pplied M at hemat ics 8 (1987) 194–207 4. B ellon, B .: Const ruct ion of rest rict ion maps. Comput er A pplicat ions in t he B iosciences (CA B I OS) 4 (1988) 111–115 5. A llison, L ., Yee, C.N .: Rest rict ion sit e mapping is in separat ion t heory. Comput er A pplicat ions in t he B iosciences (CA B I OS) 4 (1988) 97–101 6. Wright , L .W ., L icht er, J.B ., Reinit z, J., Shifman, M .A ., K idd, K .K ., M iller, P.L .: Comput er–assist ed rest rict ion mapping: an int egrat ed approach t o handling experiment al uncert aint y. Comput er A pplicat ions in t he B iosciences (CA B I OS) 10 (1994) 435–442 7. I nglehart , J., N elson, P.C.: On t he limit at ions of aut omat ed rest rict ion mapping. Comput er A pplicat ions in t he B iosciences (CA B I OS) 10 (1994) 249–261 8. K ao, M .Y ., Samet , J., Sung, W .K .: T he enhanced double digest problem for D N A physical mapping. I n: Proc. of t he 7t h Scandinavian Workshop on A lgorit hm T heory (SWAT 00). (2000) 383–392 9. Schmit t , W ., Wat erman, M .S.: M ult iple solut ions of D N A rest rict ion mapping problems. A dvances in A pplied M at hemat ics 12 (1991) 412–427 10. M art in, D .R.: Equivalence classes for t he double–digest problem wit h coincident cut sit es. Jounal of Comput at ional B iology 1 (1994) 241–253 11. Pevzner, P.A .: D N A physical mapping and alt ernat ing Eulerian cycles in colored graphs. A lgorit hmica 13 (1995) 77–105 12. Wat erman, M .S.: I nt roduct ion t o Comput at ional B iology. Chapman & H all (1995) 13. Pevzner, P.A .: Comput at ional M olecular B iology. M I T Press (2000) 14. Set ubal, J., M eidanis, J.: I nt roduct ion t o Comput at ional M olecular B iology. PW S Publishing Company (1997) 15. Promega GmbH http://www.promega.com/guides/re guide/toc.htm: Rest rict ion Enzymes Resource. (2002) 16. A rora, S., L und, C.: H ardness of approximat ions. I n H ochbaum, D ., ed.: A pproximat ion A lgorit hms for NP–H ard Problems. PW S Publishing Company (1996) 399–446 17. Garey, M .R., Johnson, D .S.: Comput ers and I nt ract abilit y: A Guide t o t he T heory of NP–Complet eness. Freeman (1979)
Fast an d S p ace-E ffi cient Lo cat ion of H eav y or D en se S egm ent s in R u n -Len gt h E n co d ed S equ en ces ( E x t en d ed A b st ract ) Ronald I. Greenberg Loyola University, 6525 N. Sheridan Rd., Chicago, IL 60626, USA, [email protected], http://www.cs.luc.edu/˜rig
T his paper considers several variat ions of an opt imizat ion problem wit h pot ent ial applicat ions in such areas as biomolecular sequence analysis and image processing. Given a sequence of it ems, each wit h a weight and a lengt h, t he goal is t o find a subsequence of consecut ive it ems of opt imal value, where value is eit her t ot al weight or t ot al weight divided by t ot al lengt h. T here may also be a specified lower and/ or upper bound on t he accept able lengt h of subsequences. T his paper shows t hat all t he variat ions of t he problem are solvable in linear t ime and space even wit h non-uniform it em lengt hs and divisible it ems, implying t hat run-lengt h encoded sequences can be handled in t ime and space linear in t he number of runs. Furt hermore, some problem variat ions can be solved in const ant space. Also, t hese t ime and space bounds suffi ce for cert ain problem variat ions in which we call for report ing of many “good” subsequences. A b st ra ct .
maximum consecut ive subsequence sum, maximum-density segment s, biomolecular sequence analysis, bioinformat ics, image processing, dat a compression K e y w o rd s:
1
Int ro d u ct ion
Let S be a sequence comprised of n r u n s , where t he i t h run (1 ≤ i ≤ n ) has weight w i and lengt h l i ≥ 0. Init ially, we define a segment of S t o be a consecut ive subsequence of runs, i.e., segment S ( i , j ) is comprised of runs i t hrough j . T he weight of S ( i , j ) is j w e igh t ( i , j ) = wk , k= i
t he lengt h of S ( i , j ) is
j
le n gt h ( i , j ) =
lk ,
k= i T . W a r n ow a n d B . Z h u ( E d s.) : C O C O O N 2003, L N C S 2697, p p . 528–536, 2003. c S p r in ger -Ver la g B er lin H eid elb er g 2003
Fast and Space-Effi cient Locat ion of Heavy or Dense Segment s
529
and t he density of S ( i , j ) is d e n sit y ( i , j ) = w e igh t ( i , j ) / le n gt h ( i , j )
.
P rior works on algorit hms for biomolecular sequence analysis have considered t he problem of finding a segment of S t hat is h ea v ie st (maximizing w e igh t ( i , j )) or d e n se st (maximizing d e n sit y ( i , j )), sub ject t o const raint s t hat t he segment lengt h must be at least L and/ or at most U [1,2,3,4].1 For brevity, we will refer t o t hese as an L const raint and/ or U const raint . In addit ion, t he heaviest segment problem wit h no const raint s on segment lengt h is discussed by Bent ley [5]. (T his version of t he problem was mot ivat ed by image processing t asks.) Not e t hat for heaviest segment s only we may consider empty segment s, which may be represent ed by choosing i > j . Most of t he prior result s were for t he u n ifo r m version of t he problem in which l i = 1 for all i ; except ions will be not ed below. (In t he uniform case, t he problem is oft en described as one of finding a subsequence of consecut ive it ems of maximum sum or of maximum average.) We will also int roduce below a new variat ion of t he non-uniform version of t he problem t hat we will refer t o as t he non-uniform case wit h breakable or non-at omic runs. Wit h non-at omic runs, we will allow each end of a segment t o include just a port ion of t he lengt h of a run. When a run is part ially included in a segment , a pro rat a port ion of it s weight will be included in t he weight of t he segment . While t he non-uniform problem wit h at omic runs was considered by Goldwasser et al. [1] and an int erest ing applicat ion might be discovered, a part icularly int erest ing use of t he non-uniform model would be for working wit h sequences t hat have been compressed. T hat is, given a sequence under t he uniform model, a simple compact ion would be t o replace any set of r consecut ive it ems of weight w wit h a run of lengt h r and weight w r under t he non-uniform model, which corresponds t o t he st andard compression t echnique of r u n -le n gt h e n cod in g . Runlengt h encoding t ends t o be part icularly useful in monochrome image processing. It could also have pot ent ial for such applicat ions as DNA sequence analysis, since each it em in a DNA sequence is chosen from just four diff erent nucleot ides. (Furt hermore, in DNA sequence analysis, researchers may oft en be int erest ed, on t he first pass, in just a binary dist inct ion between C/ G and ot her [6,7,8,9,10].) To work wit h such a compressed sequence but be able t o find a heaviest or densest segment in t he uncompressed sequence, we must be able t o break runs. We begin by reviewing prior result s for heaviest segment s and t hen for densest segment s. When discussing t he problems t oget her, we may use t he t erm o p t im a l t o mean heaviest or densest , and we may refer t o t he weight or density of a segment as it s v a lu e . T he first result was an unpublished result of Kadane [5] for t he unconst rained heaviest segment problem. T his solut ion uses O ( n ) t ime and const ant space (be1
Not e t hat Lin et al. [3] use t he t erm “heaviest ” t o mean what we define as “opt imal” below.
530
R.I. Greenberg
yond t he space used t o represent t he input ) 2 . Wit h an L const raint , an algorit hm of Huang [4] can be used t o find a heaviest segment in O ( n ) t ime and O ( n ) space as not ed by Lin et al. [3]. Lin et al. furt her showed how t o obt ain t he same t ime and space bounds wit h bot h an L const raint and a U const raint [3]. In t he case of finding a densest segment , t he problem is t rivially solvable in O ( n ) t ime and const ant space if t here is no L const raint ; just find t he single run of maximum density. Lin et al. [3] showed t hat wit h an L const raint , a densest segment can be found in t ime and space O ( n lg L ). Goldwasser et al. [2, 1] improved t he t ime and space bounds t o O ( n ). T hey furt her showed t hat t he same bounds hold wit h bot h an L const raint and a U const raint [1]. In addit ion, t hey showed t hat wit h only an L const raint , t he result s could be ext ended t o t he non-uniform version of t he problem [1]. Finally, t hey showed t hat wit h bot h const raint s, O ( n + n lg( U − L + 1)) t ime suffi ces when l i ≥ 1 for all i . Goldwasser and I have, however, observed t hat t he analysis in [1] can be modified t o yield O ( n ) t ime and space for any lengt hs sat isfying l i ≥ 0 for all i . T his paper explains in Sect . 2 why all t he result s ment ioned so far can be ext ended t o t he non-uniform model wit h at omic runs. In Sect . 3, we show t hat t he space usage for finding a heaviest segment wit h an L const raint can be reduced t o const ant space. In Sect . 4, we show t hat all t he result s can be maint ained even if we allow breakable runs. As indicat ed above, t he use of breakable runs is of part icular int erest in connect ion wit h run-lengt h encoded sequences, but t he result s of Sect . 4 apply even when l i values are allowed t o be nonint egral and when runs can be broken int o any fract ion. In Sect . 5, we consider variat ions on t he problem in which we seek not just one opt imal segment but all opt imal segment s or all opt imal segment s of maximal or minimal lengt h, or even a more general concept as considered by Huang [4].
2
T h e N on -u n iform M o d el
Most of t he prior algorit hms for finding a heaviest segment or finding a densest segment may essent ially be cast int o t he following basic framework. (T he approach of Huang [4] is somewhat except ional, and we show in Sect ion 3 t hat it can be great ly simplified when we seek only a heaviest segment wit h L const raint .) We sweep left t o right across t he given sequence considering each posit ion in t urn as a possibility for t he right endpoint of an opt imal segment . At each such st ep we det ermine a best choice of t he left endpoint , called a “good part ner” for t he current right endpoint , t hat is at least as far t o t he right as t he prior good part ner. It is relat ively easy t o see t hat t he good part ner should never “back up” when seeking a heaviest segment . For densest segment s, t he 2
T his measure of space usage is analogous t o t he concept of algorit hms t hat sort in-place (e.g., [11]) by using only a const ant amount of st orage out side t he input array. Int erest ingly, t he algorit hm of Kadane has an even st ronger property t hat one need not st ore t he ent ire input array at one t ime; rat her one may read t he input piecemeal and never use more t han const ant st orage in a st rict sense.
Fast and Space-Effi cient Locat ion of Heavy or Dense Segment s
531
correct ness of t his approach is based on t he following lemma t hat is essent ially t he same as one proven by Goldwasser et al. [2, Lemma 9]: L e m m a 1 . L e t S (i , j
) be a d e n se st segm e n t a m o n g t h o se e n d in g a t in d e x j a n d h a v in g le n gt h a t lea st L . S im ila r ly , le t S ( i ′ , j ′ ) be a d e n se st segm e n t a m o n g t h o se e n d in g a t in d e x j ′ a n d h a v in g le n gt h a t lea st L . I f j ′ > j a n d i ′ < i , t h e n d e n sit y ( i , j ) ≥ d e n sit y ( i ′ , j ′ ) . ⊓⊔
Except in t he unconst rained heaviest segment problem, t he exist ing algorit hms make use of a cleverly precomput ed dat a st ruct ure of size O ( n ) t o det ermine how far t o move t he left endpoint at each st ep wit hout overshoot ing t he proper locat ion for t he good part ner of t he right endpoint . (In t he unconst rained heaviest segment problem, no such dat a st ruct ure is necessary, because a simple check indicat es whet her t he left endpoint should st ay at t he same posit ion as in t he last st ep or move t o t he same posit ion as t he right endpoint .) For t he most part , t he l i values of t he input sequence are irrelevant t o t he operat ion of t he algorit hms t hat find an opt imal segment . T he main place t hey have an eff ect is in providing an addit ional const raint (beside t he const raint t hat t he good part ner does not back up) on t he range of indices t o consider for t he current good part ner. In t he uniform case, t he addit ional const raint is t rivial; a good part ner of posit ion j must be in t he range j − U t o j − L . In t he nonuniform case, however, t hese const raint s are easily precomput ed. In O ( n ) t ime and space, a simple scan t hrough t he input sequence allows us t o calculat e U j and L j for all j , such t hat t he good part ner for j is between U j and L j . Inst ead of precomput ing, t hese const raint s can act ually be managed on t he fly, so t hat const ant space will suffi ce for finding a heaviest sequence wit h an L const raint as shown in Sect ion 3. T here is one more complicat ion involved in finding a densest segment wit h L and U const raint s. T his problem is act ually solved by dividing t he input sequence int o cont iguous blocks of lengt h U − L before proceeding wit h any ot her operat ions. T hus, t he problem of finding a good part ner breaks down int o a problem of comparing a good part ner found in a specific block wit h no explicit U const raint t o a good part ner found in t he next fart her block wit h no explicit L const raint . Whereas Goldwasser et al. [1] proposed dividing t he sequence int o blocks of U − L runs, Goldwasser and I have observed t hat dividing int o blocks of lengt h at least U − L and as close as possible t o U − L yields O ( n ) t ime and space for finding a densest segment . T he above observat ions are encapsulat ed in t he following t heorem: T h e o r e m 2 . O (n
) t im e su ffi ce s t o fi n d a le n gt h -co n st ra in ed h ea v ie st segm e n t o r d e n se st segm e n t e v e n w it h n o n -u n ifo r m r u n le n gt h s. ⊓⊔ All result s given lat er in t his paper will also be applicable t o t he non-uniform model.
532
3
R.I. Greenberg
C on st ant -S p ace Lo cat ion of a H eav iest S egm ent w it h an L C on st raint
In t his sect ion, we show t hat a heaviest segment wit h an L const raint but no const raint can be found in O ( n ) t ime and const ant space, improving on t he O ( n ) space result t hat follows from t he approach of Huang [4]. As in t he approaches discussed in Sect . 2, we make a scan left t o right across t he input sequence, considering each posit ion in t urn as a possible locat ion for t he right endpoint of a heaviest segment . As we do so, we keep t rack of t he good part ner (a best left endpoint for t he current right endpoint ), which also moves rightward. Since w e igh t ( i , j ) is just w e igh t ( i , j − 1) + w j , a good part ner p of j − 1 serves as a good part ner of j unless a segment of higher weight t han S ( p , j ) is obt ained by considering left endpoint s p ′ wit h le n gt h ( p ′ , j ) ≥ L ≥ le n gt h ( p ′ , j − 1). By keeping t rack of t he locat ion t hat is lengt h L away from j , as well as keeping t rack of t he current good part ner and t he heaviest segment seen so far, we can find a heaviest segment in O ( n ) t ime and const ant space. We present t he algorit hm in Fig. 1, but , for simplicity, we find only t he w e igh t of a heaviest segment ; it should be clear t hat we could easily keep t rack of an act ual heaviest segment as well. T he pseudocode in Fig. 1 also incorporat es t he use of nonuniform lengt hs as discussed in Sect . 2.
U
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
L h er est a r t m a x so f a r
fo r
j ←
1
1 ←
m a x en d i n gh er e ←
to
n
L h er el en gt h L h er ew t ←
L h er ew t ←
L h er el en gt h ←
0 ←
do L h er el en gt h ←
L h er ew t
m a x en d i n gh er e
L h er el en gt h
j
≤
and
lj
−
w
L h er est a r t ←
m a x en d i n gh er e ←
+
w j
L h er el en gt h
L h er el en gt h ←
L h er ew t ←
L h er est a r t
+
w j
m a x en d i n gh er e ←
w h i l e L h er est a r t L h er ew t
+
max {
−
l
−
l
L h er est a r t
≥
L
do
L h er est a r t
L h er est a r t
+ 1 m a x en d i n gh er e , L h er ew t }
e n d w h ile i f L h er el en gt h
L
≥
t h e n m a x so f a r ←
max {
m a x so f a r , m a x en d i n gh er e }
e n d if e n d fo r
F i g . 1 . T he algorit hm t o find t he weight of a heaviest segment wit h non-uniform lengt hs in O ( n ) t ime and const ant space.
L
const raint and
We summarize wit h t he following t heorem: T h e o r e m 3 . A h ea v ie st segm e n t w it h le n gt h grea t e r t h a n o r equ a l t o L ca n be
fo u n d in
O
( n ) t im e a n d co n st a n t spa ce . ⊓⊔
Fast and Space-Effi cient Locat ion of Heavy or Dense Segment s
4
533
N on -at om ic R u n s
In t his sect ion, we show t hat all t he result s so far can be ext ended t o work wit h non-at omic runs. Not e t hat all t he running t imes remain linear in t he number of runs and t hat L , U , and t he l i values may even be nonint egral. We make use of t he following two lemmas: L e m m a 4 . T o fi n d a n o p t im a l ( h ea v ie st o r d e n se st ) segm e n t , w e n eed o n ly co n sid e r a segm e n t co n t a in in g a pa r t ia l r u n if it s le n gt h is e x a c t ly L o r U .
P roo f. Consider a segment of lengt h st rict ly between L and U t hat cont ains a part ial run. T hen t he lengt h const raint s allow us t o use more of t his run or t rim off part of t his run. One of t hese changes must not decrease t he value (weight or density) of t he segment , since t he density of a run is considered t o be uniform. ⊓⊔
L e m m a 5 . T o fi n d a n o p t im a l segm e n t , w e m a y lim it a t t e n t io n t o segm e n t s
w it h a pa r t ia l r u n o n a t m o st o n e e n d . P roo f. Consider a segment wit h part ial runs on each end. Wit hout loss of generality, suppose t hat t hat t he run t runcat ed on t he left has lower density t han t he run t runcat ed on t he right . If t he ut ilized port ion of t he run on t he left is short er t han t he unut ilized port ion of t he run on t he right , we can complet ely eliminat e t he run on t he left and add a corresponding port ion of t he run on t he right . On t he ot her hand, if t he ut ilized port ion of t he run on t he left is longer t han t he unut ilized port ion of t he run on t he right , we can complet ely include t he run on t he right at t he expense of t he run on t he left . Eit her way, neit her t he weight nor density of t he segment will decrease. ⊓⊔
Wit h t hese lemmas in mind, we see t hat we need not deviat e t oo far from working wit h at omic runs t o obt ain an opt imal segment when we are allowed t o break runs. We need only consider small adjust ment s in addit ion t o each of t he segment s considered as a possible opt imal segment when working wit h at omic runs. For example, t o updat e t he algorit hm of Fig. 1 t o work wit h breakable runs, we can just add t he following code aft er Line 11: i f L h e re le n gt h
−
L
| M | ; we denot e by M ( G ) t he set of maximum mat chings of G . A maximum mat ching of a bipart it e graph on p vert ices and q edges can b e found in t ime O ( p1 / 2 q) by t he algorit hm of Hop croft and Karp (see, e.g, [14]). Consider a bipart it e graph G = ( V1 , V2 , E ). We say t hat G is q-expanding if q ≥ 0 is an int eger such t hat | N G ( X ) | ≥ | X | + q holds for every nonempty set X ⊆ V1 . Not e t hat by Hall’s T heorem, G is 0-expanding if and only if G has a mat ching of
552
S. Szeider
size | V1 | (see [14]). T he deficiency of G is defined as δ ( G ) := | V2 | − | N G ( V2 ) | (if V1 cont ains no isolat ed vert ices, t hen δ ( G ) = | V2 | − | V1 | ). T he m axim um deficiency of G is defined as δ ∗ ( G ) := max Y ⊆ V 2 | Y | − | N G ( Y ) | . Not e t hat δ ∗ ( G ) ≥ 0 follows by t aking Y = ∅ . Let M b e a mat ching of a graph G . A pat h P in G is called M -alternating if edges of P are alt ernat ely in and out of M ; an M -alt ernat ing pat h is M -augm enting if b ot h of it s ends are M -exp osed. If P is an M -augment ing pat h, t hen t he sym m etric diff erence of M and t he set of edges which lie on P is a mat ching of size | M | + 1. In t his case we say t hat M ′ is obt ained from M by augm entation . Conversely, by a well-known result of Berge (see, e.g., [14, T heorem 1.2.1]) a mat ching M is a maximum mat ching if t here is no M -augment ing pat h. Since M -alt ernat ing pat hs of a bipart it e graph G = ( V1 , V2 , E ) are just direct ed pat hs in t he digraph obt ained from G by orient ing t he edges in M from V1 t o V2 , and orient ing t he edges in E \ M from V2 t o V1 . Hence we can find an M -augment ing pat h by breadt h-first -search st art ing from t he set of M -exp osed vert ices in V2 in linear t ime, O ( | V1 ∪ V2 | + | E | ). Consequent ly, if M exp oses s i vert ices of Vi , i = 1, 2, t hen we can find some M ′ ∈ M ( G ) in t ime O (min( s 1 , s 2 ) · ( | E | + | V1 ∪ V2 | )) by augment at ion (which is oft en more effi cient t han t o const ruct a maximum mat ching from scrat ch). We will refer t o t his way of finding a maximum mat ching t he augm entation procedure . Let M b e a mat ching of G . We define R G , M as t he set of vert ices of G which can b e reached from some M -exp osed vert ex in V2 by an M -alt ernat ing pat h. By means of t he ab ove breadt h-first -search approach we can easily obt ain t he basic graph t heoret ic result s needed for our considerat ions (for proofs see [17]): L e m m a 2 G iven a bipartite graph G = ( V1 , V2 , E ) , V = V1 ( G ) , then the following statem ents hold true. ∪
V2 , and M ∈
M
1. R G , M can be obtained in tim e O ( | V | + | E | ) . 2. N o edge joins vertices in V1 \ R G , M with vertices in V2 ∩ R G , M ; no edge in M joins vertices in V1 ∩ R G , M with vertices in V2 \ R G , M . 3. A ll vertices in V1 ∩ R G , M and V2 \ R G , M are m atched vertices. 4. If G is not 0-expanding, then | V1 \ R G , M | > | N G ( V1 \ R G , M ) | . 5. | V2 ∩ R G , M | − | N G ( V2 ∩ R G , M ) | = | V2 | − | M | . 6. If R G , M = ∅ , then R G , M induces a 1-expanding subgraph of G . 7. M exposes exactly δ ∗ ( G ) vertices of V2 . 8. | Y | − | N G ( Y ) | ≤ δ ∗ ( G ) − 1 holds for every proper subset Y of V2 .
We not e in passing t hat we get t he same set R G , M for every M ∈ M ( G ); t his follows from t he fact t hat every M ′ ∈ M ( G ) mat ches t he vert ices in V1 ∩ R G , M (t hese vert ices b elong t o every minimum vert ex cover, see [1]). T heorem 1 b elow is due t o Lov´a sz and P lummer [14, T heorem 1.3.6] and provides t he basis for an effi cient t est for q-expansion. We st at e t he t heorem using t he following const ruct ion: From a bipart it e graph G = ( V1 , V2 , E ), x ∈ V1 , and q ≥ 1, we obt ain t he bipart it e graph G q x by adding new vert ices x 1 , . . . , x q t o V1 and adding edges such t hat t he new vert ices have exact ly t he same neighb ors as x ; i.e., G q x = ( V1 ∪ { x 1 , . . . , x q } , V2 , E ∪ { x i y : x y ∈ E } ).
Minimal Unsat isfiable Formulas
553
T h e o r e m 1 ( L o v ´a s z a n d P l u m m e r [1 4 ]) A 0-expanding bipartite graph G = ( V1 , V2 , E ) is q-expanding if and only if G q x is 0-expanding for every x ∈ V1 .
L e m m a 3 G iven a bipartite graph G = ( V1 , V2 , E ) and M ∈ M ( G ) . For every fixed integer q ≥ 0, deciding whether G is q-expanding and, if G is not q-expanding, finding a “witness set” X ⊆ V1 with | N G ( X ) | < | X | + q, can be perform ed in tim e O ( | V1 | · | E | + | V2 | ) .
P roof. (Sket ch) For a vert ex x ∈ V1 we can const ruct M x ∈ M ( G q x ) by augment ing M at most q t imes. By T heorem 1, G is q-expanding if and only if | M x | = | V1 | + q holds for every x ∈ V1 . Assume t hat | M x | < | V1 | + q for some x ∈ V1 . We form R G q x , M x and consider X ′ := ( V1 ∪ { x 1 , . . . , x q } ) \ R G q x , M x . Lemma 2(4) yields | N G q x ( X ′ ) | < | X ′ | . By means of Lemma 2(2) one can show t hat { x , x 1 , . . . , x q } ⊆ X ′ . For X := X ′ \ { x 1 , . . . , x q } we have | N G ( X ) | = ′ ′ ⊓⊔ | N G q x ( X ) | < | X | = | X | − q; t hus X is a wit ness set .
4
M at ch in g s an d E x p an sio n o f Fo rm u las
To every formula F we associat e a bipart it e graph I ( F ), t he incidence graph of F , whose vert ices are t he clauses and variables of F , and where each clause is adjacent t o t he variables which occur in it ; t hat is, I ( F ) = ( v ar ( F ) , F , E ( F )) wit h ( x , C ) ∈ E ( F ) if and only if x ∈ v ar ( C ); see F ig. 1. for an example. By means v
{
F ig. 1 .
w
v, x , y }
x
{
y
v, w, y, z}
Incidence graph of t he formula
F
=
z
{
w , x , z}
{ { v, x , y}
,
{ v, w , y, z}
,
{ w , x , z} }
.
of t his const ruct ion, concept s for bipart it e graphs apply direct ly t o formulas. In part icular, we will sp eak of q-expanding formulas, mat chings of formulas, and t he (maximum) deficiency of formulas. T hat is, a formula F is q-expanding if and only if | F X | ≥ | X | + q for every nonempty set X ⊆ v ar ( F ). T he deficiency of a formula F is δ ( F ) = | F | − | v ar ( F ) | ; it s m axim um deficiency is δ ∗ ( F ) = max F ′ ⊆ F δ ( F ′ ). If v ar ( F ) = ∅ , t hen F is q-expanding for any q, and we have δ ∗ ( F ) = | F | ≤ 1. M ( F ) denot es t he set of maximum mat chings of F . Not e t hat 1-expanding formulas are exact ly t he “mat ching lean” formulas of [12]. In t erms of formulas, part s 7 and 8 of Lemma 2 read as follows (see [12] for an alt ernat e proof of Lemma 5). L e m m a 4 E very M ∈
M
( F ) exposes exactly δ ∗ ( F ) clauses.
554
S. Szeider
L e m m a 5 If F is 1-expanding and F ′
F , then δ ∗ ( F ′ )
≤
δ
∗
( F ) − 1.
A mat ching M of a formula F gives rise t o a part ial t rut h assignment τ M as follows. For every ( x , C ) ∈ M we put τ M ( x ) = 1 if x ∈ C , and τ M ( x ) = 0 if x ∈ C . If | M | = | F | , t hen τ M evident ly sat isfies F ; t hus we have t he following (t his observat ion has b een made in [18] and [1]). L e m m a 6 If a form ula F has a m atching which m atches all clauses, i.e., if δ ∗ ( F ) = 0, then F is satisfiable.
Formulas wit h maximum deficiency 0 are t ermed m atched form ulas in [8]. For example, t he formula F shown in F ig. 1. is mat ched since t he mat ching M = { ( v , { v , x , y } ), ( w , { v , w , y , z } ), ( x , { w , x , z } ) } mat ches all clauses; M gives rise t o t he sat isfying t rut h assignment τ M wit h τ M ( v ) = 0, τ M ( w ) = 1, τ M ( x ) = 0. Lemma 2 yields t he following result (which is essent ially [7, Lemma 10]). L e m m a 7 G iven a form ula F of length l and M ∈ M ( F ) , then we can find in tim e O ( l ) an autark assignm ent α of F such that F [α ] is 1-expanding; m oreover, M ∩ E ( F [α ]) ∈ M ( F [α ]) .
In view of Lemma 1 it follows t hat minimal unsat isfiable formulas F are 1-expanding and so δ ∗ ( F ) = δ ( F ) (see also [1,8]). T he next result ext ends Lemma 6 t o formulas wit h p osit ive maximum deficiency. T h e o r e m 2 ( F l e i s c h n e r , e t a l . [7 ]) A form ula F is satisfiable if and only if F [τ ] is a m atched form ula for som e truth assignm ent τ with | v ar ( τ ) | ≤ δ ∗ ( F ) .
In part icular, for δ ∗ ( F )
≤
1, T heorem 2 yields t he following.
L e m m a 8 Let F be a form ula of length l on n variables. If δ ∗ ( F ) ≤ 1, then we can find a satisfying truth assignm ent of F ( if it exists) in tim e O ( n l ) .
T heorem 2 yields an n O ( k ) t ime algorit hm for sat isfiability of formulas wit h δ ( F ) ≤ k , since for checking sat isfiability we just have t o consider all inst ant iat ions of at most k variables and t o check whet her t he result ing formulas are mat ched. We not e t hat a similar problem, k -induced 3-cnf satisfiability, is W [P ]-complet e (see [6]); t here, it is asked whet her we can inst ant iat e at most k variables such t hat t he result ing formula “unravels” – i.e., if t he result ing formula can b e sat isfied by recursive inst ant iat ion of variables which occur in unit clauses. ∗
5
M ain R e d u ct io n s
We call a formula F δ ∗ -critical if δ ∗ ( F [x = ǫ ]) ≤ δ ∗ ( F ) − 1 holds for every ( x , ǫ ) ∈ v ar ( F ) × { 0, 1} . T he ob ject ive of t his sect ion is t o reduce a given formula F effi cient ly t o a δ ∗ -crit ical formula F ′ ensuring δ ∗ ( F ′ ) ≤ δ ∗ ( F ) and F ≡ s a t F ′ . T hus δ ∗ -crit ical formulas const it ut e a “problem kernel” in t he sense of [6]. T he next lemma (a st raight forward proof can b e found in [17]) pinp oint s a suffi cient condit ion for formulas b eing δ ∗ -crit ical.
Minimal Unsat isfiable Formulas L e m m a 9 2-expanding form ulas without pure or singular literals are δ ∗
555
-critical.
Consider a sequence S = ( F 0 , M 0 ) , . . . , ( F q , M q ) where F i are formulas and ∈ M ( F i ), 0 ≤ i ≤ q. We call S a reduction sequence (st art ing from ( F 0 , M 0 )) if for each i ∈ { 1, . . . , q} one of t he following holds: Mi
– F i = F i − 1 [α i ] for some nonempty aut ark assignment α – F i = DP x i ( F i − 1 ) for a singular lit eral x i of F i − 1 .
i
of F i − 1 .
Not e t hat v ar ( F i ) v ar ( F i − 1 ), hence q ≤ | v ar ( F 0 ) | . By Lemma 1 and since always DP x ( F ) ≡ s a t F , F 0 and F q are equisat isfiable. T he following can b e verified easily. L e m m a 1 0 Let ( F 0 , M 0 ) , . . . , ( F q , M q ) be a reduction sequence. A ny satisfying truth assignm ent τ q of F q can be extended to a satisfying truth assignm ent τ 0 of F 0 ; any regular resolution refutation R q of F q can be extended to a regular resolution refutation R 0 of F 0 .
L e m m a 1 1 Let F 0 be a form ula on n variables with δ ∗ ( F 0 ) ≤ n , and let M 0 ∈ M ( F 0 ) . W e can construct in tim e O ( n 3 ) a reduction sequence S = ( F 0 , M 0 ) , . . . , ( F q , M q ) , q ≤ n , such that exactly one of the following holds.
1. δ 2. δ
∗ ∗
( F q ) ≤ δ ∗ ( F 0 ) − 1; ( F q ) = δ ∗ ( F 0 ) , F q is 1-expanding and has no pure or singular literals.
P roof. (Sket ch.) We const ruct S induct ively; assume t hat we have already const ruct ed ( F 0 , M 0 ) , . . . , ( F i − 1 , M i − 1 ) for some i ≥ 1; we obt ain F i as follows:
1. if F i − 1 is not 1-expanding then put F i := F i − 1 [α ] where α is a nonempty aut ark assignment of F i − 1 supplied by Lemma 7. 2. elseif F i − 1 has a pure lit eral x ǫ , ǫ ∈ { 0, 1} , then put F i = F i − 1 [x = ǫ ] ( x = ǫ is an aut ark assignment of F i − 1 ; cf. t he discussion in Sect ion 2). 3. elseif F i − 1 has a singular lit eral x ǫ , ǫ ∈ { 0, 1} , then put F i = DP x ( F i − 1 ). As soon as case 2 or case 3 wit h | F i | ≤ | F i − 1 | − 1 occurs, we have δ ∗ ( F i ) ≤ δ ∗ ( F i − 1 ) − 1; hence we t erminat e t he const ruct ion of S . In t erminal cases we can use t he Hop croft -Karp algorit hm for obt aining M i ; t hus t he cost of a t erminal case is O ( n 3 ). In non-t erminal cases, however, M i can b e const ruct ed direct ly from M i − 1 in t ime O ( n 2 ). ⊓⊔ By t he ab ove result s we can effi cient ly reduce a given formula unt il we end up wit h a formula which is 1-expanding and has no pure or singular lit erals. Next we present furt her reduct ions which yield δ ∗ -crit ical formulas. L e m m a 1 2 Let F be a 1-expanding form ula without pure or singular literals ∗ v ar ( F ) with | F X | ≤ | X | + 1. T hen F \ F X ≡ s a t F and δ ( F \ F X ) ≤
and let X ⊆ δ ∗ ( F ) − 1.
556
S. Szeider
P roof. (Sket ch.) F ( X ) must b e sat isfiable, since ot herwise it would b e minimal unsat isfiable, but t his is imp ossible, since every minimal unsat isfiable formula wit h deficiency 1 diff erent from { ∅ } has a singular lit eral (see [4]). Any sat isfying t ot al assignment α of F ( X ) is a nonempty aut ark assignment of F wit h F [α ] = F \ F X . T he result now follows by Lemmas 1 and 5. ⊓⊔ L e m m a 1 3 Let F be a 1-expanding form ula without pure or singular literals, m = | F | , n = | v ar ( F ) | , and let M ∈ M ( F ) . W e need at m ost O ( n 2 m ) tim e to decide whether F is 2-expanding, and if it is not, to find an autark assignm ent α of F with δ ∗ ( F [α ]) ≤ δ ∗ ( F ) − 1 and som e M ′ ∈ M ( F [α ]) .
P roof. (Sket ch.) In view of Lemma 3, O ( n 2 m ) t ime suffi ces t o decide whet her F is 2-expanding, and if it is not , t o obt ain a set X ⊆ v ar ( F ) wit h | F X | = | X | + 1 ( δ ∗ ( F ( X ) ) ≤ 1). By t he preceding Lemma, F ( X ) is sat isfiable, and by Lemma 8 we can find a t ot al sat isfying assignment α in t ime O ( n 2 m ); δ ∗ ( F [α ]) ≤ δ ∗ ( F ) − 1 follows (Lemmas 1 and 5). We need at most one augment at ion t o obt ain M ′ from M ∩ E ( F [α ]). ⊓⊔
We summarize t he result s of t his sect ion: n , and T h e o r e m 3 Let F 0 be a form ula on n variables with δ ∗ ( F 0 ) ≤ 3 let M 0 ∈ M ( F 0 ) . W e can obtain in tim e O ( n ) a reduction sequence ( F 0 , M 0 ) , . . . , ( F q , M q ) , q ≤ n , such that exactly one of the following holds:
1. δ 2. δ
6
∗ ∗
( F q ) ≤ δ ∗ ( F 0 ) − 1; ( F q ) = δ ∗ ( F 0 ) and F q is δ ∗ -critical.
P ro o f o f M ain R e su lt s
T h e o r e m 4 Satisfiability of form ulas with n variables and m axim um deficiency k can be decided in tim e O (2k n 3 ) . T he decision is certified by a satisfying truth
assignm ent or a regular resolution refutation of the input form ula. P roof. (Sket ch.) We may assume k ≤ n , since ot herwise t he t heorem holds by t rivial reasons. We form a search t ree T where each vert ex v is lab eled by a reduct ion sequence S v as follows (if S v = ( F 0 , M 0 ) , . . . , ( F r , M r ), t hen we writ e fi r st ( v ) = F 0 and l a st ( v ) = F r ). We const ruct some M ∈ M ( F ) by t he Hop croft Karp algorit hm and st art wit h a root vert ex v 0 ; we obt ain S v 0 applying T heorem 3 t o ( F , M ). Assume now t hat we have part ially const ruct ed T . We halt as soon as v ar ( l a st ( v )) = ∅ for all leaves v . If v ar ( l a st ( v )) = ∅ for a leaf v , S v = ( F 0 , M 0 ) , . . . , ( F r , M r ), t hen by T heorem 3, eit her (i) δ ∗ ( F r ) ≤ δ ∗ ( F 0 ) − 1, or (ii) δ ∗ ( F r ) = δ ∗ ( F 0 ) and F r is δ ∗ -crit ical. In t he first case we add a single child v ′ t o v , and we lab el v ′ by a reduct ion sequence st art ing from ( F r , M r ); i.e., ′ ′ ′ ′ fi r st ( v ) = l a st ( v ). In t he second case we add two children v and v , lab eled by 0 reduct ion sequences st art ing from ( F r [x = 0], M ) and ( F r [x = 1], M 1 ), resp ect ively (t he mat chings M 0 , M 1 are obt ained by t he Hop croft -Karp algorit hm).
Minimal Unsat isfiable Formulas
557
We observe t hat t he height of T is indeed at most δ ∗ ( F ) = k , and so T has at most 2k − 1 vert ices; t hus O (2k n 3 ) t ime suffi ces t o const ruct T (T heorem 3). Since F is sat isfiable if an only if l a st ( v ) is sat isfiable for at least one leaf v of T , t he first part of t he t heorem holds t rue. By means of Lemma 10 we can read off from T a sat isfying assignment or a regular resolut ion refut at ion. ⊓⊔ T h e o r e m 5 M inim al unsatisfiable form ulas with n variables and n + k clauses can be recognized in tim e O (2k n 4 ) .
P roof. If k ≥ n , t hen t he t heorem holds by t rivial reasons, since we can enumerat e all t ot al t rut h assignment s of F in t ime O (2n ); hence we assume k < n . Let F = { C 1 , . . . , C m } , m = n + k < 2n . If F is minimal unsat isfiable, t hen it must b e 1-expanding and so δ ∗ ( F ) = δ ( F ) = k ; t he lat t er can b e checked effi cient ly (Lemma 7). Furt hermore, we have t o check whet her F is unsat isfiable, and whet her F i := F \ { C i } is sat isfiable for all i ∈ { 1, . . . , m } . T his can b e accomplished by m + 1 applicat ions of T heorem 4 (we have δ ∗ ( F i ) ≤ k − 1 by Lemma 5). T hus t he t ime complexity O (( m + 1)2k n 3 ) ≤ O (2k n 4 ) follows. ⊓⊔
R e fe re n ce s 1. R. Aharoni and N. Linial. Minimal non-two-colorable hypergraphs and minimal unsat isfiable formulas. J . C om bi n . T heor y Ser . A , 43:196–204, 1986. 2. M. Alekhnovich and A. A. Razborov. Sat isfiability, branch-widt h and T seit in t aut ologies. In P r oceedi n gs of t he 43r d I E E E F O C S, pages 593–603, 2002. 3. B. Courcelle, J . A. Makowsky, and U. Rot ics. On t he fixed paramet er complexity of graph enumerat ion problems definable in monadic second-order logic. D i scr . A ppl. M at h. , 108(1-2):23–52, 2001. 4. G. Davydov, I. Davydova, and H. Kleine B¨u ning. An effi cient algorit hm for t he minimal unsat isfiability problem for a subclass of CNF . A n n . M at h. A r t i f. I n t el l. , 23:229–245, 1998. 5. R. Diest el. G r aph T heor y . Springer Verlag, New York, 2nd edit ion, 2000. 6. R. G. Downey and M. R. Fellows. P ar am et er i zed C om plexi t y . Springer Verlag, 1999. 7. H. F leischner, O. Kullmann, and S. Szeider. P olynomial-t ime recognit ion of minimal unsat isfiable formulas wit h fixed clause-variable diff erence. T heor et . C om put . Sci . , 289(1):503–516, 2002. 8. J . Franco and A. Van Gelder. A perspect ive on cert ain polynomial t ime solvable classes of sat isfiability. D i scr . A ppl. M at h. , 125:177–214, 2003. 9. G. Got t lob, F . Scarcello, and M. Sideri. F ixed-paramet er complexity in AI and nonmonot onic reasoning. A r t i fi ci al I n t el li gen ce, 138(1-2):55–86, 2002. 10. H. Kleine B¨u ning. An upper bound for minimal resolut ion refut at ions. In P r oc. C SL ’ 98, volume 1584 of L N C S, pages 171–178. Springer Verlag, 1999. 11. H. Kleine B¨u ning. On subclasses of minimal unsat isfiable formulas. D i scr . A ppl. M at h. , 107(1–3):83–98, 2000. 12. O. Kullmann. Lean clause-set s: Generalizat ions of minimally unsat isfiable clauseset s. To appear in D i scr . A ppl. M at h. 13. O. Kullmann. An applicat ion of mat roid t heory t o t he SAT problem. In F i ft een t h A n n ual I E E E C on fer en ce on C om put at i on al C om plexi t y , pages 116–124, 2000.
558
S. Szeider
14. L. Lov´a sz and M. D. P lummer. M at chi n g T heor y . Nort h-Holland P ublishing Co., Amst erdam, 1986. 15. B. Monien and E. Speckenmeyer. Solving sat isfiability in less t han 2 st eps. D i scr . A ppl. M at h. , 10:287–295, 1985. 16. C. H. P apadimit riou and D. Wolfe. T he complexity of facet s resolved. J . C om put . Syst em Sci . , 37(1):2–13, 1988. 17. S. Szeider. Minimal unsat isfiable formulas wit h bounded clause-variable diff erence are fixed-paramet er t ract able. Technical Report T R03–002, Revision 1, E lect r on i c C ol loqui um on C om put at i on al C om plexi t y (ECCC), 2003. 18. C. A. Tovey. A simplified NP -complet e sat isfiability problem. D i scr . A ppl. M at h. , 8(1):85–89, 1984. n
A ut hor I ndex
A bu-K hzam, Faisal N. 394 A sano, Tet suo 130 Ban, Y ih-En A ndrew 509 Bent ley, Jon 3 Bergeron, A nne 68 Bespamyat nikh, Sergei 20, 509 Biedl, T herese 182 Borodin, A llan 272 Brejov´a, Broˇna 182 Cai, Jin-Y i 202 Chandran, L. Sunil 385 Chen, Danny Z. 30, 455 Chen, Lihua 435 Chen, Yen Hung 122 Chen, Zhi-Zhong 57 Chen, Zhixiang 284 Chin, Francis Y .L. 425 Chung, Ren Hua 5 Chwa, K yung-Yong 415 Cieliebak, M ark 519 Collins, M ichael J. 467 Czygrinow, A . 242 Dang, Zhe 159 Demaine, Erik D. 182, 351 Deng, X iaot ie 262, 435
Ha´n´ckowiak, M . 242 He, X in 139 Hohenberger, Susan 351 Hon, W ing-K ai 80 Igarashi, Yoshihide 232 Iwama, K azuo 304, 339 K ashiwabara, K enji 192 K at oh, Naoki 130 K avit ha, T . 385 K awachi, A kinori 304 K ikuchi, Yosuke 329 K ilt z, Eike 294 K im, Hee-Chul 319 K im, Jae-Hoon 415 K oren, Yehuda 496 K ut z, M art in 212 Langst on, M ichael A . 394 Lee, Hyun Chul 272 Lefmann, Hanno 112 Li, X iang-Yang 364 374 Liben-Nowell, David 351 Lin, Guohui 57 Lin, Zhiyong 40 Lingas, A ndrzej 50 L´opez-Ort iz, A lejandro 182 Lu, Chin Lung 122
Eidenbenz, St ephan 519 Fang, Qizhi 262, 435 Fischer, E. 90 Fowler, Richard 284 Fu, A da Wai-Chee 284 Fu, Wei 80 Fung, St anley P.Y . 425
M akowsky, J.A . 90 M arron, M ark 537 M ason, James J. 455 M at suo, Yuki 172 M iyazaki, Shuichi 339 M iyazaki, Takashi 222 M oret , Bernard M . E. 537 M ust afa, Nabil H. 509
Gaibisso, Carlo 404 Gao, Yong 57 Garg, A shim 475 Greenberg, Ronald I. 528 Gusfield, Dan 5
Nakano, Shin-ichi 329 Niewiadomski, Robert 57 Nishizeki, Takao 172 Okamot o, Yoshio 192
Halld´orsson, M agn´us 339 Hamel, A ng`ele M . 182
Park, Jung-Heum 319
560
A ut hor Index
Proiet t i, Guido 404 Rot e, G¨unt er 445 Rusu, A drian 475 San Piet ro, Pierluigi 159 Schmid, St even R. 455 Schwabe, Eric J. 252 Shahrokhi, Farhad 487 Shibat a, Yukio 329 Simon, Hans Ulrich 294 Spencer, Joel 1 St oye, Jens 68 Subramanian, C.R. 385 Sung, W ing-K in 80 Sut herland, Ian M . 252 Swenson, K rist er M . 537 S´y kora, Ondrej 487 Szeider, St efan 548 Sz´ekely, Laszlo A . 487 Takamura, M asat aka 232 Tamaki, Hisao 130 Tan, Richard B. 404 Tanaka, Hiroyuki 329 Tang, Chuan Y i 122 T ian, Feng 435 Tokuyama, Takeshi 130 Uno, Takeaki 192
V inaˇr , Tom´aˇs 182 Vrt ’ o, Imrich 487 Wahlen, M art in 50 Wang, Cao A n 445 Wang, Chunyue 284 Wang, Lusheng 445 Wang, Yang 57 Wang, Yu 374 Wat anabe, Osamu 202 Woeginger, Gerhard J. 519 Wu, Junfeng 57 Wu, X iaodong 455 X u, Bin 30 X u, Jinhui 40 X u, Y infeng 445 Yamamot o, Hiroaki 222 Yamashit a, Shigeru 304 Yanagisawa, Hiroki 339 Yang, Yang 40 Yen, Hsu-Chun 149 Yu, Lien-Po 149 Zhang, Huaming 139 Zheng, X izhong 102 Zhou, X iao 172 Zhu, Shanfeng 262