Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Chapter 8 Topics in Graph Theory
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
1 Lecture 5 (part 2) Graphs II Euler and Hamiltonian Path / Circuit Reading: Epp Chp 11.2, 11.3.
Section 14.1 Intro to Graph Theory. Beginnings of Graph Theory Euler’s Konigsberg Bridge Problem (18 th c.)  Can one walk through town and cross all.
Koenigsberg bridge problem It is the Pregel River divided Koenigsberg into four distinct sections. Seven bridges connected the four portions of Koenigsberg.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Introduction to Networks HON207. Graph Theory In mathematics and computer science, graph theory is the study of graphs, mathematical structures used to.
Graphs. Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a.
Euler and Hamilton Paths
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
The Bridge Obsession Problem By Vamshi Krishna Vedam.
Copyright © Cengage Learning. All rights reserved.
GRAPH Learning Outcomes Students should be able to:
Take a Tour with Euler Elementary Graph Theory – Euler Circuits and Hamiltonian Circuits Amro Mosaad – Middlesex County Academy.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Graph Theory Topics to be covered:
(CSC 102) Lecture 29 Discrete Structures. Graphs.
Euler and Hamilton Paths
Euler and Hamilton Paths. Euler Paths and Circuits The Seven bridges of Königsberg a b c d A B C D.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
5.4 Graph Models (part I – simple graphs). Graph is the tool for describing real-life situation. The process of using mathematical concept to solve real-life.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Lecture 14: Graph Theory I Discrete Mathematical Structures: Theory and Applications.
Introduction to Graph Theory
Aim: What is an Euler Path and Circuit?
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 15 Graph Theory.
1.5 Graph Theory. Graph Theory The Branch of mathematics in which graphs and networks are used to solve problems.
Discrete Mathematical Structures: Theory and Applications
Lecture 10: Graph-Path-Circuit
Associated Matrices of Vertex Edge Graphs Euler Paths and Circuits Block Days April 30, May 1 and May
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Lecture 52 Section 11.2 Wed, Apr 26, 2006
Chapter 6: Graphs 6.1 Euler Circuits
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
1) Find and label the degree of each vertex in the graph.
Euler and Hamiltonian Graphs
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.1 Graphs, Paths, and Circuits.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
1 Euler and Hamilton paths Jorge A. Cobb The University of Texas at Dallas.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support.
Euler and Hamiltonian Graphs
Euler Paths and Circuits
Agenda Lecture Content: Introduction to Graph Path and Cycle
Konigsberg’s Seven Bridges
Discrete Maths 9. Graphs Objective
Can you draw this picture without lifting up your pen/pencil?
* Hamiltonian Circuits introduction
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Walks, Paths, and Circuits
Konigsberg- in days past.
Graph Theory What is a graph?.
Euler and Hamilton Paths
Euler and Hamiltonian Graphs
Euler circuit Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit,
Section 14.1 Graphs, Paths, and Circuits
Graph Theory Relations, graphs
CHAPTER 15 Graph Theory.
Graphs, Paths, and Circuits
Presentation transcript:

Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine

CSCI 1900 Lecture Lecture Introduction Reading –Rosen Section 10.1 Application of Graph Theory –Euler Paths and Circuits –Hamiltonian Paths and Circuits –Traveling Salesman Problem

CSCI 1900 Lecture Definitions Given a graph G and vertices v and w in G –A walk is a finite alternating sequence of vertices and edges of G –A path from v to w is a walk that does not contain repeated edges –A simple path from v to w is path that does not contain a repeated vertex –A closed walk is a walk that starts and ends at the same vertex –A circuit is a closed walk that does not contain a repeated edge –A simple circuit is a circuit that has no repeated vertices except the first and the last

CSCI 1900 Lecture Example: Walks, Paths, Circuits A walk –v 2 e 2 v 3 e 6 v 5 e 5 v 2 e 2 v 3 e 3 v 4 A path –v 2 e 2 v 3 e 6 v 5 e 5 v 2 e 1 v 1 A simple path –v 3 e 6 v 5 e 5 v 2 e 1 v 1 A circuit –v 2 e 5 v 5 e 6 v 3 e 3 v 4 e 4 v 1 e 7 v 3 e 2 v 2 A simple circuit –v 2 e 5 v 5 e 6 v 3 e 7 v 1 e 1 v 2 v2v2 v1v1 v3v3 v4v4 v5v5 e6e6 e5e5 e4e4 e3e3 e2e2 e1e1 Consider the graph e7e7

CSCI 1900 Lecture Euler Circuits Given a graph G, an Euler circuit for G is a sequence of adjacent vertices and edges in G that –Starts and ends at the same vertex, –Uses every vertex of G at least once, and –Uses every edge of G exactly once

CSCI 1900 Lecture Theorems on Euler Circuits The following theorem is quoted without proof: –If a graph has an Euler Circuit, then every vertex is of even degree The Contrapositive –If some vertex of a graph is of odd degree, then the graph does not have a Euler Circuit

CSCI 1900 Lecture Example: Euler Circuit Does the graph have an Euler Circuit? Why or why not? If not, how many edges must be added or removed to admit the existence of an Euler Circuit? v2v2 v1v1 v3v3 v4v4 v5v5 e6e6 e5e5 e4e4 e3e3 e2e2 e1e1 Consider the prior graph e7e7

CSCI 1900 Lecture Bridges of Königsberg Problem The town of Königsberg was built at the confluence of two branches of the Pregel river. The Pregel river divides the land into four land masses. These land masses are connected by seven bridges. The citizens spent many a pleasant Sunday afternoon trying to find a walk that would start on one of the land masses, cross all the bridges exactly once and end on the starting land mass.

CSCI 1900 Lecture Map of Königsberg Source:

CSCI 1900 Lecture The Solution In 1736, Leonhard Euler resolved the problem with reasoning equivalent to the two previously quoted theorem Draw the graph corresponding to the map of Konigsberg Determine the degree of the vertices of your graph By applying the theorem, show that no circuit is possible

CSCI 1900 Lecture Hamiltonian Circuits A related circuit is the Hamiltonian circuit Given a graph G, a Hamiltonian circuit, H of G, is a sequence of adjacent vertices and distinct edges, in which every vertex of G appears exactly once in H

CSCI 1900 Lecture If a graph G has a Hamiltonian circuit, then G has a subgraph H with the following properties –H contains every vertex in G –H is connected –H has the same number of edges as vertices –Every vertex of H has degree 2 Theorem on Hamilton Circuits

Traveling Salesman Problem Given a set of cities (represented by vertices) that are connected by a set of roads (represented by edges) Suppose that a salesman must travel to each of the cities exactly once, starting and ending at one of the cities –What route, driven over exiting roads, minimizes the distance that the salesman must drive? CSCI 1900 Lecture

CSCI 1900 Lecture Example: Traveling Salesman Given the above weighted graph, what is the minimum distance the salesman must travel, starting and ending in city A? D C BA

CSCI 1900 Lecture Solution: Traveling Salesman List all Hamiltonian Circuits Calculate the total distance for each circuit Select the minimum circuit CircuitDistance Traveled ABCDA = 125 ACDBA = 155 ADBCA = 140 ABDCA = 155 (ACDBA backwards) ACBDA = 140 (ADBCA backwards) ADCBA = 125 (ABCDA backwards)

CSCI 1900 Lecture Traveling Salesman Problem Exact solution? –Only known general solution is by enumeration of all possible routes –For a complete graph with n nodes Since we must start and end with one of the nodes, we need the number of permutations of (n-1) vertices, taken (n-1) at a time n-1 P n-1 = (n-1)! Hamiltonian circuits For n = 10 number of circuits =362,880 For n = 50 number of circuits > 1 x 10 64

CSCI 1900 Lecture Traveling Salesman (cont) There exist approximate solutions that yield a “good” solution, but not the best solution –“Good” means that the approximate solution will have a smaller total distance than most of the Hamiltonian circuits

CSCI 1900 Lecture Key Concepts Summary Walks, paths, and circuits Euler Circuits –Application: Seven Bridges of Königsberg Hamiltonian Circuits –Application: Traveling Salesman problem Reading for next time –No further readings