2
2
• We now know that node 3 is the closest node to node 1. We compute new
temporary labels for all nodes that are connected to node 3 by a single arc.
In Figure below that is node 5
Using Dijkstra’s Algorithm to Solve
Powerco example
• Node 2 now has the smallest temporary label; we now make node 2’s label
permanent. We now know that node 2 is the second closest node to node 1.
Our new set of labels is
• The problem is to determine at what times (if any) the tractor should
be replaced to minimize the total cost for the tractors over 3 years.
o Formulate this problem as a shortest-path problem.
o Use the Dijkstra’s Algorithm to solve this shortest-path problem.
Minimum Spanning Tree Problems
• Suppose that each arc (i,j) in a network has a length associated with it
and that arc (i,j) represents a way of connecting node i to node j.
• In many applications it must be determined that the set of arcs in a
network that connects all nodes such that the sum of the length of the
arcs is minimized. Clearly, such a group of arcs contain no loop.
• For a network with n nodes, a spanning tree is a group of n-1 arcs that
connects all nodes of the network and contains no loops.
Minimum Spanning Tree Problems
• A spanning tree of minimum length in a network is a minimum
spanning tree (MST).
• The minimum spanning tree problem bears some similarities to the
main version of the shortest-path problem presented in the preceding
section.
• Both problems also involve choosing a set of links that have the
shortest total length among all sets of links that satisfy a certain
property.
• For the shortest-path problem, this property is that the chosen links
must provide a path between the origin and the destination.
• For the minimum spanning tree problem, the required property is that
the chosen links must provide a path between each pair of nodes.
Minimum Spanning Tree Problems
The minimum spanning tree problem can be summarized as follows:
1. You are given the nodes of a network but not the links. Instead, you
are given the potential links and the positive length for each if it is
inserted into the network. (Alternative measures for the length of a link
include distance, cost, and time.)
2. You wish to design the network by inserting enough links to satisfy the
requirement that there be a path between every pair of nodes.
3. The objective is to satisfy this requirement in a way that minimizes the
total length of the links inserted into the network.
Minimum Spanning Tree Problems
Here is a list of some key types of applications of the minimum spanning
tree problem:
1. Design of telecommunication networks (fiber-optic networks,
computer networks, leased-line telephone networks, cable television
networks, etc.)
2. Design of a lightly used transportation network to minimize the total
cost of providing the links (rail lines, roads, etc.)
3. Design of a network of high-voltage electrical power transmission lines
4. Design of a network of wiring on electrical equipment (e.g., a digital
computer system) to minimize the total length of the wire
5. Design of a network of pipelines to connect a number of locations
Minimum Spanning Tree Problems
• The MST Algorithm may be used to find a minimum spanning tree.
o Begin at any node i, and join node i to the node in the network (call it
node j) that is closest to node i.
• The two nodes i and j now form a connected set of nodes C={i,j}, and
arc (i,j) will be in the minimum spanning tree. The remaining nodes in
the network (call them Ć) are referred to as the unconnected set of
nodes.
o Now choose a member of C’ (call it n) that is closest to set C. Let m
represent the node in C that is closest to n. Then the arc(m,n) will be in the
minimum spanning tree. Now update C and C’. Since n is now connected
to {i,j}, C now equals {i,j,n} and we must eliminate node n from C’.
o Repeat this process until a minimum spanning tree is found. Ties for closest
node and arc to be included in the minimum spanning tree may be
broken arbitrarily.
MST Algorithm: Example
• The State University campus has five computers. The distances
between each pair of computers are given.
• What is the minimum length of cable required to interconnect the
computers?
1 1
2
2
2
6
5 4
2 3
4
4
5 3
MST Algorithm: Example
We want to find the minimum spanning tree.
• Iteration 1: Following the MST algorithm discussed before, arbitrarily
choose node 1 to begin. The closest node is node 2. Now C={1,2},
Ć={3,4,5}, and arc(1,2) will be in the minimum spanning tree.
1 1
2
2
2
6
5 4
2 3
4
4
5 3
MST Algorithm: Example
• Iteration 2: Node 5 is closest to C. since node 5 is two blocks from node
1 and node 2, we may include either arc(2,5) or arc(1,5) in the
minimum spanning tree. We arbitrarily choose to include arc(2,5). Then
C={1,2,5} and Ć={3,4}.
1 1
2
2
2
6
5 4
2 3
4
4
5 3
MST Algorithm: Example
• Iteration 3: Since node 3 is two blocks from node 5, we may include
arc(5,3) in the minimum spanning tree. Now C={1,2,5,3} and Ć={4}.
1 1
2
2
2
6
5 4
2 3
4
4
5 3
MST Algorithm: Example
• Iteration 4: Node 5 is the closest node to node 4. Thus, we add arc(5,4)
to the minimum spanning tree.
• The minimum spanning tree consists of arcs(1,2), (2,5), (5,3), and (5,4).
The length of the minimum spanning tree is 1+2+2+4=9 blocks.
1 1
2
2
2
6
5 4
2 3
4
4
5 3
MST Algorithm: Exercise (1)
• The Seervada Park management (see Sec. 9.1) needs to determine
under which roads telephone lines should be installed to connect all
stations with a minimum total length of line
MST Algorithm: Exercise (2)
• The Wirehouse Lumber Company will soon begin logging eight groves
of trees in the same general area. Therefore, it must develop a system
of dirt roads that makes each grove accessible from every other
grove. The distance (in miles) between every pair of groves is as
follows:
MST Algorithm: Exercise (2)
• Management now wishes to determine between which pairs of groves
the roads should be constructed to connect all groves with a minimum
total length of road.
o Describe how this problem fits the network description of the
minimum spanning tree problem.
o Use the algorithm described previously to solve the problem
The End