circuits, paths, and schedules euler and königsberg

12
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Upload: justin-daniel

Post on 18-Jan-2016

215 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

CIRCUITS, PATHS, AND SCHEDULESEuler and Königsberg

Page 2: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Terminology• Network – a group or system of interconnected people or things• Graph – a mathematical structure consisting of vertices and edges• Vertices – points on a graph that may represent locations, people, or anything of interest• Edges – the lines that connect the vertices• Path – a connected sequence of edges in a graph

Page 3: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

• Circuit – a path that starts and ends at the same vertex• Valence – the number of edges connected to any given vertex• Connected graph – for every pair of vertices there is at lest one path connecting the two vertices

Page 4: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Euler Circuits• In an Euler circuit, you start and end at the same vertex while traveling each edge of the graph exactly once.• Fact: For any given graph, it has an Euler circuit if and only

if it is connected and has all vertices of even valence.• If no Euler circuit exists, we may try to add edges in order

to make it happen.

Page 6: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Hamilton and some salesman

CIRCUITS, PATHS AND SCHEDULES

Page 7: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

W.R. Hamilton• Euler focused on the traveling of edges.• Hamilton was more concerned with the visiting of vertices.• Hamiltonian circuit – start where you end (circuit) in which you visit each vertex once and only once.• Hamiltonian circuits provide the most efficient way to run

errands

Page 8: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Terminology• Weight – a number added to an edge that may be distance, cost, or even length of time• Complete graph – every pair of vertices is joined by an edge. That is, you can get to any vertex directly from the one that you are already at via only one edge.

Page 9: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

The Best?• To find the best Hamiltonian circuit for any particular weighted connected graph, you need to list all the Hamiltonian circuits and choose the shortest.• This takes time and effort so being organized is key!

Page 10: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Traveling Salesman Problem• Hamiltonian circuits led to the Traveling Salesman Problem (TSP).• TSP is trying to get a salesman through his route with as

little cost as possible.

• In order to solve the TSP we will use two types of algorithms (step-by-step procedures).

Page 11: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Nearest-Neighbor Algorithm• Start at any vertex.• Choose the next vertex by using the edge of the least weight.• Choose the next vertex by using the edge of the least weight not already used, AND that does not close off the circuit.• Continue until all vertices are visited.• This is not always best…it is said to be a greedy algorithm.

Page 12: CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg

Sorted-Edges Algorithm• Make a list of the weights in an increasing order, low to high.• Select an edge keeping two things in mind:• We don’t have to make a circuit as we go. • We cannot add an edge that would prevent a Hamiltonian

circuity from being formed. • Cannot use three edges from a single vertex and cannot close

off a path that leaves out a vertex.

• This solution may not be optimal, but it is usually “good enough.”