Finding Shortest path in weighted directional multigraph with extra constraints

时间:2015-04-23 05:17:42

标签: algorithm graph shortest-path directed-graph

Given a weighted directed multigraph, I have to find shortest path between starting vertex u to vertex v. Apart from weight, each edge also has time. The path connecting u and v cannot take more than a given maximum time. The trouble is while using Djikstra, there are chances that shortest path takes more time than the limit.

My approach is to find all valid paths between u and v and than minimize the weight. But the approach is not practical due to its high complexity.

Any ideas?

1 个答案:

答案 0 :(得分:0)

如果体重足够小

在这种情况下,您可以为每个节点执行的操作,存储您可以在该节点的路径上获得的所有可能的权重总和。现在你可以在这个新图上做dijsktra,并尝试最小化成对节点(node,weight_sum)的时间。

如果时间足够小

您可以执行与上一示例相同的操作,但可以使用对(节点,时间)。

一般问题

我担心,一般来说,你所能做的就是尝试所有可能的路径,尝试用撬开来改善它。