Build shortest path pipe