Modified Edge Relaxation function:
Edge Relaxation(u, v, w):
if dist[v] > dist[u] + w:
dist[v] = dist[u] + w
count[v] = count[u] # Update the count of shortest paths
elif dist[v] == dist[u] + w:
count[v] = count[v] + count[u] # Increment the count of shortest paths
This modification ensures that the algorithm not only calculates the length of the shortest path but also keeps track of the number of shortest paths from the source node to every other node.