private void calculate(Graph inGraph, int nValueKind)
    {
        initNShortPath(inGraph, nValueKind);

        QueueElement tmpElement;
        CQueue queWork = new CQueue();
        double eWeight;

        for (int nCurNode = 1; nCurNode < vertexCount; ++nCurNode)
        {
            // 将所有到当前结点（nCurNode)可能到达的边根据eWeight排序并压入队列
            enQueueCurNodeEdges(queWork, nCurNode);

            // 初始化当前结点所有边的eWeight值
            for (int i = 0; i < N; ++i)
                weightArray[nCurNode - 1][i] = Double.MAX_VALUE;

            // 将queWork中的内容装入fromArray
            tmpElement = queWork.deQueue();
            if (tmpElement != null)
            {
                for (int i = 0; i < N; ++i)
                {
                    eWeight = tmpElement.weight;
                    weightArray[nCurNode - 1][i] = eWeight;
                    do
                    {
                        fromArray[nCurNode - 1][i].enQueue(new QueueElement(tmpElement.from, tmpElement.index, 0));
                        tmpElement = queWork.deQueue();
                        if (tmpElement == null)
                        {
                            i = N;
                            break;
                        }
                    } while (tmpElement.weight == eWeight);
                }
            }
        }
    }
private void calculate ( Graph inGraph , int nValueKind ) { initNShortPath ( inGraph , nValueKind ) ; QueueElement tmpElement ; CQueue queWork = new CQueue ( ) ; double eWeight ; for ( int nCurNode = 1 ; nCurNode < vertexCount ; ++ nCurNode ) { enQueueCurNodeEdges ( queWork , nCurNode ) ; for ( int i = 0 ; i < N ; ++ i ) weightArray [ nCurNode - 1 ] [ i ] = Double . MAX_VALUE ; tmpElement = queWork . deQueue ( ) ; if ( tmpElement != null ) { for ( int i = 0 ; i < N ; ++ i ) { eWeight = tmpElement . weight ; weightArray [ nCurNode - 1 ] [ i ] = eWeight ; do { fromArray [ nCurNode - 1 ] [ i ] . enQueue ( new QueueElement ( tmpElement . from , tmpElement . index , 0 ) ) ; tmpElement = queWork . deQueue ( ) ; if ( tmpElement == null ) { i = N ; break ; } } while ( tmpElement . weight == eWeight ) ; } } } }
计算出所有结点上可能的路径，为路径数据提供数据准备
@param inGraph 输入图
@param nValueKind 前N个结果