I have an algorithm to determine, in a DAG, the number of paths from each vertex to a specific vertex t (which has out-degree equal to 0). Now I choose other specific vertex s with 0 in-degree. I have to develop another algorithm to determine, for each edge (u, v), the number of paths that run through (u, v) from s to t in O(|V|+|E|).
I have tried to modify the BFS (since with a DFS I think is impossible to reach the solution) but if I have an edge with more than one paths, it doesn't work. Could you suggest me or give me a hint about how can I focus my work to get the solution?
By the way, the problem is related to topological sort.
Thanks so much in advance! :)