Exemplo n.º 1
0
 void Recu(CityNode nownode, int cost_t, string citypath, string costpath)
 {
     citypath += $" {nownode.ID}";
     if (nownode.Child.Count == 0)
     {
         AllPath.Add(new Data()
         {
             cost = cost_t, citypath = citypath.ToString(), costpath = costpath.ToString()
         });
         return;
     }
     for (int i = 0; i < nownode.Child.Count; i++)
     {
         Recu(nownode.Child[i].Child,
              cost_t + nownode.Child[i].Cost,
              citypath,
              costpath + " " + nownode.Child[i].Cost.ToString());
     }
 }
Exemplo n.º 2
0
 public Bridge(int cost, CityNode a, CityNode b)
 {
     Cost   = cost;
     Parent = a;
     Child  = b;
 }