I know that the longest / shortest path can be found in linear time by "processing vertices in a topological order and calculating the path length for each vertex as the minimum or maximum length obtained using any of its edges", or more briefly, topologically Sort and find the critical path.
My problem is that I need to add another restriction, the maximum number of edges in a valid path. This complicates the situation because the βmaximum length obtained using any of its edgesβ for a node may include more edges, which means that a later higher node weight may not be available because the maximum edges have already been reached.
What would be the right way to solve this? Can it be solved in linear time?
Acorn source
share