コード例 #1
0
 public void AddNeighbor(WeightedUndirectedGraphNode <T, W> neighborToAdd, W connectionWeight)
 {
     if (!m_Neighbors.ContainsKey(neighborToAdd.Data))
     {
         WeightedGraphConnection <T, W> newConnection = new WeightedGraphConnection <T, W>(neighborToAdd, connectionWeight);
         m_Neighbors.Add(neighborToAdd.Data, newConnection);
         neighborToAdd.AddNeighbor(this, connectionWeight);
     }
 }
コード例 #2
0
 public WeightedUndirectedGraphNode(WeightedUndirectedGraphNode <T, W> initialNeighbor, T data, W connectionWeight) : this(data)
 {
     initialNeighbor.AddNeighbor(this, connectionWeight);
 }