com.hankcs.hanlp.seg.NShort.Path
类 NShortPath

java.lang.Object
  继承者 com.hankcs.hanlp.seg.NShort.Path.NShortPath

public class NShortPath
extends Object

作者:
hankcs

构造方法摘要
NShortPath(Graph graph, int N)
          构造一个N最短路径计算器
 
方法摘要
 Integer[] getBestPath()
          获取唯一一条最短路径,当然最短路径可能不只一条
 List<int[]> getNPaths()
          获取前10条最短路径
 List<int[]> getNPaths(int n)
          从短到长获取至多 n 条路径
 List<int[]> getPaths(int index)
          获取前index+1短的路径
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

NShortPath

public NShortPath(Graph graph,
                  int N)
构造一个N最短路径计算器

参数:
graph - 要计算的图
N - 要计算前几条最短路径,当然结果不一定就是N条
方法详细信息

getPaths

public List<int[]> getPaths(int index)
获取前index+1短的路径

参数:
index - index = 0 : 最短的路径; index = 1 : 次短的路径, 依此类推。index <= this.N
返回:

getBestPath

public Integer[] getBestPath()
获取唯一一条最短路径,当然最短路径可能不只一条

返回:

getNPaths

public List<int[]> getNPaths(int n)
从短到长获取至多 n 条路径

参数:
n -
返回:

getNPaths

public List<int[]> getNPaths()
获取前10条最短路径

返回:


Copyright © 2014–2015 码农场. All rights reserved.