This section is devoted to different versions of one problem. Suppose a country has n cities numbered 1.. n. For each pair of cities i and j, an integer a [i] [j] is given that is the cost of a (nonstop) plane ticket from i to j. We assume that flights exist between any two cities, and that a [k] [k] = 0 for any k. In general, a [i] [j] may be different from a [j] [i]. Our goal is to find the minimal cost of a trip from one city (s) to another one (t) that takes into account all the possible travel plans (nonstop, one stop, two stops etc.). This minimal cost does not exceed a[s] [t] but may be smaller. We allow a[i] [j] to be negative for some i and j (you are paid if you agree to use some flight).
KeywordsShort Path Minimal Cost Outgoing Edge Graph Algorithm Cost Matrix
Unable to display preview. Download preview PDF.