Flexport interview question

a shortest path problem, need bfs or Dijkstra