0

考虑接下来要做的事情

Class Point()
{
    prop int X
    prop int Y

    //ByDefault it generates a Random value
    Point()
    {
        GenerateRandom();
    }

    public void GenerateRandom() 
    {
        //Code for generateRandom
    }  
}

Class Operations
{
    public float Distance(Point A, Point B)
    {
        //Code for calculating distance
    }

    ///Determinates the distance from i=0 to i=n of the array with a for sentence
    public float AcumulatedDistance(Point[] PointsOrdered)
    {
        float ret=0;
        for(i=0;i<n-1;i++)
            ret += Distance(PointsOrdered[i], PointsOrdered[i+1]);
        return ret;
    }
}

您需要做什么(在运营中):

public Point[] ShortestPath(int initialIndex, Point[] myPoints)

myPoints 有一组点,我考虑myPoints[initialindex]我的 StartPosition。并且返回的数组是为了得到最短路径而排序的点。

我似乎不知道如何申请 Floyd–Warshall niether Dijkstra 是否适用。

4

0 回答 0