SlideShare a Scribd company logo
1 of 5
Download to read offline
16      CSC1001 Discrete Mathematics                                                                          11 - Graphs


  4      Connectivity of Graphs
1. Paths and Connectivity
 Definition 1

 Let n be a nonnegative integer and G an undirected graph. A path of length n from u to v in G is a
 sequence of n edges e1, . . . , en of G for which there exists a sequence x0 = u, x1, . . . , xn-1, xn = v of
 vertices such that ei has, for i = 1, . . . , n, the endpoints xi-1 and xi . When the graph is simple, we denote
 this path by its vertex sequence x0, x1, . . . , xn (because listing these vertices uniquely determines the path).
 The path is a circuit if it begins and ends at the same vertex, that is, if u = v, and has length greater than
 zero. The path or circuit is said to pass through the vertices x1, x2, . . . , xn-1 or traverse the edges e1, e2, . . .
 , en. A path or circuit is simple if it does not contain the same edge more than once.

 Definition 2
 An undirected graph is called connected if there is a path between every pair of distinct vertices of the
 graph. An undirected graph that is not connected is called disconnected. We say that we disconnect a
 graph when we remove vertices or edges, or both, to produce a disconnected subgraph.

Example 23 (4 points) Graph G1 and G2 are connected or disconnected, and can you show a path from
vertex a to g, a path from vertex b to e of graph G1




 Definition 3
 Let n be a nonnegative integer and G a directed graph. A path of length n from u to v in G is a sequence of
 edges e1, e2, . . . , en of G such that e1 is associated with (x0, x1), e2 is associated with (x1, x2), and so on,
 with en associated with (xn-1, xn), where x0 = u and xn = v. When there are no multiple edges in the directed
 graph, this path is denoted by its vertex sequence x0, x1, x2, . . . , xn. A path of length greater than zero that
 begins and ends at the same vertex is called a circuit or cycle. A path or circuit is called simple if it does
 not contain the same edge more than once.

มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                       เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Graphs - 11                                                              CSC1001 Discrete Mathematics         17
  Definition 4
 A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are
 vertices in the graph.

  Definition 5
 A directed graph is weakly connected if there is a path between every two vertices in the underlying
 undirected graph.

Example 24 (4 points) Are the directed graphs G and H strongly connected? Are they weakly connected?
Show a path from vertex b to a of graph G and show a path from vertex c to a of graph H.




2. Euler Paths and Circuits
  Definition 6

 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.

  Definition 7
 A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has
 even degree.

  Definition 8
 A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices
 of odd degree.

Example 25 (4 points) Which of the undirected graphs have an Euler circuit? which have an Euler path?




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
18      CSC1001 Discrete Mathematics                                                                           11 - Graphs


Example 26 (4 points) Which of the directed graphs have an Euler circuit? which have an Euler path?




3. Hamilton Paths and Circuits
 Definition 9

 A simple path in a graph G that passes through every vertex exactly once is called a Hamilton path, and a
 simple circuit in a graph G that passes through every vertex exactly once is called a Hamilton circuit. That
 is, the simple path x0, x1, . . . , xn-1, xn in the graph G = (V ,E) is a Hamilton path if V = {x0, x1, . . . , xn-1, xn}
 and xi = xj for 0 ≤ i < j ≤ n, and the simple circuit x0, x1, . . . , xn-1, xn, x0 (with n > 0) is a Hamilton circuit if
 x0, x1, . . . , xn-1, xn is a Hamilton path.

 Definition 10

 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 Hamilton circuit.

Example 27 (3 points) Which of the simple graphs have a Hamilton circuit or, if not, a Hamilton path?




Example 28 (2 points) This simple graphs has a Hamilton circuit or, if not, a Hamilton path?




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                                         เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
Graphs - 11                                                      CSC1001 Discrete Mathematics        19
4. Shortest-Path
 Definition 11
 The Dijkstra’s Algorithm

 procedure Dijkstra(G: positive weighted connected simple graph) {
   /* G has vertices a = v0, v1, … , vn = z and lengths w(vi, vj)
       where w(vi, vj) = ∞ if {vi, vj} is not an edge in G */
   for i = 1 to n { L(vi) = ∞ }
   L(a) = 0
   S = ∅
   /* the labels are now initialized so that the label of a is 0 and all
       other labels are ∞, and S is the empty set */
   while z ∈ S {
     u = a vertex not in S with L(u) minimal
     S = S ∪ {u}
     for all vertices v not in S {
        if L(u) + w(u, v) < L(v) then
          L(v) = L(u) + w(u, v) {
          /* this adds a vertex to S with minimal label and updates the labels
             of vertices not in S */
        }
     }
   }
   return L(z) /* L(z) = length of a shortest path from a to z */
 }


Using Dijkstra’s Algorithm to find a shortest path from a to z




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                       เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
20      CSC1001 Discrete Mathematics                                                               11 - Graphs


Example 29 (5 points) Find the length of a shortest path between a and z in the given weighted graph.




Example 30 (5 points) Find the length of a shortest path between a and z in the given weighted graph.




Example 31 (5 points) Find the length of a shortest path between a and z in the given weighted graph.




มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555)                             เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี

More Related Content

What's hot

Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2showslidedump
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersappasami
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory IntroductionMANISH T I
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and lifeMilan Joshi
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network systemManikanta satyala
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applicationsManikanta satyala
 
Graph terminologies & special type graphs
Graph terminologies & special type graphsGraph terminologies & special type graphs
Graph terminologies & special type graphsNabeel Ahsen
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphsTech_MX
 

What's hot (17)

Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Cs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answersCs6702 graph theory and applications 2 marks questions and answers
Cs6702 graph theory and applications 2 marks questions and answers
 
Graphs - Discrete Math
Graphs - Discrete MathGraphs - Discrete Math
Graphs - Discrete Math
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and life
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network system
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applications
 
Graph
GraphGraph
Graph
 
graph theory
graph theorygraph theory
graph theory
 
Graph terminologies & special type graphs
Graph terminologies & special type graphsGraph terminologies & special type graphs
Graph terminologies & special type graphs
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph theory
Graph theoryGraph theory
Graph theory
 
graph theory
graph theory graph theory
graph theory
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphs
 

Similar to Discrete-Chapter 11 Graphs Part III

Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptxARVIND SARDAR
 
1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptxswapnilbs2728
 
Elements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxElements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxmiki304759
 
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdf
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdfISOMORFISME, CONNECTIVITY EULER HAMILTON.pdf
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdfmurniatimurni9
 
graph.pptx
graph.pptxgraph.pptx
graph.pptxhijigaf
 
358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13sumitbardhan
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringSaurabh Kaushik
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxasimshahzad8611
 
Introduction to-graph-theory-1204617648178088-2
Introduction to-graph-theory-1204617648178088-2Introduction to-graph-theory-1204617648178088-2
Introduction to-graph-theory-1204617648178088-2Houw Liong The
 
Chapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).pptChapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).pptishan743441
 

Similar to Discrete-Chapter 11 Graphs Part III (20)

DIGITAL TEXT BOOK
DIGITAL TEXT BOOKDIGITAL TEXT BOOK
DIGITAL TEXT BOOK
 
graphs
graphsgraphs
graphs
 
Graph ASS DBATU.pptx
Graph ASS DBATU.pptxGraph ASS DBATU.pptx
Graph ASS DBATU.pptx
 
1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx1. Graph and Graph Terminologiesimp.pptx
1. Graph and Graph Terminologiesimp.pptx
 
Graph
GraphGraph
Graph
 
graph ASS (1).ppt
graph ASS (1).pptgraph ASS (1).ppt
graph ASS (1).ppt
 
Elements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptxElements of Graph Theory for IS.pptx
Elements of Graph Theory for IS.pptx
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdf
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdfISOMORFISME, CONNECTIVITY EULER HAMILTON.pdf
ISOMORFISME, CONNECTIVITY EULER HAMILTON.pdf
 
Network Theory
Network TheoryNetwork Theory
Network Theory
 
gsm nithya.pdf
gsm nithya.pdfgsm nithya.pdf
gsm nithya.pdf
 
graph.pptx
graph.pptxgraph.pptx
graph.pptx
 
Graph algorithms
Graph algorithmsGraph algorithms
Graph algorithms
 
358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13358 33 powerpoint-slides_13-graphs_chapter-13
358 33 powerpoint-slides_13-graphs_chapter-13
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
 
Graph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptxGraph terminology and algorithm and tree.pptx
Graph terminology and algorithm and tree.pptx
 
Graphs.pptx
Graphs.pptxGraphs.pptx
Graphs.pptx
 
Graph
GraphGraph
Graph
 
Introduction to-graph-theory-1204617648178088-2
Introduction to-graph-theory-1204617648178088-2Introduction to-graph-theory-1204617648178088-2
Introduction to-graph-theory-1204617648178088-2
 
Chapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).pptChapter 5 Graphs (1).ppt
Chapter 5 Graphs (1).ppt
 

More from Wongyos Keardsri

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramWongyos Keardsri
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsWongyos Keardsri
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingWongyos Keardsri
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemWongyos Keardsri
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageWongyos Keardsri
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsWongyos Keardsri
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsWongyos Keardsri
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityWongyos Keardsri
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 CountingWongyos Keardsri
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsWongyos Keardsri
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIWongyos Keardsri
 
Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IWongyos Keardsri
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesWongyos Keardsri
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesWongyos Keardsri
 
Discrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationDiscrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationWongyos Keardsri
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowWongyos Keardsri
 
Java-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsJava-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsWongyos Keardsri
 

More from Wongyos Keardsri (20)

How to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master ProgramHow to Study and Research in Computer-related Master Program
How to Study and Research in Computer-related Master Program
 
The next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applicationsThe next generation intelligent transport systems: standards and applications
The next generation intelligent transport systems: standards and applications
 
IP address anonymization
IP address anonymizationIP address anonymization
IP address anonymization
 
SysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script ProgrammingSysProg-Tutor 03 Unix Shell Script Programming
SysProg-Tutor 03 Unix Shell Script Programming
 
SysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating SystemSysProg-Tutor 02 Introduction to Unix Operating System
SysProg-Tutor 02 Introduction to Unix Operating System
 
SysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming LanguageSysProg-Tutor 01 Introduction to C Programming Language
SysProg-Tutor 01 Introduction to C Programming Language
 
Discrete-Chapter 10 Trees
Discrete-Chapter 10 TreesDiscrete-Chapter 10 Trees
Discrete-Chapter 10 Trees
 
Discrete-Chapter 09 Algorithms
Discrete-Chapter 09 AlgorithmsDiscrete-Chapter 09 Algorithms
Discrete-Chapter 09 Algorithms
 
Discrete-Chapter 08 Relations
Discrete-Chapter 08 RelationsDiscrete-Chapter 08 Relations
Discrete-Chapter 08 Relations
 
Discrete-Chapter 07 Probability
Discrete-Chapter 07 ProbabilityDiscrete-Chapter 07 Probability
Discrete-Chapter 07 Probability
 
Discrete-Chapter 06 Counting
Discrete-Chapter 06 CountingDiscrete-Chapter 06 Counting
Discrete-Chapter 06 Counting
 
Discrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and ProofsDiscrete-Chapter 05 Inference and Proofs
Discrete-Chapter 05 Inference and Proofs
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part II
 
Discrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part IDiscrete-Chapter 04 Logic Part I
Discrete-Chapter 04 Logic Part I
 
Discrete-Chapter 03 Matrices
Discrete-Chapter 03 MatricesDiscrete-Chapter 03 Matrices
Discrete-Chapter 03 Matrices
 
Discrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and SequencesDiscrete-Chapter 02 Functions and Sequences
Discrete-Chapter 02 Functions and Sequences
 
Discrete-Chapter 01 Sets
Discrete-Chapter 01 SetsDiscrete-Chapter 01 Sets
Discrete-Chapter 01 Sets
 
Discrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling ComputationDiscrete-Chapter 12 Modeling Computation
Discrete-Chapter 12 Modeling Computation
 
Java-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindowJava-Chapter 14 Creating Graphics with DWindow
Java-Chapter 14 Creating Graphics with DWindow
 
Java-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and ObjectsJava-Chapter 13 Advanced Classes and Objects
Java-Chapter 13 Advanced Classes and Objects
 

Discrete-Chapter 11 Graphs Part III

  • 1. 16 CSC1001 Discrete Mathematics 11 - Graphs 4 Connectivity of Graphs 1. Paths and Connectivity Definition 1 Let n be a nonnegative integer and G an undirected graph. A path of length n from u to v in G is a sequence of n edges e1, . . . , en of G for which there exists a sequence x0 = u, x1, . . . , xn-1, xn = v of vertices such that ei has, for i = 1, . . . , n, the endpoints xi-1 and xi . When the graph is simple, we denote this path by its vertex sequence x0, x1, . . . , xn (because listing these vertices uniquely determines the path). The path is a circuit if it begins and ends at the same vertex, that is, if u = v, and has length greater than zero. The path or circuit is said to pass through the vertices x1, x2, . . . , xn-1 or traverse the edges e1, e2, . . . , en. A path or circuit is simple if it does not contain the same edge more than once. Definition 2 An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. An undirected graph that is not connected is called disconnected. We say that we disconnect a graph when we remove vertices or edges, or both, to produce a disconnected subgraph. Example 23 (4 points) Graph G1 and G2 are connected or disconnected, and can you show a path from vertex a to g, a path from vertex b to e of graph G1 Definition 3 Let n be a nonnegative integer and G a directed graph. A path of length n from u to v in G is a sequence of edges e1, e2, . . . , en of G such that e1 is associated with (x0, x1), e2 is associated with (x1, x2), and so on, with en associated with (xn-1, xn), where x0 = u and xn = v. When there are no multiple edges in the directed graph, this path is denoted by its vertex sequence x0, x1, x2, . . . , xn. A path of length greater than zero that begins and ends at the same vertex is called a circuit or cycle. A path or circuit is called simple if it does not contain the same edge more than once. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 2. Graphs - 11 CSC1001 Discrete Mathematics 17 Definition 4 A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are vertices in the graph. Definition 5 A directed graph is weakly connected if there is a path between every two vertices in the underlying undirected graph. Example 24 (4 points) Are the directed graphs G and H strongly connected? Are they weakly connected? Show a path from vertex b to a of graph G and show a path from vertex c to a of graph H. 2. Euler Paths and Circuits Definition 6 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. Definition 7 A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree. Definition 8 A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree. Example 25 (4 points) Which of the undirected graphs have an Euler circuit? which have an Euler path? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 3. 18 CSC1001 Discrete Mathematics 11 - Graphs Example 26 (4 points) Which of the directed graphs have an Euler circuit? which have an Euler path? 3. Hamilton Paths and Circuits Definition 9 A simple path in a graph G that passes through every vertex exactly once is called a Hamilton path, and a simple circuit in a graph G that passes through every vertex exactly once is called a Hamilton circuit. That is, the simple path x0, x1, . . . , xn-1, xn in the graph G = (V ,E) is a Hamilton path if V = {x0, x1, . . . , xn-1, xn} and xi = xj for 0 ≤ i < j ≤ n, and the simple circuit x0, x1, . . . , xn-1, xn, x0 (with n > 0) is a Hamilton circuit if x0, x1, . . . , xn-1, xn is a Hamilton path. Definition 10 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 Hamilton circuit. Example 27 (3 points) Which of the simple graphs have a Hamilton circuit or, if not, a Hamilton path? Example 28 (2 points) This simple graphs has a Hamilton circuit or, if not, a Hamilton path? มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 4. Graphs - 11 CSC1001 Discrete Mathematics 19 4. Shortest-Path Definition 11 The Dijkstra’s Algorithm procedure Dijkstra(G: positive weighted connected simple graph) { /* G has vertices a = v0, v1, … , vn = z and lengths w(vi, vj) where w(vi, vj) = ∞ if {vi, vj} is not an edge in G */ for i = 1 to n { L(vi) = ∞ } L(a) = 0 S = ∅ /* the labels are now initialized so that the label of a is 0 and all other labels are ∞, and S is the empty set */ while z ∈ S { u = a vertex not in S with L(u) minimal S = S ∪ {u} for all vertices v not in S { if L(u) + w(u, v) < L(v) then L(v) = L(u) + w(u, v) { /* this adds a vertex to S with minimal label and updates the labels of vertices not in S */ } } } return L(z) /* L(z) = length of a shortest path from a to z */ } Using Dijkstra’s Algorithm to find a shortest path from a to z มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี
  • 5. 20 CSC1001 Discrete Mathematics 11 - Graphs Example 29 (5 points) Find the length of a shortest path between a and z in the given weighted graph. Example 30 (5 points) Find the length of a shortest path between a and z in the given weighted graph. Example 31 (5 points) Find the length of a shortest path between a and z in the given weighted graph. มหาวิทยาลัยราชภัฏสวนส ุนันทา (ภาคการศึกษาที่ 2/2555) เรียบเรียงโดย อ.วงศ์ยศ เกิดศรี