16. PathsCircuits

16. PathsCircuits - Maggie Johnson CS103B Handout #16 Paths...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Maggie Johnson CS103B Handout #16 Paths and Circuits Key Topics * The Bridges of Königsberg * Some Definitions * Euler Circuits * Hamilton Circuits * The Traveling Salesperson problem _____________________________________________________________________ In the introductory graph handout, we talked about how the subject of graph theory began in 1736 when the great mathematician Leonhard Euler published a paper that contained the solution to the following puzzle: The town of Königsberg in Prussia (now Kaliningrad in Russia) is built at a point where two branches of the Pregel River join. The town consists of an island and some land along the river banks. All land masses are connected by seven bridges: Given this geographical situation, is it possible for a person to take a walk around town, starting and ending at the same location, and crossing each of the seven bridges exactly once? To solve this problem, Euler modeled it using what we now call a graph. He noticed that all the points of a given land mass can be identified with each other because the person can travel from any point on the land mass to any other point without crossing a bridge. So, his map of Konigsberg looked like this: So, in terms of the graph, the question is: Is it possible to find a route through the graph that starts and ends at some one vertex, and traverses each edge exactly once? i.e.: Is it possible to trace this graph, starting and ending at the same point, without ever lifting your pencil from the paper, and without drawing over the same line twice?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Any way you try, you end up on a vertex that does not have an unused edge on which to leave. If we start at A, for example, each time we pass through B, C and D, we use up two edges, one for arrival and one for departure. Therefore, the degrees of B, C and D must be even (a multiple of 2) in order for us to start at A and pass through B, C and D using each edge only once. deg(B) = 5 and deg(C, D) = 3, so it is not possible to travel all around the city crossing each bridge only once. Some Definitions Travel around the edges of a graph is accomplished by an alternating sequence of vertex, edge, vertex, edge. .. Certain types of sequences of adjacent vertices along connecting edges are of special importance in graph theory. Let G be a graph and v and w be vertices in G. A walk from v to w is a finite alternating sequence of adjacent vertices and edges of G. The trivial walk from v to v consists of a single vertex v. path from v to w is a walk from v to w that does not contain a repeated edge. A simple path from v to w is a path that does not contain a repeated vertex. circuit is a path that starts and ends at the same vertex and does not contain a repeated edge. A simple circuit starts and ends at the same vertex and does not have any other repeated vertex. The following table summarizes these definitions: repeated edge? repeated vertex? starts/ends same point walk allowed allowed possibly path no allowed possibly simple path no no no circuit no allowed yes simple circuit no 1st/last only yes Given the following graph: Which of the following walks are paths, simple paths, circuits and simple circuits?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/01/2011 for the course CS 103B taught by Professor Sahami,m during the Winter '08 term at Stanford.

Page1 / 13

16. PathsCircuits - Maggie Johnson CS103B Handout #16 Paths...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online