Foundations of Discrete Mathematics

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Chapter 8 Topics in Graph Theory
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
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.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Applied Discrete Mathematics Week 12: Trees
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
Chapter 4 Graphs.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
GRAPH Learning Outcomes Students should be able to:
Programming for Geographical Information Analysis: Advanced Skills Online mini-lecture: Introduction to Networks Dr Andy Evans.
EECS 203: It’s the end of the class and I feel fine. Graphs.
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Graph Theory Topics to be covered:
Foundations of Discrete Mathematics
Can you connect the dots as shown without taking your pen off the page or drawing the same line twice.
© 2010 Pearson Prentice Hall. All rights reserved. 1 §15.3, Hamilton Paths and Circuits.
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media.
Discrete Mathematical Structures: Theory and Applications
Foundations of Discrete Mathematics Chapters 9 and 10 By Dr. Dalia M. Gil, Ph.D.
Lecture 10: Graph-Path-Circuit
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Chapter 9: Graphs.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
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.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i,
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
An Introduction to Graph Theory
Graphs Chapter 20.
EECS 203 Lecture 19 Graphs.
Shortest Path Problems
CSNB 143 Discrete Mathematical Structures
Graphs: Definitions and Basic Properties
Euler and Hamiltonian Graphs
Graph theory Definitions Trees, cycles, directed graphs.
Agenda Lecture Content: Introduction to Graph Path and Cycle
Discrete Structures – CNS2300
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
EECS 203 Lecture 20 More Graphs.
Advanced Algorithms Analysis and Design
Discrete Maths 9. Graphs Objective
Graph Algorithm.
Can you draw this picture without lifting up your pen/pencil?
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graph Theory.
Lecture 15: Graph Theory II
Graphs Chapter 13.
Discrete Math II Howon Kim
Walks, Paths, and Circuits
A path that uses every vertex of the graph exactly once.
Discrete Mathematics Lecture 13_14: Graph Theory and Tree
Euler and Hamilton Paths
Hamilton Paths and Hamilton Circuits
Euler and Hamiltonian Graphs
Foundations of Discrete Mathematics
Graph Theory Relations, graphs
Agenda Review Lecture Content: Shortest Path Algorithm
Concepts of Computation
Presentation transcript:

Foundations of Discrete Mathematics Chapter 10 By Dr. Dalia M. Gil, Ph.D.

Path A path is a sequence of edges hat begins at a vertex of a graph and travels along edges of the graph, always connecting pairs of adjacent vertices.

Walk A walk in a pseudograph is an altering sequence of vertices and edges, beginning and ending with a vertex, in which each edge is incident with the vertex immediately preceding it and the vertex immediately following it.

Walk The length of a walk is the number of edges in it. A walk is closed if the first vertex is the same as the last and otherwise open.

Trail A trail is a walk in which all edges are distinct; a path is a walk in which all vertices are distinct.

Circuit A closed trail is a circuit. A circuit in which the first vertex appears exactly twice (at the beginning and the end) and in which no other vertex appears more than once is a cycle. An n-cycle is a cycle with n vertices. It is even if n is even and odd if n is odd.

Terms and their characteristics Trail Distinct edges Path Distinct vertices Circuit Closed trail Cycle Closed trail with distinct vertices (hence distinct edges too)

Example Walk : A B C E F C B D (length : 7) “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

Example Trail : A B C E F C D “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

Example Closed walk : A B C E F C B D A “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

Example Circuit : B C E F C D B “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

Example 3-cycle : B C D B “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

Example A closed walk (not a cycle): C E F C B D C “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 305

An Eulerian Circuit An Eulerian or Euler circuit in a graph G is a simple circuit containing every edge of G. An Euler path in G is a simple path containing every edge of G.

Example: An Eulerian Circuit The graph G1 has an Euler circuit: a, e, c, d, e, b, a “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 578

Example: An Eulerian Circuit The graph G2 and G3 don’t have an Euler circuit. G3 has an Euler path: a, c, d, e, b, d, a, b G2 does not have an Euler path. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 578

Example: An Eulerian Circuit H2 has an Euler circuit: a, g, c, b, g, e, d, f, a H1 nor H3 has an Euler circuit. H3 has an Euler path: c, a, b, c, d, b H1 does not have an Euler path. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 579

An Eulerian Circuit A connected multigraph has an Eulerian circuit if and only if each of its vertices has even degree. A connected multigraph has an Eulerian path but not an Eulerian circuit if and only if it has exactly two vertices of odd degree.

Example: Eulerian Path G1 contains two vertices of odd degree (b and d). b and d must be the end points of this Euler path. d, a, b, c, d, b is an Euler path. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 582

Example: Eulerian Path G2 contains exactly two vertices of odd degree (b and d). b and d must be the end points of this Euler path. b, a, g, f, e, d, c, g, b, c, f, d is an Euler path. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 582

Example: No Eulerian Path G3 has six vertices of odd degree. G3 has no Euler path. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, 2003. pag 582

Hamiltonian Cycles A Hamiltonian cycle in a graph is a cycle that contains every vertex of a graph. A Hamiltonian graph is one with a Hamiltonian cycle. A Hamiltonian circuit as a circuit in which every vertex except the first and last appears exactly once.

Hamiltonian Cycles A Hamiltonian circuit is a cycle. The terms Hamiltonian circuit and Hamiltonian cycle are synonymous.

Hamiltonian Cycles G1 is Hamiltonian G2 is not Hamiltonian Cycle A B C D E A is Hamiltonian “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 311

Shortest Path Algorithm Many problems can be modeled using graphs with weights to their edges. Problems associated with edge is a unit of time, distance, cost, or capacity in some sense.

Shortest Path Algorithm A weighted graph is a graph G(V, E) together with a function w: E → [0, ). If e is an edge, the nonnegative real number w(e) is called the weight of e. The weight of a subgraph of G (often a path or a trail) is the sum of the weights of the edges of the subgraph.

The Traveling Salesman’s Problem A traveling salesman visits various towns and cities. If he wants to avoid having to pass through the same community twice, he needs a Hamiltonian cycle through the map of towns and air routs.

The Traveling Salesman’s Problem A traveling salesman visits various towns and cities. If he wants to avoid having to pass through the same community twice, he needs a Hamiltonian cycle through the map of towns and air routs.

Dijkstra’s Algorithm To find a shortest path from vertex A to vertex E in a weighted graph. Step 1 Assign to A the label (_, 0). Step 2 Until E or no further labels can be assigned, do the following. For each labeled vertex u(x, d) and for each unlabeled vertex v adjacent to u, compute d+w(e) where e = uv.

Dijkstra’s Algorithm b) Find the minimum value d’ of all numbers d + w(e) found in a). c) For each u and v for which d + w(e) = d’, assign to v the label (u, d’). If a vertex can be labeled (x, d’) for various vertices x, make any choice.

Example: Dijkstra’s Algorithm Give A the label (_, 0). There are 3 edges incident with A with weights 7, 5, and 8. d = 0 “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Example: Dijkstra’s Algorithm Since d = 0, vertex H gives the smallest value of d + w(e), H acquires the label (A, 5), G the label (A, 8), and B the label (A, 7) because they are the smallest d + w(e). “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Example: Dijkstra’s Algorithm Vertex I and C give the smallest value of d + w(e), I acquires the label (B, 10), and C the label (B, 15) “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Example: Dijkstra’s Algorithm Vertex J, D and F give the smallest value of d + w(e), J acquires the label (I, 17), D the label (J, 20), and F the label (D, 15). “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Example: Dijkstra’s Algorithm Vertex E gives the smallest value of d + w(e), E acquires the label (F, 21). “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Example: Dijkstra’s Algorithm The shortest route from A to E has weight 21. A shortest path is AGFE. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 328

Dijkstra’s Algorithm (Improved) To find a shortest path from vertex A to vertex E in a weighted graph. Step 1 Set v1 = A and assign to this vertex the permanent label 0. Assign every other vertex a temporary label of  , where  is a symbol that, by definition, is deemed to be larger that any real number. Step 2 Until E has been assigned a permanent label or no temporary labels are changed in (a) or (b) do the following:

Dijkstra’s Algorithm (Improved) Take the vertex vi that most recently acquired a permanent label, say d. For each vertex v that is adjacent to vi and has not yet received a permanent label, if d + w(vi, v) < t, the current temporary label of v, change the temporary label of v to d + w(vi, v). Take a vertex v that has a temporary label smallest among all temporary labels in the graph. Set vi+1 = v and make its temporary label permanent. If there are several vertices v that tie for smallest temporary label, make any choice.

Dijkstra’s Algorithm (Improved) At the start, A = v1 is given the permanent label 0, all the others are given temporary label  “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) Next, H, B, and G have their temporary labels decreased to 5, 7, and 8, respectively, all other temporary labels stay at . “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) Since 5 is the minimum of 5, 7, 8, set v2 = H, The vertices adjacent to v2. For B, 5 + 4 = 9, 9 > 7, so no change occurs. For G, 5 + 5 = 10, 10 > 8. so no change occurs, set v3 = B. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) The vertices adjacent to v3. For C, 7 + 8 = 15. For I, 7 + 3 = 10. Now C, I, and G have their temporary labels 15, 10, 8, respectively. The smallest is 8. so v4 = G. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) The vertices adjacent to v4. For I, 8 + 2 = 10, the current label , so there is no change. For F, 8 + 7 = 15, so F gets a temporary label of 15 and set v5 = I “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) Next, we have a choice of C or F for v6 and J gets a temporary label 17. Assuming v6= C, then F = v7 and D obtains a temporary label 23. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) Finally, v10 = 21. Then D gets its temporary label lowered to 20 and becomes v9. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) This algorithm gives the length of the shortest path but not the path itself. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 2006. pag 330

Dijkstra’s Algorithm (Improved) This algorithm gives the length of the shortest path but not the path itself. (permanent label of vl) + (weight of edge vlvi) = (permanent label of vi)

Topics covered Eulerian circuits. Hamilton cycles. Shortest path algorithms: Dijkstra’s Algorithm.

Reference “Discrete Mathematics with Graph Theory”, Third Edition, E. Goodaire and Michael Parmenter, Pearson Prentice Hall, 2006. pp 304-338.

Reference “Discrete Mathematics and Its Applications”, Fifth Edition, Kenneth H. Rosen, McGraw-Hill, 2003. pp 557-601.