示例#1
0
 public void AddLink(Node node, int weight)
 {
     neighbors.Add(node);
     node.AddNeighbor(this);
     netGraph.AddEdge(node.GetId());
     netGraph.SetLink(id, node.GetId(), weight);
     if (packetsCheck)
     {
         ReceiveNewPacket(GeneratePacket(node));
     }
     if (!packetsCheck)
     {
         ReceivePacket(GeneratePacket(node));
     }
 }
示例#2
0
 public Node(string id)
 {
     this.id   = id;
     neighbors = new List <Node>();
     packets   = new List <int>();
     netGraph  = new NetworkGraph(15);
     netGraph.AddEdge(id);
     connections = new Dictionary <string, string>();
     connections.Add(id, id);
 }