Skip to main content

The Routing Routine

The dynamic data base built by the wiretap routine is used by the routing routine to compute routes as required. Ordinarily, this needs to be done only when the first frame to a new destination is sent and at intervals thereafter, with the intervals perhaps modulated by retry count together with congestion thresholds, etc. The technique used is a variation of the Viterbi Algorithm [1], which is similar to the the shortest-path-first algorithm used in the ARPANET and elsewhere [2]. It operates by constructing a set of candidate paths on the network graph from the destination to the source in increasing number of hops. Construction continues until all the complete paths satisfying a specified condition are found, following which one with minimum distance is selected as the primary route and the others ranked as alternate routes.

There are a number of algorithms to determine the mimimum-distance path on a graph between two nodes with given metric. The prototype implementation operates using a dynamic path list of entries derived from the link table. Each list entry includes (a) the NID of the current node, (b) a pointer to the preceding node on the path and (c) the hop count and (d) distance from the node to the final destination node of the path:

[ NID, pointer, hop, distance ] .

The algorithm starts with the list containing only the entry [ dest-NID, 0, 0, 0 ], where dest-NID is the final destination NID, and then scans the list starting at this entry. For each such entry it scans the link table for all links with either to-NID or from-NID matching NID and for each one found inserts a new entry:

[ new-NID, new-pointer, hop + 1, distance + weight ] ,

where the new-NID is the to-NID of the link if its from-NID matches the old NID and the from-NID of the link otherwise. The new-pointer is set at the address of the old entry and the weight is computed from the factors and weights as described previously. The algorithm coontinues to select succeeding entries and scan the link table until no further entries remain to be processed, the allocated list area is full or the maximum hop count or distance are exceeded, as explained below.

Note that in the Viterbi Algorithm, which operates in a similar manner, when paths merge at a single node, all except one of the minimum-distance paths (called survivors) are abandonded. If only one of the minimum-distance paths is required, Wiretap does the same; however, in the more general case where alternate paths are required, all non-looping paths are potential survivors. In order to prevent a size explosion in the list, as well as to suppress loops, new list entries with new-NID matching the NID of an existing entry on the path to the final destination NID are suppressed and paths with hop counts exceeding (currently) eight or distances exceeding 255 are abandoned.

If the Wiretap station NID is found in the from-NID of an entry inserted in the list, a complete path has been found. The algorithm remembers the minimum distance and minimum hop count of the complete paths found as it proceeds. When only one of the minimum-distance paths (primary route) is required, then for any list entry where the distance exceeds the minimum distance or the hop count exceeds the maximum hop count (plus one), the path is abandoned and no further processing done for it. When alternate routes are required the hop-count test is used, but the minimum-distance test is not.

The above pruning mechanisms are designed so that the the algorithm always finds all complete paths with the minimum hop count and the minimum hop count (plus one), which are designated the alternate routes. The assignment of factor computations and weights is intended to favor minimum-hop paths under most conditions, but to allow the path length to grow by no more than one additional hop under conditions of extreme congestion. Thus, the minimum-distance path (primary route) must be found among the alternate paths, usually, but not always, one of the minimum-hop paths.

At the completion of processing the complete paths are ranked first by distance, then by the order of the final entry in the list, which is in hop-count order by construction, to establish a well-defined ordering. The first of these paths represents the primary route, while the remaining represent alternatives should all lower-ranked routes fail.

Some idea of the time and space complexity of the routing routine can be determined from the observation that the computations for all primary and secondary routes of the example in Appendix A with 58 nodes and 98 links requires a average of about 30 list entries, but occasionally overflows the maximum size, currently 100 entries. Each step requires a scan of all the links and a search (for loops) along the maximum path length, which in principle can add most of the links to the list for each new hop. Obviously, the resources required can escalate dramatically, unless effective pruning techniques such as the above are used.

The prototype implementation requires 316 milliseconds on an LSI-11/73 to calculate the 58 primary routes to all 58 nodes for an average of about 5.4 milliseconds per route. The implementation requires 1416 milliseconds to calculate the 201 combined primary and alternate routes to all 58 nodes for an average of about 3.4 milliseconds per route.