better shortest path verification