|
SOLUTIONS
|
MATHEMATICA 内置符号
FindShortestPath
FindShortestPath[g, s, t]
求图 g 中从源顶点 s 到目标顶点 t 的最短路径.
FindShortestPath[g, s, All]
生成一个 ShortestPathFunction[...],它可以重复应用于不同的 t.
FindShortestPath[g, All, t]
生成一个 ShortestPathFunction[...],它可以重复应用于不同的 s.
FindShortestPath[g, All, All]
生成一个 ShortestPathFunction[...],它可以应用于不同的 s 和 t.
更多信息更多信息
- FindShortestPath[g, s, t] 给出从 s 到 t 的一条路径.
- FindShortestPath[g, s] 等价于 FindShortestPath[g, s, All].
- FindShortestPath[g] 等价于 FindShortestPath[g, All, All].
- 对于非加权图,假设边的长度为 1.
- 对于加权图,采用边的长度作为权值.
- 也可以给出一个 Method 选项. 可能的 Method 设置包括:
-
"BellmanFord" 支持正、负权值 "Dijkstra" 支持正权值
版本 8 的新功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »


