/// <summary> Adds an {@link Edge} to the subgraph. /// The associated {@link DirectedEdge}s and {@link Node}s /// are also added. /// /// </summary> /// <param name="e">the edge to add /// </param> public void Add(Edge e) { if (edges.Contains(e)) { return; } edges.Add(e); dirEdges.Add(e.GetDirEdge(0)); dirEdges.Add(e.GetDirEdge(1)); nodeMap.Add(e.GetDirEdge(0).FromNode); nodeMap.Add(e.GetDirEdge(1).FromNode); }
/// <summary> /// Adds a node to the map, replacing any that is already at that location. /// Only subclasses can Add Nodes, to ensure Nodes are of the right type. /// </summary> /// <returns> The added node.</returns> protected void Add(Node node) { nodeMap.Add(node); }