Finding the K Shortest Loopless Paths in a Network
”
中做了系统阐述。当查找绝对最短路径并非唯一目标时,用该算法可获取替代路径。当需
要一个以上的备选计划时,该算法非常有用。
使用
Neo4j
实现
Yen
算法
下面的查询执行
Yen
算法来查找
Gouda
(高达)和
Felixstowe
之间的最短路径。
MATCH
(
start
:Place {id:"Gouda"}),
(end:Place {id:"Felixstowe"})
CALL algo.kShortestPaths.stream(
start
, end, 5, "distance")
YIELD index, nodeIds, path, costs
RETURN
index, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.