public Digraph contract(Digraph contractedDigraph) { return contract(contractedDigraph, null); }
public Object next() { Collection component = buildStronglyConnectedComponent(); if (dfsStack.isEmpty()) runDirectDFS(); return component; }
StrongConnection contractor = new StrongConnection( pkDependencyGraph, CollectionFactory.ARRAYLIST_FACTORY); Digraph contractedDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY); contractor.contract(contractedDigraph, CollectionFactory.ARRAYLIST_FACTORY); IndegreeTopologicalSort sorter = new IndegreeTopologicalSort( contractedDigraph);
private boolean runDirectDFS() { dfsStack.clear(); reverseDFSFilter.seenVertices.clear(); Object root = nextDFSRoot(); if (root == null) return false; if (directDfs == null) directDfs = new DepthFirstStampSearch(filteredDigraph, root); else directDfs.reset(root); int stamp; Object vertex; while (directDfs.hasNext()) { vertex = directDfs.next(); stamp = directDfs.getStamp(); if (stamp == DepthFirstStampSearch.SHRINK_STAMP || stamp == DepthFirstStampSearch.LEAF_STAMP) { //if (seen.add(vertex)) { dfsStack.push(vertex); reverseDFSFilter.seenVertices.add(vertex); //} } } seen.addAll(dfsStack); return true; }
public StrongConnection(DigraphIteration digraph, CollectionFactory componentFactory) { this.digraph = digraph; this.componentFactory = componentFactory; filteredDigraph = new FilterIteration(digraph, new NotSeenPredicate(), GraphUtils.TRUE_PREDICATE); reverseDigraph = new FilterIteration(new ReversedIteration(digraph), reverseDFSFilter, GraphUtils.TRUE_PREDICATE); vertexIterator = filteredDigraph.vertexIterator(); runDirectDFS(); } public boolean hasNext() {
StrongConnection contractor = new StrongConnection( pkDependencyGraph, CollectionFactory.ARRAYLIST_FACTORY); Digraph contractedDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY); contractor.contract(contractedDigraph, CollectionFactory.ARRAYLIST_FACTORY); IndegreeTopologicalSort sorter = new IndegreeTopologicalSort( contractedDigraph);
StrongConnection contractor = new StrongConnection( referentialDigraph, CollectionFactory.ARRAYLIST_FACTORY); contractedReferentialDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY); contractor.contract( contractedReferentialDigraph, CollectionFactory.ARRAYLIST_FACTORY);
StrongConnection contractor = new StrongConnection( referentialDigraph, CollectionFactory.ARRAYLIST_FACTORY); contractedReferentialDigraph = new MapDigraph(MapDigraph.HASHMAP_FACTORY); contractor.contract( contractedReferentialDigraph, CollectionFactory.ARRAYLIST_FACTORY);