public Collection<Edge> getLeavingEdgeSet() { ArrayList<Edge> l; Iterator<Edge> it; elementLock.lock(); sg.elementLock.lock(); l = new ArrayList<Edge>(wrappedElement.getOutDegree()); it = wrappedElement.<Edge> getEachLeavingEdge().iterator(); while (it.hasNext()) l.add(sg.getEdge(it.next().getIndex())); sg.elementLock.unlock(); elementLock.unlock(); return l; }
public Collection<Edge> getLeavingEdgeSet() { ArrayList<Edge> l; Iterator<Edge> it; elementLock.lock(); sg.elementLock.lock(); l = new ArrayList<Edge>(wrappedElement.getOutDegree()); it = wrappedElement.<Edge> getEachLeavingEdge().iterator(); while (it.hasNext()) l.add(sg.getEdge(it.next().getIndex())); sg.elementLock.unlock(); elementLock.unlock(); return l; }
/** * Internal method call in computation. * * @param v */ protected void strongConnect(Node v) { NodeData nd = new NodeData(); data.put(v, nd); nd.index = index; nd.lowlink = index; index++; S.push(v); for (Edge vw : v.getEachLeavingEdge()) { Node w = vw.getOpposite(v); if (!data.containsKey(w)) { strongConnect(w); nd.lowlink = Math.min(nd.lowlink, data.get(w).lowlink); } else if (S.contains(w)) { nd.lowlink = Math.min(nd.lowlink, data.get(w).index); } } if (nd.index == nd.lowlink) { Node w; Object currentSCCIndex = sccIndex.nextIndex(); do { w = S.pop(); w.setAttribute(sccAttribute, currentSCCIndex); } while (w != v); } }
/** * Internal method call in computation. * * @param v */ protected void strongConnect(Node v) { NodeData nd = new NodeData(); data.put(v, nd); nd.index = index; nd.lowlink = index; index++; S.push(v); for (Edge vw : v.getEachLeavingEdge()) { Node w = vw.getOpposite(v); if (!data.containsKey(w)) { strongConnect(w); nd.lowlink = Math.min(nd.lowlink, data.get(w).lowlink); } else if (S.contains(w)) { nd.lowlink = Math.min(nd.lowlink, data.get(w).index); } } if (nd.index == nd.lowlink) { Node w; Object currentSCCIndex = sccIndex.nextIndex(); do { w = S.pop(); w.setAttribute(sccAttribute, currentSCCIndex); } while (w != v); } }
@SuppressWarnings("unchecked") public T next() { if (qHead >= qTail) throw new NoSuchElementException(); Node current = queue[qHead++]; int level = depth[current.getIndex()] + 1; Iterable<Edge> edges = directed ? current.getEachLeavingEdge() : current.getEachEdge(); for (Edge e : edges) { Node node = e.getOpposite(current); int j = node.getIndex(); if (depth[j] == -1) { queue[qTail++] = node; depth[j] = level; } } return (T)current; }
@SuppressWarnings("unchecked") public T next() { if (qHead >= qTail) throw new NoSuchElementException(); Node current = queue[qHead++]; int level = depth[current.getIndex()] + 1; Iterable<Edge> edges = directed ? current.getEachLeavingEdge() : current.getEachEdge(); for (Edge e : edges) { Node node = e.getOpposite(current); int j = node.getIndex(); if (depth[j] == -1) { queue[qTail++] = node; depth[j] = level; } } return (T)current; }
private void visitNode(Node node, int[] marks) { int mark = marks[node.getIndex()]; if (mark == MARK_TEMP) { throw new GraphHasCycleException(); } else if (mark == MARK_UNMARKED) { marks[node.getIndex()] = MARK_TEMP; for (Edge edge : node.getEachLeavingEdge()) { visitNode(edge.getOpposite(node), marks); } marks[node.getIndex()] = MARK_PERM; sortedNodes[index] = node; index--; } }
if (dataU.edgeFromParent != null) edgeOn(dataU.edgeFromParent); for (Edge e : u.getEachLeavingEdge()) { Node v = e.getOpposite(u); Data dataV = v.getAttribute(resultAttribute);
if (dataU.edgeFromParent != null) edgeOn(dataU.edgeFromParent); for (Edge e : u.getEachLeavingEdge()) { Node v = e.getOpposite(u); Data dataV = v.getAttribute(resultAttribute);