nr Of Paths
Calculates the number of distinct paths from the starting node to the target node in the graph.
This function assumes that the graph is a Directed Acyclic Graph (DAG) and uses dynamic programming to count the number of paths efficiently.
Return
The number of distinct paths from the starting node to the target node.
Parameters
start Node
The starting node.
target Node
The target node.
mod
Makes the function return the nrOfPaths modulo mod. Defaults to Long.MAX_VALUE
Throws
Illegal State Exception
If either the starting node or the target node is not found in the graph.