/** * 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. * * @param node the node to add */ protected void add(Node node) { nodeMap.add(node); }
/** * Adds an {@link Edge} to the subgraph. * The associated {@link DirectedEdge}s and {@link Node}s * are also added. * * @param e the edge to add */ 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).getFromNode()); nodeMap.add(e.getDirEdge(1).getFromNode()); }
/** * 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. * * @param node the node to add */ protected void add(Node node) { nodeMap.add(node); }
/** * Adds an {@link Edge} to the subgraph. * The associated {@link DirectedEdge}s and {@link Node}s * are also added. * * @param e the edge to add */ 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).getFromNode()); nodeMap.add(e.getDirEdge(1).getFromNode()); }