Number Of paths between two nodes in a DAG?

Do a topological sort of the DAG, then scan the vertices from the target backwards to the source. For each vertex v keep a count of the number of paths from v to the target. When you get to the source, the value of that count is the answer.

That is O(V+E) .

The number of distinct paths from node you to v is the sum of distinct paths from nodes x to v, where x is a direct descendant of u.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions