You can use dynamic programming and fill in the number of paths along the way, if D[u] + w(u,v) = D[v], something like:
N = [0,...,0]
N[s] = 1
For each vertex v, in *ascending* order of `D[v]`:
for each edge (u,v) such that D[u] < D[v]:
if D[u] + w(u,v) = D[v]:
N[v] += N[u]
Difficulty O(VlogV + E), assuming the graph is not sparse, O(E)is dominant.
Explanation:
v0->v1->...->v_(k-1)->v_k v0 v_k, v0->...->v_(k-1) v0 v_k-1, - v_k - N[v_(k-1)] (, D[V_k-1] < D[v_k], D[v]).
v0->...->v_(k-1) N[v_(k-1)].
v0->...->v_(k-1)-v_k - D[v_(k-1)] + w(v_k-1,v_k) = D[v_k] - , , N[v_k].
, , .