Euler Paths and Euler Circuits
- How do I plow the roads in a township as efficiently as possible?
- An Euler Path is a path that passes through each of the edges of a graph exactly once.
- An Euler Circuit is a circuit that passes through each edge of a graph exactly once.
- Euler's Theorem
- A graph with no odd verticies has at least on Euler path, which is also an Euler circuit. An Euler circuit can be started at any vertex , and it will end at the same vertex.
- A graph with exactly two odd verticies has at least one Euler path, but not Euler circuits. Each Euler path must begin at one of the two odd verticies, and it will end at the other odd vertex.
- A graph with more than two odd verticies has neither an Euler path nor an Euler circuit.
- An algorithm is a set of instructions to solve a problem in a finite amount of time.
- Fleury's Algorithm:
- Use Euler's theorem to determine if an Euler path or Euler circuit exists.
- If the graph has no odd verticies, choose any vertex as the starting point. If the graph has two odd verticies, choose one of the two odd verticies as the starting point.
- Trace the edges, numbering (and erasing) the edges as you traverse them.
- When faced with a choice of edges, if possible, choose an edge that is not a bridge.
- Continue until each edge has been traced once.
- Numbers 7, 11, 15, 17, 21, 24, 25, 34, 39, 40, 41
Hamiltonian Paths and Circuits
- A Hamiltonian path is a path that contains each vertex of a graph exactly one time.
- A Hamiltonian circuit is a path that begins and ends at the same vertex and passes through all other verticies of the graph exactly once.
- A weighted graph is a graph with weights associated with the edges.
- The traveling salesman problem asks: Given a weighted graph, find the lowest cost Hamiltonian circuit.
- A complete graph is a graph that has edges between every pair of verticies.
- A complete graph with n verticies has (n-1)! Hamiltonian circuits.
- A heuristic is a set of steps which "nearly" solves a problem.
- Nearest Neighbor heuristic for a solution to TSP
- Find the starting vertex.
- While not back at the starting point
- Select the minimal cost path out that does not lead to an already explored vertex.
- Numbers 9, 11, 15, 22, 29