Ejemplo n.º 1
0
 /// <summary>
 /// Adds the or update cost so far.
 /// </summary>
 /// <param name="costSoFar">The cost so far.</param>
 /// <param name="next">The next.</param>
 /// <param name="newCost">The new cost.</param>
 private void AddOrUpdateCostSoFar(Dictionary <T, int> costSoFar, Adjacency <T> next, int newCost)
 {
     if (costSoFar.ContainsKey(next.Node))
     {
         costSoFar[next.Node] = newCost;
     }
     else
     {
         costSoFar.Add(next.Node, newCost);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the or update camefrom.
 /// </summary>
 /// <param name="camefrom">The camefrom.</param>
 /// <param name="current">The current.</param>
 /// <param name="next">The next.</param>
 private void AddOrUpdateCamefrom(Dictionary <T, T> camefrom, PathFindingQueueNode <T> current, Adjacency <T> next)
 {
     if (camefrom.ContainsKey(next.Node))
     {
         camefrom[next.Node] = current.Node;
     }
     else
     {
         camefrom.Add(next.Node, current.Node);
     }
 }