Euler Paths and Euler Circuits



Similar documents
Graph Theory Lecture 3: Sum of Degrees Formulas, Planar Graphs, and Euler s Theorem Spring 2014 Morgan Schreffler Office: POT 902

Class One: Degree Sequences

136 CHAPTER 4. INDUCTION, GRAPHS AND TREES

Graph Theory Origin and Seven Bridges of Königsberg -Rhishikesh

Sum of Degrees of Vertices Theorem

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

V. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005

Graph Theory Problems and Solutions

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

CS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin

Max Flow, Min Cut, and Matchings (Solution)

Chapter 6: Graph Theory

Social Media Mining. Graph Essentials

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

Connectivity and cuts

2.5 Zeros of a Polynomial Functions

Simple Graphs Degrees, Isomorphism, Paths

Introduction to Graph Theory

8.1 Min Degree Spanning Tree

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Lecture 7: NP-Complete Problems

CMPSCI611: Approximating MAX-CUT Lecture 20

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Analysis of Algorithms, I

A simple criterion on degree sequences of graphs

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Chapter 4. Polynomial and Rational Functions. 4.1 Polynomial Functions and Their Graphs

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Zachary Monaco Georgia College Olympic Coloring: Go For The Gold

Cycles in a Graph Whose Lengths Differ by One or Two

Answer: (a) Since we cannot repeat men on the committee, and the order we select them in does not matter, ( )

Planar Graphs. Complement to Chapter 2, The Villas of the Bellevue

Graph theory and network analysis. Devika Subramanian Comp 140 Fall 2008

Finding and counting given length cycles

The Clar Structure of Fullerenes

Midterm Practice Problems

Triangle deletion. Ernie Croot. February 3, 2010

Short cycle covers of graphs with minimum degree three

Extremal Wiener Index of Trees with All Degrees Odd

ALGEBRA 2 CRA 2 REVIEW - Chapters 1-6 Answer Section

Applied Algorithm Design Lecture 5

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, Chapter 7: Digraphs

Polynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005

UPPER BOUNDS ON THE L(2, 1)-LABELING NUMBER OF GRAPHS WITH MAXIMUM DEGREE

Algorithm Design and Analysis

CAD Algorithms. P and NP

Mathematics for Computer Scientists

Mathematical Induction. Mary Barnes Sue Gordon

Data Structures and Algorithms Written Examination

Small Maximal Independent Sets and Faster Exact Graph Coloring

Network Flow I. Lecture Overview The Network Flow Problem

Generalized Induced Factor Problems

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

A permutation can also be represented by describing its cycles. What do you suppose is meant by this?

Lecture 1: Course overview, circuits, and formulas

Introduction to computer science

Every tree contains a large induced subgraph with all degrees odd

Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014

SOME APPLICATIONS OF EULERIAN GRAPHS

All trees contain a large induced subgraph having all degrees 1 (mod k)

Graphical degree sequences and realizations

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

A Turán Type Problem Concerning the Powers of the Degrees of a Graph

The degree of a polynomial function is equal to the highest exponent found on the independent variables.

Optimized e-transportation System customized to user need

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

CSC 373: Algorithm Design and Analysis Lecture 16

Approximation Algorithms

Chinese postman problem

Static Program Transformations for Efficient Software Model Checking


Graphs without proper subgraphs of minimum degree 3 and short cycles

Circuits 1 M H Miller

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY

HOLES 5.1. INTRODUCTION

(Refer Slide Time: 01.26)

Minimum cost maximum flow, Minimum cost circulation, Cost/Capacity scaling

REWARD System For Even Money Bet in Roulette By Izak Matatya

Graphs over Time Densification Laws, Shrinking Diameters and Possible Explanations

Arrangements And Duality

Zeros of Polynomial Functions

8 Polynomials Worksheet

Degree Hypergroupoids Associated with Hypergraphs

In the Herb Business, Part III Factoring and Quadratic Equations

Boulder Dash is NP hard

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

SOLUTIONS FOR PROBLEM SET 2

Calculus with Parametric Curves

On end degrees and infinite cycles in locally finite graphs

NP-completeness and the real world. NP completeness. NP-completeness and the real world (2) NP-completeness and the real world

Networks and Paths. The study of networks in mathematics began in the middle 1700 s with a famous puzzle called the Seven Bridges of Konigsburg.

MSLC Workshop Series Math Workshop: Polynomial & Rational Functions

Picture Maze Generation by Successive Insertion of Path Segment

The Normal Approximation to Probability Histograms. Dice: Throw a single die twice. The Probability Histogram: Area = Probability. Where are we going?

The positive minimum degree game on sparse graphs

Transcription:

Euler Paths and Euler Circuits An Euler path is a path that uses every edge of a graph exactly once. An Euler circuit is a circuit that uses every edge of a graph exactly once. An Euler path starts and ends at different vertices. An Euler circuit starts and ends at the same vertex.

Euler Paths and Euler Circuits A B A B C C E D E D An Euler path: BBADCDEBC

Euler Paths and Euler Circuits A B A B C C E D E D Another Euler path: CDCBBADEB

Euler Paths and Euler Circuits A B A B C C E D E D An Euler circuit: CDCBBADEBC

Euler Paths and Euler Circuits A B A B C C E D E D Another Euler circuit: CDEBBADC

Euler Paths and Euler Circuits Is it possible to determine whether a graph has an Euler path or an Euler circuit, without necessarily having to find one explicitly?

The Criterion for Euler Paths Suppose that a graph has an Euler path P.

The Criterion for Euler Paths Suppose that a graph has an Euler path P. For every vertex v other than the starting and ending vertices, the path P enters v the same number of times that it leaves v (say s times).

The Criterion for Euler Paths Suppose that a graph has an Euler path P. For every vertex v other than the starting and ending vertices, the path P enters v the same number of times that it leaves v (say s times). Therefore, there are 2s edges having v as an endpoint.

The Criterion for Euler Paths Suppose that a graph has an Euler path P. For every vertex v other than the starting and ending vertices, the path P enters v the same number of times that it leaves v (say s times). Therefore, there are 2s edges having v as an endpoint. Therefore, all vertices other than the two endpoints of P must be even vertices.

The Criterion for Euler Paths Suppose the Euler path P starts at vertex x and ends at y.

The Criterion for Euler Paths Suppose the Euler path P starts at vertex x and ends at y. Then P leaves x one more time than it enters, and leaves y one fewer time than it enters.

The Criterion for Euler Paths Suppose the Euler path P starts at vertex x and ends at y. Then P leaves x one more time than it enters, and leaves y one fewer time than it enters. Therefore, the two endpoints of P must be odd vertices.

The Criterion for Euler Paths The inescapable conclusion ( based on reason alone! ): If a graph G has an Euler path, then it must have exactly two odd vertices. Or, to put it another way, If the number of odd vertices in G is anything other than 2, then G cannot have an Euler path.

The Criterion for Euler Circuits Suppose that a graph G has an Euler circuit C.

The Criterion for Euler Circuits Suppose that a graph G has an Euler circuit C. For every vertex v in G, each edge having v as an endpoint shows up exactly once in C.

The Criterion for Euler Circuits Suppose that a graph G has an Euler circuit C. For every vertex v in G, each edge having v as an endpoint shows up exactly once in C. The circuit C enters v the same number of times that it leaves v (say s times), so v has degree 2s.

The Criterion for Euler Circuits Suppose that a graph G has an Euler circuit C. For every vertex v in G, each edge having v as an endpoint shows up exactly once in C. The circuit C enters v the same number of times that it leaves v (say s times), so v has degree 2s. That is, v must be an even vertex.

The Criterion for Euler Circuits The inescapable conclusion ( based on reason alone ): If a graph G has an Euler circuit, then all of its vertices must be even vertices. Or, to put it another way, If the number of odd vertices in G is anything other than 0, then G cannot have an Euler circuit.

Things You Should Be Wondering Does every graph with zero odd vertices have an Euler circuit? Does every graph with two odd vertices have an Euler path? Is it possible for a graph have just one odd vertex?

How Many Odd Vertices?

How Many Odd Vertices? Odd vertices

How Many Odd Vertices? 6 8 6 Number of odd vertices 2 4 8

The Handshaking Theorem The Handshaking Theorem says that In every graph, the sum of the degrees of all vertices equals twice the number of edges. If there are n vertices V 1,..., V n, with degrees d 1,..., d n, and there are e edges, then Or, equivalently, d 1 + d 2 + + d n 1 + d n = 2e e = d 1 + d 2 + + d n 1 + d n 2

The Handshaking Theorem Why Handshaking? If n people shake hands, and the i th person shakes hands d i times, then the total number of handshakes that take place is d 1 + d 2 + + d n 1 + d n. 2 (How come? Each handshake involves two people, so the number d 1 + d 2 + + d n 1 + d n counts every handshake twice.)

The Number of Odd Vertices The number of edges in a graph is which must be an integer. d 1 + d 2 + + d n 2

The Number of Odd Vertices The number of edges in a graph is which must be an integer. d 1 + d 2 + + d n 2 Therefore, d 1 + d 2 + + d n must be an even number.

The Number of Odd Vertices The number of edges in a graph is which must be an integer. d 1 + d 2 + + d n 2 Therefore, d 1 + d 2 + + d n must be an even number. Therefore, the numbers d 1, d 2,, d n must include an even number of odd numbers.

The Number of Odd Vertices The number of edges in a graph is which must be an integer. d 1 + d 2 + + d n 2 Therefore, d 1 + d 2 + + d n must be an even number. Therefore, the numbers d 1, d 2,, d n must include an even number of odd numbers. Every graph has an even number of odd vertices!

Back to Euler Paths and Circuits Here s what we know so far: # odd vertices Euler path? Euler circuit? 0 No Maybe 2 Maybe No 4, 6, 8,... No No 1, 3, 5,... No such graphs exist! Can we give a better answer than maybe?

Euler Paths and Circuits The Last Word Here is the answer Euler gave: # odd vertices Euler path? Euler circuit? 0 No Yes* 2 Yes* No 4, 6, 8,... No No 1, 3, 5, No such graphs exist * Provided the graph is connected.

Euler Paths and Circuits The Last Word Here is the answer Euler gave: # odd vertices Euler path? Euler circuit? 0 No Yes* 2 Yes* No 4, 6, 8,... No No 1, 3, 5, No such graphs exist * Provided the graph is connected. Next question: If an Euler path or circuit exists, how do you find it?

Bridges Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.

Bridges Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.

Bridges Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.

Bridges Loops cannot be bridges, because removing a loop from a graph cannot make it disconnected. e delete loop e

Bridges If two or more edges share both endpoints, then removing any one of them cannot make the graph disconnected. Therefore, none of those edges is a bridge. A B C delete multiple edges D

Bridges If two or more edges share both endpoints, then removing any one of them cannot make the graph disconnected. Therefore, none of those edges is a bridge. A B C delete multiple edges D

Finding Euler Circuits and Paths Don t burn your bridges.

Finding Euler Circuits and Paths Problem: Find an Euler circuit in the graph below. B A C D E F

Finding Euler Circuits and Paths There are two odd vertices, A and F. Let s start at F. B A C D E F

Finding Euler Circuits and Paths Start walking at F. When you use an edge, delete it. B A C D E F

Finding Euler Circuits and Paths Path so far: FE A B C D E F

Finding Euler Circuits and Paths Path so far: FEA A B C D E F

Finding Euler Circuits and Paths Path so far: FEAC A B C D E F

Finding Euler Circuits and Paths Path so far: FEACB A B C D E F

Finding Euler Circuits and Paths Up until this point, the choices didn t matter.

Finding Euler Circuits and Paths Up until this point, the choices didn t matter. But now, crossing the edge BA would be a mistake, because we would be stuck there.

Finding Euler Circuits and Paths Up until this point, the choices didn t matter. But now, crossing the edge BA would be a mistake, because we would be stuck there. The reason is that BA is a bridge. We don t want to cross ( burn?) a bridge unless it is the only edge available.

Finding Euler Circuits and Paths Path so far: FEACB A B C D E F

Finding Euler Circuits and Paths Path so far: FEACBD. A B C D E F

Finding Euler Circuits and Paths Path so far: FEACBD. A Don t cross the bridge! B C D E F

Finding Euler Circuits and Paths Path so far: FEACBDC A B C D E F

Finding Euler Circuits and Paths Path so far: FEACBDC A Now we have to cross the bridge CF. B E C F D

Finding Euler Circuits and Paths Path so far: FEACBDCF A B C D E F

Finding Euler Circuits and Paths Path so far: FEACBDCFD A B C D E F

Finding Euler Circuits and Paths Path so far: FEACBDCFDB A B C D E F

Finding Euler Circuits and Paths Euler Path: FEACBDCFDBA B A C D E F

Finding Euler Circuits and Paths Euler Path: FEACBDCFDBA B A C D E F

Fleury s Algorithm To find an Euler path or an Euler circuit:

Fleury s Algorithm To find an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices.

Fleury s Algorithm To find an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them.

Fleury s Algorithm To find an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge.

Fleury s Algorithm To find an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge. 4. Stop when you run out of edges.

Fleury s Algorithm To find an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge. 4. Stop when you run out of edges. This is called Fleury s algorithm, and it always works!

Fleury s Algorithm: Another Example A B C D E F G H J K L M N O P Q