Introduction to Graphs

Similar documents
Ma/CS 6a Class 8: Eulerian Cycles

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Intermediate Math Circles Wednesday, February 22, 2017 Graph Theory III

11.2 Eulerian Trails

GRAPH THEORY - FUNDAMENTALS

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Chapter 11: Graphs and Trees. March 23, 2008

8.2 Paths and Cycles

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Chapter 3: Paths and Cycles

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

How can we lay cable at minimum cost to make every telephone reachable from every other? What is the fastest route between two given cities?

Eulerian Cycle (2A) Young Won Lim 4/26/18

Sarah Will Math 490 December 2, 2009

CHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ - artale/z

Characterization of Graphs with Eulerian Circuits

Introduction to Graphs

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Math 443/543 Graph Theory Notes 2: Transportation problems

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

Varying Applications (examples)

Eulerian Cycle (2A) Young Won Lim 5/25/18

Introduction III. Graphs. Motivations I. Introduction IV

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees

Number Theory and Graph Theory

#30: Graph theory May 25, 2009

(5.2) 151 Math Exercises. Graph Terminology and Special Types of Graphs. Malek Zein AL-Abidin

Trees. Arash Rafiey. 20 October, 2015

Dieter Jungnickel (2008), Graphs, Networks and Algorithms, 3rd edition, which is available online via SpringerLink.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Graph Theory

MATH 113 Section 9.2: Topology

Eulerian Paths and Cycles

Eulerian Tours and Fleury s Algorithm

4.1 Eulerian Tours. 4. Eulerian Tours and Trails. Königsberg. Seven Bridges. Try. Königsberg bridge problem

CHAPTER 10 GRAPHS AND TREES. Copyright Cengage Learning. All rights reserved.

PATH FINDING AND GRAPH TRAVERSAL

Discrete mathematics

GRAPH THEORY: AN INTRODUCTION

Network Topology and Graph

Junior Circle Meeting 3 Circuits and Paths. April 18, 2010

Eulerian Tours and Fleury s Algorithm

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

Eulerian Cycle (2A) Walk : vertices may repeat, edges may repeat (closed or open) Trail: vertices may repeat, edges cannot repeat (open)

North Bank. West Island. East Island. South Bank

Discrete Mathematics and Probability Theory Spring 2015 Vazirani Note 5

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

The University of Sydney MATH2969/2069. Graph Theory Tutorial 2 (Week 9) 2008

Compatible circuits in eulerian digraphs

Chapter 1 Graph Theory

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Worksheet 28: Wednesday November 18 Euler and Topology

Eulerian circuits with no monochromatic transitions

Lecture 3: Graphs and flows

3 Euler Tours, Hamilton Cycles, and Their Applications

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

Section Graphs, Paths, and Circuits. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

1 Digraphs. Definition 1

Definition 1.1. A matching M in a graph G is called maximal if there is no matching M in G so that M M.

Graph Algorithms. Tours in Graphs. Graph Algorithms

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

Chapter 9. Graph Theory

An Introduction to Graph Theory

Compatible circuits in eulerian digraphs

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1

Eulerian tours. Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck. April 20, 2016

BIL694-Lecture 1: Introduction to Graphs

Math 776 Graph Theory Lecture Note 1 Basic concepts

Lecture 5: Graphs. Graphs! Euler Definitions: model. Fact! Euler Again!! Planar graphs. Euler Again!!!!

Section 3.4 Basic Results of Graph Theory

PAIRED-DOMINATION. S. Fitzpatrick. Dalhousie University, Halifax, Canada, B3H 3J5. and B. Hartnell. Saint Mary s University, Halifax, Canada, B3H 3C3

Some Graph Theory for Network Analysis. CS 249B: Science of Networks Week 01: Thursday, 01/31/08 Daniel Bilar Wellesley College Spring 2008

MATH 101: Introduction to Contemporary Mathematics

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Introduction aux Systèmes Collaboratifs Multi-Agents

Excursions in Modern Mathematics Sixth Edition. Chapter 5 Euler Circuits. The Circuit Comes to Town. Peter Tannenbaum

14 More Graphs: Euler Tours and Hamilton Cycles

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Fundamental Properties of Graphs

Grades 7 & 8, Math Circles 31 October/1/2 November, Graph Theory

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

Elements of Graph Theory

Walking with Euler through Ostpreußen and RNA

Chapter 2: Graph Theory

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Assignment 4 Solutions of graph problems

2 Eulerian digraphs and oriented trees.

Math 443/543 Graph Theory Notes

Graph theory was invented by a mathematician named Euler in the 18th century. We will see some of the problems which motivated its study.

GRAPH THEORY AND LOGISTICS

MA 111 Review for Exam 3

Week 11: Eulerian and Hamiltonian graphs; Trees. 15 and 17 November, 2017

Section Graphs, Paths, and Circuits. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Today s Outline. CSE 326: Data Structures. Topic #15: Cool Graphs n Pretty Pictures. A Great Mathematician. The Bridges of Königsberg

Graphs. Introduction To Graphs: Exercises. Definitions:

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Math 443/543 Graph Theory Notes

Transcription:

Introduction to Graphs

Historical Motivation

Seven Bridges of Königsberg Königsberg (now Kaliningrad, Russia) around 1735 Problem: Find a walk through the city that would cross each bridge once and only once. 3 / 22

Definitions

Graph Graph A graph G = (V, E) is a set V of vertices connected by an edge set E. 5 / 22

Variations Multi-Graph: Multiple edges between two vertices. Directed: Edges have a direction. Weighted: Vertices and/or edges have weights. Simple: No multiple edges, no loops. Simple Undirected Graph A simple undirected graph G = (V, E) is a set V of vertices connected by an edge set E {{u, v} u, v V, u v}. An edge {u, v} is also written as uv. 6 / 22

Adjacency Adjacency Two vertices u and v are adjacent if there is an edge connecting them. This is sometimes written as u v. v a b c v is adjacent with b and c but not with a. 7 / 22

Neighbourhood Neighbourhood The open neighbourhood N(v) = {u V u v, u v} of a vertex v is the set of vertices adjacent to v (not including v). The closed neighbourhood N[v] = N(v) {v} includes v. v a b c N(v) = {b, c} N[v] = {v, b, c} 8 / 22

Degree Degree The degree deg(v) of a vertex v is the number of incident edges. Note that the degree is not necessarily equal to the cardinality of neighbours. v a b c deg(v) = 3 deg(a) = 1 deg(b) = 5 deg(c) = 1 9 / 22

Degree (directed) Indegree, Outdegree For a vertex v, the indegree deg (v) is the number of incoming edges, and the outdegree deg + (v) the number of incoming edges. v a b c deg + (v) = 2 deg + (a) = 0 deg + (b) = 3 deg + (c) = 1 deg (v) = 1 deg (a) = 1 deg (b) = 2 deg (c) = 0 10 / 22

Degree Let G = (V, E) be a graph. Then Lemma deg(v) = 2 E v V If G is directed Lemma deg + (v) = deg (v) = E v V v V It follows that the number of odd degree vertices is even. 11 / 22

Path Path In a graph a path p of length l is sequence of l +1 adjacent vertices, i. e. p = (v 0,..., v l ) with v i v i+1 E. A path is simple if all vertices are different, i. e. v i v j i j. v v a c a c b b u u path (b, a, v, c, u) simple path (a, v, b, u) 12 / 22

Cycle Cycle A cycle is a path that begins and ends with same vertex. A cycle is simple, if it doesn t cross itself. v v a c a c b b u u cycle (a, v, b, c, u, b, a) simple cycle (a, v, c, u, b, a) 13 / 22

Eulerian Cycles

Recall: Seven Bridges of Königsberg Königsberg (now Kaliningrad, Russia) around 1735 Problem: Find a walk through the city that would cross each bridge once and only once. 15 / 22

Euler s Solution Represent problem as graph: Original problem: Find a walk through the city that would cross each bridge once and only once. Graph problem: Does G contain a path using each edge exactly once? 16 / 22

Euler s Solution Given a graph G = (V, E) with E = m and index arithmetic modulo m. Eulerian Cycle An Eulerian cycle in a graph G is a sequence of vertices and edges v 1, e 1,..., v m, e m, v 1 such that e i = v i v i+1 and e i e j i j. Eulerian Path An Eulerian path in a graph G is a sequence of vertices and edges v 1, e 1,..., v m, e m, v m+1 such that e i = v i v i+1 and e i e j i j. In an Eulerian cycle the start and end vertex hast to be equal. In an Eulerian path they can be different. 17 / 22

Euler s Solution Theorem A connected graph has an Eulerian cycle if and only if the degree of all vertices is even, i. e. v V k N: deg(v) = 2k. Theorem A graph has an Eulerian path if and only if it is connected and has at most two vertices with an odd degree. 18 / 22

Seven bridges of Königsberg Degree of all vertices is odd. 3 5 3 3 Thus, there is no walk through the city that would cross each bridge once and only once. 19 / 22

Algorithm

Algorithm Given a graph G. Does G have an Eulerian path? Algorithm based on Hierholzer s algorithm from 1837. a b c d e f 21 / 22

Algorithm 1. Determine the degree of all vertices. 3 4 5 3 3 4 21 / 22

Algorithm 2. If There are more than two vertices with an odd degree Then Stop, G has no Eulerian path. 3 4 5 3 3 4 21 / 22

Algorithm 3. Choose any starting vertex v. Select a vertex with odd degree if possible. 3 4 4 2 3 4 21 / 22

Algorithm 4. Follow a trail T of edges from v until getting stuck. a b c d e f T = a, e, f, d, b, c, e 21 / 22

Algorithm 5. While There is a vertex v belonging to the current trail T but has adjacent edges not part of T. a b c d e f T = a, e, f, d, b, c, e 21 / 22

Algorithm 5.1 Start another trail T from v, following unused edges until returning to v. a b c d e f T = a, e, f, d, b, c, e T = b, f, c, a, b 21 / 22

Algorithm 5.1 Start another trail T from v, following unused edges until returning to v. a b c d e f T = a, e, f, d, b, c, e T = b, f, c, a, b 21 / 22

Algorithm 5.2 Join the tour T formed in this way to the previous trail T. a b c d e f T = a, e, f, d, b, f, c, a, b, c, e 21 / 22

Complete Algorithm Given a graph G = (V, E). 1. Determine the degree of all vertices. 2. If There are more than two vertices with an odd degree Then Stop, G has no Eulerian path. 3. Choose any starting vertex v. Select a vertex with odd degree if possible. 4. Follow a trail T of edges from v until getting stuck. 5. While There is a vertex v belonging to the current trail T but has adjacent edges not part of t. 5.1 Start another trail T from v, following unused edges until returning to v. 5.2 Join the tour T formed in this way to the previous trail T. This algorithm can be implemented in O( E ) time. 22 / 22