When Given a graph G with vertices and edges |V| and |E| respectively and vertices u and t, write a O(|E|+|V|) algorithm to compute the number of shortest paths from u to t, i.e. if there are 5 paths of length 4 with length 4 being the shortest path from u to t then the algorithm will output 5.
I know that the algorithm must somehow incorporate either a DFS or a BFS due to its run-time as each have a O(|E|+|V|) run-time, but I am a bit stuck. I tried implementing something where it would do a DFS repeatedly with the algorithm terminating at t but it this became problematic for deciding which nodes to set as visited and which to reset after each iteraition.
Thanks in advance!