Relations and Graphs Relations and Graphs Sanjay Jain, Lecturer, School of Computing.

Slides:



Advertisements
Similar presentations
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, …,
Advertisements

Discrete Mathematics University of Jazeera College of Information Technology & Design Khulood Ghazal Connectivity Lecture _13.
Epp, section 10.? CS 202 Aaron Bloomfield
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,
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m  n connection.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Graph-02.
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
1 Chapter 22: Elementary Graph Algorithms IV. 2 About this lecture Review of Strongly Connected Components (SCC) in a directed graph Finding all SCC (i.e.,
Tirgul 8 Graph algorithms: Strongly connected components.
8.4 Closures of Relations. Intro Consider the following example (telephone line, bus route,…) abc d Is R, defined above on the set A={a, b, c, d}, transitive?
Introduction to Graph Theory Lecture 19: Digraphs and Networks.
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
1 Data Structures DFS, Topological Sort Dana Shapira.
Computational Geometry Seminar Lecture 1
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
1 Section 8.4 Connectivity. 2 Paths In an undirected graph, a path of length n from u to v, where n is a positive integer, is a sequence of edges e 1,
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 14 Strongly connected components Definition and motivation Algorithm Chapter 22.5.
MCA 520: Graph Theory Instructor Neelima Gupta
Curve Curve: The image of a continous map from [0,1] to R 2. Polygonal curve: A curve composed of finitely many line segments. Polygonal u,v-curve: A polygonal.
Graphs Rosen 8.1, 8.2. There Are Many Uses for Graphs! Networks Data organizations Scene graphs Geometric simplification Program structure and processes.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
GRAPH Learning Outcomes Students should be able to:
Lecture 13 Graphs. Introduction to Graphs Examples of Graphs – Airline Route Map What is the fastest way to get from Pittsburgh to St Louis? What is the.
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,
CSE, IIT KGP Graph Theory: Introduction Pallab Dasgupta Dept. of CSE, IIT
Based on slides by Y. Peng University of Maryland
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Introduction Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
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.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Chapter 1 Fundamental Concepts Introduction to Graph Theory Douglas B. West July 11, 2002.
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.
Lecture 10: Graph-Path-Circuit
CSCI 115 Chapter 8 Topics in Graph Theory. CSCI 115 §8.1 Graphs.
Chapter Relations and Their Properties
 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.
Basic properties Continuation
Introduction to Graph Theory
8.4 Closures of Relations Definition: The closure of a relation R with respect to property P is the relation obtained by adding the minimum number of.
CSE, IIT KGP Graph Theory: Introduction Pallab Dasgupta Dept. of CSE, IIT
Great Theoretical Ideas in Computer Science for Some.
Chap. 7 Relations: The Second Time Around
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Planarity Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
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.
Trees.
Graphs: Definitions and Basic Properties
Basic Concepts Graphs For more notes and topics visit:
Advanced Algorithms Analysis and Design
Graph Algorithms Using Depth First Search
Based on slides by Y. Peng University of Maryland
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
Relations (sections 7.1 – 7.5)
Summary 3 Discrete Probability (sections )
Chapter 9: Graphs Basic Concepts
Connectivity Section 10.4.
Relations and Digraphs
Proof Techniques.
Graphs G = (V, E) V are the vertices; E are the edges.
Planarity.
Discrete Mathematics for Computer Science
Graph Theory: Proof Techniques
Closures of Relations Epp, section 10.1,10.2 CS 202.
Chapter 9: Graphs Basic Concepts
Presentation transcript:

Relations and Graphs Relations and Graphs Sanjay Jain, Lecturer, School of Computing

Relations as Directed Graphs Symmetric Relations as Undirected Graphs Directed Walks Paths and Circuits Partial Order and DAGs Connected Component and Equivalence Relation Main Menu Main Menu (Click on the topics below) Sanjay Jain, Lecturer, School of Computing

Relations and Directed Graphs Suppose R is a relation on a set A. We can associate with R a directed graph G as follows: V(G)=A D(G)={(a,b) | aRb}

Relations and Directed Graphs A={a,b,c} R={(a,b), (b,c)}... a c b

Relations and Directed Graphs Suppose G is a directed graph such that for any pair of vertices, u and v, there is at most one edge with endpoints (u,v). (In other words there are no parallel directed edges) Then we can associate a relation with G as follows: A=V(G) R on A is defined as follows: uRv iff (u,v) is an edge. Note that, for graphs without parallel edges, we identify edges with their endpoints.

Relations and Directed Graphs A={a,b,c,d} R={(a,b), (b,c), (a,c), (c,d)}... a c b. d

END OF SEGMENT

Symmetric Relations and Undirected Graphs Suppose R is symmetric relation on set A. Then we can associate an undirected graph with R as follows: V(G)=A {u,v} is an edge in E(G) iff uRv. Note that above is valid definition since {v,u}  E(G)  {u,v}  E(G)  uRv  vRu

Theorem Suppose G is an undirected graph. Define R (on V(G)) as follows for u,v  V(G), uRv iff {u,v}  E(G). Then R is a symmetric relation on V(G). Proof: We need to show uRv  vRu Suppose uRv. Then {u,v}  E(G). Thus, {v,u}  E(G). Hence vRu is true.

Relations Directed graphs Symmetric relations undirected graphs (No parallel edges. Loops are allowed. Name of edges are not important)

END OF SEGMENT

Directed Walks/Paths/Circuits Suppose G is a directed graph. Suppose u, v  V(G). A directed walk (in G) from u to v is a sequence of vertices and edges v 0 e 1 v 1 e 2 v 2 e 3……….. e k v k, where v i and e i are vertices and edges in the graph G, u=v 0, v=v k and for any e i, endpoints(e i )=(v i-1, v i ). Note that the order is important. Trivial walk from u to u consists of just u Length of a walk: number of edges in the walk, where we count different appearance of an edge in the walk separately.

Directed Walks/Paths/Circuits A directed path in G is a directed walk that does not have repeated edges. A closed walk in G is a directed walk that starts and ends in the same vertex. A closed walk is a circuit iff it does not have repeated edges. A closed walk is a simple circuit iff it does not have repeated vertices except for the first and last vertices being the same.

END OF SEGMENT

Directed Acyclic Graphs A directed graph G is called a directed acyclic graph (dag) iff it has no non-trivial circuits.

END OF SEGMENT

Partial Order and DAGs Suppose R is a partial order and G is its associated directed graph. Then G does not have any simple circuit which has at least 2 distinct vertices. Proof: Suppose otherwise. That is G has a simple circuit containing at least two distinct vertices. Let it be v 0 e 1 v 1 e 2 …e k v k (where v k =v 0 and e i is an edge from v i-1 to v i ) But then v 0 Rv 1, v 1 Rv 2, …, v k-1 Rv k =v 0 This is a contradiction to R being a partial order.

END OF SEGMENT

Partial Order and DAGs Suppose G is a dag. Let R be a relation on V(G) defined as follows: for u,v  V(G), uRv iff there is a directed walk from u to v. Then R is a partial order.

Proof Reflexive: uRu for all u (since “u” is a directed walk from u to u). Antisymmetric: Suppose uRv and vRu. Then there is a walk of the form u….v...u. This is a closed walk. Since G is a dag, we must have u=v. Transitive: Suppose uRv and vRw. Then there is a walk of the form u….v…..w. Thus, uRw

END OF SEGMENT

Theorem: Suppose G is an undirected graph. Define R on V(G) as follows: for u,v  V(G), uRv iff u and v are connected in G. Then R is an equivalence relation. The connected components of G are precisely the equivalence classes of R. Connected Component and Equivalence Relation

Reflexive: For each u in V(G) clearly, u is connected to u. Thus uRu. Symmetric: Suppose u,v are in V(G). Suppose uRv. Thus u is connected to v. Since G is undirected graph, this means that v is connected to u. Thus vRu. Transitive: Suppose uRv and vRw. Thus there is a walk from u to v and from v to w. Hence there is a walk from u to w (by going from u to v, and then to w) Hence uRw. Proof:

END OF SEGMENT

Theorem: Suppose R is an equivalence relation. Represent R using undirected graph G. Then the connected components of G are precisely the equivalence classes of R. Furthermore, every connected component of G is a complete graph + loops on each of vertices. Connected Component and Equivalence Relation

Informal Proof: If a and b are in the same equivalence class, then aRb. Thus there is an edge from a to b in G. Thus a and b are in the same connected component. If a and b are in the same connected component, then there exist v 0,v 1,v 2,….,v k such that a v 0 v 1 v 2 ….v k b is a walk in G (where we ignore the edges, since G does not have parallel edges). Thus, a Rv 0, v 0 Rv 1, v 1 Rv 2, ….v k Rb Thus, by transitivity, aRb. Which means that a and b are in the same equivalence class. Connected Component and Equivalence Relation

END OF SEGMENT