Beispiel #1
0
        public void SetEdgeCost(int fromId, int toId, int cost)
        {
            GraphEdge edge = GetEdge(fromId, toId);

            if (edge != null)
            {
                edge.cost = cost;
            }
        }
Beispiel #2
0
 public void RemoveNodeByID(int id)
 {
     for (int i = 0; i < nodeTable.Count; ++i)
     {
         if (nodeTable[i].id == id)
         {
             nodeTable.Remove(id);
             EdgeList edgeList = edgeListTable[id];
             for (int j = 0; j < edgeList.Count; ++j)
             {
                 GraphEdge edge = edgeList[j];
                 RemoveEdge(edge.to, edge.from);
             }
             edgeList.Clear();
             edgeListTable.Remove(id);
             break;
         }
     }
 }