Foundations of Discrete Mathematics Chapters 9 and 10 By Dr. Dalia M. Gil, Ph.D.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

CSE 211 Discrete Mathematics
CSE 211 Discrete Mathematics
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.
Discrete Mathematics and Its Applications
1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Applied Discrete Mathematics Week 12: Trees
Discrete Structures Chapter 7A Graphs Nurul Amelina Nasharuddin Multimedia Department.
Applied Discrete Mathematics Week 12: Trees
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
9.3 Representing Graphs and Graph Isomorphism
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 1): Graphs  Introduction to Graphs (9.1)
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
Foundations of Discrete Mathematics
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
Chapter 6 Graph Theory R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
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.
Basic Notions on Graphs. The House-and-Utilities Problem.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
An Introduction to Graph Theory
Discrete Mathematical Structures: Theory and Applications
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 1): Graphs  Introduction to Graphs (9.1)
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
And before you really hate (mathematical) relations and begin to break your (social) relations, let’s switch to a new topic: Graphs Discrete Structures.
Introduction to Graphs Slides by Gene Boggess
Chapter Graphs and Graph Models
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.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
An Introduction to Graph Theory
Chapter 9 (Part 1): Graphs
Applied Discrete Mathematics Week 14: Trees
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Applied Discrete Mathematics Week 13: Graphs
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Graph theory Definitions Trees, cycles, directed graphs.
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.
Graphs.
Chapter 13 (Part 1): Graphs
Lecture 15: Graph Theory II
Foundations of Discrete Mathematics
CS100: Discrete structures
Discrete Math II Howon Kim
Let us switch to a new topic:
Applied Discrete Mathematics Week 13: Graphs
Agenda Review Lecture Content: Shortest Path Algorithm
Presentation transcript:

Foundations of Discrete Mathematics Chapters 9 and 10 By Dr. Dalia M. Gil, Ph.D.

Graphs  Graphs are discrete structures consisting of vertices and edges that connect these vertices.

Graphs  A graph is a pair (V, E) of sets, V nonempty and each element of E a set of two distinct elements of V.  The elements of V are called vertices;  the elements of E are called edges.

Graphs  If e is an edge, then e = {v, w}, where v and w are different elements of set V called the end vertices of ends of e.  The vertices v and w are said to be incident with the edge vw. The edge vw is incident with each vertex.

Graphs  Two vertices are adjacent if they are the end vertices of an edge.  Two vertices are adjacent if they have a vertex in common.  The number of edges incident with a vertex v is called the degree of that vertex and is denoted deg v.

Graphs  If deg v is an even number, then v is said to be an even vertex.  If deg v is an odd number, then v is odd vertex.  A vertex of degree 0 is said to be isolated.

Subgraph  A graph G 1 is a subgraph of another graph G if and only if the vertex and edge sets of G 1 are, respectively, subsets of the vertex and edge sets of G.

Example: Subgraph  A graph G and three subgraphs G 1, G 2, and G 3 “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, pag 290

A Bipartite Graph  A bipartite graph is one whose vertices can be partitioned into two (disjoint) sets V 1 and V 2, called bipartition sets in such a way that every edge joins a vertex in V 1 and a vertex in V 2.

A Bipartite Graph  The complete bipartite graph on bipartition sets of m vertices and n vertices, respectively, is denoted K m,n.

Bipartite Graphs  Three bipartite graphs, two of which are not complete.  No two top vertices are adjacent, and no two bottom vertices are adjacent. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, pag 291

Euler  The sum of the degrees of the vertices of a pseudograph is an even number equal to twice the number of edges.  In symbols, if G(V, E) is a pseudograph, then  deg v = 2 |E| vV

Example: Euler  The graph has 8 vertices of degree 3  deg v = 8(3) = 24 =2|E| vV it must have 12 edges. “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, pag 291

Graphs  There are several different types of graphs that differ with respect to the kind and number of edges that connect a pair of vertices.  Many real problems can be solved using graph models.

Types of Graphs  Simple graph.  Multigraph.  Pseudograph.  Directed graph.  Direct multigraph.

A Simple Graph  A simple graph G = (V, E) consists of  V, a nonempty set of vertices, and  E, a set of unordered pairs of distinct elements of V (edges).

Example of a Simple Graph  A computer network that represents computers (vertices) and telephone lines (undirected edges) that connect two distinct vertices. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 538

A Multigraph  A multigraph G = (V, E) consists of a set V of vertices,  a set E of edges, and  a function f (from E to {{u, v} | u, v  V, u ≠ v}).  The edges e 1 and e 2 are called multiple or parallel edges if f(e 1 ) = f(e 2 ).

Example of a Multigraph  This graph consist of vertices and undirected edges between these vertices with multiple edges between pairs of vertices allowed (two or more edges may connect the same pair of vertices). “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 538

A Pseudograph  A pseudograph G = (V, E) consists of  a set V of vertices,  a set E of edges, and  a function f (from E to {{u, v} | u, v  V}).  An edge is a loop if f (e) = {u, v} = {u}

Example of a Pseudograph  A computer network may contain vertices with loops, which are edges from a vertex to itself. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 539

A Direct Graph  A direct graph (V, E) consists of  a set of vertices V and  a set of edges E that are ordered pairs of elements of V.

Example of a Direct Graph  A network may not operate in both directions. In this case an arrow pointing from u to v to indicate the direction of the edge (u, v) is used. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 539

A Directed Multigraph  A directed multigraph G = (V, E) consists of  a set V of vertices,  a set E of edges, and  a function f (from E to {(u, v) | u, v  V}).  The edges e 1 and e 2 are multiple edges if f(e 1 ) = f(e 2 ).

Example of a Directed Multigraph  The algorithm uses a finite number of steps, since it terminates after all the integers in the sequence have been examined. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 540

Graph Terminology “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 540 TypeEdgesMultiple Edges Allowed? Loops Allowed? Simple GraphUndirectedNo MultigraphUndirectedYesNo PseugographUndirectedYes Directed GraphDirectedNoYes Directed MultigraphDirectedYes

Niche Overlap Graphs in Ecology  The competition between species in an ecosystem can be modeled using a niche overlap graph.  Each species is represented by a vertex.

Niche Overlap Graphs in Ecology  An undirected edge connects two vertices if the two species represented by these vertices compete. Two species are connected if the food resources they use are the same. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 541

Acquaintanceship Graph  To represent whether two people know each other (whether they are acquainted) Each person is represented by a vertex. An undirected edge connects two people when they know each other. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 541

Influence Graph  In studies of group behavior it is observed that certain people can influence the thinking of others.  A directed graph can model this behavior.  Each person is represented by a vertex.  There is a directed vertex from vertex a to vertex b when person a influences person b.

Influence Graph (A Directed Graph) Deborah can influence Brian, Fred, and Linda, but no one can influence her. Yvonne and Brian can influence each other. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 542

Round-Robin Tournaments  A tournament where each team plays each other team exactly once is called a round-robin tournament.  In this case a directed graph is used.  Each team is represented by a vertex.

Round-Robin Tournaments  (a, b) is an edge if team a beats team b.  Team 1 is undefeated in this tournament  Team 3 is winless. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 542

Call Graphs  Graphs can be used to model telephone calls made in a network, such as a long- distance telephone network.  A directed multigraph can be used.  Each telephone is a vertex  Each telephone call is represented by a directed edge.

Call Graph using Directed Graph Three calls have been made from to and two in the other direction. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 542

Call Graph using Directed Graph One call has been made from to “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 542

Call Graph using Undirected Graph  An undirected graph is used if there has been a call connecting two telephone numbers. Each edge tells us whether there has been a call between two numbers. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 542

Precedence Graph and Concurrent Processing  Computer programs can be executed more rapidly by executing certain statements concurrently.  It is important not to execute a statement that requires results of statement not yet executed.

Precedence Graph and Concurrent Processing  The dependence of statements on previous statements can be represented by a directed graph.  There is an edge from one vertex to a second vertex if the statement represented by the second vertex cannot be executed before the statement represented by the first vertex has been executed.

Precedence Graph and Concurrent Processing In this section of a computer program the statement S 5 cannot be executed before S 1, S 2, and S 4 are executed. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 543

Representing Graphs 1.To represent a graph without multiple edges is to list all the edges of this graph. 2.To represent a graph with no multiple edges is to use adjacent list, which specify the vertices that are adjacent to each vertex of the graph.

Example: Representing Graphs Use adjacent lists to describe the simple graph given in the figure. VertexAdjacent Vertices ab, c, e ba ca, d, e dc, e ea, c, d “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 557

Example: Representing Graphs Represent the directed graph shown in the figure by listing all the vertices that are the terminal vertices of edges starting at each vertex of the graph in the figure. Initial Vertex Terminal Vertices ab, c, d, e bb, d ca, c, e d eb, c, d “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 558

The Adjacency Matrix A (A G )  If A = {a ij } is the adjacency matrix A of G, then a ij = 1 if {v i, v j } is an edge of G and a ij = 0 otherwise.  The adjacency matrix of a simple graph is symmetric if a ij = a ji.  A simple graph has no loops, so each entry a ii = 1, 2, …, n is 0.

Example: Adjacent Matrix Use an adjacent matrix to represent the graph. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 558

Example: Adjacent Matrix Draw a graph with the adjacent matrix with respect to ordering of vertices a, b, c, d. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 559

Example: Adjacent Matrix Use an adjacent matrix to represent the pseudograph shown in the figure. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 559

Incidence Matrices  Let G = (V, E) be an undirected graph. Suppose that v 1,v 2, …, v n are the vertices and e 1, e 2, …, e m are the edges of G.  Then the incidence matrix with respect to this ordering of V and E is n x m matrix M = {m ij }, where m ij = 1 when edge e i is incident with v i, m ij = 0 otherwise

Represent the graph with an incidence matrix. Example: Incidence Matrix “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 560

Represent the pseudograph with an incidence matrix. Example: Incidence Matrix “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 560

 We often need to know whether it is possible to draw two graph in the same way. Isomorphism of Graphs  In chemistry different compounds can have the same molecular formula but can differ in structure.  Such compounds will be represented by graph that cannot be drawn in the same way.

 The simple graphs G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) are isomorphic if there is a one-to-one and onto function f from V 1 to V 2,  a and b are adjacent in G 1 if and only if f(a) and f(b) are adjacent in G 2, for all a and b in V 1. Isomorphism of Graphs

 Two simple graphs are isomorphic, if there is a one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship.  Isomorphism of simple graph is an equivalence relation.  Isomorphism comes from the Greek root isos for “equal” and morphe for “form.” Isomorphism of Graphs

Show that the graphs G = (V, E) and H = (W, F) are isomorphic Example: Isomorphism f(u 1 )= v 1, f(u 2 )= v 4, f(u 3 )= v 3, f(u 4 )= v 2 “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561 There is a one-to-one correspondence between V and W.

Show that the graphs G = (V, E) and H = (W, F) are isomorphic Example: Isomorphism (cont.) The adjacent vertices in G are u 1 and u 2, u 1 and u 3, u 2 and u 4, u 3 and u 4 “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

Show that the graphs G = (V, E) and H = (W, F) are isomorphic Example: Isomorphism (cont.) Each of the pairs f(u 1 )= v 1 and f(u 2 )= v 4 f(u 1 )= v 1 and f(u 3 )= v 3 f(u 2 )= v 4 and f(u 4 )= v 2 f(u 3 )= v 3 and f(u 4 )= v 2 are adjacent in H. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

 Two simple graphs are not isomorphic, if they do not share a property that isomorphic simple graphs must both have.  This property is called an invariant with respect to isomorphism of simple graph. Isomorphism of Graphs

 Isomorphic simple graphs must have the same number of vertices, since there is a one-to-one correspondence between the sets of vertices of the graphs. Isomorphism: Some Invariants

 Isomorphic simple graphs must have the same number of edges, because the one-to-one correspondence between vertices establishes a one-to-one correspondence between edges. Isomorphism of Graphs

 The degree of the vertices in isomorphic simple graph must be the same.  A vertex v of degree d in G must correspond to a vertex f(v) of degree d in H, since a vertex w in G is adjacent to v if and only if f(v) and f(w) are adjacent in H. Isomorphism of Graphs

 Show that the graphs are not isomorphic. Examples of Graphs not Isomorphic  G and H have 5 vertices and 6 edges  H has a vertex of degree one (e).  G has no vertices of degree one.  G and H are not isomorphic. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

 Determine whether the graphs are isomorphic. Examples of Graphs not Isomorphic  G and H have 8 vertices and 10 edges.  G and H have 4 vertices of degree 2 and 4 of degree 3. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

 Determine whether the graphs are isomorphic. Examples of Graphs not Isomorphic  In G deg(a) = 2, and a must correspond to either t, u, x, or y in H.  t, u, x, and y are adjacent to another vertex of degree 2, which is not true for a in G.  G and H are not isomorphic. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

 Determine whether the graphs are isomorphic using subgraphs. Examples of Graphs not Isomorphic  In G deg(a) = 2, and a must correspond to either t, u, x, or y in H.  t, u, x, and y are adjacent to another vertex of degree 2, which is not true for a in G. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 561

 Determine whether the graphs are isomorphic using subgraphs. Examples of Graphs not Isomorphic “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 562

 Determine whether the graphs are isomorphic using subgraphs. Examples of Graphs not Isomorphic  The subgraphs of G and H made up of vertices of degree 3 and the edges connecting then must be isomorphic if these two graphs are isomorphic.  G and H are not isomorphic. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 562

 Determine whether the graphs are isomorphic using adjacency matrix. Examples of Graphs Isomorphic  Both G and H have 6 vertices and 7 edges.  Both have four vertices of degree 2 and 2 vertices of degree three. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pag 562

 Determine whether the graphs are isomorphic using adjacency matrix. Examples of Graphs Isomorphic “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pp

 Determine whether the graphs are isomorphic using adjacency matrix. Examples of Graphs Isomorphic “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, pp

 Determine whether the graphs are isomorphic using adjacency matrix. Examples of Graphs Isomorphic  A G = A H, G and H are isomorphic. “Discrete Mathematics and its Applications.” Fifth Edition, by Kenneth H. Rosen. Mc Graw Hill, p 563

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

 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. Walk

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

 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. Circuit

Terms and their characteristics TermCharacteristics TrailDistinct edges PathDistinct vertices CircuitClosed trail CycleClosed 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, pag 305

Example  Trail : A B C E F C D (distinct edges) “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, 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, 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, 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, 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, pag 305

 An 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. An Eulerian or Euler Circuit

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

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

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

 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. An Eulerian Circuit

 G 1 contains two vertices of odd degree (b and d).  b and d must be the end points of this Euler path. Example: Eulerian 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, pag 582

 G 2 contains exactly two vertices of odd degree (b and d).  b and d must be the end points of this Euler path. Example: Eulerian 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, pag 582

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

 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

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

 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. Shortest Path Algorithm

 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. The Traveling Salesman’s Problem

 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. a)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. Dijkstra’s Algorithm

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, 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, 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, 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, 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, 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, pag 328

 To find a shortest path from vertex A to vertex E in a weighted graph.  Step 1 Set v 1 = 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)

(a)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). (b)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 = v 1 is given the permanent label 0, all the others are given temporary label  Dijkstra’s Algorithm (Improved) “Discrete Mathematics with Graph Theory.” Fifth Edition, by E. G. Goodaire ane M. Parmenter Prentce Hall, pag 330

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

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

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

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

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

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

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

 This algorithm gives the length of the shortest path but not the path itself. (permanent label of v l ) + (weight of edge v l v i ) = (permanent label of v i ) Dijkstra’s Algorithm (Improved)

Topics covered  Graph. Definitions and basic properties.  Adjacency matrices.  Isomorphism.

Topics covered  Path, walk, circuit, and cycle.  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, pp

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