@Override public String writeServiceGraph(final ServiceTree serviceTree) { final StringBuilder textGraph = new StringBuilder().append(String.format("%n")); final DepthFirstIterator<IServiceTreeVertex<?>, DefaultEdge> dfs = new DepthFirstIterator<>(serviceTree, serviceTree.getRoot()); // Walk the graph depth-first and use the service tree listener // to create a text representation of the service tree final TextServiceTreeListener listener = new TextServiceTreeListener(serviceTree, textGraph); dfs.addTraversalListener(listener); while (dfs.hasNext()) { dfs.next(); } return textGraph.toString(); }
private void addTrapsToGraph() { DepthFirstIterator<FlowElement, Scope> iterator = getDepthFirstIterator(); while( iterator.hasNext() ) { FlowElement element = iterator.next(); if( !( element instanceof Pipe ) ) continue; Pipe pipe = (Pipe) element; Tap trap = traps.get( pipe.getName() ); if( trap == null ) continue; addVertex( trap ); if( LOG.isDebugEnabled() ) LOG.debug( "adding trap edge: " + pipe + " -> " + trap ); if( getEdge( pipe, trap ) != null ) continue; addEdge( pipe, trap ).setName( pipe.getName() ); // name scope after previous pipe } }
DepthFirstIterator<V, DefaultEdge> dfsIt = new DepthFirstIterator<>(mst, start); while (dfsIt.hasNext()) { V v = dfsIt.next(); if (found.add(v)) { tour.add(v);
/** * Graph edges may not be named "." or ".." and any non-root node has exactly * one incoming edge. */ private static void checkEdgeInvariants( final CatalogDirectoryNode root, final UnmodifiableGraph<CatalogNodeType, CatalogDirectoryEntry> g) { final DepthFirstIterator<CatalogNodeType, CatalogDirectoryEntry> di = new DepthFirstIterator<>(g); while (di.hasNext()) { final CatalogNodeType k = di.next(); final Set<CatalogDirectoryEntry> ie = g.incomingEdgesOf(k); if (k.equals(root)) { Assert.assertEquals(0L, (long) ie.size()); } else { Assert.assertEquals(1L, (long) ie.size()); final CatalogDirectoryEntry ee = ie.iterator().next(); Assert.assertNotEquals(".", ee.getName()); Assert.assertNotEquals("..", ee.getName()); } } }
final List< Spot > branch = depthFirstIterator.next();
final List< Spot > branch = depthFirstIterator.next();
Action a = iterator.next(); Action transition = getTransition(workflowGraph, a); switch (a.getType()) {