Adding Edge Weights Along a Route

A weighted path's additive cost is the sum of the weights of its edges. The best route can have more edges than an alternative.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Compare two choices
  2. State the weight assumptions
  3. Compare a longer path whose total is lower
  4. Verify the algebra matches the quantity

Compare two choices

A direct link A to C costs ten. A to B and B to C cost three and four, so that route costs seven. Edge-count distance would instead prefer the direct link.

State the weight assumptions

A routing method may require nonnegative weights or another restriction. Do not use an edge-count procedure just because all weights are known. The Dijkstra invariant explains how nonnegative weights support a different search.[1]

Compare a longer path whose total is lower

Suppose direct connection A to C costs nine, while A to B costs two and B to C costs three. The direct route has one edge. The other has total cost five and wins if costs add. See unweighted shortest routes.

Route     edges  cost
A→C           1     9
A→B→C         2     5

Verify the algebra matches the quantity

Elapsed travel plus a transfer fee can be additive if both terms use compatible units. A reliability probability for independent links combines by multiplication instead. Negative edge costs also change which shortest-path algorithms apply. State what the weight means before computing.

References

  1. Eric Lehman, F. Thomson Leighton and Albert R. Meyer, Mathematics for Computer Science ↩