1 CS104 : Discrete Structures Chapter V Graph Theory.

Slides:



Advertisements
Similar presentations
Chapter 9 Graphs.
Advertisements

22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
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.
Applied Discrete Mathematics Week 12: Trees
1 Section 8.2 Graph Terminology. 2 Terms related to undirected graphs Adjacent: 2 vertices u & v in an undirected graph G are adjacent (neighbors) in.
SE561 Math Foundations Week 11 Graphs I
Introduction to Graphs
Graph Theory in CS Route Search in Online Map Services
Discrete Structures Chapter 7A Graphs Nurul Amelina Nasharuddin Multimedia Department.
Selected Topics in Data Networking Graph Representation.
Applied Discrete Mathematics Week 12: Trees
Chapter 4 Graphs.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
9.3 Representing Graphs and Graph Isomorphism
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
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,
1 Graphs Chapters 9.1 and 9.2 University of Maryland Chapters 9.1 and 9.2 Based on slides by Y. Peng University of Maryland.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
 期中测验时间:  11 月 4 日  课件 集合,关系,函数,基数, 组合数学.  Ⅰ Introduction to Set Theory  1. Sets and Subsets  Representation of set:  Listing elements, Set builder.
Module #19: Graph Theory: part I Rosen 5 th ed., chs. 8-9 내년 3 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
Lecture 10: Graphs Graph Terminology Special Types of Graphs
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree.
Based on slides by Y. Peng University of Maryland
GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.
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.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
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.
An Introduction to Graph Theory
CS 103 Discrete Structures Lecture 20
Graph Theory and Applications
Foundations of Discrete Mathematics Chapters 9 and 10 By Dr. Dalia M. Gil, Ph.D.
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
 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.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Graphs Basic properties.
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Graph Theory Unit: 4.
Chapter 9: Graphs.
Introduction to Graph Theory By: Arun Kumar (Asst. Professor) (Asst. Professor)
Chapter 05 Introduction to Graph And Search Algorithms.
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.
Applied Discrete Mathematics Week 14: Trees
Chapter 9 (Part 2): Graphs
Applied Discrete Mathematics Week 13: Graphs
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Graph theory Definitions Trees, cycles, directed graphs.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Let us switch to a new topic:
Lecture 10: Graphs Graph Terminology Special Types of Graphs
5/9/2019 Discrete Math II Howon Kim
Introduction to Graph Theory
Applied Discrete Mathematics Week 13: Graphs
Presentation transcript:

1 CS104 : Discrete Structures Chapter V Graph Theory

2  A Graph, G = (V, E), is a data structure which consists of a nonempty set of vertices (or nodes), V, and a set of edges, E, that connect (some of) them.  The set of vertices V of a graph G may be infinite.  A graph with infinite vertex set is called infinite graph.  A graph with finite vertex set is called finite graph.  For example,  V = {1, 2, 3, 4, 5}  E = { (1,2), (1,3), (1,4), (2,3), (3,5), (4,5) } Vertex (Node) Edge What is a Graph?

3  Computer Networks  Electrical Circuits  Road Map Computer Resistor/Inductor/… City Application of Graphs

4  An Undirected Graph is a graph where the edges have no directions.  The edges in an undirected graph are called Undirected Edges  For example, G = (V, E), where  V = {1, 2, 3, 4, 5} and E = {(1,2), (1,3), (1,4), (2,3), (3,5), (4,5)}  A Directed Graph or Digraph is a graph where each edge has a direction.  The edges in a digraph are called Arcs or Directed Edges  For example, G = (V, E), where V = {1, 2, 3, 4, 5, 6} and E = {(1,4), (2,1), (2,3), (3,2), (4,3), (4,5), (4,6), (5,3), (6,1), (6,5)}  The edge (1, 4) = 1 → 4 where 1 is the tail and 4 is the head Graph Categorization

 A graph with both directed and undirected edges is called a mixed graph.  Adjacent vertices: If (u, v) is an edge of the graph, then the nodes u and v are adjacent.  An edge (u, v) is incident to vertices u and v.  For example, Vertices 1 and 2 are adjacent, but vertices 2 and 5 are not adjacent  A Weighted Graph is a graph where all the edges are assigned weights.  If the same pair of vertices have more than one edges (multiple edges), that graph is called a Multigraph Graph Categorization

6  Loop or self edges: An edge (u, u) is called a self edge or a loop.  ( 1,1 ) and ( 4,4 ) are self edges  Graphs that may include loops, and possibly multiple edges connecting same pair of nodes, are called pseudographs.  In simple graphs (or graphs) loops and multiple edges are not permitted  The complete graph on n vertices, K n, is the simple graph that contains exactly one edge between each pair of distinct nodes Graph Categorization

7  The cycle C n, n≥3, consists of n vertices v 1, v 2, ….., v n, and edges (v 1, v 2 ), (v 2, v 3 ), …, (v n-1, v n ), and (v n, v 1 ).  That is, C n consists of n vertices and n edges.  A simple graph G is called bipartite if its vertex set can be partitioned into two disjoint sets V 1 and V 2 such that every edge in the graph connects a vertex in V 1 and a vertex in V 2. When this condition holds, we call the pair (V 1, V 2 ) a bipartition of the vertex set V of G Graph Categorization

8  Example 1:- C 6 is bipartite, because its vertex set can be partitioned into two disjoint sets V 1 ={v 1,v 3,v 5 } and V 2 ={v 2,v 4,v 6 }, and every edge of C 6 connects a vertex in V 1 and a vertex in V 2.  Example 2:- K 3 is not bipartite, because if we divide the vertex set into two disjoint sets, one set must contain two vertices. If the graph were bipartite, these two vertices could not be connected by an edge, but in K 3 each vertex is connected to every other vertex by an edge.  Theorem:- A simple graph is bipartite if and only if it is possible to assigns one of two different colors to each vertex of the graph so that no two adjacent vertices are assigned the same color. Graph Categorization V 1 v 1. v 3. v 5. V 2. v 2. v 4. v 6

9  A Subgraph of graph G=(V,E) is a graph H=(U,F) such that U ⊆ V and F ⊆ E. A subgraph H is a proper subgraph of G if H≠G.  The union of two simple graphs G 1 =(V 1, E 1 ) and G 2 =(V 2, E 2 ) is the simple graph with vertex set (V 1 υV 2 ) and edge set (E 1 υE 2 ). The union of G 1 and G 2 is denoted by G 1 υG 2. For example, G=(V,E) H=(U,F) Graph Categorization G1G G2G G 1 U G 2

10  Degree of a Vertex : In an undirected graph, the no. of edges incident to the vertex. Degree of vertex v is denoted by deg(v).  For example, deg(1)=3, deg(2)=2, deg(3)=2, deg(4)=1 and deg(5)=0.  A vertex of degree zero is called isolated vertex.  A vertex of degree one is called pendant vertex.  For example, vertex 4 is pendant and vertex 5 is isolated.  The Handshaking Theorem: - Let G=(V, E) be an undirected graph. Then 2|E| = ∑deg(v), ∀ v ∈ V  Example 3:- How many edges are there in a graph with 10 vertices each of degree six?  Solution:- Because the sum of the degrees of the vertices is 6x10=60, it follows that 2|E|=60. Therefore, |E|=30. Graph Terminology

11  In diagram, there are two types ofdegree of a vertex - in-degree and out-degree  In-degree: In-degree of a vertex v, denoted by deg - (v), is the no. of edges entering the vertex in a digraph  Out-Degree: Out-degree of a vertex v, denoted by deg + (v), is the no. of edges leaving the vertex  For example, deg - (1)=3 and deg + (1)=1. deg - (2)=1 and deg + (2)=1.  Theorem:- For a digraph G=(V, E), ∑deg - (v)+∑deg + (v)=|E|, ∀ v ∈ V Graph Terminology

12  Adjacency Matrix:- The Adjacency Matrix A=(a i,j ) of a graph G=(V,E) with n nodes is an nXn zero-one matrix. Element of A can be defined as follows: a ij = 1, if (v i, v j ) Є E, = 0, otherwise  Example 4: Find the adjacency matrices of the following graphs Representation of Graphs

13  Adjacency Matrix of a Weighted Graph:- The weight of the edge can be shown in the matrix when the vertices are adjacent  A nil value (0 or ∞) depending on the problem is used when they are not adjacent  Example 5: Adjacency matrix to find the minimum distance between nodes  Example 6: Draw graph with the adjacency matrix 123 1∞4∞ 2∞∞5 395∞ Representation of Graphs 123 1∞19 21∞∞ 3∞8∞

14  Adjacency List:- An Adjacency list is an array of lists, each list showing the vertices a given vertex is adjacent to….  Example 7: Find the adjacency list of the following graph.  Adjacency List of a Weighted Graph:- The weight is included in the list  Example 8: Find the adjacency list of the following graph Representation of Graphs

15  Incidence Matrix:- Let G=(V,E) be a graph with v 1, v 2, …, v n are vertices and e 1, e 2, …., v m are edges. Then the incidence matrix with respect to this ordering of V and E is the nxm matrix M=[m ij ], where m ij = 1, when edge e j is incidence on v i, = 0, otherwise  Example 9: Find the incidence matrices of the following graphs. e1e1 e2e2 e3e3 e4e4 e5e5 e6e6 v1v v2v v3v v4v v5v e1e1 e2e2 e3e3 v1v1 100 v2v2 011 v3v3 000 Representation of Graphs v1v1 v2v2 v3v3 v4v4 v5v5 e2e2 e5e5 e1e1 e4e4 e6e6 e3e3 v1v1 v2v2 v3v3 e1e1 e2e2 e3e3

16  Def:- The simple graphs G 1 =(V 1, E 1 ) and G 2 =(V 2, E 2 ) are isomorphic if there is one-to-one and onto function f from V 1 to V 2 with the property that 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, b in V 1. Such a function f is called an isomorphism.  Example 10: Show that the graphs G=(V, E) and H=(U, F) are isomorphic.  Proof:- The function f with f(v 1 )=u 1, f(v 2 )=u 4, f(v 3 )=u 3, and f(v 4 )=u 2 is a one-to-one correspondence between V and U. Next, to verify that this function preserves adjacency also. Adjacency vertices in G are v 1 and v 2, v 1 and v 3, v 2 and v 4, and v 3 and v 4. Also, the pairs f(v 1 )=u 1 and f(v 2 )=u 4, f(v 1 )=u 1 and f(v 3 )=u 3, f(v 2 )=u 4 and f(v 4 )=u 2, f(v 3 )=u 3, and f(v 4 )=u 2 are adjacent in H. Isomorphism of Graphs v1v1 v2v2 v3v3 v4v4 u1u1 u2u2 u3u3 u4u4 G H

17  A a path a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along the edges of the graph.  There can be more than one path between two vertices.  Vertex u is reachable from v if there is a path from u to v.  Paths from 5 to 1 are 5, 3, 1 and 5, 3, 2, 1  A Simple Path is a path, where all the vertices are distinct.  For example, 1,4,5,3 is a simple path, but 1,4,5,4 is not  Length of a path is the no. of edges considered in the path.  Length of the path 1,4,5,3 is 3  A circuit is a path whose first and last vertices are the same.  For example, the path 3,2,1,4,5,3 is a circuit Connectivity

18  A Cycle is a circuit where all the vertices are distinct except for the first (and the last) vertex.  For example, 1,4,5,3,1 is a cycle, but 1,4,5,4,1 is not a cycle.  Hamiltonian Cycle: A Cycle that contains all the vertices of the graph.  1,4,5,3,2,1 is a Hamiltonian Cycle.  A graph is said to be connected if there is at least one path from every vertex to every other vertex in the graph.  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.  For example, G has an Euler circuit, but H does not have Euler Paths G H

19  Tree: A connected undirected graph that contains no cycles  Forest: A graph that does not contain a cycle  The Spanning Tree of a Graph G is a subgraph of G that is a tree and contains all the vertices of G Tree Forest Spanning Tree Graph Spanning Tree Tree

20 End of Chapter V