坐标平面上随机点的最短路径

时间:2011-05-31 12:59:44

标签: c# shortest-path

考虑下一步已完成的事情

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。

0 个答案:

没有答案
相关问题