I have a directed weighted graph (with cycles), where each weight represents a period of time.
I am trying to come up with an algorithm which will give the maximum number of nodes visited in a given amount of time (of course visiting each node no more than once).
There is a root node to start from and the path can end at any node.
Any ideas or pointers?
(Before you ask, this is based on a homework problem I once had. This particular question is not homework.)
I’m almost positive that’s going to be NP-hard, so any graph enumeration will probably work. Depth first search, for example. The easy thing is to add a marker so you don’t traverse a path more than ones; enumerate all paths, summing the weights, and keep track of the maximum.