Chapter 10 Graph Theory. 10.2 Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Lecture 15. Graph Algorithms
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.
Introduction to Graphs
9.7 Planar Graphs. Intro problem- 3 houses and 3 utilities K 3,3 problem: Can 3 houses be connected to 3 utilities so that no 2 lines cross? Similarly,
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Lecture 17 Path Algebra Matrix multiplication of adjacency matrices of directed graphs give important information about the graphs. Manipulating these.
Introduction This chapter explores graphs and their applications in computer science This chapter explores graphs and their applications in computer science.
Edited by Malak Abdullah Jordan University of Science and Technology Data Structures Using C++ 2E Chapter 12 Graphs.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Applied Discrete Mathematics Week 12: Trees
Discussion #36 Spanning Trees
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.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
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?
Tucker, Applied Combinatorics, Section 1.4, prepared by Patti Bodkin
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Discrete Math for CS Chapter 8: Directed Graphs. Discrete Math for CS digraph: A digraph is a graph G = (V,E) where V is a finite set of vertices and.
Applied Discrete Mathematics Week 12: Trees
Tirgul 13 Today we’ll solve two questions from last year’s exams.
Chapter 9: Graphs Basic Concepts
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
IS 2610: Data Structures Graph April 5, 2004.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Chapter 2 Graph Algorithms.
Graph Theory Topics to be covered:
 期中测验时间:  11 月 4 日  课件 集合,关系,函数,基数, 组合数学.  Ⅰ Introduction to Set Theory  1. Sets and Subsets  Representation of set:  Listing elements, Set builder.
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Vertices and Edges Introduction to Graphs and Networks Mills College Spring 2012.
CSCI 115 Chapter 7 Trees. CSCI 115 §7.1 Trees §7.1 – Trees TREE –Let T be a relation on a set A. T is a tree if there exists a vertex v 0 in A s.t. there.
Data Structures & Algorithms Graphs
Basic Notions on Graphs. The House-and-Utilities Problem.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
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.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
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. undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph.
Great Theoretical Ideas in Computer Science for Some.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Connectivity. Graph Scanning Algorithm Input: A graph G and some vertex s. Output: The set R of vertices reachable from s and a set T ⊆ E(G) such that.
COMPSCI 102 Introduction to Discrete Mathematics.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
1 Euler and Hamilton paths Jorge A. Cobb The University of Texas at Dallas.
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.
Graphs. Representations of graphs : undirected graph An undirected graph G have five vertices and seven edges An adjacency-list representation of G The.
An Introduction to Graph Theory
Outline 1 Properties of Planar Graphs 5/4/2018.
Graph theory Definitions Trees, cycles, directed graphs.
Discrete Maths 9. Graphs Objective
Planarity Testing.
CSE 421: Introduction to Algorithms
Graph.
Graphs Chapter 13.
Gaph Theory Planar Graphs
Discrete Mathematics for Computer Science
Applied Combinatorics, 4th Ed. Alan Tucker
Closures of Relations Epp, section 10.1,10.2 CS 202.
Agenda Review Lecture Content: Shortest Path Algorithm
Presentation transcript:

Chapter 10 Graph Theory

10.2 Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4 Shortest path

10.2 Eulerian Cycle and the property of graph theory

Example 1 What is Königsberg Bridge problem? Ans. Two islands A and B are reduced to nodes. On the side of the river C and D are also reduced to nodes, it can be modeled as a graph and it is shown in Fig G=(V,E), V denotes Node Set, and E denotes Edge Set. V={A,B,C,D} and E={(A,C),(A,C),(A,D),(A,D),(A,B),(B,C),(B,D)}.

Fig Königsberg Bridge

Fig The model of Fig Edge(A,C) appears two times, it is called Multiple Edges. The degree of node B is 3, it can be denoted by d(B)=3 which means that there are 3 edges incident to the node B.

Example 2 From Fig , Can we find an Eulerian cycle from node A? Ans. Node C will consume two adjacency edges when we cross. Since d(C) is odd, there will remain at last an adjacency edge. The discussion on node C is also suitable for node A, since d(A) is also odd. We are unable to find an Eulerian cycle in Fig

Example 2.1 Let G=(V,E) be a loop-free connected undirected graph, and let (a, b) be an edge of G. Prove that (a, b) is a part of a cycle if and only if remove the vertices a and b does not disconnect G. Ans. (  ) If (a, b) is a part of a cycle and let a-b-v 1 -v 2 -…v i -a be a cycle. Suppose remove edge (a, b) from G. The path b-v 1 -v 2 -…-v i - a connects (a, b), thus G still connect. (  )It is still a connected image when removing the edge (a,b) from G, thus there exists a path a-v 1 -v 2 -…-v i -b. If we replace edge (a, b), we can obtain image G with a cycle a-v 1 -v 2 -…-v i -b-a, thus (a, b) is a part of a cycle.

Example 3 Let G=(V,E) be a connected graph. Prove that G has an Eulerian cycle if and only if all degree of nodes in G are even? Ans. (  ) If G has an Eulerian cycle, it means that for all nodes in the cycle, the number of in-edges are equal to out-edges. Thus, for all nodes in G, the degree of them are all even. (  ) Assume that we select two different node x, y  V from G, and it forms a longest Eulerian Chain C 1 from x to y. At this moment, we must select an edge (y, z) not be a part of C1 from G. Then, add an edge (y, z) to C1, we have a longer Eulerian chain. In fact, node z is node x. Assume that C1 has included all the edges in G, we get the proof.

If there are still edges in G which extend from node u  C1 but are not a part of C1, let G’ be discarded the edge set of C1 in G. Since G is a connected graph and every degree of node is even, the degree of nodes in G’ are still even. Assume we can find a cycle in G’, we merge this cycle into C1, we have Eulerian cycle larger than C1, this is a contradiction. Discard multiple edges (A,D) and (A,C) in figure , we can also find an Eulerian chain.

10.3 The important property of graph theory and its representation

Example 1 Given a simple planar graph, are there upper bounds to limit the degree of nodes ? Ans. A face at least includes three edges. Let represents the number of faces that are formed by i edges, then the total number of faces F in G will satisfy Consider an edge shared by two faces, we obtain We have (10.3.1) We prove it by contradiction : there is a degree of node less than 6. Assume every node in V satisfy 6, we obtain (10.3.2)

represents the degree of nodes greater than 6. From (10.2.1) we induce that (10.3.3) We have (10.3.4) Merge (10.3.1) and (10.3.4), we have (10.3.1) multiplied by 2 and then merge (10.3.4) again, we obtain (10.3.5) From Euler formula we know (10.3.5) is wrong, since. Thus we prove it is impossible that every degree of nodes is greater than 6 in simple planar graph.

Example 2 Prove that there are at most edges in simple planar graph G. Ans. From (10.3.1) we have (10.3.6) Substitute Euler formula into the left pattern of (10.3.6), we have Thus, we prove that there are at most edges.

Example 3 Is a simple planar graph? Ans. In, there are 10 edges, there are at most edges in simple planar graph. Thus, is not a simple planar graph. Fig

Example 3.1 For every tree, if, T has at least two pendant vertices. i.e. vertices of degree 1. Ans. (1)If T doesn’t have pendant vertices and T is connected graph, then,, and |E| = |V|  1, we have Induce that, it is a contradiction. (2)If T has one pendant vertices, then Induce that, it is a contradiction. Combine the discussion (1) and (2), thus T has at least two pendant vertices.

Example 3.2 Suppose G is an arbitrary digraph with n vertices. What is the largest possible number of distinct subgraphs with k vertices that G may have ? (Isomorphic subgraphs are distinct. Choose G to maximize this number.) Ans. When G is a complete graph which the number of nodes is n, it will have the largest possible number of distinct subgraphs. When the number of nodes is k, there are at most edges, and these edges have two choices : choose or not choose, it will compose all the digraph, there are different digraph. There are choices and we need to consider about which the number of nodes is k, thus the answer =.

Example 4 What is the representation of adjacency list ? Ans. Fig A little example

Example 5 What is the representation of adjacency matrix ? Ans. The representation of adjacency matrix : From above, the representation of adjacency matrix in figure is

Example 6 What the problem is Warshall algorithm used to solve ? Ans. If, but node i can reach node j through node k, we say that node i can reach node j and write down. As shown in Figure Fig

represents that node I can reach node j through m edges. Warshall algorithm is the check of reachability between any two nodes in graph G, that is to compute (10.3.7) Here,. We solve the transitive closure problem in graph G.

Let Then we obtain

Example7 Before introduce Warshall’s algorithm, can you use brute force method to obtain ? Ans. A:=M B:=A for i=2 to (|V|-1) begin A:=A  M B:=B  A end It will take by brute force method.

Example8 What is Warshall method? Ans. Warshall’s method is easy, the following is the three for loops included in Warshall’s method : B:=M for k=1 to |V| begin for i=1 to |V| begin for j=1 to |V| B[i, j]=B[i, j]  (B[i, k]  B[k, j]) end The above procedure only need time

10.4 Shortest path

Example1 How many types does the shortest path have ? Ans. Let the source node in is S, and the target node is T. The four combinations of the shortest path are: Fig four combinations of the shortest path The symbol I denotes the set of inner nodes. ST 1S0S0 T0T0 2IT0T0 3S0S0 I 4II

Fig an example of a direct graph The first type of the shortest path is the problem of walking from node 1 to node 6. Let I=4, then the second type of the shortest path is the problem of walking from node 4 to node 6.

Example2 How is Floyd-Warshall algorithm used to solve the fourth type of the all pairs shortest path problem? And what is its time complexity? Ans. The fourth type of shortest path problem Floyd-Warshall algorithm is used to solve all pairs shortest path problem.

Let adjacency matrix is W, Floyd-Warshall algorithm can bedesigned as follow : B:=W for k=1 to |V| begin for i=1 to |V| begin for j=1 to |V| W[i, j]=min(W[i, j],W[i, k]+W[k, j]) end Its time complexity is.

Example3 Can Floyd-Warshall algorithm solve the all pairs shortest path problem in figure ? Ans. From figure , we can get the source adjacency matrix is Here, represents that node 1 and node 4 not connect each other. After running k=1, adjacency matrix not change, that is

After running k=2, we obtain

After running k=3, will change into

Here, pay attention !. When we complete k=4, 5 and 6, finally we obtain Thus, the solve of the all pairs shortest path in figure hides in. For example : tells us, the shortest path between node 2 and node 6 is 2.

Example4 How Dijkstra solve the all pairs shortest path problems? Ans. Given fig : Fig An example

Select node A and place it into Labeled Node Set (LNS), and the other four nodes B 、 C 、 D and E are placed into Unlabeled Node Set (UNS). Find the edge node set which connects LNS and UNS and denote it as (LNS, UNS). In the edge node set (LNS,UNS), we find the smallest weighted edge (A,C) and know its weighted edge value is 2. Fig is the present condition. Direct at node C in the figure, we record [A,2]. Fig The condition of LNS after include node C

Check the edges joined in LNS and UNS, then we discover that (A,B), (A,D), (C,B) and (C,D) is four edges to join LNS and UNS. We can calculate from figure (10.4.1) Similar, can calculate Choose node B! Then the record on node B of [C,3]. Figure is a sketch map after adding node B.

Fig Adding B to LNS

And then, we choose node B. Fig is a sketch map of LNS adding node D. Finally, we choose edge (B,E ) and node E, then pursued the final result of the Fig Fig Adding node D into LNS

Fig Final result By Fig , we can get the shortest path and the length of shortest path from node A to all other nodes.

Example5 What is the time complexity of Dijkstra algorithm in Example4 ? Ans. As to any node in LNS, at least (|V|-k) edges can link to any node in UNS. If consider all extreme point in LNS, then there are at most k(|V|-k) edges link between LNS and UNS. Time complexity is (10.4.2)