public static <T> List<T> getChildren(DirectedGraph g, T n) { List<IndexedEdge> outgoing = new ArrayList(g.outgoingEdgesOf(n)); List<T> ret = new ArrayList(); for(IndexedEdge e: outgoing) { ret.add((T)e.target); } return ret; }
/** * Returns a set of all clickables outgoing from the specified vertex. * * @param stateVertix * the state vertix. * @return a set of the outgoing edges (clickables) of the stateVertix. * @see org.jgrapht.DirectedGraph#outgoingEdgesOf(Object) */ public Set<Eventable> getOutgoingClickables(StateVertex stateVertix) { return sfg.outgoingEdgesOf(stateVertix); }
@Override public Set< ? extends EE > edgesOf( final VV vertex ) { return graph.outgoingEdgesOf( vertex ); } }
@Override public Set< ? extends EE > edgesOf( final VV vertex ) { return graph.outgoingEdgesOf( vertex ); } }
public Set<DirectedEdge<ExecutableMethod>> outgoingEdgesOf(ExecutableMethod arg0) { return graph.outgoingEdgesOf(arg0); }
public Set<DirectedEdge<ExecutableMethod>> outgoingEdgesOf(ExecutableMethod arg0) { return graph.outgoingEdgesOf(arg0); }
public static <T> List<T> getChildren(DirectedGraph g, T n) { List<IndexedEdge> outgoing = new ArrayList(g.outgoingEdgesOf(n)); List<T> ret = new ArrayList(); for(IndexedEdge e: outgoing) { ret.add((T)e.target); } return ret; }
protected List<String> getEndVertices() { final List<String> endVertices = new ArrayList<>(); Set<String> vertices = _directedGraph.vertexSet(); for (String vertex : vertices) { Set<UpgradeProcessEdge> upgradeProcessEdges = _directedGraph.outgoingEdgesOf(vertex); if (upgradeProcessEdges.isEmpty()) { endVertices.add(vertex); } } return endVertices; }
/** * Fetch all of the dependencies of the given source vertex * @return mutable snapshot of the target vertices of all outgoing edges */ public static <V> Set<V> getOutgoingVertices(DirectedGraph<V, DefaultEdge> graph, V source) { Set<DefaultEdge> edges = graph.outgoingEdgesOf(source); Set<V> targets = new LinkedHashSet<V>(); for (DefaultEdge edge : edges) { targets.add(graph.getEdgeTarget(edge)); } return targets; }
public static Set outgoingEdgesOf(Graph g, Object node) { if (g instanceof DirectedGraph) { return ((DirectedGraph) g).outgoingEdgesOf(node); } else { return g.edgesOf(node); } }
/** * @param pageID The pageID of the category. * @return A set of child nodes of the given category. */ protected Set<Integer> __getChildren(int pageID) { Set<DefaultEdge> outgoingEdges = graph.outgoingEdgesOf(pageID); Set<Integer> outLinks = new HashSet<Integer>(); for (DefaultEdge edge : outgoingEdges) { outLinks.add(graph.getEdgeTarget(edge)); } return outLinks; }
/** * <p>outgoingEdgesOf</p> * * @param node a V object. * @return a {@link java.util.Set} object. */ public Set<E> outgoingEdgesOf(V node) { if (!containsVertex(node)) // should this just return null? throw new IllegalArgumentException( "node not contained in this graph"); // TODO hash set? can't be sure E implements hash correctly return new LinkedHashSet<E>(graph.outgoingEdgesOf(node)); }
/** * Find the leave vertices in the graph. I.E. Vertices that have no outgoing edges * @param graph graph to search * @return mutable snapshot of all leaf vertices. */ public static <V> Set<V> getLeafVertices(DirectedGraph<V, DefaultEdge> graph) { Set<V> vertexSet = graph.vertexSet(); Set<V> leaves = new HashSet<V>(vertexSet.size()*2); for (V vertex : vertexSet) { if (graph.outgoingEdgesOf(vertex).isEmpty()) { leaves.add(vertex); } } return leaves; }
public static Set<Node> getOutNeighbors(DirectedGraph<Node, DefaultLink> g, Node n) { Set<Node> neighbors = new HashSet<>(); if (g == null || n == null || !g.vertexSet().contains(n)) return neighbors; Set<DefaultLink> outgoingLinks = g.outgoingEdgesOf(n); if (outgoingLinks != null) { for (DefaultLink l : outgoingLinks) { neighbors.add(l.getTarget()); } } return neighbors; }
public void removeChilds(String dynamicRoot, String dynKey) { Iterator<DefaultEdge> iterator = graph.outgoingEdgesOf(dynamicRoot).iterator(); List<DefaultEdge> list = new ArrayList<DefaultEdge>(); while(iterator.hasNext()) { DefaultEdge edge = iterator.next(); String target = graph.getEdgeTarget(edge); if(target.startsWith(dynKey)) { list.add(edge); } } graph.removeAllEdges(list); }
public static <T> SetIterable<T> getDependentNodes(final DirectedGraph<T, DefaultEdge> graph, T vertex) { return SetAdapter.adapt(graph.outgoingEdgesOf(vertex)).collect(new Function<DefaultEdge, T>() { @Override public T valueOf(DefaultEdge e) { return graph.getEdgeTarget(e); } }); }
private static List<List<Stage>> findAllRunnablePaths(Stage start, DirectedGraph<Stage, Edge> graph) { List<List<Stage>> paths = new LinkedList<>(); if (graph.outDegreeOf(start) == 0) { List<Stage> path = new LinkedList<>(); path.add(start); paths.add(path); } else { for (Edge edge : graph.outgoingEdgesOf(start)) { List<List<Stage>> allPathsFromTarget = findAllRunnablePaths(edge.getTarget(), graph); for (List<Stage> path : allPathsFromTarget) { path.add(0, start); } paths.addAll(allPathsFromTarget); } } return paths; }
public static <T> SetIterable<T> getDependentNodes(final DirectedGraph<T, DefaultEdge> graph, T vertex) { return SetAdapter.adapt(graph.outgoingEdgesOf(vertex)).collect(new Function<DefaultEdge, T>() { @Override public T valueOf(DefaultEdge e) { return graph.getEdgeTarget(e); } }); }
private void collapseCycle(Set<ATermAppl> scc) { Iterator<ATermAppl> i = scc.iterator(); ATermAppl rep = i.next(); while( i.hasNext() ) { ATermAppl node = i.next(); addEquivalent( rep, node ); for( DefaultEdge edge : graph.incomingEdgesOf( node ) ) { ATermAppl incoming = graph.getEdgeSource( edge ); if( !incoming.equals( rep ) ) graph.addEdge( incoming, rep ); } for( DefaultEdge edge : graph.outgoingEdgesOf( node ) ) { ATermAppl outgoing = graph.getEdgeTarget( edge ); if( !outgoing.equals( rep ) ) graph.addEdge( rep, outgoing ); } graph.removeVertex( node ); } }
static public <V> BinaryRelation<V, V> getBinaryRelation(DirectedGraph<V, Edge<V>> source) { final BinaryRelation<V, V> relation = new BinaryRelationImpl<V, V>(); final Set<V> vertexSet = source.vertexSet(); for (V v : vertexSet) { final Set<Edge<V>> edges = source.outgoingEdgesOf(v); for (Edge<V> edge : edges) { final Pair<V, V> pair = Pair.create(edge.getSource(), edge.getTarget()); relation.asPairs().add(pair); } } return relation; }