Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph-02. Graph representation Adjacency list Graph representation Adjacency matrix.

Similar presentations


Presentation on theme: "Graph-02. Graph representation Adjacency list Graph representation Adjacency matrix."— Presentation transcript:

1 Graph-02

2 Graph representation Adjacency list

3 Graph representation Adjacency matrix

4 Graph representation When sparse use adjacency list When dense use adjacency matrix

5 Isomorphic Graph The simple graphs G 1 = (V 1,E 1 ) and G 2 = (V 2, E 2 ) are isomorphic if there is a one-to-one and onto function f from V 1 to V 2 with the property that a and b are adjacent in G 1 if and only if f(a) and f(b) are adjacent in G 2, for all a and b in V1. Such a function f is called an isomorphism.

6

7 Properties must have same number of vertices must have the same number of edges the degrees of the vertices must be the same.

8 Isomorphic Not Isomorphic

9 Path Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph. The path is a circuit if it begins and ends at the same vertex, that is, if u = v and has length greater than zero. A path or circuit is simple if it does not contain the same edge more than once.

10 Connected Graph An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. 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 vertices in the graph.

11 THEOREM Let G be a graph with adjacency matrix A with respect to the ordering V 1, V 2,.. V n (with directed or undirected edges, with multiple edges and loops allowed). The number of different paths of length r from V i to V j, where r is a positive integer, equals the (i, j)th entry of N.

12

13 Euler Circuit An Euler circuit in a graph G is a simple circuit containing every edge of G. An Euler path in G is a simple path containing every edge of G. Solution: The graph G1 has an Euler circuit, for example, a, e, c, d, e, b, a. Neither of the graphs G2 or G3 has an Euler circuit. However, G3 has an Euler path, namely, a, c, d, e, b, d, a, b. G2 does not have an Euler path.

14 Solution: The graph H 2 has an Euler circuit, for example, a, g, c, b, g, e, d, f, a. Neither H 1 nor H 3 has an Euler circuit. H 3 has an Euler path, namely, c, a, b, c, d, b but H 1 does not.

15 THEOREM A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree. A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree.

16 G 1 contains exactly two vertices of odd degree, namely, b and d. Hence, it has an Euler path that must have b and d as its endpoints. One such Euler path is d, a, b, c, d, b. Similarly, G 2 has exactly two vertices of odd degree, namely, b and d. So it has an Euler path that must have b and d as endpoints. One such Euler path is b, a, g, j, e, d, c, g, b, c, j, d.

17 Hamilton Path A simple path in a graph G that passes through every vertex exactly once is called a Hamilton path and a simple circuit in a graph G that passes through every vertex exactly once is called a Hamilton circuit.

18 G1 has a Hamilton circuit: a, b, c, d, e, a. There is no Hamilton circuit in G2 (this can be seen by noting that any circuit containing every vertex must contain the edge {a, b} twice), but G2 does have a Hamilton path, namely, a, b, c, d. G3 has neither a Hamilton circuit nor a Hamilton path, because any path containing all vertices must contain one of the edges {a, b}, {e, f}, and {c, d} more than once.

19 THANK YOU


Download ppt "Graph-02. Graph representation Adjacency list Graph representation Adjacency matrix."

Similar presentations


Ads by Google