0% found this document useful (1 vote)
228 views33 pages

Maths Graph Theory

Uploaded by

shubha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
228 views33 pages

Maths Graph Theory

Uploaded by

shubha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

A TOUR THROUGH

GRAPH THEORY
TEXTBOOKS in MATHEMATICS
Series Editors: Al Boggess and Ken Rosen

PUBLISHED TITLES
ABSTRACT ALGEBRA: A GENTLE INTRODUCTION
Gary L. Mullen and James A. Sellers
ABSTRACT ALGEBRA: AN INTERACTIVE APPROACH, SECOND EDITION
William Paulsen
ABSTRACT ALGEBRA: AN INQUIRY-BASED APPROACH
Jonathan K. Hodge, Steven Schlicker, and Ted Sundstrom
ADVANCED LINEAR ALGEBRA
Hugo Woerdeman
ADVANCED LINEAR ALGEBRA
Nicholas Loehr
ADVANCED LINEAR ALGEBRA, SECOND EDITION
Bruce Cooperstein
APPLIED ABSTRACT ALGEBRA WITH MAPLE™ AND MATLAB®, THIRD EDITION
Richard Klima, Neil Sigmon, and Ernest Stitzinger
APPLIED DIFFERENTIAL EQUATIONS: THE PRIMARY COURSE
Vladimir Dobrushkin
APPLIED DIFFERENTIAL EQUATIONS WITH BOUNDARY VALUE PROBLEMS
Vladimir Dobrushkin
APPLIED FUNCTIONAL ANALYSIS, THIRD EDITION
J. Tinsley Oden and Leszek Demkowicz
A BRIDGE TO HIGHER MATHEMATICS
Valentin Deaconu and Donald C. Pfaff
COMPUTATIONAL MATHEMATICS: MODELS, METHODS, AND ANALYSIS WITH MATLAB® AND MPI,
SECOND EDITION
Robert E. White
A COURSE IN DIFFERENTIAL EQUATIONS WITH BOUNDARY VALUE PROBLEMS, SECOND EDITION
Stephen A. Wirkus, Randall J. Swift, and Ryan Szypowski
A COURSE IN ORDINARY DIFFERENTIAL EQUATIONS, SECOND EDITION
Stephen A. Wirkus and Randall J. Swift
DIFFERENTIAL EQUATIONS: THEORY, TECHNIQUE, AND PRACTICE, SECOND EDITION
Steven G. Krantz
PUBLISHED TITLES CONTINUED

DIFFERENTIAL EQUATIONS: THEORY, TECHNIQUE, AND PRACTICE WITH BOUNDARY VALUE PROBLEMS
Steven G. Krantz
DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES, THIRD EDITION
George F. Simmons
DIFFERENTIAL EQUATIONS WITH MATLAB®: EXPLORATION, APPLICATIONS, AND THEORY
Mark A. McKibben and Micah D. Webster
DISCOVERING GROUP THEORY: A TRANSITION TO ADVANCED MATHEMATICS
Tony Barnard and Hugh Neill
DISCRETE MATHEMATICS, SECOND EDITION
Kevin Ferland
ELEMENTARY NUMBER THEORY
James S. Kraft and Lawrence C. Washington
ESSENTIALS OF MATHEMATICAL THINKING
Steven G. Krantz
EXPLORING CALCULUS: LABS AND PROJECTS WITH MATHEMATICA®
Crista Arangala and Karen A. Yokley
EXPLORING GEOMETRY, SECOND EDITION
Michael Hvidsten
EXPLORING LINEAR ALGEBRA: LABS AND PROJECTS WITH MATHEMATICA®
Crista Arangala
EXPLORING THE INFINITE: AN INTRODUCTION TO PROOF AND ANALYSIS
Jennifer Brooks
GRAPHS & DIGRAPHS, SIXTH EDITION
Gary Chartrand, Linda Lesniak, and Ping Zhang
INTRODUCTION TO ABSTRACT ALGEBRA, SECOND EDITION
Jonathan D. H. Smith
INTRODUCTION TO ANALYSIS
Corey M. Dunn
INTRODUCTION TO MATHEMATICAL PROOFS: A TRANSITION TO ADVANCED MATHEMATICS, SECOND EDITION
Charles E. Roberts, Jr.
INTRODUCTION TO NUMBER THEORY, SECOND EDITION
Marty Erickson, Anthony Vazzana, and David Garth
INVITATION TO LINEAR ALGEBRA
David C. Mello
PUBLISHED TITLES CONTINUED

LINEAR ALGEBRA, GEOMETRY AND TRANSFORMATION


Bruce Solomon
MATHEMATICAL MODELLING WITH CASE STUDIES: USING MAPLE™ AND MATLAB®, THIRD EDITION
B. Barnes and G. R. Fulford
MATHEMATICS IN GAMES, SPORTS, AND GAMBLING–THE GAMES PEOPLE PLAY, SECOND EDITION
Ronald J. Gould
THE MATHEMATICS OF GAMES: AN INTRODUCTION TO PROBABILITY
David G. Taylor
A MATLAB® COMPANION TO COMPLEX VARIABLES
A. David Wunsch
MEASURE AND INTEGRAL: AN INTRODUCTION TO REAL ANALYSIS, SECOND EDITION
Richard L. Wheeden
MEASURE THEORY AND FINE PROPERTIES OF FUNCTIONS, REVISED EDITION
Lawrence C. Evans and Ronald F. Gariepy
NUMERICAL ANALYSIS FOR ENGINEERS: METHODS AND APPLICATIONS, SECOND EDITION
Bilal Ayyub and Richard H. McCuen
ORDINARY DIFFERENTIAL EQUATIONS: AN INTRODUCTION TO THE FUNDAMENTALS
Kenneth B. Howell
PRINCIPLES OF FOURIER ANALYSIS, SECOND EDITION
Kenneth B. Howell
REAL ANALYSIS AND FOUNDATIONS, FOURTH EDITION
Steven G. Krantz
RISK ANALYSIS IN ENGINEERING AND ECONOMICS, SECOND EDITION
Bilal M. Ayyub
SPORTS MATH: AN INTRODUCTORY COURSE IN THE MATHEMATICS OF SPORTS SCIENCE AND
SPORTS ANALYTICS
Roland B. Minton
TRANSFORMATIONAL PLANE GEOMETRY
Ronald N. Umble and Zhigang Han
TEXTBOOKS in MATHEMATICS

A TOUR THROUGH
GRAPH THEORY

KARIN R. SAOUB
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2018 by Taylor & Francis Group, LLC


CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper


Version Date: 20171003

International Standard Book Number-13: 978-1-138-19780-0 (Paperback)


International Standard Book Number-13: 978-1-138-07084-4 (Hardback)

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the
validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the
copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to
publish in this form has not been obtained. If any copyright material has not been acknowledged please write and
let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or
utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including
photocopying, microfilming, and recording, or in any information storage or retrieval system, without written
permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com
(http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive,
Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for
a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of
payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only
for identification and explanation without intent to infringe.

Library of Congress Cataloging-in-Publication Data

Names: Saoub, Karin R., author.


Title: A tour through graph theory / Karin R. Saoub.
Description: Boca Raton : Taylor & Francis, 2017. | “A CRC title, part of the
Taylor & Francis imprint, a member of the Taylor & Francis Group, the
academic division of T&F Informa plc.” | Includes bibliographical
references and index.
Identifiers: LCCN 2017025808 | ISBN 9781138197800 (paperback)
Subjects: LCSH: Graph theory--Textbooks.
Classification: LCC QA166 .S26 2017 | DDC 511/.5--dc23
LC record available at https://lccn.loc.gov/2017025808

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com

and the CRC Press Web site at


http://www.crcpress.com
For my children
Contents

Preface xiii

1 Eulerian Tours 1

1.1 Königsberg Bridge Problem . . . . . . . . . . . . . . . . . . . 1


1.2 Introduction to Graph Models . . . . . . . . . . . . . . . . . 2
1.3 Touring a Graph . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Eulerian Circuit Algorithms . . . . . . . . . . . . . . . . . . 12
Fleury’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 12
Hierholzer’s Algorithm . . . . . . . . . . . . . . . . . . . . . . 16
1.5 Eulerization . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chinese Postman Problem . . . . . . . . . . . . . . . . . . . . 24
1.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

2 Hamiltonian Cycles 35

2.1 Conditions for Existence . . . . . . . . . . . . . . . . . . . . 36


2.2 Traveling Salesman Problem . . . . . . . . . . . . . . . . . . 41
Brute Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Nearest Neighbor . . . . . . . . . . . . . . . . . . . . . . . . . 47
Cheapest Link . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Nearest Insertion . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.3 Digraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Asymmetric Traveling Salesman Problem . . . . . . . . . . . 65
2.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

3 Paths 81

3.1 Shortest Paths . . . . . . . . . . . . . . . . . . . . . . . . . . 81


Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . 82
Chinese Postman Problem Revisited . . . . . . . . . . . . . . 91
3.2 Project Scheduling . . . . . . . . . . . . . . . . . . . . . . . . 93
Critical Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
3.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

ix
x Contents

4 Trees and Networks 109

4.1 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109


4.2 Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Kruskal’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . 115
Prim’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.3 Shortest Networks . . . . . . . . . . . . . . . . . . . . . . . . 130
Steiner Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
4.4 Traveling Salesman Problem Revisited . . . . . . . . . . . . . 140
4.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

5 Matching 151

5.1 Bipartite Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 152


5.2 Matching Terminology and Strategies . . . . . . . . . . . . . 154
Augmenting Paths and Vertex Covers . . . . . . . . . . . . . 159
5.3 Stable Marriages . . . . . . . . . . . . . . . . . . . . . . . . . 168
Unacceptable Partners . . . . . . . . . . . . . . . . . . . . . . 173
5.4 Matchings in Non-Bipartite Graphs . . . . . . . . . . . . . . 176
Stable Roommates . . . . . . . . . . . . . . . . . . . . . . . . 178
5.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

6 Graph Coloring 189

6.1 Four Color Theorem . . . . . . . . . . . . . . . . . . . . . . . 189


6.2 Coloring Bounds . . . . . . . . . . . . . . . . . . . . . . . . . 192
6.3 Coloring Strategies . . . . . . . . . . . . . . . . . . . . . . . 196
General Strategies . . . . . . . . . . . . . . . . . . . . . . . . 196
On-line Coloring . . . . . . . . . . . . . . . . . . . . . . . . . 200
6.4 Perfect Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Interval Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Tolerance Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 213
6.5 Weighted Coloring . . . . . . . . . . . . . . . . . . . . . . . . 216
6.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

7 Additional Topics 227

7.1 Algorithm Complexity . . . . . . . . . . . . . . . . . . . . . . 227


Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
7.2 Graph Isomorphism . . . . . . . . . . . . . . . . . . . . . . . 232
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
7.3 Tournaments . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
7.4 Flow and Capacity . . . . . . . . . . . . . . . . . . . . . . . . 245
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Contents xi

7.5 Rooted Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . 256


Depth-First Search Tree . . . . . . . . . . . . . . . . . . . . . 258
Breadth-First Search Tree . . . . . . . . . . . . . . . . . . . . 261
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
7.6 Planarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
7.7 Edge-Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Ramsey Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 281
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

Appendix 285
Creating a Triangle . . . . . . . . . . . . . . . . . . . . . . . . 285
Finding Angle Measure . . . . . . . . . . . . . . . . . . . . . 285
Finding the Fermat Point . . . . . . . . . . . . . . . . . . . . 286
Other Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

Selected Answers and Solutions 289

Bibliography 295

Image Credits 299

Index 301
Preface

Graph theory has been my passion since senior year of college. I was hooked
after just one week of my first course in graph theory. I completely changed
my plans post-graduation, choosing to apply to graduate schools and study
more mathematics. I found the interplay between rigorous proofs and simple
drawings both appealing and a nice break from my more computationally
heavy courses. Since becoming a teacher I have found a new appreciation for
graph theory, as a concept that can challenge students’ notions as to what
mathematics is and can be.
You might wonder why I chose to write this book, as there are numerous
texts devoted to the study of graph theory. Most books either focus on the
theory and the exploration of proof techniques, or contain a chapter or two on
the algorithmic aspect of a few topics from graph theory. This book is intended
to strike a balance between the two — focus on the accessible problems for
college students not majoring in mathematics, while also providing enough
material for a semester long course.
The goal for this textbook is to use graph theory as the vehicle for a
one-semester liberal arts course focusing on mathematical reasoning. Expla-
nations and logical reasoning for solutions, but no formal mathematical proofs,
are provided. There are discussions of both historical problems and modern
questions, with each chapter ending in a section detailing some more in-depth
problems. The final chapter also provides more rigorous graph theory and
additional topics that I personally find interesting but for which there is not
enough material to warrant an entire chapter. Each chapter will include prob-
lems to test understanding of the material and can be used for homework
or quiz problems. In addition, project ideas and items requiring research are
included at the end of each exercise section. Selected answers are available on
page 289.

Advice for Students


Reading a mathematics textbook takes skill and more effort than reading
your favorite novel at the beach. Professors often complain that their students
are not getting enough out of the readings they assign, but fail to realize that
most students have not been taught how to read mathematics. My advice
can be boiled down to one sentence: anytime you read mathematics, have
paper and pencil next to your book. You should expect to work through

xiii
xiv Preface

examples, draw graphs, and play around with the concepts. We learn by doing,
not passively reading or watching someone perform mathematics. This book
contains examples often posed in the form of a question. You should attempt to
find the solution before reading the one provided. In addition, some definitions
and concepts can get technical (as happens in mathematics) and the best way
to truly understand these is through working examples. At times, details of
an example, especially if it is the second or third of a type, will be left for the
reader or will appear in the exercises.

Advice for Instructors


This book is split into three main areas. The first focuses on topics related
to tours within a graph (Eulerian circuits, Hamiltonian cycles, and short-
est paths), the second to finding structure within a graph (spanning trees,
maximum matchings, and optimal coloring), and the third is a collection of
additional topics that can be used to delve deeper into topics covered in pre-
vious chapters or topics that do no warrant an entire chapter. Definitions
will appear as needed, but as with most mathematics books, later chapters
build upon previously introduced concepts. The chart below outlines how the
sections are related.
1.1

1.2

1.3

1.4 2.1 4.1 6.1 5.1

1.5 4.2 6.2 5.2


2.2
3.2 4.3 6.3 5.3
2.3
4.4 6.4 5.4
3.1
6.5

The Additional Topics sections in Chapter 7 may relate to multiple ear-


lier sections and will indicate individually which prior material is necessary.
References to these sections will occasionally appear throughout the first six
chapters of the book.
Preface xv

Thanks
I owe a huge debt to the many people who made this book possible.
To my colleagues Adam Childers, Chris Lee, Roland Minton, Maggie Rah-
moeller, Hannah Robbins, and David Taylor for their unwavering support. In
particular, David Taylor who provided a great sounding board for my ideas,
gave advice on formatting, and found the typos I could not.
To my sister-in-law, Leena Saoub Saunders, for her expertise in designing
the cover of this book.
To my parents, David and Pamela Steece, who always supported my
dreams and taught me the benefit of hard work.
To my husband Samer and children, Layla and Rami, who bring joy to my
life and endured my excitement and exasperation while writing this book.
To my CRC Press team, namely editor Bob Ross, editorial assistant Jose
Soto, copy editor Michele Dimont, and designer Kevin Craig, for their guidance
through the long process of writing a book.
Finally, a very special thanks goes to Ann Trenk, my graph theory professor
at Wellesley College. If not for her, I would not have discovered my life’s
passion and you would not be reading this book.

Dr. Karin R. Saoub


MCSP Department
Roanoke College
Salem, Virginia 24153
[email protected]
Chapter 1
Eulerian Tours

1.1 Königsberg Bridge Problem


You arrive in a new city and hear of an intriguing puzzle captivating the
population: can you leave your home, travel across each of the bridges in the
city exactly once and then return home? Upon one look at the map, you claim
“Of course it can’t be done!” You describe the requirements needed for such
a walk to take place and note this city fails those requirements. Easy enough!

The puzzle above is described by some as the birth of graph theory. In


1736, Leonhard Euler, one of the greatest mathematicians of all time, pub-
lished a short paper on the bridges of Königsberg, a city in Eastern Europe
(see the map above). Euler translated the problem into one of the “geometry
of location” (geometris situs) and determined that only certain configurations
would allow a solution to be possible. His publication set in motion an entirely
new branch of mathematics, one that has profound impact in modern math-
ematics, computer science, management science, counterterrorism, ... and the
list continues. This book will explore some of these topics, but we begin with
some basic terminology and mathematical modeling.

1
2 A Tour through Graph Theory

Without worrying about the technicalities, see if you can find a solution to
the Königsberg Bridge Problem! To aid in your analysis, note that Königsberg
contains seven brides and four distinct landmasses.

1.2 Introduction to Graph Models

Definition 1.1 A graph G consists of two sets: V (G), called the vertex set,
and E(G), called the edge set. An edge, denoted xy, is an unordered pair of
vertices. We will often use G or G = (V, E) as short-hand.

In a general graph xy and yx are treated equally, though it is customary to


write them in alphabetical order. In Chapter 2 we will study directed graphs
where the order in which an edge is written provides additional meaning.

Example 1.1 Let G be a graph where V (G) = {a, b, c, d, e} and E(G) =


{ab, cd, cd, bb, ad, bc}. Although G is defined by these two sets, we generally
use a visualization of the graph where a dot represents a vertex and an edge
is a line connecting the two dots (vertices). A drawing of G is given below.

e b

d c

Note that two lines were drawn between vertices c and d as the edge cd is
listed twice in the edge set. In addition, a circle was drawn at b to indicate an
edge (bb) that starts and ends at the same vertex.

It should be noted that the drawing of a graph can take many different
forms while still representing the same graph. The only requirement is to
faithfully record the information from the vertex set and edge set. We often
draw graphs with the vertices in a circular pattern (as shown in the example
Eulerian Tours 3

above), though in some instances other configurations better display the de-
sired information. The best configuration is the one that reduces complexity
or best illustrates the relationships arising from the vertex set and edge set.

Example 1.2 Consider the graph G from Example 1.1. Below are two
different drawings of G.
a c e

a b c d e

b d

To verify that these drawings represent the same graph from Example 1.1, we
should check the relationships arising from the vertex set and edge set. For
example, there are two edges between vertices c and d, a loop at b, and no
edges at e. You should verify the remaining edges.

To discuss the properties of graphs in mathematical models, we need the


proper terminology. The graph given in the examples above works as a good
reference for this initial terminology. The formal definitions are given below,
followed by the appropriate references to the graph in Example 1.1 (or Exam-
ple 1.2).

Definition 1.2 Let G be a graph.


• If xy is an edge, then x and y are the endpoints for that edge. We say
x is incident to edge e if x is an endpoint of e.
• If two vertices are incident to the same edge, we say the vertices are
adjacent. Similarly, if two edges share an endpoint, we say they are
adjacent. If two vertices are adjacent, we say they are neighbors and
the set of all neighbors of a vertex x is denoted N (x).
– ab and ad are adjacent edges since they share the endpoint a
– a and b are adjacent vertices since ab is an edge of G
– N (d) = {a, c} and N (b) = {a, b, c}
• If a vertex is not incident to any edge, we call it an isolated vertex .
– e is an isolated vertex
• If both endpoints of an edge are the same vertex, then we say the edge
is a loop.
4 A Tour through Graph Theory

– bb is a loop
• If there is more than one edge with the same endpoints, we call these
multi-edges.

– cd is a multi-edge
• If a graph has no multi-edges or loops, we call it simple.
• The degree of a vertex is the number of edges incident to that vertex,
with a loop adding two to the degree. Denote the degree of vertex v as
deg(v). If the degree is even, the vertex is called even; if the degree is
odd, then the vertex is odd.
– deg(a) = 2, deg(b) = 4, deg(c) = 3, deg(d) = 3, deg(e) = 0

Now that we have some basic graph terms, let’s look back at the
Königsberg Bridge Problem. Euler brilliantly reduced the map of Königsberg
to a simpler version where only the relationships between landmasses was of
importance. In graph form, the vertices represent the landmasses in the city
and the bridges are the edges. This is what we refer to as modeling — taking
a complex real-world problem and representing it mathematically.
Modeling is used in many branches of
mathematics, but often the phenomenon
in question is being translated into an
equation or experiment; here we are rep-
resenting a puzzle as a graph and using
properties of graphs to find a solution.
To the right is the drawing from Euler’s
original paper, and below it a graph c
model of Königsberg. You should see
how much simpler the graph is compared
to either the original map or Euler’s
drawing of the city. This is one bene-
fit of using a graph — only the relevant
information is displayed, which in this a d
case consists solely of bridges connect-
ing landmasses. The vertices represent
an island, a south bank, a north bank,
and a peninsula (a, b, c, and d, respec-
tively). The answer to the initial ques- b
tion becomes more evident when using
the graph: can you leave your home (vertex), travel across each of the bridges
(edges) in the city (graph) exactly once and then return home? If you have
not done so already, try it again on the graph. Do you have an answer?
Before we get too much further into answering the Königsberg Bridge
Eulerian Tours 5

Problem and its subsequent generalization, let’s go through a few more mod-
eling problems.

Example 1.3 Professor Minton needs to create a seating chart for his overly
chatty class. He wants students seated away from their friends whenever pos-
sible. He knows that Adam is friends with Betty, Carlos, Dave and Frank;
Betty is friends with Adam, Carlos, Dave and Emily; Dave is friends with
Adam, Betty, Carlos and Emily; and Frank is friends with Adam and Carlos.
Draw a graph that depicts these friendships.

Solution: Each person is represented by a vertex and an edge denotes a friend-


ship.

Adam

Frank Betty

Emily Carlos

Dave

Note that since friendships are symmetric (e.g., Adam is friends with Betty
and so Betty is friends with Adam) we only draw one edge between the ver-
tices. In Chapter 2 we will explore asymmetric relationships where direction-
ality becomes important.

As the example above demonstrates, problems that can be modeled by a


graph need to consist of distinct objects (such as people) and a relationship
between them (such as a friendship). The proper model will allow the graph
structure, or properties of the graph, to answer the question being asked. The
example below gives a different approach to graph modeling.

Example 1.4 Three student organizations (Student Government, Math


Club, and the Equestrian Club) are holding meetings on Thursday afternoon.
The only available rooms are 105, 201, 271, and 372. Based on membership
and room size, the Student Government can only use 201 or 372, Equestrian
Club can use 105 or 372, and Math Club can use any of the four rooms. Draw
a graph that depicts these restrictions.

Solution: Each organization and room is represented by a vertex, and an edge


denotes when an organization is able to use a room.
6 A Tour through Graph Theory

Student Math Equestrian


Government Club Club

372 201 105 271

Note that edges do not occur between two organizations or between two rooms,
as these would be nonsensical in the context of the problem. The graph above
is an example of a bipartite graph. This type of graph is often used to model
interactions between two distinct types of groups and will appear later in
Chapters 5 and 6.

Hopefully, you now have a clearer understanding of how modeling works.


We often need to think about what information is relevant, what question
we are trying to answer, and what type of visual display to employ. See the
exercises at the end of the chapter for more practice with graph modeling.

1.3 Touring a Graph


A part of the modeling process is determining what the answer we are
searching for looks like in graph form. What type of structure or operation
are we looking for? In our original search for a solution to the Königsberg
Bridge Problem, we discuss traveling through the city. What would traveling
through a graph mean? What types of restrictions might we place on such
travel? Below are additional definitions needed to answer these questions, after
which we will finally describe how to use a graph model to solve the Königsberg
Bridge Problem. As with the previous definitions, you are encouraged to refer
back to the graph in Example 1.1 for examples of these terms.

Definition 1.3 Let G be a graph.


• A walk is a sequence of vertices so that there is an edge between con-
secutive vertices. A walk can repeat vertices and edges.
• A trail is a walk with no repeated edges. A trail can repeat vertices but
not edges.
Eulerian Tours 7

• A path is a trail with no repeated vertex (or edges). A path on n vertices


is denoted Pn .
• A closed walk is a walk that starts and ends at the same vertex.
• A circuit is a closed trail; that is, a trail that starts and ends at the
same vertex with no repeated edges though vertices may be repeated.

• A cycle is a closed path; that is, a path that starts and ends at the
same vertex. Thus cycles cannot repeat edges or vertices. Note: we do
not consider the starting and ending vertex as being repeated since each
vertex is entered and exited exactly once. A cycle on n vertices is denoted
Cn .
The length of any of these tours is defined in terms of the number of edges.
For example, Pn has length n − 1 and Cn has length n.

Technically, since a path is a more restrictive version of a trail and a trail


is a more restrictive form of a walk, any path can also be viewed as a trail
and as a walk. However, a walk might not be a trail or a path (for example, if
it repeats vertices or edges). Similarly, a cycle is a circuit and a closed walk.
Unless otherwise noted, when we use any of the terms from Definition 1.3 we
are referring to the most restrictive case possible; for example, if we ask for a
walk in a graph then we want a walk that is not also a trail or a path.
In practice, it is often necessary to label the edges of a tour of a graph in
the sequential order in which they are traveled. This is especially important
when the graph is not simple.

Example 1.5 Given the graph below, find a trail (that is not a path) from
a to c, a path from a to c, a circuit (that is not a cycle) starting at b, and a
cycle starting at b.

a b c

d
f

g e
8 A Tour through Graph Theory

Solution:

Trail from a to c
a b 7 c

6
1
3
d
f
4
5
2
g e

Path from a to c
a b c

1 5
d
f
2 3
4
g e

Circuit starting at b
a b 6 c

1
5
2
d
f
4 3

g e

Cycle starting at b
a b 4 c

1
3
2
d
f

g e
Eulerian Tours 9

Note that the trail from a to c is not a path since the vertex f is repeated
and the circuit starting at b is not a cycle since the vertex d is repeated.
Moreover, the examples given above are not the only solutions but rather an
option among many possible solutions.

Earlier we defined what it meant for two vertices to be adjacent, namely


x and y are adjacent if xy is an edge in the graph. Notice that in common
language we may have wanted to say that x and y are connected since there
is a line that connects these dots on the page. However, in graph theory the
term connected refers to a different, though related, concept.

Definition 1.4 Let G be a graph. Two vertices x and y are connected if


there exists a path from x to y in G. The graph G is connected if every pair
of distinct vertices is connected.

This definition may seem overly technical when visually it is often easy to
determine if a graph is connected. The concept of connectedness is surprisingly
important in applications. The example below illustrates the importance of
connectedness for the Königsberg Bridge Problem.

Example 1.6 Island City has two islands, a peninsula, and left and right
banks, as shown on the left below. Modeling the relationship between the
landmasses and bridges of Island City gives us the graph below on the right.
r

p i1 i2

If the same puzzle were posed to the citizens of Island City as the one
for Königsberg, it would be impossible to travel every bridge and then return
home. In particular, there is no way to even travel from one side of the river
to the other! Thus, if we even have a hope of finding a solution, the resulting
graph must, at a minimum, be connected.

The Königsberg Bridge Problem is not just looking for a circuit, but rather
a special type that hits every edge. In honor of Leonhard Euler, these special
circuits are named for him. A similar term is used when allowing differing
starting and ending location of the tour.
10 A Tour through Graph Theory

Definition 1.5 Let G be a graph. An Eulerian circuit (or trail ) is a


circuit (or trail) that contains every edge and every vertex of G. If G contains
an Eulerian circuit it is called Eulerian and if G contains an Eulerian trail
but not an Eulerian circuit it is called semi-Eulerian.

Part of Euler’s brilliance was not only his ability to quickly solve a puzzle,
such as the Königsberg Bridge Problem, but also the foresight to expand on
that puzzle. What makes a graph Eulerian? Under what conditions will a city
have the proper tour? In his original paper, Euler laid out the conditions for
such a solution, though as was typical of the time, he only proved a portion
of the statement (see [2] or [14]).

Theorem 1.6 A graph G is Eulerian if and only if


(i) G is connected and
(ii) every vertex has even degree.
A graph G is semi-Eulerian if and only if
(i) G is connected and
(ii) exactly two vertices have odd degree.

The theorem above is of a special type in mathematics. It is written as an


“if and only if ” statement, which indicates that the conditions laid out are
both necessary and sufficient. A necessary condition is a property that must
be achieved in order for a solution to be possible and a sufficient condition is
a property that guarantees the existence of a solution.
For a more familiar example, consider renting and driving a car. If you
want to rent a car, a necessary condition would be having a driver’s license;
but this condition may not be sufficient since some companies will only rent a
car to a person of at least 25 years of age. In contrast, having a driver’s license
is sufficient to be able to drive a car, but is not necessary since you can drive
a car with a learner’s permit as long as a guardian is present.
Mathematicians often search for a property (or collection of properties)
that is both necessary and sufficient (such as a number is even if and only if
it is divisible by 2). The theorem above gives both necessary and sufficient
conditions for a graph to be Eulerian or semi-Eulerian. It should be clear why
connectedness must be achieved if every vertex is to be reached in a single
tour. Can you explain the degree condition? When traveling through a graph,
we need to pair each entry edge with an exit edge. If a vertex is odd, then
there is no pairing available and we would eventually get stuck at that vertex.
However, if the starting and ending locations are different, then exactly two
vertices must be odd since the first edge out of the starting vertex does not
need to be paired with a return edge and the last edge to the ending vertex
does not need to be paired with an exit edge.
Eulerian Tours 11

The proof that the conditions above were indeed both necessary and suf-
ficient was not published until 1873. The work was completed by German
mathematician Carl Hierholzer, who unfortunately died too young to see his
work in print. His contribution was recognized through the naming of one
procedure for finding Eulerian circuits that is discussed in the next section.

Example 1.7 Look back at each of the graphs appearing so far in this chap-
ter. Which ones are Eulerian? semi-Eulerian? neither?

Solution:
• The graph representing Königsberg is neither Eulerian nor semi-Eulerian
since all four vertices are odd.
• The graph in Example 1.1 is neither Eulerian nor semi-Eulerian since it
is not connected.
• The graph in Example 1.3 is Eulerian since it is connected and all the
vertices have degree 2 or 4.
• The graph in Example 1.4 is semi-Eulerian since it is connected and
exactly two vertices are odd (namely, 372 and 271).
• Even though the graph in Example 1.5 is connected, it is neither Eule-
rian nor semi-Eulerian since it has more than two odd vertices (namely,
a, b, e, and f ).

Note that the solution discussed in the first bullet above definitively an-
swers the Königsberg Bridge Problem — there is no way to leave your home,
travel across every bridge in the city exactly once, and return home!
In addition to the result above, Euler also determined some basic properties
of graphs in his seminal paper. The most important of these is stated below.

Theorem 1.7 (Handshaking Lemma) Let G = (V, E) be a graph and |E|


denote the number of edges in G. Then the sum of the degrees of the vertices
equals twice the number of edges; that is if V = {v1 , v2 , . . . , vn }, then

deg(v1 ) + deg(v2 ) + · · · + deg(vn ) = 2|E|

This is often referred to as the Handshaking Lemma, as a quick proof of the


statement is best described by a graph model of handshakes. Define a graph
where each vertex represents a person and an edge represents a handshake
that has occurred between the people represented by the endpoints of the
edge. Then the total number of handshakes is equal to the total number of
edges in the graph and the number of times a person shook hands is equal
to the degree of his or her representative vertex. When totaling the degrees
of all the vertices, each handshake will be counted twice (one for each person
involved) and so the sum of the degrees equals twice the number of edges.
12 A Tour through Graph Theory

If the sum total of a collection of integers is even, how many odd integers
could appear in the sum? If not immediately clear, try a few examples. If
we add an odd number of odd integers, will the sum be even? No! In graph
theoretic terms, we get the following corollary to the Handshaking Lemma.

Corollary 1.8 There must be an even number of odd vertices in any graph G.

Why is this true? Since the sum of the degrees in any graph is twice the
number of edges, we know that the sum of the degrees must be even. Based
on our discussion above, this implies the number of odd vertices must also be
even.

1.4 Eulerian Circuit Algorithms


The previous section was mainly concerned with the existence question
— under what conditions will a graph have an Eulerian circuit? This was
definitively answered with two conditions that are easy to check. This section
focuses on the construction question: how do we find an Eulerian circuit once
we know one exists?
There are numerous methods for finding an Eulerian circuit (or trail),
though we will focus on only two of these. Each of these is written in the form
of an algorithm.

Definition 1.9 [36] An algorithm is a procedure for solving a mathematical


problem in a finite number of steps that frequently involve repetition of an
operation.

For our purposes, algorithms will be described in terms of the input, steps
to perform, and output, so it is clear how to apply the algorithm in various
scenarios. For the pseudo-code or more technical forms of the algorithms in
this book, the reader is encouraged to explore [4] or [24].

Fleury’s Algorithm
The first method for finding an Eulerian circuit that we discuss is Fleury’s
Algorithm. Although Fleury’s solution was not the first in print, it is one of the
easiest to walk through (no pun intended) [16]. As with all future algorithms
presented in this book, an example will immediately follow the description of
the algorithm and further examples are available in the exercises. Note that
Fleury’s Algorithm will produce either an Eulerian circuit or an Eulerian trail
depending on which solution is possible.
Eulerian Tours 13

Fleury’s Algorithm

Input: Connected graph G where zero or two vertices are odd.

Steps:
1. Choose a starting vertex, call it v. If G has no odd vertices, then any
vertex can be the starting point. If G has exactly two odd vertices, then
v must be one of the odd vertices.

2. Choose an edge incident to v that is unlabeled and label it with the


number in which it was chosen, ensuring that the graph consisting of
unlabeled edges remains connected.
3. Travel along the edge to its other endpoint.
4. Repeat steps 2 and 3 until all edges have been labeled.

Output: Labeled Eulerian circuit or trail.

The intention behind Fleury’s Algorithm is that you are prevented from
getting stuck at a vertex with no edges left to travel. In practice, it may be
helpful to use two copies of the graph — one to keep track of the route and
the other where labeled edges are removed. This second copy makes it easier
to see which edges are unavailable to be chosen. In the example below, the
vertex under consideration during a step of the algorithm will be highlighted
and edges will be labeled in the order in which they are chosen.

Example 1.8 Input: A connected graph (shown below) where every vertex
has even degree. We are looking for an Eulerian circuit.

v x

y z
u
w

Step 1: Since no starting vertex is explicitly stated, we choose vertex v to be


the starting vertex.

Step 2: We can choose any edge incident to v. Here we chose vx. The labeled
graph is on the left and the unlabeled portions are shown on the right with
14 A Tour through Graph Theory

edges removed that have already been chosen.

v 1 x v x

y z y z
u u
w w

Step 3: Looking at the graph to the right, we can choose any edge out of x.
Here we chose xy. The labeled and unlabeled graphs have been updated below.

v 1 x v x

y z y z
u u
w w

Step 4: At this point we cannot choose yv, as its removal would disconnect
the unlabeled graph shown above on the right. However, yx and yz are both
valid choices. Here we chose yx.

v 1 x v x

y z y z
u u
w w

Step 5: There is only one available edge xz.


Eulerian Tours 15

v 1 x v

2
4

y z y z
u u
w w

Step 6: There is only one available edge zy.

v 1 x v

2
4

y 5 z y
u u
w w

Step 7: There is only one available edge yv.

v 1 x v

2
6 4

y 5 z
u u
w w

Step 8: Both vw and vu are valid choices for the next edge. Here we chose vw.

v 1 x v

2
6 4

7 3

y 5 z
u u
w w
16 A Tour through Graph Theory

Step 9: There is only one available edge wu.

v 1 x v

2
6 4

7 3

y 5 z
u u
8
w

Step 10: There is only one available edge uv.

v 1 x v

2
6 4
9 3
7
y 5 z
u
8
w

Output: The graph above on the left has an Eulerian circuit labeled, starting
and ending at vertex v.

Hierholzer’s Algorithm
As mentioned above, Hierholzer’s Algorithm is named for the German
mathematician whose paper inspired the procedure described below. This ef-
ficient algorithm begins by finding an arbitrary circuit originating from the
starting vertex. If this circuit contains all the edges of the graph, then an
Eulerian circuit has been found. If not, then we join another circuit to the
existing one.

Hierholzer’s Algorithm

Input: Connected graph G where all vertices are even.

Steps:

1. Choose a starting vertex, call it v. Find a circuit C originating at v.


2. If any vertex x on C has edges not appearing in C, find a circuit C 0
originating at x that uses two of these edges.

You might also like