Ejemplo n.º 1
0
        private int Cost(Node n1, Node n2)
        {
            NodePair np = new NodePair(n1, n2);
            if(costTable.ContainsKey(np)) return costTable[np];
            else Console.WriteLine("Error: Unable to find path cost!");

            return -1;
        }
Ejemplo n.º 2
0
 private void AddToCostTable(string name_1, string name_2, int cost)
 {
     NodePair nPair = new NodePair(name_1, name_2);
     if(!costTable.ContainsKey(nPair)){
         costTable.Add(nPair, cost);
     }else{
         Console.WriteLine("ERROR: Several roads between the same cities!");
     }
 }