Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Discrete Math Graphs, representation, isomorphism, connectivity.

Similar presentations


Presentation on theme: "1 Discrete Math Graphs, representation, isomorphism, connectivity."— Presentation transcript:

1 1 Discrete Math Graphs, representation, isomorphism, connectivity

2 Adjacent  The vertices u and v in a undirected graph are adjacent when there are endpoints of an edge of G represented by the un ordered pair (u,v)  When the initial vertex u and final vertex v in a directed graph are endpoints of the edge represented by the ordered pair (u,v), then u is adjacent to v and v is adjacent from u 2

3 Representation  Consider a graph with no multiple edges. (NOTE: For directed graphs the pairs (u,v) and (v,u) are not multiple edges)  The graph can be represented by a list of all the edges that are part of the graph  The graph can be represented by an adjacency list  The graph can be represented by an adjacency matrix. 3

4 Adjacency List: undirected vertexAdjacent vertices ac bc ca, b, d dc, e, f ed, e, f fd, e 4 e f c d a f e d c b

5 Adjacency Matrix  The Adjacency matrix A of a graph G=(V,E), with respect to the set of edges V, where V does not include multiple edges is  The graph has at most one edge  If the graph is not directed is an unordered pair  If the graph is directed is a ordered pair 5

6 Adjacency Matrix 6 e f c d a f e d c b Adjacency matrix element a mk is 1 if there is an edge between node number m and number k, and 0 otherwise

7 Adjacency List: directed Initial vertexTerminal vertices ab, c, g ba cd, e de, g ec, e, g, f f- gd, f 7 e f c d a f e d c b d g

8 Adjacency Matrix 8 Adjacency matrix element a mk is 1 if there is an edge from node number m to node number k, and 0 otherwise e f c d a f e d c b d g

9 Observations  The adjacency matrix of an undirected graph is symmetric  The adjacency list will be more useful in a sparse graph with few edges  The adjacency matrix will be most useful in a dense graph with many edges 9

10 What about multiple edges?  How do we generalize these representations to include graphs with multiple edges between the same vertices  Multiple edges for an undirected graph means two or more edges between the same pair of nodes  Multiple edges for a directed graph means two or more edges between the same ordered pair of nodes. That is multiple edges in the same direction between the same pair of nodes 10

11 Adjacency Matrix  The Adjacency matrix A of a graph G=(V,E), with respect to the set of edges V, where V does include multiple edges is 11

12 Adjacency Matrix 12 e f c d a f e d c b Adjacency matrix element a mk is 1 if there is an edge between node number m and number k, and 0 otherwise

13 Adjacency Matrix 13 Adjacency matrix element a mk is 1 if there is an edge from node number m to node number k, and 0 otherwise e f c d a f e d c b d g

14 Incidence matrices  Let G=(V,E) be an undirected graph, an incidence matrix representing G has one row for each vertex v 1, v 2, …, v n in V and one column for each edge e 1, e 2, …, e m in E. 14

15 Incidence Matrix 15 e f c d a f e d c b Incidence matrix element a mk is 1 if there is an edge e k is incident with node number m and node number k, and 0 otherwise e9e9 e1,e2e1,e2 e 5,e 6 e 7, e 8 e4e4 e3e3 e 10 e 11

16 Incidence matrices  Let G=(V,E) be an directed graph, an incidence matrix representing G has one row for each vertex v 1, v 2, …, v n in V and one column for each edge e 1, e 2, …, e m in E. 16

17 Incidence Matrix 17 Adjacency matrix element a mk is 1 if there is an edge from node number m to node number k, and 0 otherwise e c d a f e d c d b e8e8 e 9, e 10 e 11 e7e7 e5,e6e5,e6 e4e4 e2,e3e2,e3 e1e1

18 Isomorphism  Two simple graphs G 1 =(V,E) and G 2 =(W,F) are isomorphic if there is a oneto one and onto function f from V to W with the property that if a and b are adjacent in G 1 iff f(a) and f(b) are adjacent in G 2, for all a and b in V.  Such a function f is called an isomorphism 18

19 Isomorphic graphs  When two graphs are isomorphic then they have  the same number of vertices  the same number of edges  the same number of vertices or any degree n  These properties are called graph invariants and are identical for two graphs that are isomorphic. If any of these invariants changes between the two graphs, the two graphs are not isomorphic.  However, if these graph invariants are all identical it does not imply the graphs are isomorphic 19

20 Graphs A and B 20 a1 a5a4 a3a2 b5 b4 b3b2 b1

21 Are A and B isomorphic?  They both have the same number of vertices  They both have the same number of edges  They both have 3 vertices of degree 2, and 2 vertices of degree 3  The graphs may be isomorphic, to prove they are we need to find an isomorphism  However, in graph a there are no two nodes of degree 2 that are adjacent to each other, in graph b there are two nodes of degree 2 that are adjacent. Therefore, the two graphs are not isomorphic 21

22 Graphs A and B 22 a1 a5a4 a3a2 b5 b4 b3b2 b1

23 Are A and B isomorphic?  They both have the same number of vertices  They both have the same number of edges  They both have two vertices of degree 2, two vertices of degree 3 and 1 vertex of degree 4  The graphs may be isomorphic, to prove they are we need to find an isomorphism 23

24 Isomorphism  Since an isomorphism preserves adjacency, If n vertices are adjacent to a given vertex in a graph, then the images of those n vertices must be adjacent to the image of the vertex in the isomorphic graph.  Therefore, the order of the nodes should be preserved by the isomorphism. 24

25 Graphs A and B 25 a1 a5a4 a3a2 b5 b4 b3b2 b1

26 Isomorphism (2)  There is only one node that is adjacent to 4 other nodes ( degree 4) so the image of that node must be the node in graph B which has degree 4. So  F(a1) = b2  a1 is adjacent to 2 nodes of degree 3 (a2 and a3). The images of these nodes must be the nodes in B which have degree 3 (b4 and b5). Both are adjacent to b2 26

27 Isomorphism (3)  We have two possible ways to choose to assign the isomorphism between these points. Since both ways preserve adjacency  a2 and a3 are adjacent, b4 and b5 are adjacent  a2 and a3 are both adjacent to a1, b4 and b5 are both adjacent to b2  a2 and a3 are both adjacent to a node of degree 2, that is adjacent to a1, b4 and b5 are both adjacent to a node of degree 2 that is adjacent to b2 27

28 Isomorphism (4)  we will randomly choose one, if it does not work we will return and try the other.  F(a2) = b5  F(a3) = b4 28

29 Graphs A and B 29 a1 a5a4 a3a2 b5 b4 b3b2 b1

30 Isomorphism (5)  F(a1)= b2  F(a2) = b5  F(a3) = b4  A4 is adjacent to both a3 and a1, so its image must be adjacent to b4 and b2.  A5 is adjacent to both a2 and a1 so its image must be adjacent to b5 and b4  F(a4) = b1, F(a5) = b3 30

31 Isomorphic Graphs A and B 31 a1 a5a4 a3a2 b5 b4 b3b2 b1

32 Paths: undirected graphs  Let n be a nonnegative integer and G an undirected graph. A path of length n from u to v in G is a sequence of n edges e 1, e 2, …, e n of G such that e1 is (u, x 1 ), e 2 is (x 1,x 2 ), and en is (x n-1, v).  When the graph is simple we denote the path by the vertex sequence u, x 1, x 2, …, x n-1, v.  A circuit is a path with n>0 which starts and ends at the same vertex  The path or circuit passes through these vertices and traverses the edges  A path or circuit is simple if it does not traverse the same edge more than once 32

33 Paths: directed graphs  Let n be a nonnegative integer and G a directed graph. A path of length n from u to v in G is a sequence of n edges e 1, e 2, …, e n of G such that e1 is (u, x 1 ), e 2 is (x 1,x 2 ), and en is (x n-1, v).  When there are no multiple edges we denote the path by the vertex sequence u, x 1, x 2, …, x n-1, v.  A circuit is a path with n>0 which starts and ends at the same vertex  The path or circuit passes through these vertices and traverses the edges  A path or circuit is simple if it does not traverse the same edge more than once 33

34 Alternate terms  A walk is an alternating sequence of vertices and edges starting at vertex u and ending at vertex v  A circuit may be called a closed walk  S simple circuit may be called a trail  If a reference is using walk, closed walk and trail, it may use path do describe a trail with no repeated vertices 34

35 Connected  An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. 35

36 Connectedness: directed graphs  A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are nodes in the directed graph  A directed graph is weakly connected if there is a path between each of the vertices in the underlying undirected graph 36

37 Connected?  Is this undirected graph connected? 37 NO

38 Connected?  Is this undirected graph connected?  The green vertex is an isolated vertex. There is no path connecting it to any other vertex. The graph cannot be connected.  The red vertex is a pendant vertex. It is connected to the graph by only a single edge 38

39 Connected?  Is this undirected graph connected? 39 YES

40 Strongly Connected?  Is this undirected graph strongly connected? 40 NO

41 Weakly Connected?  Is this undirected graph strongly connected? 41

42 Underlying undirected graph  Is this underlying undirected graph connected?  YES: so the digraph is weakly connected 42

43 Strongly Connected?  Is this undirected graph connected? 43 YES

44 Subgraph  Recall  A subgraph of a graph G=(V,E) is a graph H=(W,F) when W ⊆ V and F ⊆ E.  A subgraph H of G is a proper subgraph of G if H=G 44

45 Connected component  A maximal connected subgraph is a subgraph such that there are no nodes and edges in the original graph that could be added to the subgraph and still leave it connected.  A connected component of a graph G is a connected subgraph of G that is not a proper subgraph of another connected subgraph of G. That is, it is a maximal connected subgraph of G 45

46 Connected components? 46

47 Cut Edges  When removing a vertex, increases the number of connected components in the graph then the vertex (that was removed) is called a cut vertex or articulation point  Let v be a vertex in a graph G=(V,E). The subgraph of G denoted G-v has the vertex set V 1 =V-v and the edges E 1 ⊆ E where E 1 contains all edges in E except for those that are incident with (out from, in to) the vertex v 47

48 Find a cut vertex 48

49 With cut vertex removed 49

50 Cut Edges  When removing a edge, increases the number of connected components in the graph then the edge (that was removed) is called a cut edge or bridge  Let e be an edge in a graph G=(V,E). The subgraph of G denoted G-e has the same vertex set V and the edges E 1 =E-e 50

51 Find a cut edge 51

52 With a cut edge removed 52

53 Paths and Isomorphism  The existance of a circuit of a particular length within a graph is an isomorphic invariant.  If a graph G has a circuit of length n from node v to node v then any graph that is isomorphic to G must also have a circuit of length n from F(v) to F(v) 53


Download ppt "1 Discrete Math Graphs, representation, isomorphism, connectivity."

Similar presentations


Ads by Google