Esempio n. 1
0
        public void Path()
        {
            int startTree = 0;

            this.verticies[startTree].isInTree = true;

            this.nTree = 1;

            for (int j = 0; j < this.numVerts; j++)
            {
                int tempDist = this.adMatrix[startTree, j];
                sPath[j] = new cDistOriginal(startTree, tempDist);
            }

            while (this.nTree < this.numVerts)
            {
                int indexMin = GetMin();
                int minDist  = sPath[indexMin].distance;
                this.currentVert    = indexMin;
                this.startToCurrent = sPath[indexMin].distance;
                this.verticies[this.currentVert].isInTree = true;
                this.nTree++;
                this.AdjustShortPath();
            }

            this.DisplayPaths();
            this.nTree = 0;
            for (int i = 0; i < this.numVerts; i++)
            {
                this.verticies[i].isInTree = false;
            }
        }
Esempio n. 2
0
        public void Path()
        {
            int startTree = 0;
            this.verticies[startTree].isInTree = true;

            this.nTree = 1;

            for (int j = 0; j < this.numVerts; j++)
            {
                int tempDist = this.adMatrix[startTree, j];
                sPath[j] = new cDistOriginal(startTree, tempDist);
            }

            while (this.nTree < this.numVerts)
            {
                int indexMin = GetMin();
                int minDist = sPath[indexMin].distance;
                this.currentVert = indexMin;
                this.startToCurrent = sPath[indexMin].distance;
                this.verticies[this.currentVert].isInTree = true;
                this.nTree++;
                this.AdjustShortPath();
            }

            this.DisplayPaths();
            this.nTree = 0;
            for (int i = 0; i < this.numVerts; i++)
            {
                this.verticies[i].isInTree = false;
            }
        }