13
Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler Paths & Circuits Hamilton Paths & Circuits Gray Code

Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Embed Size (px)

DESCRIPTION

Paths in Graphs

Citation preview

Page 1: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Lecture 11:

9.4 ConnectivityPaths in Undirected & Directed GraphsGraph IsomorphismsCounting Paths between Vertices

9.5 Euler and Hamilton Paths Euler Paths & Circuits Hamilton Paths & Circuits Gray Code

Page 2: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Introduction of Connectedness

http://farm4.static.flickr.com/3120/3409325514_68840abcb8.jpg

Page 3: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Paths in Graphs

http://www.ctl.ua.edu/math103/euler/ifagraph.htm

Page 4: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Connected Components of a Graph

Page 5: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Connectedness in Directed Graphs

Page 6: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Test for Isomorphism

Page 7: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Counting Paths Between Vertices

Page 8: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

The problem was to find a walk through the city that would cross each bridge once and only once. The islands could not be reached by any route other than the bridges, and every bridge must have been crossed completely every time (one could not walk half way onto the bridge and then turn around and later cross the other half from the other side). Euler showed that there is no solution.

The traversal of any graph in which every edge is used exactly once is called an Euler Circuit.

The Seven Bridges of Konigsberg

Graph theory began with the analysis of a puzzle involving the bridges in the town of Konigsberg, Prussia (currently Kaliningrad, Russia) by the mathematician Leonhard Euler

Euler observed that a necessary condition for the existence of Eulerian circuits is that all vertices in the graph have an even degree. A graph where every vertex has an even degree is called Eulerian graph.

http://en.wikipedia.org/wiki/Eulerian_path

Page 9: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Graph Coloring Algorithm

In graph theory, graph coloring is a special case of graph labeling; it is an assignment of labels traditionally called "colors" to elements of a graph subject to certain constraints. In its simplest form, it is a way of coloring the vertices of a graph such that no two adjacent vertices share the same color; this is called a vertex coloring.

Determining if a graph can be colored with 2 colors is equivalent to determining whether or not the graph is bipartite, and thus computable in linear time using breadth-first search.

Course Scheduling (Timetable) Problem as Graph Coloring -

vertex = course edge = conflict color = time of course

http://en.wikipedia.org/wiki/Graph_coloring

A B C D EA - * * *B * - * * *C * * - * D * * * - *E * * -

A

B

E

D

CA

B

E

D

C

Page 10: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler
Page 11: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Hamilton Circuit

Page 12: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Graph Depth-First Traversal (DFT) Algorithm Implementationpseudo-code

DFT( node vk ){ // deal with current node for each node, vi { if (node_avail(vi)) then DFT(vi) }}

node_avail( vi ) is a boolean function that returns true if node vi is available for traversal, which

means that vi has not been traversed, and vi is adjacent to vk.

Page 13: Lecture 11: 9.4 Connectivity Paths in Undirected & Directed Graphs Graph Isomorphisms Counting Paths between Vertices 9.5 Euler and Hamilton Paths Euler

Gray Code

0110

00110 00 11 11 0

00001111