Tag - shortest path algorithm