Graph of Shortest Paths between All Connected Pairs Temporarily remove all linked pairs A[K], B[K] if A[K]>B[K], 1<=K<=Npairs, and condense THen 1<=K<=Nlinks.