# Exam 1 Review

```Review for Exam 1
Chinese Postman Problem
Traveling Salesman Problem
Network Problem
Critical Path Analysis
Spring 2015
Mathematics in
Management Science
Exam 1 – Wed Feb 11
Chapters 1 &amp; 2.
pencils and a valid UC ID .
Section # and M # .
No phones allowed. 
Seats will be assigned – come early.
Exam 1 – Wed Feb 11
• Please sit in every other seat
starting in the front rows.
• Please be certain to include your:
M # , Version Letter
• No phones out.
Example What are critical paths?
What is ECT?
Example Spp task 6 time reduced by
4. What is new ECT?
3
Example Spp task 7 time increased
by 4. What is new ECT?
12
Example What are critical paths and
ECT for pictured job?
Chinese Postman Problem
Given connected graph: Find a minimal
length circuit traversing entire graph.
If the graph has an Euler circuit, it is
such a minimal length circuit. If not:
Eulerize the graph
Find an EC on new graph
Transfer back to original graph
Solving CPP – easy case
If the graph has an Euler circuit (or
path), it is a minimal length circuit (or
path) traversing the entire graph.
Euler’s Circuit/Path Theorems tells us
exactly when a graph has EC/EP.
How do we actually find an Euler circuit
or Euler path? (Fleury’s Algorithm)
Euler’s Theorem
A graph has an Euler circuit
if and only if
the graph is connected,
and,
all its vertices have even valence.
Fleury’s Algorithm
Check that the graph is connected and
either has no odd vertices (for circuit),
or has two odd vertices (for path).
Choose a starting vertex. For a circuit,
can be any vertex; for path, it must be
one of the two odd vertices.
At each step, if you have a choice,
don’t choose a bridge of the yet-tobe-traveled part of the graph.
Solving CPP – harder case
What if there are no ECs or EPs?
No EC means: some odd vertex!
No EP means….(?)
No EC/EP: gotta retrace edge(s).
• Eulerize the graph.
• Find an EC (or EP) on new graph.
• Transfer back to original graph.
Eulerizing Graphs – to get EC
If all vtxs have even, done (bcuz have
an EC). Otherwise, have odd vtxs:
mark them. (Must have an even
number of odd vtxs!)
Pick an odd vtx. Duplicate an existing
edge having this vtx as an endpoint.
Change degrees of two vtxs just
connected. All degrees even – done;
otherwise, repeat the above step.
Finding Good Eulerizations
Locate odd vertices. Try to duplicate
any connecting edges between pairs
of odd vertices.
Sometimes vertices are more than one
edge apart; in this case, gotta
duplicate edges between vertices.
Look for the fewest edges to duplicate
to make all vertices even.
Solving a TSP
TSP
Given complete weighted graph, find a
minimum cost Hamiltonian circuit.
Brute Force Algorithm
Nearest Neighbor Algorithm
Repetitive Nearest Neighbor
Algorithm
Sorted Edges Algorithm
Nearest Neighbor Algorithm
From a given vertex, go to the nearest
Repetitive Nearest Neighbor
Do NNA with each vertex of the graph
as the starting vertex.
Of all the circuits obtained, keep the
best one.
If there is a designated starting vertex,
rewrite this best circuit using that
vertex as the reference point.
Sorted Edges Algorithm
Pick the cheapest link (edge with
smallest weight) available.
available that does not
close a circuit which is not an HC, nor
create three edges coming out of a single
vertex.
Done when get a Hamilton circuit.
CPP versus TSP
CPP
Given a connected graph, find a
minimal length circuit (or path)
traversing all edges of the graph.
TSP
Given a complete weighted graph,
find a minimum weight Hamilton
circuit (visiting all vtxs just once).
Network Problem
Find a minimal cost spanning tree
in a given weighted graph.
Of all possible spanning trees, the one
whose sum of the associated weights is
as small as possible is called a
minimum-cost spanning tree.
Kruskal’s Algorithm
Use the edges, in order of
increasing cost, so that
–no circuits get formed
Done when
–all vertices on some edge
–connected
Critical Paths
Look at all paths; each has an
associated completion time (the sum of
all processing times for tasks along the
path).
A path with the longest processing time
is called a critical path.
Can find these via backflow algorithm;
we use eyeball approach.
Earliest Completion Time
The shortest possible time it takes to
complete the overall project. You
cannot do better than this.
A major factor in the overall cost.
Just the length of a critical path:
ECT=length of critical path
```