Introduction to Graphs Lecture 18: Nov 16. Seven Bridges of Königsberg Is it possible to walk with a route that crosses each bridge exactly once?

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Great Theoretical Ideas in Computer Science for Some.
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.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
Introduction to Graphs
1 Lecture 5 (part 2) Graphs II Euler and Hamiltonian Path / Circuit Reading: Epp Chp 11.2, 11.3.
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.
MCA 520: Graph Theory Instructor Neelima Gupta
Koenigsberg bridge problem It is the Pregel River divided Koenigsberg into four distinct sections. Seven bridges connected the four portions of Koenigsberg.
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.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Graph Colouring Lecture 20: Nov 25.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 5,Wednesday, September 10.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
GRAPH Learning Outcomes Students should be able to:
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Graphs Chapter 10.
EECS 203: It’s the end of the class and I feel fine. Graphs.
Summing degree sequences work out degree sequence, and sum.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
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.
Data Structures & Algorithms Graphs
Chapter 10 Graph Theory Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4.
CSS106 Introduction to Elementary Algorithms
Introduction to Graph Theory
Graph Colouring Lecture 20: Nov 25. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including.
Graph Theory and Applications
Lecture 10: Graph-Path-Circuit
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Eulerian Paths and Cycles. What is a Eulerian Path Given an graph. Find a path which uses every edge exactly once. This path is called an Eulerian Path.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Lecture 52 Section 11.2 Wed, Apr 26, 2006
Introduction to Graph Theory
Introduction to Graph Theory
CS 261 – Nov. 17 Graph properties – Bipartiteness – Isomorphic to another graph – Pseudograph, multigraph, subgraph Path Cycle – Hamiltonian – Euler.
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
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.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
Trees.
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
EECS 203 Lecture 19 Graphs.
Graphs: Definitions and Basic Properties
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Graph Theory CSRU1400, Fall 2007 Ellen Zhang.
Graphs Rosen, Chapter 8.
Graph theory Definitions Trees, cycles, directed graphs.
Eulerian tours Miles Jones MTThF 8:30-9:50am CSE 4140 August 15, 2016.
Planarity Testing.
Can you draw this picture without lifting up your pen/pencil?
Graph.
Introduction to Graphs
Graph Theory What is a graph?.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Euler and Hamilton Paths
Simple Graphs: Connectedness, Trees
Applied Combinatorics, 4th Ed. Alan Tucker
Discrete Math II Howon Kim
Discrete Math II Howon Kim
Graph Theory Proof In Class Exercise.
Presentation transcript:

Introduction to Graphs Lecture 18: Nov 16

Seven Bridges of Königsberg Is it possible to walk with a route that crosses each bridge exactly once?

Seven Bridges of Königsberg Forget unimportant details. Forget even more.

A Graph A vertex (or a node, or a point) a d c b An edge (or a line) e1 e3 e2 e4 e6 e5 e7 So, what is the “Seven Bridges of Königsberg” problem now? To find a walk that visits each edge exactly once.

Euler’s Solution a d c b e1 e3 e2 e4 e6 e5 e7 Question: Is it possible to find a walk that visits each edge exactly once. Suppose there is such a walk, there is a starting point and an endpoint point. For every “intermediate” point v, there must be the same number of incoming and outgoing edges, and so v must have an even number of edges. v

Euler’s Solution a d c b e1 e3 e2 e4 e6 e5 e7 Question: Is it possible to find a walk that visits each edge exactly once. Suppose there is such a walk, there is a starting point and an endpoint point. For every “intermediate” point v, there must be the same number of incoming and outgoing edges, and so v must have an even number of edges. In this graph, every vertex has only an odd number of edges, and so there is no walk which visits each edge exactly one. So, at most two vertices can have odd number of edges.

Euler’s Solution So Euler showed that the “Seven Bridges of Königsberg” is unsolvable. When is it possible to have a walk that visits every edge exactly once? 一筆畫問題 Is it always possible to find such a walk if there is at most two vertices with odd number of edges?

Euler’s Solution So Euler showed that the “Seven Bridges of Königsberg” is unsolvable. When is it possible to have a walk that visits every edge exactly once? Is it always possible to find such a walk if there is at most two vertices with odd number of edges? NO!

Euler’s Solution So Euler showed that the “Seven Bridges of Königsberg” is unsolvable. When is it possible to have a walk that visits every edge exactly once? Is it always possible to find such a walk if the graph is “connected” and there are at most two vertices with odd number of edges? YES!

Euler’s Solution So Euler showed that the “Seven Bridges of Königsberg” is unsolvable. When is it possible to have a walk that visits every edge exactly once? Eulerian path Euler’s theorem: A graph has an Eulerian path if and only if it is “connected” and has at most two vertices with an odd number of edges. This theorem was proved in 1736, and was regarded as the starting point of graph theory.

Types of Graphs Directed Graph Multi-Graph Simple Graph Eulerian path problem Most of the problems in this course. Will see later

A graph G=(V,E) consists of: A set of vertices, V A set of undirected edges, E Simple Graphs a f e d c b G V(G) = {a,b,c,d,e,f} E(G) = {ad,af,bd,be,cd,ce,df} Two vertices a,b are adjacent (neighbours) if the edge ab is present.

Vertex Degrees degree of a vertex = # of incident edges a f e d c b An edge uv is incident on the vertex u and the vertex v. The neighbour set N(v) of a vertex v is the set of vertices adjacent to it. e.g. N(a) = {d,f}, N(d) = {a,b,c,f}, N(e) = {b,c}. e.g. deg(d) = 4, deg(a)=deg(b)=deg(c)=deg(e)=deg(f)=2. the degree of a vertex v = the number of neighbours of v? For multigraphs, NO.For simple graphs, YES.

Degree Sequence Is there a graph with degree sequence (2,2,2)?YES. Is there a graph with degree sequence (3,3,3,3)? YES. Is there a graph with degree sequence (2,2,1)? Where to go? 2 12 NO. Is there a graph with degree sequence (2,2,2,2,1)? NO. What’s wrong with these sequences?

Handshaking Lemma For any graph, sum of degrees = twice # edges Examples = odd, so impossible = odd, so impossible. Lemma. Corollary. 1.Sum of degree is an even number. 2.Number of odd degree vertices is even.

Handshaking Lemma Lemma. Proof.Each edge contributes 2 to the sum on the right.Q.E.D. Question. Given a degree sequence, if the sum of degree is even, is it true that there is a graph with such a degree sequence? For simple graphs, NO, consider the degree sequence (3,3,3,1). For multigraphs (with self loops), YES! (easy by induction)

Same Graphs? Same graph (different drawings) Albert Christos Jessica Sharat Sonya Grant Same graph (different labels)

All that matters is the connections. Graphs with the same connections are isomorphic. Graph Isomorphism Informally, two graphs are isomorphic if they are the same after renaming. G 1 isomorphic to G 2 means there is an edge-preserving vertex matching. relation preserving renaming function Graph isomorphism has applications like checking fingerprint, testing molecules…

Dog Pig Cat Cow Beef Tuna Corn Hay f (Dog) = Beef f (Cat) = Tuna f (Cow) = Hay f (Pig) = Corn Are These Isomorphic? A bijection.

Dog Pig Cat Cow Beef Tuna Corn Hay Are These Isomorphic? Edge preserved? If there is an edge in the original graph, there is an edge after the mapping. YES! A bijection.

Dog Pig Cat Cow Beef Tuna Corn Hay Are These Isomorphic? Non-Edge preserved? If there is no edge in the original graph, there is no edge after the mapping. YES! A bijection.

Graph Isomorphism G 1 isomorphic to G 2 means there is an edge-preserving vertex matching.  bijection f: V 1 → V 2 u —v in E 1 iff f (u)—f (v) in E 2 uv is an edge in G1 f(u)f(v) is an edge in G2 If G1 and G2 are isomorphic, do they have the same number of vertices? If G1 and G2 are isomorphic, do they have the same number of edges? If G1 and G2 are isomorphic, do they have the same degree sequence? If G1 and G2 have the same degree sequence, are they isomorphic? YES NO

Exercise degree 2 all degree 3 Non-isomorphic How to show two graphs are isomorphic? Find a mapping and show that it is edge-preserving. How to show two graphs are non-isomorphic? Find some isomorphic-preserving properties which is satisfied in one graph but not the other.

Exercise Testing graph isomorphism is not easy – No known general method to test graph ismorphism much more efficient than checking all possibilities. Which is isomorphic to G1?

Paths Path: sequence of adjacent vertices( )

Simple Path: all vertices different ( ) Simple Paths

Connectedness  Vertices v, w are connected if and only if there is a path starting at v and ending at w.  A graph is connected iff every pair of vertices are connected. Every graph consists of separate connected pieces called connected components E25 E connected components So a graph is connected if and only if it has only 1 connected component.

w v a A cycle is a path that begins and ends with same vertex. cycle: v ···b ···w ···w ···a ···v b also: a ···v ···b ···w ···w ···a Cycles

A simple cycle is a cycle that doesn’t cross itself cycle: v ···w ···v v w also: w ···v ···w Simple Cycles In a simple cycle, every vertex is of degree exactly 2.

Is a shortest path between two vertices always simple? u v c Shortest Paths A path between u and v is a shortest path if among all u-v paths it uses the minimum number of edges. Idea: remove the cycle will make the path shorter.

Lemma. A shortest path between two vertices is simple. u v c Shortest Paths Proof (by contradiction): 1.Suppose there is a non-simple shortest path P=(u,…,v) 2.Let c be the first vertex that is visited twice. 3.Then P=(u,P1,c,P2,c,P3,v). 4.But P’=(u,P1,c,P3,v) is shorter, a contradiction. P1P2 P3 This is a simple cycle without using vertices in P1

Euler’s theorem: A graph has an Eulerian path if and only if it is connected and has at most two vertices with an odd number of edges. Eulerian Graphs Euler’s theorem: A graph has an Eulerian path if and only if it has zero or two vertices with odd degrees. Can a graph has only 1 odd degree vertex? Odd degree vertices. Proof by induction.

Proof Idea Assume every vertex is of even degree. Pick any vertex, go to unvisited edges as long as possible. Get stuck.Now what?

Proof Idea Assume every vertex is of even degree. Pick any vertex, go to unvisited edges as long as possible. Idea: Remove the edges already visited

Proof Idea Assume every vertex is of even degree. Again, pick any vertex, go to unvisited edges as long as possible. The remaining graph is still Eulerian (why?)

Proof Idea Assume every vertex is of even degree. Let’s say we’ve found an Eulerian path in the remaining graph Now what? Again, pick any vertex, go to unvisited edges as long as possible.

Proof Idea Assume every vertex is of even degree. Idea: Combine the two Eulerian paths Common vertex v 1.Go along the first Eulerian path until reaching v, 2.follow the second Eulerian path visiting all the edges until coming back v, 3.then follow the remaining first Eulerian path.

Complication What if we start and then get stuck in the blue vertex?

Complication Then the remaining graph is disconnected into more components. The same idea applies. What if we start and then get stuck in the blue vertex?