0

Graph layering is a common technique to deal with the shortest path with some restrictions. Here is a description about this technique: https://youtu.be/OQ5jsbhAv_M?t=47m7s. So, just wondering, whether this technique will be the same as doing DP, but just with a different memorization structure?

Guy Coder
  • 24,501
  • 8
  • 71
  • 136
NoSegfault
  • 675
  • 1
  • 9
  • 14

1 Answers1

0

The shortest path algorithms are dynamic programming algorithms already. They calculate the shortest path to a node based on the shortest paths to its predecessors (optimal substructure), and memoize the results for each node, because each one can be a predecessor of several different successor nodes (overlapping subproblems).

The "layering technique" lets you extend the dynamic programming solution to handle restrictions and other kinds of complications.

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87