Presentation is loading. Please wait.

Presentation is loading. Please wait.

Agenda Review Lecture Content: Shortest Path Algorithm

Similar presentations


Presentation on theme: "Agenda Review Lecture Content: Shortest Path Algorithm"— Presentation transcript:

1 Agenda Review Lecture Content: Shortest Path Algorithm
Representations of Graphs Isomorphism of Graphs Planar Graphs Quiz

2 Paths Definition Let v0 and vn be vertices in a graph.
A path from v0 to vn of length n is an alternating sequence of n+1 vertices and n edges beginning with vertex v0 and ending with vertex vn, (v0,e1,v1,e2,v2,...,vn-1,en,vn) , in which edge ei is incident on vertices vi-1and vi for i = 1, ..., n. Path allows repetitions of vertices or edges or both If there are no parallel edges, path is simply a sequence of vertices.

3 Simple Paths and Cycles
Definition Let v and w be vertices in a graph G. A simple path from v to w is a path from v to w with no repeated vertices. A cycle(or circuit) is a path of nonzero length from v to v with no repeated edges. A simple cycle is a cycle from v to v in which, except for the beginning and ending vertices that are both equal to v, there are no repeated vertices. Euler Cycle: A cycle in a graph G that includes all of the edges, and only visits each edge once Hamiltonian Cycle: A cycle in a graph G that contains each vertex in G exactly once, except for the starting and ending vertex that appears twice.

4 Shortest Path Algorithm

5  Dijkstra’s Shortest Path Algorithm.
Find the shortest path (a path having minimum length) between two given vertices.  Dijkstra’s Shortest Path Algorithm.

6 Dijkstra’s Shortest Path Algorithm

7 Dijkstra’s Shortest Path Algorithm: Example 1

8 Dijkstra’s Shortest Path Algorithm: Example 1
Continue labelling until z Shortest_Path = (a, b, c, z)

9 Dijkstra’s Shortest Path Algorithm: Example 2

10 Dijkstra’s Shortest Path Algorithm: Example 2

11 Representation of Graphs

12 Graph Representation Two type of matrices for graph representation:
Based on the adjacency of vertices adjacency matrices Based on incidence of vertices and edges  incidence matrices

13 Adjacency Matrices A = [aij]
Definition Suppose that G = (V, E) is a simple graph where |V| = n. Suppose that the vertices of G are v1, v2, …, vn The adjacency matrix A of G (or AG) is the n x n zero-one matrix with 1 as its (i, j)th entry when vi and vj, are adjacent and 0 as its (i, j)th entry when they are not adjacent . A = [aij] aij = 1 if {vi, vj} is an edge of G = 0 otherwise

14 Example

15 Example

16 Example: Graph with parallel edge & loop

17 Adjacency Matrices Theorem
If A is the adjacency matrix of a simple graph, the ijth entry of An is equal to the number of paths of length n from vertex i to vertex j, n= 1, 2, ... . Example: Fig (Johnsonbaugh) Show the adjacency matrix A Compute A2 How many paths of length 2?

18 Incidence Matrices M = [mij], where:
Definition Suppose that G = (V, E) is a graph where |V| = n. Suppose that the vertices of G are v1, v2, …, vn and the edges of G are e1, e2, …, em. The incidence matrix is the n x m matrix M = [mij], where: mij = 1 when edge ej is incidence with vi = 0 otherwise

19 Example

20 Example: Graph with parallel edges and loops

21 Isomorphisms of Graphs

22 Isomorphisme of Graphs
Definition: 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.

23 Show that G = (V, E) and H = (W, F) are isomorphic
Example Show that G = (V, E) and H = (W, F) are isomorphic The function f with f(u1) = v1, f(u2) = v4, f(u3) = v3 and f(u4) = v2 is a one-to-one correspondence between G and H. For every adjacent vertices in G, there is also corresponding adjacent vertices in H.

24 Testing for isomorphism
Testing isomorphic is difficult, since there are n! possible one-to-one correspondence for two graphs with n vertices, and further complication in testing adjacency.  Not practical for large n. It is easier to test that two graphs are not isomorphic, i.e. check: Have the same number of vertices. Have the same number of edges have the same number of vertices of each degree If any of quantities above differ, then the two graphs cannot be isomorphic But, if any of quantities above the same, it does not necessarily mean the two graphs are isomorphic

25 Example Are G and H isomorphic?

26 Example Are G and H isomorphic?

27 Check for isomorphism: using adjacency matrices
Show the adjacency matrix of G is the same as the adjacency matric of H, when rows and columns are labeled to correspond to images under f of the vertices of G Example: Are G and H isomorphic?

28 Planar Graph

29 Planar Graphs Definition: A graph is called planar if it can be drawn in the plane without any edges crossing (where a crossing of edges is the intersection of the lines or arcs representing them at a point other than their common endpoint). Such a drawing is called a planar representation of the graph

30 Example: Planar Graph

31 Example: Non-Planar Graph

32 Euler’s Formula A planar representation of a graph splits the plane into regions or faces, including an unbounded region Euler’s Formula: Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G, then r = e – v + 2 Boundary is formed by cycle

33 Some inequalities for planar graphs
Euler’s formula can be used to establish some inequalities that must be satisfied by planar graphs, i.e:

34 K3,3 dan K5 Show that K3,3 and K5 are not planar (using inequality)
If a graph contains K3,3 or K5 as a subgraph, then it cannot be planar The converse of statement above is not true Use concept of homeomorphic graph

35 Homeomorphic Graph Definition
If a graph G has a vertex v of degree 2 and edges (v,v1) and (v,v2) with v1≠ v2 ,  edges (v,v1) and (v,v2) are in series A series reduction consists of deleting vertex v from G and replacing edges (v,v1) and (v,v2) by the edge (v1,v2). The graph G’ is said to be obtained from G by a series of reduction or elementary subdivision Graphs G1 and G2 are homeomorphic if G1 and G2 can be reduced to isomorphic graphs by performing a sequence of series reduction Any graph is homeomorphic to itself Graphs G1 and G2 are homeomorphic if G1 can be reduced to a graph isomorphic to G2 or if G2 can be reduced to a graph isomorphic to G1

36 Example

37 Kuratowski’s Theorem Theorem:
A graph is nonplanar if and only if it contains a subgraph homeomorphic to K3,3 or K5 Example: Determine whether G is planar or nonplanar?


Download ppt "Agenda Review Lecture Content: Shortest Path Algorithm"

Similar presentations


Ads by Google