# Graph-02

## Graph-02

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Graph-02

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

5. Isomorphic Graph • 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 if and only if f(a) and f(b) are adjacent in G2 , for all a and b in V1 . Such a function f is called an isomorphism.

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

7. Isomorphic • Not Isomorphic

8. 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 circuitif 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.

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

10. THEOREM • Let G be a graph with adjacency matrix A with respect to the ordering V1, V2, . . Vn (with directed or undirected edges, with multiple edges and loops allowed). The number of different paths of length r from Vi to Vj , where r is a positive integer, equals the (i, j)th entry of N.

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

12. Solution: The graph H2 has an Euler circuit, for example, a , g, c, b, g, e, d, f, a. Neither H1 nor H3has an Euler circuit. H3has an Euler path, namely, c, a , b, c, d, b but H1does not.

13. 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 multigraphhas an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree.

14. G1contains 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,G2has 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.

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

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

17. THANK YOU