/// <summary> /// Creates a new <see cref="GraphEdge"/> with the given parameters and adds it to the set. /// </summary> public void Add(int n1, int n2, uint weight) { var edge = new GraphEdge(n1, n2, weight); // Assigning with indexer does not override the existing value ... _edgeDict.Remove(edge); _edgeDict[edge] = edge; _adjacencyMatrix[edge.N1].Add(edge.N2); _adjacencyMatrix[edge.N2].Add(edge.N1); }
/// <summary> /// Removes the given edge from the set. /// </summary> public void Remove(GraphEdge edge) { _adjacencyMatrix[edge.N1].Remove(edge.N2); _adjacencyMatrix[edge.N2].Remove(edge.N1); _edgeDict.Remove(edge); }