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); } }
public WeightedUndirectedGraphNode(WeightedUndirectedGraphNode <T, W> initialNeighbor, T data, W connectionWeight) : this(data) { initialNeighbor.AddNeighbor(this, connectionWeight); }