CSE 211 Discrete Mathematics

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

CSE 211 Discrete Mathematics
Discrete Mathematics University of Jazeera College of Information Technology & Design Khulood Ghazal Connectivity Lecture _13.
Graphs, representation, isomorphism, connectivity
CS 253: Algorithms Chapter 22 Graphs Credit: Dr. George Bebis.
Based on slides by Y. Peng University of Maryland
Analysis of Algorithms CS 477/677
Chapter 9 Graphs.
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.
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.
Review Binary Search Trees Operations on Binary Search Tree
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
Applied Discrete Mathematics Week 12: Trees
Introduction to Graphs
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,
Applied Discrete Mathematics Week 12: Trees
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:
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
(CSC 102) Lecture 29 Discrete Structures. Graphs.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
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.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
Data Structures & Algorithms Graphs
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Basic Notions on Graphs. The House-and-Utilities Problem.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
COSC 2007 Data Structures II Chapter 14 Graphs I.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
Introduction to Graphs Slides by Gene Boggess
Introduction to Graph Theory
Chapter 9: Graphs.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
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
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
Fundamental Graph Theory (Lecture 1) Lectured by Hung-Lin Fu 傅 恆 霖 Department of Applied Mathematics National Chiao Tung University.
Trees.
An Introduction to Graph Theory
Applied Discrete Mathematics Week 14: Trees
Chapter 9 (Part 2): Graphs
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Representing Graphs and
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.
Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Connectivity Section 10.4.
Walks, Paths, and Circuits
Decision Maths Graphs.
Applied Discrete Mathematics Week 13: Graphs
Based on slides by Y. Peng University of Maryland
Agenda Review Lecture Content: Shortest Path Algorithm
GRAPHS.
Presentation transcript:

CSE 211 Discrete Mathematics Chapter 8.3 Representing Graphs and Graph Isomorphism

§8.3: Graph Representations & Isomorphism Adjacency lists. Adjacency matrices. Incidence matrices. Graph isomorphism: Two graphs are isomorphic iff they are identical except for their node names.

Adjacency Lists A table with 1 row per vertex, listing its adjacent vertices. b a d c e f

Directed Adjacency Lists 1 row per node, listing the terminal nodes of each edge incident from that node. node Terminal nodes 3 1 0, 2, 4 2 4 0,2

Adjacency Matrix A simple graph G = (V,E) with n vertices can be represented by its adjacency matrix, A, where the entry aij in row i and column j is:

Adjacency Matrix Example W5 d b a c e f a b c d e f a b c d e f From To 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 {v1,v2} row column

Adjacency Matrices Matrix A=[aij], where aij is 1 if {vi, vj} is an edge of G, 0 otherwise. a b c d a b a b d c c d

Adjacency Matrices Example 5: Use an adjacency matrix to represent the pseudograph shown in Figure 5. FIGURE A Pseudograph.

Incidence Matrix Let G = (V,E) be an undirected graph. Suppose v1,v2,v3,…,vn are the vertices and e1,e2,e3,…,em are the edges of G. The incidence matrix w.r.t. this ordering of V and E is the nm matrix M = [mij], where

Incidence Matrix Example Represent the graph shown with an incidence matrix. e1 e2 e3 e4 e5 e6 edges v1 v2 v3 v4 v5 e1 e2 e3 e4 e5 e6 v1 v2 v3 v4 v5 vertices 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 0

Incidence matrices Matrix M=[mij], where mij is 1 when edge ej is incident with vi, 0 otherwise e1 e2 e3 e4 e5 v1 e2 v4 e3 v1 e1 e4 v2 e5 v2 v3 v3 v4

Incidence Matrices Example 7: Represent the pseudograph shown in Figure 7 using an incidence matrix. FIGURE 7 A Pseudograph.

Isomorphism Two simple graphs are isomorphic if: there is a one-to one correspondence between the vertices of the two graphs the adjacency relationship is preserved

Isomorphism (Cont.) The simple graphs G1=(V1,E1) and G2=(V2,E2) are isomorphic if there is a one-to-one and onto function f from V1 to V2 with the property that a and b are adjacent in G1 iff f(a) and f(b) are adjacent in G2, for all a and b in V1.

One to one and onto function

One to one and onto function

Example Are G and H isomorphic? u1 u3 u4 u2 v1 v3 v4 v2 G H Are G and H isomorphic? f(u1) = v1, f(u2) = v4, f(u3) = v3, f(u4) = v2

Isomorphism Example If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. d b a b a d c e e c f f

Example 11: a more general solution Are These Isomorphic? If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. * Same # of vertices a b * Same # of edges d * Different # of vertices of degree 2! (1 vs 3) e c Example 11: a more general solution

Invariants Invariants – properties that two simple graphs must have in common to be isomorphic Same number of vertices Same number of edges Degrees of corresponding vertices are the same If one is bipartite, the other must be; if one is complete, the other must be; and others …

Graph isomorphism Example The two graphs shown below are isomorphic, despite their different looking drawings. Graph G Graph H An isomorphism between G and H ƒ(a) = 1 ƒ(b) = 6 ƒ(c) = 8 ƒ(d) = 3 ƒ(g) = 5 ƒ(h) = 2 ƒ(i) = 4 ƒ(j) = 7

Example a e d c G H b Are G and H isomorphic?

Example Are these two graphs isomorphic? They both have 5 vertices G H u1 u2 u5 u3 u4 v1 v2 v5 v3 v4 They both have 5 vertices They both have 8 edges They have the same number of vertices with the same degrees: 2, 3, 3, 4, 4.

Example (Cont.) G H H  G? G and H don’t appear to be isomorphic. u1 u2 u3 u4 u5 u1 0 1 0 1 1 u2 1 0 1 1 1 u3 0 1 0 1 0 u4 1 1 1 0 1 u5 1 1 0 1 0 v1 v2 v3 v4 v5 v1 0 0 1 1 1 v2 0 0 1 0 1 v3 1 1 0 1 1 v4 1 0 1 0 1 v5 1 1 1 1 0 v1 v3 v2 v5 v4 v1 v3 v2 v5 v4 G and H don’t appear to be isomorphic. However, we haven’t tried mapping vertices from G onto H yet.

Example (Cont.) Start with the vertices of degree 2 since each graph only has one: deg(u3) = deg(v2) = 2 therefore f(u3) = v2 G H u1 u2 u5 u3 u4 v1 v2 v5 v3 v4

Example (Cont.) Now consider vertices of degree 3 deg(u1) = deg(u5) = deg(v1) = deg(v4) = 3 therefore we must have either one of f(u1) = v1 and f(u5) = v4 f(u1) = v4 and f(u5) = v1 G H u1 u2 u5 u3 u4 v1 v2 v5 v3 v4

Example (Cont.) Now try vertices of degree 4: deg(u2) = deg(u4) = deg(v3) = deg(v5) = 4 therefore we must have one of: f(u2) = v3 and f(u4) = v5 or f(u2) = v5 and f(u4) = v3 G H u1 u2 u5 u3 u4 v1 v2 v5 v3 v4

Example (Cont.) There are four possibilities (this can get messy!) f(u1) = v1, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v4 f(u1) = v4, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v1 f(u1) = v1, f(u2) = v5, f(u3) = v2, f(u4) = v3, f(u5) = v4 f(u1) = v4, f(u2) = v5, f(u3) = v2, f(u4) = v3, f(u5) = v1 G H u1 u2 u5 u3 u4 v1 v2 v5 v3 v4

Example (Cont.) G H H’ u1 u2 u3 u4 u5 u1 0 1 0 1 1 u2 1 0 1 1 1 u3 0 1 0 1 0 u4 1 1 1 0 1 u5 1 1 0 1 0 v1 v2 v3 v4 v5 v1 0 0 1 1 1 v2 0 0 1 0 1 v3 1 1 0 1 1 v4 1 0 1 0 1 v5 1 1 1 1 0 v1 v3 v2 v5 v4 v1 0 1 0 1 1 v3 1 0 1 1 1 v2 0 1 0 1 0 v5 1 1 1 0 1 v4 1 1 0 1 0 We permute the adjacency matrix of H (per function choices above) to see if we get the adjacency of G. Let’s try: f(u1) = v1, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v4 Does G = H’? Yes!

Example (Cont.) G H H’ It turns out that u1 u2 u3 u4 u5 u1 0 1 0 1 1 u2 1 0 1 1 1 u3 0 1 0 1 0 u4 1 1 1 0 1 u5 1 1 0 1 0 v1 v2 v3 v4 v5 v1 0 0 1 1 1 v2 0 0 1 0 1 v3 1 1 0 1 1 v4 1 0 1 0 1 v5 1 1 1 1 0 v4 v3 v2 v5 v1 v4 0 1 0 1 1 v3 1 0 1 1 1 v2 0 1 0 1 0 v5 1 1 1 0 1 v1 1 1 0 1 0 It turns out that f(u1) = v4, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v1 also works.

FIGURE 10 The Graphs G and H. Isomorphism of Graphs Example 10: Determine whether the graphs shown in below are isomorphic. FIGURE 10 The Graphs G and H.

Isomorphism of Graphs FIGURE 11 The Subgraphs of G and H Made Up of Vertices of Degree Three and the Edges Connecting Them.

Isomorphism of Graphs Example 11: Determine whether the graphs G and H displayed in below are isomorphic. FIGURE 12 Graphs G and H.

CSE 211 Discrete Mathematics Chapter 8.4 Connectivity

Paths in Undirected Graphs There is a path from vertex v0 to vertex vn if there is a sequence of edges from v0 to vn This path is labeled as v0,v1,v2,…,vn and has a length of n. The path is a circuit if the path begins and ends with the same vertex. A path is simple if it does not contain the same edge more than once.

Graph Theoretic Foundations Paths and Cycles: Walk in a graph G is v0, e1, v1, …, vl-1, el, vl

Graph Theoretic Foundations Paths and Cycles: IF v0, v1, …, vl are distinct (except possible v0,vl) then the walk is a path. Denoted by v0, v1, …, vl or e1, e2, …, el Length of path is l

Paths, Cycles, and Trails A trail is a walk with no repeated edge.

Graph Theoretic Foundations Paths and Cycles: A path or walk is closed if v0 = vl A closed path containing at least one edge is called a cycle.

Paths in Undirected Graphs A path or circuit is said to pass through the vertices v0, v1, v2, …, vn or traverse the edges e1, e2, …, en.

Example u1, u4, u2, u3 Is it simple? yes What is the length? 3 Does it have any circuits? no u1 u2 u5 u4 u3

Example u1, u5, u4, u1, u2, u3 Is it simple? yes What is the length? 5 Does it have any circuits? Yes; u1, u5, u4, u1 u1 u2 u5 u3 u4

Example u1, u2, u5, u4, u3 Is it simple? yes What is the length? 4 Does it have any circuits? no u1 u2 u5 u3 u4

Connectedness An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. There is a simple path between every pair of distinct vertices of a connected undirected graph.

Example Are the following graphs connected? Yes No c e f a d b g e c a

Connectedness (Cont.) A graph that is not connected is the union of two or more disjoint connected subgraphs (called the connected components of the graph).

Example What are the connected components of the following graph? b d

Example What are the connected components of the following graph? b a {a, b, c}, {d, e}, {f, g, h}

Cut edges and vertices If one can remove a vertex (and all incident edges) and produce a graph with more connected components, the vertex is called a cut vertex. If removal of an edge creates more connected components the edge is called a cut edge or bridge.

Example Find the cut vertices and cut edges in the following graph. a b c d f e h g

Example Find the cut vertices and cut edges in the following graph. b c d f e h g Cut vertices: c and e Cut edge: (c, e)

Graph Theoretic Foundations Connectivity: Connectivity (G) of graph G is … G is k connected if (G)  k Separator or vertex-cut Cut vertex Separation pair

Graph Theoretic Foundations Trees and Forests: Tree – connected graph without any cycle Forest – a graph without any cycle

Connectedness in Directed Graphs A directed graph is strongly connected if there is a directed path between every pair of vertices. A directed graph is weakly connected if there is a path between every pair of vertices in the underlying undirected graph.

Example Is the following graph strongly connected? Is it weakly connected? This graph is strongly connected. Why? Because there is a directed path between every pair of vertices. If a directed graph is strongly connected, then it must also be weakly connected. a b c e d

Example Is the following graph strongly connected? Is it weakly connected? This graph is not strongly connected. Why not? Because there is no directed path between a and b, a and e, etc. However, it is weakly connected. (Imagine this graph as an undirected graph.) a b c e d

Connectedness in Directed Graphs The subgraphs of a directed graph G that are strongly connected but not contained in larger strongly connected subgraphs (the maximal strongly connected subgraphs) are called the strongly connected components or strong components of G.

Example What are the strongly connected components of the following graph? a b c e d This graph has three strongly connected components: The vertex a The vertex e The graph consisting of V = {b, c, d} and E = { (b, c), (c, d), (d, b)}

Distance in Trees and Graphs Consider a connected graph G. The distance between vertices u and v in G, written d(u, v), is the length of the shortest path between u and v. The distance of G, written diam(G), is the maximum distance between any two points in G. For example, in Fig. 1-8(a), d(A,F) = 2 and diam(G) = 3, whereas in Fig. 1-8(b), d(A, F) = 3 and diam(G) = 4

Distance in Trees and Graphs If G has a u, v-path, then the distance from u to v, written dG(u, v) or simply d(u, v), is the least length of u, v-path. The diameter (diam G) is maxu,vV(G)d(u,v) The eccentricity [(u)] of a vertex u is maxvV(G)d(u,v) The radius of G (rad G) is minuV(G)(u) A vertex with minimum eccentricity in G is called a center of G.

Distance in Trees and Graphs Find the diameter, eccentricity, radius and center of the given G.