Download presentation

1
**CSE 211 Discrete Mathematics**

Chapter 8.3 Representing Graphs and Graph Isomorphism

2
**§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.

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

4
**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

5
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:

6
**Adjacency Matrix Example**

W5 d b a c e f a b c d e f a b c d e f From To {v1,v2} row column

7
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

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

9
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 nm matrix M = [mij], where

10
**Incidence Matrix Example**

Represent the graph shown with an incidence matrix. e1 e2 e3 e4 e5 e6 edges v v v3 v v5 e1 e2 e3 e4 e5 e6 v1 v2 v3 v4 v5 vertices

11
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

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

13
**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

14
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.

15
**One to one and onto function**

16
**One to one and onto function**

17
**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

18
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

19
**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

20
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 …

21
**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

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

23
**Example Are these two graphs isomorphic? They both have 5 vertices**

G H u u2 u u3 u4 v 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.

24
**Example (Cont.) G H H G? G and H don’t appear to be isomorphic.**

u1 u2 u3 u4 u5 u u u u u v1 v2 v3 v4 v5 v v v v v 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.

25
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 u u2 u u3 u4 v v2 v5 v3 v4

26
**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 u u2 u u3 u4 v v2 v5 v3 v4

27
**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 u u2 u u3 u4 v v2 v5 v3 v4

28
**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 u u2 u u3 u4 v v2 v5 v3 v4

29
Example (Cont.) G H H’ u1 u2 u3 u4 u5 u u u u u v1 v2 v3 v4 v5 v v v v v v1 v3 v2 v5 v4 v v v v v 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!

30
**Example (Cont.) G H H’ It turns out that**

u1 u2 u3 u4 u5 u u u u u v1 v2 v3 v4 v5 v v v v v v4 v3 v2 v5 v1 v v v v v It turns out that f(u1) = v4, f(u2) = v3, f(u3) = v2, f(u4) = v5, f(u5) = v1 also works.

31
**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.

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

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

34
**CSE 211 Discrete Mathematics**

Chapter 8.4 Connectivity

35
**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.

36
**Graph Theoretic Foundations**

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

37
**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

38
**Paths, Cycles, and Trails**

A trail is a walk with no repeated edge.

39
**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.

40
**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.

41
**Example u1, u4, u2, u3 Is it simple? yes What is the length? 3**

Does it have any circuits? no u u2 u5 u u3

42
**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 u u2 u u3 u4

43
**Example u1, u2, u5, u4, u3 Is it simple? yes What is the length? 4**

Does it have any circuits? no u u2 u u3 u4

44
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.

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

46
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).

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

48
**Example What are the connected components of the following graph? b a**

{a, b, c}, {d, e}, {f, g, h}

49
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.

50
**Example Find the cut vertices and cut edges in the following graph. a**

b c d f e h g

51
**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)

52
**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

53
**Graph Theoretic Foundations**

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

54
**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.

55
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

56
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

57
**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.

58
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)}

59
**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

60
**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,vV(G)d(u,v) The eccentricity [(u)] of a vertex u is maxvV(G)d(u,v) The radius of G (rad G) is minuV(G)(u) A vertex with minimum eccentricity in G is called a center of G.

61
**Distance in Trees and Graphs**

Find the diameter, eccentricity, radius and center of the given G.

Similar presentations

© 2021 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google