/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ @Override public Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ public Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ public synchronized Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ @Override public synchronized Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ @Override public Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * @see edu.uci.ics.jung.graph.Graph#getInEdges(java.lang.Object) */ public Collection<E> getInEdges(V vertex) { return delegate.getInEdges(vertex); }
/** * Returns the incoming edges of the vertex. * @param vertex The vertx * @return The collection of edges. */ public Collection getInEdges(Object vertex) { return delegate.getInEdges(vertex); }
public Collection<E> getInEdges(V vertex) { return graph.getInEdges(vertex); } public int getNeighborCount(V vertex) {
private Set<V> getRoots() { Set<V> roots = graph.getVertices().stream() .filter(v -> graph.getInEdges(v).isEmpty()) // Preserve the order of the roots .collect(Collectors.toCollection(LinkedHashSet::new)); return roots; }
@Override public E getParentEdge(V vertex) { if (isRoot(vertex)) { return null; } return delegate.getInEdges(vertex).iterator().next(); }
private Set<V> getRoots() { Set<V> roots = graph.getVertices().stream() .filter(v -> graph.getInEdges(v).isEmpty()) // Preserve the order of the roots .collect(Collectors.toCollection(LinkedHashSet::new)); return roots; }
public E getParentEdge(V vertex) { if (isRoot(vertex)) return null; return delegate.getInEdges(vertex).iterator().next(); }
@Override public Iterable<GraphEdge<V, E>> incomingEdgesOf(V vertex) { try { // getInEdges blueprints impl throws null pointer exception final Collection<E> inEdges = graph.getInEdges(vertex); if (inEdges == null || inEdges.isEmpty()) { return Collections.emptyList(); } return adapt(inEdges); }catch(NullPointerException e){ return Collections.emptyList(); } } }
protected V findRoot(Graph<V,E> graph) { for(V v : graph.getVertices()) { if(graph.getInEdges(v).size() == 0) { return v; } } // if there is no obvious root, pick any vertex if(graph.getVertexCount() > 0) { return graph.getVertices().iterator().next(); } // this graph has no vertices return null; }
protected V findRoot(Graph<V, E> graph) { for (V v : graph.getVertices()) { if (graph.getInEdges(v).size() == 0) { return v; } } // if there is no obvious root, pick any vertex if (graph.getVertexCount() > 0) { return graph.getVertices().iterator().next(); } // this graph has no vertices return null; }
protected V findRoot(Graph<V,E> graph) { for(V v : graph.getVertices()) { if(graph.getInEdges(v).size() == 0) { return v; } } // if there is no obvious root, pick any vertex if(graph.getVertexCount() > 0) { return graph.getVertices().iterator().next(); } // this graph has no vertices return null; }
/** * Calculate the edge lengths between a node and its parents/children. */ protected double calcEdgeLengths(Graph graph, INode node, int layer, int pos) { double length = 0; for(Iterator it=graph.getInEdges(node).iterator(); it.hasNext(); ) { ReteEdge edge = (ReteEdge)it.next(); // System.out.println(edge); length += calcEdgeLength(edge, node, layer, pos); } for(Iterator it=graph.getOutEdges(node).iterator(); it.hasNext(); ) { ReteEdge edge = (ReteEdge)it.next(); // System.out.println(edge); length += calcEdgeLength(edge, node, layer, pos); } return length; }
protected void updateRankings() { for (V v : getVertices()) { Collection<E> incomingEdges = getGraph().getInEdges(v); double currentPageRankSum = 0; for (E e : incomingEdges) { double currentWeight = getEdgeWeight(e); currentPageRankSum += mPreviousRankingsMap.get(getGraph().getOpposite(v,e)).doubleValue()*currentWeight; } setCurrentRankScore(v,currentPageRankSum); } } }
protected void updateRankings() { for (V v : getVertices()) { Collection<E> incomingEdges = getGraph().getInEdges(v); double currentPageRankSum = 0; for (E e : incomingEdges) { double currentWeight = getEdgeWeight(e); currentPageRankSum += mPreviousRankingsMap.get(getGraph().getOpposite(v,e)).doubleValue()*currentWeight; } setCurrentRankScore(v,currentPageRankSum); } } }
public int getIndex(Graph<GUINode,GUILink> graph, GUILink e) { final GUINode u = e.getOriginNode(); final GUINode v = e.getDestinationNode(); final HashSet<GUILink> commonEdgeSet = new HashSet<>(graph.getInEdges(v)); commonEdgeSet.retainAll(graph.getOutEdges(u)); commonEdgeSet.removeIf(ee->!ee.isShownSeparated()); int count=0; for(GUILink other : commonEdgeSet) if (other == e) return count; else count ++; throw new RuntimeException(); } });