1 Introduction
Given a road map of the United States on which the distance between each pair of adjacent intersections. Is marked how can, a motorist determine the shortest route from New York City to San Francisco? The brute-force way is to. Generate all possible routes from New York City to, San Francisco and select the shortest one among them.This approach apparently generates too many routes that are not worth considering. For example a route, from New York City. To Miami to San Francisco is a poor choice. In this chapter we introduce some efficient algorithms for finding all the shortest. Paths from a given starting location.
Consider, a connected undirected network with one special node called the, source. (or root).Associated with each edge is, a distance a nonnegative number. The objective is to find the set of edges connecting all. Nodes such that the sum of the edge lengths from the source to each node is minimized. We call it a shortest-paths tree. (SPT) rooted at the source.
In order to minimize the total path lengths the path, from the root to each node must be a shortest. Path connecting them.Otherwise we substitute, such a path with a, shortest path and get a "lighter." spanning tree whose total path lengths from. The root to all nodes are smaller.
Shortest-paths trees are not necessarily unique. Figure 2 gives two shortest-paths trees. Rooted at vertex a for the graph from Figure 1. Take a look at the paths from a to e. In Figure 2 (a), it goes from a to. G and then, G to e.In Figure 2 (b), it goes from a to B B D and, to, then d to e. Both of them are of, length 7 which is the length of a shortest. Path from a to e. Notice that the total edge weight of two shortest-paths trees may not be the same. For example the total,, Edge weight of the shortest-paths tree in Figure 2 (a), is 18 whereas that of the shortest-paths tree in Figure 2 (b) is 17.
.
การแปล กรุณารอสักครู่..