Major Themes. Graph Traversals. Euler s SoluWon to The Bridges of Königsberg. The Bridges of Königsberg Puzzle. Dr Papalaskari 1

Similar documents
Graph Traversals. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari 1

Major Themes. 14: Graph Traversals. The Bridges of Königsberg Puzzle. Dr Papalaskari 1. Graph traversals: Euler circuit/trail.

EECS 203 Lecture 20. More Graphs

3 Euler Tours, Hamilton Cycles, and Their Applications

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

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

6.2. Paths and Cycles

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

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

Ma/CS 6a Class 8: Eulerian Cycles

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

Week 11: Eulerian and Hamiltonian graphs; Trees. 21 and 23 November, 2018

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Chapter 14 Section 3 - Slide 1

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Fundamental Properties of Graphs

Graph Theory. Part of Texas Counties.

Introduction III. Graphs. Motivations I. Introduction IV

Chapter 11: Graphs and Trees. March 23, 2008

Characterization of Graphs with Eulerian Circuits

Chapter 3: Paths and Cycles

GRAPH THEORY AND COMBINATORICS ( Common to CSE and ISE ) UNIT 1

Graph Algorithms. A Brief Introduction. 高晓沨 (Xiaofeng Gao) Department of Computer Science Shanghai Jiao Tong Univ.

Launch problem: Lining streets

Trees. CSC 1300 Discrete Structures Villanova University

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

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

Section 3.4 Basic Results of Graph Theory

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

#30: Graph theory May 25, 2009

Worksheet 28: Wednesday November 18 Euler and Topology

1. The Highway Inspector s Problem

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

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

Major Themes. Trees. Types of Graphs. Which of the following are trees? G 3 G 1 G 2 G 4. Dr Papalaskari 1

IE 102 Spring Routing Through Networks - 1

Classic Graph Theory Problems

Math 443/543 Graph Theory Notes 2: Transportation problems

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?

The Traveling Salesman Problem Outline/learning Objectives The Traveling Salesman Problem

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

Graph (1A) Young Won Lim 4/19/18

Week 10: Colouring graphs, and Euler s paths. 14 and 16 November, 2018

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

The Traveling Salesman Problem Outline/learning Objectives The Traveling Salesman Problem

Brief History. Graph Theory. What is a graph? Types of graphs Directed graph: a graph that has edges with specific directions

Theorem 2.9: nearest addition algorithm

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

Chapter 8 Topics in Graph Theory

Lecture 8: The Traveling Salesman Problem

Elements of Graph Theory

Introduction to Graphs

Precept 4: Traveling Salesman Problem, Hierarchical Clustering. Qian Zhu 2/23/2011

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

Graphs: Definitions Trails, Paths, and Circuits Matrix Representations Isomorphisms. 11. Graphs and Trees 1. Aaron Tan. 30 October 3 November 2017

Discrete mathematics

14.2 Euler Paths and Circuits filled in.notebook November 18, Euler Paths and Euler Circuits

Vertex-Edge Graphs. Vertex-Edge Graphs In the Georgia Performance Standards. Sarah Holliday Southern Polytechnic State University

Sarah Will Math 490 December 2, 2009

11-5 Networks. Königsberg Bridge Problem

Graph Planarity. CSC 1300 Discrete Structures Villanova University

Network Topology and Graph

Number Theory and Graph Theory

Discrete Mathematics and Probability Theory Spring 2015 Vazirani Note 5

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

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

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

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

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Networks and Graphs: Circuits, Paths, and Graph Structures VII.A Student Activity Sheet 1: Euler Circuits and Paths

Networks and Graphs: Circuits, Paths, and Graph Structures VII.A Student Activity Sheet 1: Euler Circuits and Paths

Foundations of Discrete Mathematics

Approximation Algorithms

MITOCW watch?v=zm5mw5nkzjg

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Assignments are handed in on Tuesdays in even weeks. Deadlines are:

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

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

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Majority and Friendship Paradoxes

8.2 Paths and Cycles

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

Understand graph terminology Implement graphs using

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

Math 776 Graph Theory Lecture Note 1 Basic concepts

Circuits and Paths. April 13, 2014

State Space Search. Many problems can be represented as a set of states and a set of rules of how one state is transformed to another.

2 Approximation Algorithms for Metric TSP

Chapter 5: Euler Paths and Circuits The Mathematics of Getting Around

Matching 4/21/2016. Bipartite Matching. 3330: Algorithms. First Try. Maximum Matching. Key Questions. Existence of Perfect Matching

2. CONNECTIVITY Connectivity

Notes for Recitation 9

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

V1.0: Seth Gilbert, V1.1: Steven Halim August 30, Abstract. d(e), and we assume that the distance function is non-negative (i.e., d(x, y) 0).

Chapter 5: Euler Paths and Circuits The Mathematics of Getting Around

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

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

The Traveling Salesman Problem

Varying Applications (examples)

Transcription:

Major Themes raph Traversals CSC 1300 Discrete Structures Villanova University Villanova CSC 1300 - Dr Papalaskari 1 raph traversals: Euler circuit/path Every edge exactly once amilton circuit/path Every vertex exactly once Shortest circuit: Traveling Salesman Problem Shortest Path: Dijkstra s algorithm 2 4 8 7 5 9 3 5 8 2 Villanova CSC 1300 - Dr Papalaskari 2 The Bridges of Königsberg Puzzle 18 th century map of the city of Königsberg with 7 bridges over the Pregel river Find a walk through the city that would cross each bridge once and only once before returning to the starting point Euler s SoluWon to The Bridges of Königsberg A C D B Leonhard Euler (1707-1783) rephrased the queswon in terms of the mul9graph (i.e., mulwple edges allowed) C Is there a cycle in the mulwgraph that traverses all its edges exactly once? A D Villanova CSC 1300 - Dr Papalaskari 3 B Villanova CSC 1300 - Dr Papalaskari 4 Dr Papalaskari 1

Euler cycles (circuits) and paths Euler cycle: a cycle traversing all the edges of the graph exactly once Euler path: a path (not a cycle) traversing all the edges of the graph exactly once Examples: Necessary and sufficient condiwons for Euler cycles Theorem 12.3.1 (1) A connected graph has an Euler cycle if and only if every vertex of has even degree. as an Euler cycle as an Euler path, but no Euler cycle as neither Euler cycle nor Euler path ( è ) A necessary condi9on has an Euler cycle only if every vertex has even degree Assume has an Euler cycle. Observe that every Wme the cycle passes through a vertex, it contributes 2 to the vertex s degree, since the cycle enters via an edge incident with this vertex and leaves via another such edge. Villanova CSC 1300 - Dr Papalaskari 5 Villanova CSC 1300 - Dr Papalaskari 6 (ç ) A sufficient condi-on If every vertex in has even degree, has an Euler cycle Lemma Assume every vertex in a mulwgraph has even degree. Start at an arbitrary non- isolated vertex v 0, choose an arbitrary edge (v 0,v 1 ), then choose an arbitrary unused edge from v 1 and so on. Then aeer a finite number of steps the process will arrive at the starwng vertex v 0, yielding a cycle with diswnct edges. Proof In the above procedure, once you entered a vertex v, there will always be another unused edge to exit v because v has an even degree and only an even number of the edges incident with it had been used before you entered it. The only edge from which you may not be able to exit aeer entering it is v 0 (because an odd number of edges incident with v 0 have been used as you didn t enter it at the beginning), but if you have reached v 0, then you have already constructed a required cycle. Villanova CSC 1300 - Dr Papalaskari 7 A procedure for construcwng an Euler cycle Algorithm Euler() //Input: Connected graph with all verwces having even degrees //Output: Euler cycle Construct a cycle in using the procedure from Lemma Remove all the edges of cycle from to get subgraph while has edges find a non- isolated vertex v that is both in cycle and in //the existence of such a vertex is guaranteed by s connecwvity construct subcycle in using Lemma s procedure splice subcycle into cycle at v remove all the edges of subcycle from return cycle Villanova CSC 1300 - Dr Papalaskari 8 Dr Papalaskari 2

Example Example (cont.) cycle 1231 splicing: 34653 1231 subcycle 34653 cycle 12346531 splicing 6786 12346531 Euler cycle obtained 12346786531 Villanova CSC 1300 - Dr Papalaskari 9 Villanova CSC 1300 - Dr Papalaskari 10 Necessary and sufficient condiwons for Euler paths Theorem 12.3.1 (2) A connected graph has an Euler path but not an Euler cycle if and only if if it has exactly two verwces of odd degree. Icosian ame Icosian ame This puzzle has been invented by the renowned Irish mathemawcian Sir William amilton (1805-1865) and presented to the world under the name of the Icosian ame. The game's board was a wooden board with holes represenwng major world ciwes with grooves represenwng connecwons between them. The object of the game was to find a circular route that would pass through all the ciwes exactly once before returning to the starwng point. Villanova CSC 1300 - Dr Papalaskari 11 Villanova CSC 1300 - Dr Papalaskari 12 Dr Papalaskari 3

amilton Circuit and/or Traversal? amilton Circuits: Sufficient condiwon C 3 K 4 Let be a graph with n verwces where n 3. If the degree of every vertex is more than n/2, then has a amilton circuit. K 6 Note: NOT a necessary condiwon No property is known to efficiently verify existence of a amilton cycle/path for general graphs. Moreover, the problem is known to be as difficult as the TSP Villanova CSC 1300 - Dr Papalaskari 13 Villanova CSC 1300 - Dr Papalaskari 14 Traveling Salesman Problem find the lowest cost amilton circuit Shortest Paths Dijkstra s Algorithm: build a tree of minimal length paths from root to leaves similar to Prim s MST algorithm 11 Image:hjp://www.wired.com/images_blogs/wiredscience/2013/01/tsp_map.jpg More about TSP: hjp://www.math.uwaterloo.ca/tsp/index.html Villanova CSC 1300 - Dr Papalaskari 15 Villanova CSC 1300 - Dr Papalaskari 16 Dr Papalaskari 4

Try This! 12.5 #1 Try This! 12.5 #2 a b c d f e g j k l h i m n o Villanova CSC 1300 - Dr Papalaskari 17 Villanova CSC 1300 - Dr Papalaskari 18 Puzzle 1: SeaWng King Arthur s knights (and their grudges) on the round table King Arthur needs to seat 100 knights (including himself) around his round table so that no knight is seated next to his enemy. The king has a list of enemies for each knight, which contains less than 50 persons for each of them. Can the king find an acceptable seawng? Puzzle 2: Weaving an epic tale of King Arthur s knights (and their grudges) There is a story or stories! between every pair of knights that are enemies. A poet is capwvated by these tales and wants to weave them into one great epic poem. The poem s subject must naturally flow from knight to knight, possibly returning to some of them repeatedly (if they are involved in more than one tale), telling each and every one of these stories, but never jumping arbitrarily from one story to another that does not involve either of the knights in the first story; so the story needs to be connected, somehow. For example, if at a given point the poem is describing a story of how knight 37 and knight 12 became enemies, the next story must be a story involving one of these knights (or both of them, in case there is more than one reason that they are enemies) it cannot, say, jump to a story about knight 42 and knight 61. Can you state condiwons on the number of enemies for each knight that would guarantee that such a story can be told? Villanova CSC 1300 - Dr Papalaskari 19 Villanova CSC 1300 - Dr Papalaskari 20 Dr Papalaskari 5