Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

CS 336 March 19, 2012 Tandy Warnow.
Great Theoretical Ideas in Computer Science for Some.
Coloring Warm-Up. A graph is 2-colorable iff it has no odd length cycles 1: If G has an odd-length cycle then G is not 2- colorable Proof: Let v 0, …,
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,
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
Bayesian Networks, Winter Yoav Haimovitch & Ariel Raviv 1.
 期中测验时间:本周五上午 9 : 40  教师 TA 答疑时间 : 周三晚上 6 : 00—8 : 30  地点:软件楼 315 房间,  教师 TA :李弋老师  开卷考试.
Introduction to Graphs
1 Lecture 5 (part 2) Graphs II Euler and Hamiltonian Path / Circuit Reading: Epp Chp 11.2, 11.3.
Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Section 2.1 Euler Cycles Vocabulary CYCLE – a sequence of consecutively linked edges (x 1,x2),(x2,x3),…,(x n-1,x n ) whose starting vertex is the ending.
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
Definition Hamiltonian graph: A graph with a spanning cycle (also called a Hamiltonian cycle). Hamiltonian graph Hamiltonian cycle.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Math Foundations Week 12 Graphs (2). Agenda Paths Connectivity Euler paths Hamilton paths 2.
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
4/17/2017 Section 8.5 Euler & Hamilton Paths ch8.5.
MCA 520: Graph Theory Instructor Neelima Gupta
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
GRAPH Learning Outcomes Students should be able to:
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,
Graph Theory Topics to be covered:
(CSC 102) Lecture 29 Discrete Structures. Graphs.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
Based on slides by Y. Peng University of Maryland
5.2 Trees  A tree is a connected graph without any cycles.
V Spanning Trees Spanning Trees v Minimum Spanning Trees Minimum Spanning Trees v Kruskal’s Algorithm v Example Example v Planar Graphs Planar Graphs v.
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.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Connectivity and Paths 報告人:林清池. Connectivity A separating set of a graph G is a set such that G-S has more than one component. The connectivity of G,
Introduction to Graph Theory
Topics Paths and Circuits (11.2) A B C D E F G.
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.
CSCI 115 Chapter 8 Topics in Graph Theory. CSCI 115 §8.1 Graphs.
Chap. 11 Graph Theory and Applications 1. Directed Graph 2.
Main Menu Main Menu (Click on the topics below) Combinatorics Introduction Equally likely Probability Formula Counting elements of a list Counting elements.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Lecture 52 Section 11.2 Wed, Apr 26, 2006
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Chapter 11 - Graph CSNB 143 Discrete Mathematical Structures.
Introduction to Graph Theory
Great Theoretical Ideas in Computer Science for Some.
COMPSCI 102 Introduction to Discrete Mathematics.
12. Lecture WS 2012/13Bioinformatics III1 V12 Menger’s theorem Borrowing terminology from operations research consider certain primal-dual pairs of optimization.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
1. 期中测验时间和地点: 11 月 4 日, 上午 9:40—11 : 40 地点: 教室 2. 答疑时间和地点: 1)11 月 1 日 ( 周五 )13:00—15:00 软件楼 319 2)11 月 2 日和 3 日, 14:00—17:00 软件楼 3 楼 机房讨论室.
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
Relations and Graphs Relations and Graphs Sanjay Jain, Lecturer, School of Computing.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
Trees.
An Introduction to Graph Theory
Euler Paths and Circuits
Agenda Lecture Content: Introduction to Graph Path and Cycle
Advanced Algorithms Analysis and Design
Planarity Testing.
Can you draw this picture without lifting up your pen/pencil?
Proof Techniques.
Euler and Hamilton Paths
Simple Graphs: Connectedness, Trees
Discrete Mathematics for Computer Science
Graph Theory: Euler Graphs and Digraphs
Agenda Review Lecture Content: Shortest Path Algorithm
Presentation transcript:

Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing

v Walks Walks v Paths and Circuits Paths and Circuits v Notation for Walks Notation for Walks v Connected Graphs Connected Graphs v Lemma Lemma v Euler Circuit Euler Circuit v Euler Path Euler Path v Connected Component Connected Component v Hamiltonian Circuit Hamiltonian Circuit Main Menu Main Menu (Click on the topics below)

Walks l A walk from a vertex u to v (in G) is a sequence of the form v 0 e 1 v 1 e 2 v 2 e 3……….. e k v k where u = v 0, v = v k and for any e i, endpoints(e i ) = {v i-1, v i } l Trivial walk from u to u consists of just u l Length of a walk: number of edges in the walk, where we count different appearance of an edge in the walk separately.

Walks v 1 e 2 v 2 e 3 v 3 e 3 v 2 is a walk from v 1 to v 2 with length 3. v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7  v6v6    

Notation for Walks In graphs without parallel edges, we often omit the name of edges from the walk. This is so, since the edges are uniquely determined by the end points. Thus, we can reinsert the edges if needed.

END OF SEGMENT

Paths and Circuits l Path from u to v (in G) is a walk from u to v such that no edges are repeated. l A Simple Path from u to v (in G) is a path from u to v in which no vertices are repeated. l A closed walk is a walk which starts and ends at the same vertex. l A circuit is a closed walk in which no edges are repeated. l A simple circuit is a circuit in which no vertices (except for the last vertex, which is the same as first vertex) are repeated.

Paths and Circuits l v 1 e 2 v 2 e 3 v 3 e 3 v 2 is walk but not a path. l v 1 e 2 v 2 e 3 v 3 is a path from v 1 to v 3 l v 1 e 2 v 2 e 3 v 3 e 3 v 2 e 2 v 1 is a closed walk but not a circuit l v 1 e 2 v 2 e 3 v 3 e 1 v 1 is a simple circuit v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7  v6v6    

END OF SEGMENT

Theorem Suppose G is a graph, u and v are vertices in V(G), and there is a walk from u to v (in G). Then there is a simple path from u to v in G.

Proof Since there is a walk from u to v, there must be a shortest walk from u to v. Let it be W = v 0 e 1 v 1 e 2... v i e i+1…… v j e j+1 ….. e k v k If it is a simple path, then we are done. Otherwise suppose v i = v j, i  j. Then, W’ = v 0 e 1 v 1 e 2... v i e j+1 ….. e k v k v0v0 v i =v j vkvk is also a walk from u to v, with length smaller than W. A contradiction to W being of shortest length.. Thus W must be simple path.

END OF SEGMENT

Connected Graphs Two vertices u and v in a graph G, are connected iff there is a walk from u to v. G is connected iff all pair of vertices in G are connected.

Example v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4  

Example v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7  v6v6    

END OF SEGMENT

Theorem Suppose G is a graph and C is a circuit in G containing vertices u, v. Suppose e is an edge in G. Let G’ be formed by deleting edge e from the graph G. Then there is still a path from u to v in G’.

Proof Suppose the circuit C in G is w…… u ……v ….. ……w e can be in only one of the above paths. So at least one path remains intact after removal of e. Thus, in G’, there is a path from u to v.

END OF SEGMENT

Lemma (a) If G is a connected graph, then any two distinct vertices of G can be connected by a simple path (b) If two distinct vertices v and w are part of a non-trivial circuit and one edge is removed from the circuit, then there still exists a path from v to w in the new graph so formed. (c) If G is connected and we remove an edge in a circuit, then G still remains connected.

END OF SEGMENT

Proof of Lemma (a) Suppose v, w are vertices in G. Then since G is connected, there exists a walk from u to v (in G). Therefore, by a theorem done earlier, there is a simple path from u to v. (a) If G is a connected graph, then any two distinct vertices of G can be connected by a simple path

END OF SEGMENT

Proof of Lemma (b) In earlier theorem we showed: Suppose G is a graph and C is a circuit in G containing vertices u and v. Suppose e is an edge in G. Let G’ be formed by deleting edge e from the graph G. Then there is still a path from u to v in G’. (b) If two distinct vertices v and w are part of a non-trivial circuit and one edge is removed from the circuit, then there still exists a path from v to w in the new graph so formed.

END OF SEGMENT

Proof of Lemma (c) (c) If G is connected and we remove an edge in a circuit, then G still remains connected.

Proof of Lemma (c) Suppose e is the edge in a circuit of G which is removed. Suppose e has endpoints u and v. Suppose G’ be the new graph. By part (b) there is a path, say P, from u to v in G’. To show: for all u’,v’ in V(G), there exists a walk from u’ to v’ in G’. Consider any u’, v’ in G. G is connected --> there is a walk and thus a path, say Q, from u’ to v’ in G. If Q doesn’t contain e: Q is a path from u’ to v’ in G’. If Q contains e: replace “uev” in Q by P and “veu” in Q by reverse of P. That is, if Q=u’……uev…..v’ then consider the walk u’……P…….v’ Note that this new walk is a walk in G’ from u’ to v’. Since u’, v’ were arbitrary element of V(G’), we get that G’ is connected.

END OF SEGMENT

Euler Circuit Suppose G is a graph. Euler circuit of G (in G) is a circuit which goes through all the edges (exactly once) and all the vertices of G. Note that the vertices may be repeated in an Euler circuit.

Euler Circuit - Example v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 0 v 1 v 3 v 2 v 5 v 4 v 2 v 0 is an Euler circuit of the above graph

Euler Circuit - Example v0v0 v2v2 v4v4 v5v5 v3v3 v1v1

END OF SEGMENT

Theorem If a graph G has Euler circuit, then (a) G is connected, and (b) every vertex of G has even degree. Part (a): If G is not-connected then no circuit goes through all the vertices.

Proof (b) Suppose the Euler circuit is: v 0 e 1 v 1 e 2….. e i v i e i+1…… e j v j e j+1 ….. e k v 0 For any vertex v (except v 0 ): Coming in, going out occur in pairs. Each coming in and going out are via different edges (no repetition of edges in a circuit). Thus the degree of vertex v in G must be even. Similar reasoning holds for v 0 also, except that we consider the first exit and last entry separately.. come in, go out,.. ….. go out,.. come in,

END OF SEGMENT

Theorem If G is connected and every vertex of G has even degree, then G has an Euler circuit. Corollary: G has Euler circuit iff it is connected and every vertex of G has even degree.

Proof.v.v u.u. C (b) No edges left: Done. Or: we made a circuit C and v (in C) still has an edge unused in C. a) From u, walk until you are back at u (don’t repeat an edge). C’ c) From v build circuit C’ (using only unused edges). d) Insert C’ in C to form C’’ as follows: e) Let C =C’’, and go to step b). C’’ C: …… v…… ….. Then C’’: …..C’….. ….. (v is replaced by C’). C’’ uses all the edges in C and C’ exactly once..

END OF SEGMENT

Euler Path Suppose G is a graph. Let u and v be two distinct vertices of G. Then Euler path of G, from u to v, is a path from u to v which goes through all the edges of G (exactly once) and all the vertices of G.

Euler Path - Example v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 2 v 0 v 1 v 3 v 5 v 4 v 2 v 3 is an Euler path from v 2 to v 3

Euler Path Corollary: Suppose G is a connected graph, and u, v are two distinct vertices in G. Then G has an Euler path from u to v, iff degree of u and v is odd, and the degree of all other vertices in G is even.

END OF SEGMENT

Connected Component A Graph H is a connected component of G iff a) H is a subgraph of G b) H is connected c) No connected subgraph H’ of G has H as its proper subgraph.

Connected Component v1v1 v2v2 e2e2 e3e3 v3v3 e1e1 e4e4 v4v4 v5v5 e5e5 e6e6 e7e7  v6v6    

END OF SEGMENT

Hamiltonian Circuit A Hamiltonian Circuit of G is a simple circuit of G which goes through every vertex of G.

Hamiltonian Circuit - Example v0v0 v2v2 v4v4 v5v5 v3v3 v1v1 v 0 v 1 v 3 v 5 v 4 v 2 v 0 is an Hamiltonian circuit of the above graph

END OF SEGMENT

Hamiltonian Circuit - Theorem A non-empty graph G has Hamiltonian Circuit iff 1. G has only one vertex or 2. G has at least two vertices and G has a subgraph H such that a) H contains every vertex of G b) H is connected c) every vertex of H has degree 2 (note that this means H has same number of vertices as edges)

END OF SEGMENT