Associate a cost with each edge; improved testability.