/** * Removes a {@link DirectedEdge} from its from-{@link Node} and from this graph. * This method does not remove the {@link Node}s associated with the DirectedEdge, * even if the removal of the DirectedEdge reduces the degree of a Node to zero. */ public void remove(DirectedEdge de) { DirectedEdge sym = de.getSym(); if (sym != null) sym.setSym(null); de.getFromNode().remove(de); de.remove(); dirEdges.remove(de); }
/** * Removes a node from the graph, along with any associated DirectedEdges and * Edges. */ public void remove(Node node) { // unhook all directed edges List outEdges = node.getOutEdges().getEdges(); for (Iterator i = outEdges.iterator(); i.hasNext(); ) { DirectedEdge de = (DirectedEdge) i.next(); DirectedEdge sym = de.getSym(); // remove the diredge that points to this node if (sym != null) remove(sym); // remove this diredge from the graph collection dirEdges.remove(de); Edge edge = de.getEdge(); if (edge != null) { edges.remove(edge); } } // remove the node from the graph nodeMap.remove(node.getCoordinate()); node.remove(); }
/** * Removes a {@link DirectedEdge} from its from-{@link Node} and from this graph. * This method does not remove the {@link Node}s associated with the DirectedEdge, * even if the removal of the DirectedEdge reduces the degree of a Node to zero. */ public void remove(DirectedEdge de) { DirectedEdge sym = de.getSym(); if (sym != null) sym.setSym(null); de.getFromNode().remove(de); de.remove(); dirEdges.remove(de); }
/** * Removes a node from the graph, along with any associated DirectedEdges and * Edges. */ public void remove(Node node) { // unhook all directed edges List outEdges = node.getOutEdges().getEdges(); for (Iterator i = outEdges.iterator(); i.hasNext(); ) { DirectedEdge de = (DirectedEdge) i.next(); DirectedEdge sym = de.getSym(); // remove the diredge that points to this node if (sym != null) remove(sym); // remove this diredge from the graph collection dirEdges.remove(de); Edge edge = de.getEdge(); if (edge != null) { edges.remove(edge); } } // remove the node from the graph nodeMap.remove(node.getCoordinate()); node.remove(); }