/** * Restores an edge if it has been removed, and both of its nodes are not removed. * * @param e the edge * @return <code>true</code> if the edge was restored */ private boolean restoreEdge(Edge e) { if (!e.flag || e.source.flag || e.target.flag) return false; e.flag = false; changeOutDegree(e.source, 1); changeInDegree(e.target, 1); return true; }
private boolean removeEdge(Edge e) { if (e.flag) return false; e.flag = true; changeOutDegree(e.source, -1); changeInDegree(e.target, -1); return true; }
private void removeSource(Node n, NodeList allSources) { for (int i = 0; i < n.outgoing.size(); i++) { Edge e = n.outgoing.getEdge(i); if (!e.flag) { e.flag = true; changeInDegree(e.target, -1); changeOutDegree(e.source, -1); Node target = e.target; if (allSources != null && isSource(target) && canBeRemoved(target)) { allSources.add(target); target.flag = true; } } } }
private void setCandidate(Edge e) { e.flag = true; }