Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphs, representation, isomorphism, connectivity

Similar presentations


Presentation on theme: "Graphs, representation, isomorphism, connectivity"— Presentation transcript:

1 Graphs, representation, isomorphism, connectivity
Discrete Math Graphs, representation, isomorphism, connectivity 1

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

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.

4 Adjacency List: undirected
vertex Adjacent vertices a c b a, b, d d c, e, f e d, e, f f d, e a c e c d d b f f e

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

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

7 Adjacency List: directed
Initial vertex Terminal vertices a b, c, g b c d, e d e, g e c, e, g, f f - g d, f a c e c d d b f f e g d

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

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

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

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

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

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

14 Incidence matrices Let G=(V,E) be an undirected graph, an incidence matrix representing G has one row for each vertex v1, v2, … , vn in V and one column for each edge e1, e2, …, em in E.

15 Incidence Matrix e1, e2 a c e10 e e11 e4 e9 d e3 b e5,e6 e7, e8 f
Incidence matrix element amk is 1 if there is an edge ek is incident with node number m and node number k, and 0 otherwise

16 Incidence matrices Let G=(V,E) be an directed graph, an incidence matrix representing G has one row for each vertex v1, v2, … , vn in V and one column for each edge e1, e2, …, em in E.

17 Incidence Matrix a c e8 e e1 e7 e9, d e4 e10 e11 e5, e6 e2, e3 f b
Adjacency matrix element amk is 1 if there is an edge from node number m to node number k, and 0 otherwise

18 Isomorphism Two simple graphs G1=(V,E) and G2=(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 G1 iff f(a) and f(b) are adjacent in G2, for all a and b in V. Such a function f is called an isomorphism

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

20 Graphs A and B b1 b2 b3 a1 a2 a3 b4 b5 a4 a5

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

22 Graphs A and B b1 b2 b3 a1 a2 a3 b4 b5 a4 a5

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

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.

25 Graphs A and B b1 b2 b3 a1 a2 a3 b4 b5 a4 a5

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

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

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

29 Graphs A and B b1 b2 b3 a1 a2 a3 b4 b5 a4 a5

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

31 Isomorphic Graphs A and B

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 e1, e2, … , en of G such that e1 is (u, x1), e2 is (x1,x2), and en is (xn-1, v). When the graph is simple we denote the path by the vertex sequence u, x1, x2, … , xn-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 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 e1, e2, … , en of G such that e1 is (u, x1), e2 is (x1,x2), and en is (xn-1, v). When there are no multiple edges we denote the path by the vertex sequence u, x1, x2, … , xn-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

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

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

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

37 Connected? Is this undirected graph connected? 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

39 Connected? Is this undirected graph connected? YES

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

41 Weakly Connected? Is this undirected graph strongly connected?

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

43 Strongly Connected? Is this undirected graph connected? 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

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

46 Connected components?

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 V1=V-v and the edges E1⊆E where E1 contains all edges in E except for those that are incident with (out from, in to) the vertex v

48 Find a cut vertex

49 With cut vertex removed

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 E1=E-e

51 Find a cut edge

52 With a cut edge removed

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)


Download ppt "Graphs, representation, isomorphism, connectivity"

Similar presentations


Ads by Google