Exemple #1
0
        private int SumPathCosts(Queue <Node> nodes)
        {
            int pathCost = 0;

            Node current = nodes.Dequeue();

            while (nodes.Count > 0)
            {
                pathCost += current.GetCostTo(nodes.Peek());
                current   = nodes.Dequeue();
            }
            return(pathCost);
        }
Exemple #2
0
 private int GetCostBetween(Node node, Node neighbor)
 {
     return(GetCostFor(node) + node.GetCostTo(neighbor));
 }