dyn prog: graph shortest paths improved (memoization)