I know that longest/shortest path can be found in linear time by "processing the vertices in a topological order, and calculating the path length for each vertex to be the minimum or maximum length obtained via any of its incoming edges", or to put it more concisely, topologically sorting and finding the critical path.
My problem is that I need to add another restriction, which is maximum number of edges in a valid path. This complicates matters as the "maximum length obtained via any of its incoming edges" for a node may involve more edges, meaning a later higher weighted node may no longer be reachable because the maximum edges has already been reached.
What would be the correct way to go about solving this? Can it still be solved in linear time?