예제 #1
0
 public object Clone()
 {
     AdjacencyMatrix newMatrix = new AdjacencyMatrix(this.NodeCount);
     for (int i = 0; i < this.matrix.Length; i++)
     {
         for (int j = 0; j < this.matrix[i].Length; j++)
         {
             if (this.matrix[i][j].HasValue) { newMatrix.AddEdge(i, j, this.matrix[i][j].Value); }
         }
     }
     return newMatrix;
 }
예제 #2
0
 public void AlgoritmStep()
 {
     for (int k = 0; k < previousMatrix.NodeCount; k++)
     {
         for (int i = 0; i < previousMatrix.NodeCount; i++)
         {
             for (int j = 0; j < previousMatrix.NodeCount; j++)
             {
                 if ((previousMatrix.GetElement(i,k).HasValue)&&(previousMatrix.GetElement(k,j).HasValue))
                 {
                     int prev = previousMatrix.GetElement(i,j) ?? Int32.MaxValue;
                     int next = previousMatrix.GetElement(i,k).Value + previousMatrix.GetElement(k,j).Value;
                     nextMatrix.SetElement(i,j, prev <= next ? prev : next);
                 }
             }
         }
         previousMatrix = (AdjacencyMatrix)nextMatrix.Clone();
     }
 }
예제 #3
0
 public FlWaAlgoritm(AdjacencyMatrix inputMatrix)
 {
     previousMatrix = (AdjacencyMatrix)inputMatrix.Clone();
     nextMatrix = (AdjacencyMatrix)inputMatrix.Clone();
 }