Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个在边上具有任意权重的有向无环图和两个特定节点 s 和 t,其中 s 的入度和 t 的出度为 0。如何确定从 s 到 t 的最短路径具有正成本?
使用修改后的 Bellman-Ford,如果生成的最短路径成本小于 0,则从图中删除边,直到达到成本,即不小于 0。