Unifying implementations of `shortest<Dir>` in topologies