【发布时间】:2014-10-07 23:02:23
【问题描述】:
我有一个带加权边的有向图,我想在我的图中找到所有对的最短路径。但我希望能够考虑到折扣。
例如:
A->B with weight 10
A->C with weight 20
B->C with weight 10
C->D with weight 10
A->B->C with weight 15 because I get a discount of 5 if and only if I visit B first. (see clarification)
A->B->C->D should therefor have weight 25 while
A->C->D with weight 30
有没有办法实现这个?我查看了各种算法(Floyd-Warshall 等),但他们似乎没有认识到这个问题......
编辑:澄清:只有组合 (A->B->C) 获得折扣。
E->(A->B->C)->F gets it because it has the exact combination in its path, but
A->E->B->C does not get it
【问题讨论】:
-
去
A->E->B->F->C有优惠吗? -
不可以,只有A->B->C才能打折
-
这仍然是一个不充分的问题定义。如何准确描述所有折扣的集合? “如果我先访问 B”这句话有许多不同的可能含义。
-
你为什么不能添加一个快捷方式到
A->C和所有其他折扣子路径? -
所以实际上不是全对最短路径,而是带航点的最短路径?
标签: algorithm graph graph-theory graph-algorithm