public void AddEdge(int vertex, int weight) { if (AdjList.ContainsKey(vertex)) { AdjList[vertex].Add(weight); } else { var list = new List <int> { weight }; AdjList.Add(vertex, list); } if (AdjList.ContainsKey(weight)) { AdjList[weight].Add(vertex); } else { var list = new List <int> { vertex }; AdjList.Add(weight, list); } }
public void AddNode(NodeD vertices) { LinkedList <DEdge> neighbor = new LinkedList <DEdge>(); AdjList.Add(vertices, neighbor); Size = 1 + Size; }