add shortest path from a to b through c