Title: 0200 Hamiltonian Circuits
10200 Hamiltonian Circuits
2- Hamiltonian Circuits
- 3 Rules
- Start and stop at the same vertex
- Touch every vertex
- Pass through every vertex only once
- Example
3(No Transcript)
422
27
5Fundamental principle of counting If there are
a ways of choosing on thing, b ways of choosing a
second after the first is chosen, and z ways of
choosing the last item after the earlier choices,
then the total number of choice patterns is a
X b X c X . X z
19
6FPC for Hamiltonian Circuits Given a complete
graph with n vertices, once you choose the
beginning vertex, there are n-1 ways to choose
the second vertex, the next will have n-2 ways to
be chosen, and so on... So a complete
Hamiltonian Circuit will have (n-1)! POSSIBLE
routes. Since a route is the same forwards and
backwards, there are (n-1)!/2 DIFFERENT routes.
5...
7- The Traveling Salesman Problem adds weights
based on the context of the problem to each of
the edges. To solve this problem and find a
minimum-cost circuit we can use one of three
different methods - Brute force method will give ALL possible
routes, therefore ALWAYS finding the absolute
minimum-cost circuit - Nearest-neighbor algorithm will give A
minimum-cost circuit, but maybe NOT the absolute
smallest and may depend on the starting vertex - Sorted-edges algorithm will give A minimum-cost
circuit, but maybe NOT the absolute smallest OR
the same as the nearest-neighbor
8- Brute Force Method
- Find all possible routes using the method of
trees - Calculate all the routes costs
- Pick the smallest number
24
9- Nearest-neighbor algorithm In the context that
the vertices are cities - You will be given a starting city (if not must
calculate starting at every city) - Visit the nearest city
- Visit the nearest city that has not already
been visited - Repeat step 3 over and over
- - Return to the starting city only once all
the cities have been visited - 5. Tally the weights of the edges used
4...
10- Sorted-edges Algorithm Not dependent on a
starting vertex - Remove all the edges
- Sort the edges from smallest to largest
- Place the smallest edge back on the graph
- Place the next smallest edge back on the graph
- Place the third smallest edge and so on until a
HC is created - - Skip edges that create a circuit on the
graph that doesnt include all the vertices - - Skip edges that make the valence of a
vertex more than 2 - 6.Tally the weights of the edges used
20
11 A Hamiltonian Circuit must use EVERY vertex on a
given graph A Spanning Tree must also use EVERY
vertex on a graph, BUT in a spanning tree closing
the circuit is not necessary and its perfectly
ok to retrace your steps
18
12- Kruskals Algorithm only algorithm we know to
find a minimum-cost spanning tree - Remove all the edges
- Sort the edges from smallest to largest
- Place the smallest edge on the graph
- Place the second smallest edge on the graph
- Continue placing edges on the graph until the
graph is connected (Can I trace my pencil over
the entire graph without lifting my pencil?) - Locate any circuits and remove the largest edge
21
1313
Can you give an example why we would use a
spanning tree and not a Hamiltonian Circuit?
14Order-requirement digraph the longest path is
the shortest possible completion time, known as
the critical path
26
9...
1564 from book At a large toy store, scooters
arrive unassembled in boxes. To assemble a
scooter, the following tasks must be
performed TASK 1 Remove parts from the
box TASK 2 Attach wheels to the footboard TASK
3 Attach vertical housing TASK 4 Attach
handlebars to vertical housing TASK 5 Put on
reflector tape TASK 6 Attach bell to
handlebars TASK 7 Attach decals TASK 8 Attach
kickstand TASK 9 Attach safety instructions to
handlebars Its like a puzzle!!
16HAPPY STUDYING!!!