Algorithm 在流网络中,使用约束增加边的权重,以使所有路径权重相等

Algorithm 在流网络中,使用约束增加边的权重,以使所有路径权重相等,algorithm,graph,Algorithm,Graph,给定一个有一个源和一个汇的流动网络。流动网络中没有循环。我需要通过增加边的权重使所有路径(从源到汇)的权重相等。约束条件是,在不超过1条边的路径中,可以增加边的权重,并且路径的权重应最小 路径权重=沿路径的所有边的权重之和 有关解释,请参见下面的示例- source - 1 sink - 6 Edges - 1->2 8 1->5 12 1->4 7 2->4 2 2->3 4 3->6 6 4->6 8 5->6 10 Routes are

给定一个有一个源和一个汇的流动网络。流动网络中没有循环。我需要通过增加边的权重使所有路径(从源到汇)的权重相等。约束条件是,在不超过1条边的路径中,可以增加边的权重,并且路径的权重应最小

路径权重=沿路径的所有边的权重之和

有关解释,请参见下面的示例-

source - 1
sink - 6

Edges - 
1->2 8
1->5 12
1->4 7
2->4 2
2->3 4
3->6 6
4->6 8
5->6 10

Routes are - 
1->2->3->6 weight - 18
1->2->4->6 weight - 18
1->4->6 weight - 15
1->5->6 weight - 22

If i add weight like this

Add 4 to 3->6 
Add 4 to 2->4
Add 7 to 1->4


Total cost of all the routes become 22 which is minimum possible.

我认为这可以通过二进制搜索+最大流来解决。我会考虑细节,如果没有其他人会考虑的话,可能会在以后发布。@IVlad你能告诉我如何使用search+max-flow进行搜索吗?我认为这可以用binary search+max-flow解决。我会考虑细节,如果没有其他人会考虑的话,可能会在以后发布。@IVlad你能告诉我如何使用搜索+最大流量来完成吗?