我有加權邊有向圖,我想找到我的圖表中的所有對最短路徑。但我希望能夠考慮折扣。圖的遍歷算法的折扣
例如:
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
是否有實現這個的方法嗎?我已經看過了各種算法(弗洛伊德 - 沃肖爾等),但他們似乎沒有認識到這個問題...
編輯:澄清:只有組合(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'? – 2014-10-07 23:25:45
沒有,如果是A-> B-> C^ – sandbox 2014-10-07 23:34:20
這仍然是一個問題的定義不夠僅適用折扣。所描述的所有折扣集究竟如何? 「如果我先訪問B」這個短語有很多不同的含義。 – Gene 2014-10-07 23:41:49