public class NShortPath extends Object
| Constructor and Description |
|---|
NShortPath(Graph graph,
int N)
构造一个N最短路径计算器
|
| Modifier and Type | Method and Description |
|---|---|
Integer[] |
getBestPath()
获取唯一一条最短路径,当然最短路径可能不只一条
|
List<int[]> |
getNPaths()
获取前10条最短路径
|
List<int[]> |
getNPaths(int n)
从短到长获取至多 n 条路径
|
List<int[]> |
getPaths(int index)
获取前index+1短的路径
|
public NShortPath(Graph graph, int N)
graph - 要计算的图N - 要计算前几条最短路径,当然结果不一定就是N条public List<int[]> getPaths(int index)
index - index = 0 : 最短的路径; index = 1 : 次短的路径, 依此类推。index <= this.Npublic Integer[] getBestPath()
public List<int[]> getNPaths(int n)
n - public List<int[]> getNPaths()
Copyright © 2014–2021 码农场. All rights reserved.