/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ public Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ public synchronized Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ @Override public Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ public Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * Returns the vertices that have an incoming edge from the given vertex. * @param vertex The vertex. * @return The collection of vertices. */ public Collection getSuccessors(Object vertex) { return delegate.getSuccessors(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ @Override public synchronized Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getSuccessors(java.lang.Object) */ @Override public Collection<V> getSuccessors(V vertex) { return delegate.getSuccessors(vertex); }
/** * Returns the children of {@code v}. */ @Override public Collection<V> getChildren(V v) { return delegate.getSuccessors(v); }
/** * @param v the vertex whose children are to be returned * @return the children of {@code v}. */ public Collection<V> getChildren(V v) { return delegate.getSuccessors(v); }
public Collection<V> getSuccessors(V vertex) { return graph.getSuccessors(vertex); } public int getVertexCount() {
private int calculateDimensionX(V v) { int size = 0; int childrenNum = graph.getSuccessors(v).size(); if (childrenNum != 0) { for (V element : graph.getSuccessors(v)) { size += calculateDimensionX(element) + distX; } } size = Math.max(0, size - distX); basePositions.put(v, size); return size; }
private int calculateDimensionX(V v) { int size = 0; int childrenNum = graph.getSuccessors(v).size(); if (childrenNum != 0) { for (V element : graph.getSuccessors(v)) { size += calculateDimensionX(element) + distX; } } size = Math.max(0, size - distX); basePositions.put(v, size); return size; }
/** * get the immediate children nodes of the passed parent */ @Override public Collection<V> getChildren(V parent) { if (!delegate.containsVertex(parent)) { return null; } return delegate.getSuccessors(parent); }
/** * get the immediate children nodes of the passed parent */ public Collection<V> getChildren(V parent) { if (!delegate.containsVertex(parent)) return null; return delegate.getSuccessors(parent); }
/** * Returns the set of nodes reachable from a given node. * * @param node Node * @return Collection of reachable nodes */ public Collection<Node> getNeighbors(Node node) { return Collections.unmodifiableCollection(getGraph_JUNG().getSuccessors(node)); }
private void buildTree(V v, int x) { if (!alreadyDone.contains(v)) { alreadyDone.add(v); //go one level further down this.m_currentPoint.y = (levelMap.get(v) + 1) * this.distY; this.m_currentPoint.x = x; this.setCurrentPositionFor(v); int sizeXofCurrent = basePositions.get(v); int lastX = x - sizeXofCurrent / 2; int sizeXofChild; int startXofChild; for (V element : graph.getSuccessors(v)) { sizeXofChild = this.basePositions.get(element); startXofChild = lastX + sizeXofChild / 2; buildTree(element, startXofChild); lastX = lastX + sizeXofChild + distX; } this.m_currentPoint.y -= this.distY; } }
private void buildTree(V v, int x) { if (!alreadyDone.contains(v)) { alreadyDone.add(v); //go one level further down this.m_currentPoint.y = (levelMap.get(v) + 1) * this.distY; this.m_currentPoint.x = x; this.setCurrentPositionFor(v); int sizeXofCurrent = basePositions.get(v); int lastX = x - sizeXofCurrent / 2; int sizeXofChild; int startXofChild; for (V element : graph.getSuccessors(v)) { sizeXofChild = this.basePositions.get(element); startXofChild = lastX + sizeXofChild / 2; buildTree(element, startXofChild); lastX = lastX + sizeXofChild + distX; } this.m_currentPoint.y -= this.distY; } }
/** * setRoot calculates the level of each vertex in the graph. Level 0 is * allocated to any vertex with no successors. Level n+1 is allocated to * any vertex whose successors' maximum level is n. */ public void setRoot(Graph<V,E> g) { numRoots = 0; for(V v : g.getVertices()) { Collection<V> successors = getGraph().getSuccessors(v); if (successors.size() == 0) { setRoot(v); numRoots++; } } }
/** * Calculates the level of each vertex in the graph. Level 0 is * allocated to each vertex with no successors. Level n+1 is allocated to * any vertex whose successors' maximum level is n. */ public void setRoot() { numRoots = 0; Graph<V, E> g = getGraph(); for(V v : g.getVertices()) { if (g.getSuccessors(v).isEmpty()) { setRoot(v); numRoots++; } } }
/** * Removes <code>vertex</code> from this tree. If * <code>remove_subtrees</code> is <code>true</code>, removes the subtrees * rooted at the children of <code>vertex</code>. Otherwise, leaves these * subtrees intact as new component trees of this forest. * * @param vertex * the vertex to remove * @param remove_subtrees * if <code>true</code>, remove the subtrees rooted at * <code>vertex</code>'s children * @return <code>true</code> iff the tree was modified */ public boolean removeVertex(V vertex, boolean remove_subtrees) { if (!delegate.containsVertex(vertex)) { return false; } if (remove_subtrees) { for (V v : new ArrayList<V>(delegate.getSuccessors(vertex))) { removeVertex(v, true); } } return delegate.removeVertex(vertex); }