CS 200 Algorithms and Data Structures

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE An Euler.
Discrete Mathematics 6. GRAPHS Lecture 10 Dr.-Ing. Erwin Sitompul
Chapter 9 Graphs.
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.
Graph-02.
Chapter 7 Graph Theory 7.1 Modeling with graphs and finding Euler circuits. Learning Objectives: Know how to use graphs as models and how to determine.
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.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
AMDM UNIT 7: Networks and Graphs
9.2 The Traveling Salesman Problem. Let us return to the question of finding a cheapest possible cycle through all the given towns: We have n towns (points)
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
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.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Frank Carrano, © 2012.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
CS 2813 Discrete Structures
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.
Copyright © Cengage Learning. All rights reserved.
GRAPH Learning Outcomes Students should be able to:
EECS 203: It’s the end of the class and I feel fine. Graphs.
Graph Theory Topics to be covered:
Graphs Rosen, Chapter 8. Isomorphism (Rosen 560 to 563) Are two graphs G1 and G2 of equal form? That is, could I rename the vertices of G1 such that the.
Structures 7 Decision Maths: Graph Theory, Networks and Algorithms.
Can you connect the dots as shown without taking your pen off the page or drawing the same line twice.
Euler and Hamilton Paths. Euler Paths and Circuits The Seven bridges of Königsberg a b c d A B C D.
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.
Planar Graphs Graph Coloring
Graph.
Aim: What is an Euler Path and Circuit?
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
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
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Vertex-Edge Graphs Euler Paths Euler Circuits. The Seven Bridges of Konigsberg.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
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
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
Chapter 6: Graphs 6.1 Euler Circuits
1) Find and label the degree of each vertex in the graph.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Introduction to Graph & Network Theory Thinking About Networks: From Metabolism to the Genome to Social Conflict Summer Workshop for Teachers June 27 th.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Homework 8 Graph G is given by the figure below.
Discrete Mathematics Graph: Planar Graph Yuan Luo
Graphs Chapter 20.
EECS 203 Lecture 19 Graphs.
Euler and Hamiltonian Graphs
Graph theory Definitions Trees, cycles, directed graphs.
Discrete Structures – CNS2300
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
EECS 203 Lecture 20 More Graphs.
CS120 Graphs.
Can you draw this picture without lifting up your pen/pencil?
* Hamiltonian Circuits introduction
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graph Theory.
Graphs Chapter 13.
Genome Assembly.
Discrete Math II Howon Kim
Euler and Hamilton Paths
Presentation transcript:

CS 200 Algorithms and Data Structures Part 10. Graphs CS 200 Algorithms and Data Structures

Outline Introduction Terminology Implementing Graphs Graph Traversals Topological Sorting Shortest Paths Spanning Trees Minimum Spanning Trees Circuits

Circuits Cycle A special cycle that passes through every vertex (or edge) in a graph exactly once and returns back to the place it started.

Euler’s bridge problem (Bridges of Konigsberg Problem) River Bank A Edge Between A and D Edge Between A and C Edge Between A and C Island C Edge Between C and D Island D Edge Between B and C River Bank B Edge Between B and D Euler Edge Between B and C Is it possible to travel across every bridge without crossing any bridge more than once? http://yeskarthi.wordpress.com/2006/07/31/euler-and-the-bridges-of-konigsberg

Euler’s bridge problem (Bridges of Konigsberg Problem) Is it possible to travel across every bridge without crossing any bridge more than once? http://yeskarthi.wordpress.com/2006/07/31/euler-and-the-bridges-of-konigsberg

Euler paths/circuits Euler path: A path that visits each edge only once in the graph Euler circuit: A cycle that visits each edge only once in the graph

Example: Does any graph have an Euler circuit? b c d e a b c d a b c d e e

Example: Does any graph have an Euler path? b c d e a b c d a b c d e e

Example: Does any graph have an Euler circuit? b c d a b d e f c g a b c d

Euler paths/circuits Is there a simple criterion that allows us to determine whether a graph has an Euler circuit or path?

Euler Paths Theorem: A connected multigraph has an Euler path .iff. it has exactly two vertices of odd degree

Euler Circuits Theorem: A connected multigraph with at least two vertices has an Euler circuit .iff. each vertex has an even degree.

Mohammed’s Scimitars j a e i f b h g d c k Can Mohammed’s scimitars be drawn without lifting a pencil and the drawing begins and ends at the same point? a-e-f-i-e-b-c-d-g-h-j-i-k-g-d-b-a

Hamiltonian Paths/Circuits A Hamiltonian path/circuit: path/circuit that visits every vertex exactly once. Defined for directed and undirected graphs. Is there an efficient way to determine whether a graph has a Hamiltonian circuit?

Does any graph have a Hamiltonian circuit or a Hamiltonian path? b c d e a b c d a b c d e

DIRAC’s Theorem If G is a simple graph with n vertices with n≥3 such that the degree of every vertex in G is at least n/2, then G has a Hamiltonian circuit.

Ore’s Theorem If G is a simple graph with n vertices with n≥3 such that deg(u)+deg(v)≥n for every pair of nonadjacent vertices u and v in G, then G has a Hamiltonian circuit.

Hamiltonian Paths/Circuits Direc and Ore’s theorems provide sufficient condition for a connected simple graph to have a Hamiltonian circuit. They do NOT provide necessary condition for the existence of a Hamiltonian circuit This problem belongs to a class of problems for which it is believed there is no efficient (polynomial running time) algorithm.

The Traveling Salesman Problem (TSP) Can we use the Shortest path algorithm? Can we use the Euler Circuit? TSP: Given a list of cities and their pairwise distances, find a shortest possible tour that visits each city exactly once. Can we use the Hamilton Circuit? 13,509 cities and towns in the US that have more than 500 residents An optimal TSP tour through Germany’s 15 largest cities (one out of 14!/2) http://www.tsp.gatech.edu/

Using Hamiltonian Circuits Examine all possible Hamiltonian circuits and select one of minimum total length With n cities.. (n-1)! Different Hamiltonian circuits Ignore the reverse ordered circuits (n-1)!/2 With 50 cities 12,413,915,592,536,072,670,862,289,047,373,375,038,521,486,354,677,760,000,000,000 routes

The three utilities problem House A House B ? House C

Designing a Microchip You are designing a microchip – connections between any two units cannot cross http://www.dmoma.org/

Planar Graphs You are designing a microchip – connections between any two units cannot cross The graph describing the chip must be planar planar non-planar http://en.wikipedia.org/wiki/Planar_graph

Is this graph planar?

Chip Design You want more than planarity: the lengths of the connections need to be as short as possible (faster, and less heat is generated) http://www.dmoma.org/

Euler’s Formula Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. Then r=e-v+2

Example Suppose that a connected planar simple graph has 20 vertices, each of degree 3. Into how many regions does a representation of this planar graph split the plane?

Graph Coloring A coloring of a simple graph is the assignment of a color to each vertex of the graph so that no two adjacent vertices are assigned the same color

Map and graph A B C D G E F B A C D E F G

Chromatic number The least number of colors needed for a coloring of this graph. The chromatic number of a graph G is denoted by χ(G)

The four color theorem The chromatic number of a planar graph is no greater than four

Example

Example What is the chromatic number of the graph Cn, where n>=3? (Cn is the cycle with n vertices)