开发者

Graph search for specific length path

I have a directed weighted graph (with cycles), where each weight represents a period of time. I am trying to come up with an algorit开发者_如何学运维hm 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜