Challenge: Count the Paths Between Two Nodes
Given a graph, print all the paths that exist between two nodes.
We'll cover the following...
Problem statement
Implement a function that counts all the paths that exist between two nodes (source to destination) of an acyclic (not containing cycles) directed graph.
Input
The inputs are a graph, a source value, a destination value.
Output
The output is a value returning the total number of paths.
Sample input
graph = {
0 -> 1
1 -> 2
1 -> 5
2 -> 3
2 -> 4
5 -> 3
5 -> 6
3 -> 6
}
source = 0
destination = 6
Sample output
3
Access this course and 1400+ top-rated courses and projects.