ebook img

Algorithms on Trees and Graphs PDF

491 Pages·2002·16.02 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Algorithms on Trees and Graphs

Algorithms on Trees and Graphs Springer-Verlag Berlin Heidelberg GmbH Gabriel Valiente Algorithms on Trees and Graphs With 157 Figures " Springer prof Dr. Gabriel Valiente Technical University of Catalonia Department of Software Jordi Girona, 1-3 (Module C6) 08034 Barcelona Spain Library of Congress Cataloging-in-Publication Data applied for Die Deutsche Bibliothek-CIP-Einheitsaufnahme Valiente, Gabriel: Algorithms on trees and graphs / Gabriel Valiente ISBN 978-3-642-07809-5 ISBN 978-3-662-04921-1 (eBook) DOI 10.1007/978-3-662-04921-1 ACM Computing Classification (1998) E2, G.2.2, GA, D.I ISBN 978-3-642-07809-5 This work is subject to copyright. Ali rights are reserved. whether the whole or part of the material is concerned, specificallythe rights oftranslation. reprinting, reuse ofillustrations, recitation. broadcasting, reproduction on microfilm or in any olher 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 ils current version, and permission for use must always be obtained from Springer-Verlag Berlin Heidelberg GmbH. Violalions are liable for prosecution under the German Copyright Law. © Springer-Verlag Berlin Heidelberg 2002 Originally published by Springer-Verlag Berlin Heidelberg New York in 2002 Softcover reprint of the hardcover 1st edition 2002 The use of designations, trademarks. etc. in this publication does not imply. even in the absence of a specific statement, that such names are exempt from the relevant protective laws and reguJations and therefore free for general use. Cover Design: KunkelLopka. Heidelberg Typesetting: Computer ta film by author 5 data Printed an acid-free paper SPIN 10855180 45/3142PS 5432 I O To Daina, Kristians, and Davis Preface Graph algorithms, a long-established subject in mathematics and com puter science curricula, are also of much interest to disciplines such as computational molecular biology and computational chemistry. This book goes beyond the classical graph problems of shortest paths, spanning trees, flows in networks, and matchings in bipartite graphs, and addresses further algorithmic problems of practical application of trees and graphs. Much of the material presented in the book is only available in the specialized research literature. The book is structured around the fundamental problem of isomor phism. Tree isomorphism is covered in much detail, together with the related problems of subtree isomorphism, maximum common subtree isomorphism, and tree comparison. Graph isomorphism is also cov ered in much detail, together with the related problems of sub graph isomorphism, maximal common subgraph isomorphism, and graph edit distance. Building blocks for solving some of these isomorphism problems are algorithms for finding maximal and maximum cliques. Most intractable graph problems of practical application are not even approximable to within a constant bound, and several of the isomorphism problems addressed in this book are no exception. The book can thus be seen as a companion to recent texts on approxima tion algorithms [15, 344], but also as a complement to previous texts on combinatorial and graph algorithms [69, 78, 107, 127, 130, 203, 232,236,229,255,271,304,321,336,367]. The book is conceived on the ground of first, introducing simple algorithms for these problems in order to develop some intuition be fore moving on to more complicated algorithms from the research lit erature, and second, stimulating graduate research on tree and graph VIII Preface algorithms by providing, together with the underlying theory, a solid basis for experimentation and further development. Algorithms are presented on an intuitive basis, followed by a de tailed exposition in a literate programming style. Correctness proofs are also given, together with a worst-case analysis of the algorithms. Further, full C++ implementation of all the algorithms using the LEDA library of efficient data structures and algorithms is given throughout the book. These implementations include result checking of implementation correctness using correctness certificates. The choice of LEDA, which is becoming a defacto standard for graduate courses on graph algorithms throughout the world, is not casual, because it allows the student, lecturer, researcher, and prac titioner to complement algorithmic graph theory with actual imple mentation and experimentation, building upon a thorough library of efficient implementations of modern data structures and fundamental algorithms. An interactive demonstration including animations of all the al gorithms using LEDA is given in an appendix and is available on a web site, at http://www.lsi. upc. esrvaliente/algorithm/, together with the source code of all the algorithms. The interactive demonstration also includes visual checkers of implementation cor rectness. Structure The book is divided into four parts. Part I is of an introductory na ture and consists of two chapters. Chap. 1 includes a review of ba sic graph-theoretical notions and results used throughout the book, a brief primer of literate programming, and an exposition of the imple mentation correctness approach by result checking using correctness certificates. Chap. 2 is devoted exclusively to the fundamental algorithmic tech niques used in the book: backtracking, branch-and-bound, divide-and conquer, and dynamic programming. These techniques are illustrated by means of a running example: algorithms for the tree edit distance problem. Preface IX Part II also consists of two chapters. Chap. 3 addresses the most common methods for traversing general, rooted trees: depth-first pre fix leftmost (preorder), depth-first prefix rightmost, depth-first postfix leftmost (postorder), depth-first postfix rightmost, breadth-first left most (top-down), breadth-first rightmost, and bottom-up traversal. Tree drawing is also discussed as an application of tree traversal meth ods. Chap. 4 addresses several isomorphism problems on ordered and unordered trees: tree isomorphism, subtree isomorphism, and maxi mum common subtree isomorphism. Computational molecular biol ogy is also discussed as an application of the different isomorphism problems on trees. Part III consists of three chapters. Chap. 5 addresses the most common methods for traversing graphs: depth-first and breadth-first traversal, which respectively generalize depth-first prefix leftmost (preorder) and breadth-first leftmost (top-down) tree traversal. Left most depth-first traversal of an undirected graph, a particular case of depth-first traversal, is also discussed. Isomorphism of ordered graphs is also discussed as an application of graph traversal methods. Chap. 6 addresses the related problems of finding cliques, inde pendent sets, and vertex covers in trees and graphs. Multiple align ment of protein sequences in computational molecular biology is also discussed as an application of clique algorithms. Chap. 7 addresses several isomorphism problems on graphs: graph isomorphism, graph automorphism, subgraph isomorphism, and max imal common subgraph isomorphism. Chemical structure search is also discussed as an application of the different graph isomorphism problems. Part IV consists of three appendices, followed by bibliographic ref erences and an index. Appendix A gives an overview of LEDA, in cluding a simple C++ representation of trees as LEDA graphs, and a C++ implementation of radix sort using LEDA. The interactive demonstration of graph algorithms presented throughout the book is put together in Appendix B. Finally, Appendix C contains a complete index to all program modules described in the book. X Preface Audience This book is suitable for use in upper undergraduate and graduate level courses on algorithmic graph theory. It can also be used as a sup plementary text in basic undergraduate and graduate-level courses on algorithms and data structures, and in computational molecular biol ogy and computational chemistry courses as well. Some basic knowl edge of discrete mathematics, data structures, algorithms, and pro gramming at the undergraduate level is assumed. Acknowledgments This book is based on lectures taught at the Technical University of Catalonia, Barcelona between 1996 and 2002, and the University of Latvia, Riga between 2000 and 2002. Numerous colleagues at the Technical University of Catalonia have influenced the approach to data structures and algorithms on trees and graphs expressed in this book. In particular, the author would like to thank Jose L. Balcazar, Rafel Casas, Jordi Cortadella, Josep Diaz, Conrado Martinez, Xavier Messeguer, Roberto Nieuwenhuis, Fernando Orejas, Jordi Petit, Salvador Roura, and Maria Serna, to name just a few. It has been a pleasure to share teaching and research experiences with them over the last several years. The author would also like to thank Ricardo Baeza-Yates, Francesc Rosse116, and Steven Skiena, for their standing support and encour agement, and Hans-Jorg Kreowski, for supporting basic and applied research on graph algorithms within the field of graph transformation. It has been a pleasure for the author to work out editorial matters together with Alfred Hofmann, Ingeborg Mayer, and Peter StraBer of Springer-Verlag. Special thanks go to the Technical University of Catalonia for funding the sabbatical year during which this book was written, and to the Institute of Mathematics and Computer Science, University of Latvia, in particular to Janis Barzdin, s and Rusin, s Freivalds, for host- ing the sabbatical visit. July 2002 Gabriel Valiente Contents Part I. Introduction 1. Introduction..................................... 3 1.1 Trees and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Literate Programming ...... . . . . . . . . . . . . . . . . . . . . .. 23 1.3 Implementation Correctness . . . . . . . . . . . . . . . . . . . . . .. 28 1.4 Representation of Trees and Graphs. . . . . . . . . . . . . . . .. 34 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 49 Bibliographic Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 49 Review Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 50 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 51 2. Algorithmic Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . .. 55 2.1 The Tree Edit Distance Problem. . . . . . . . . . . . . . . . . . .. 55 2.2 Backtracking.................................... 70 2.3 Branch-and-Bound............................... 80 2.4 Divide-and-Conquer.............................. 85 2.5 Dynamic Programming . . . . . . . . . . . . . . . . . . . . . . . . . .. 94 Summary ........................................... 107 Bibliographic Notes .................................. 107 Review Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 108 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 110 Part II. Algorithms on Trees 3. Tree Traversal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 113 3.1 Preorder Traversal of a Tree ....................... 113 3.2 Postorder Traversal of a Tree ...................... 119

Description:
Graph algorithms is a well-established subject in mathematics and computer science. Beyond classical application fields, like approximation, combinatorial optimization, graphics, and operations research, graph algorithms have recently attracted increased attention from computational molecular biolog
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.