Package org.jgrapht.graph

Examples of org.jgrapht.graph.DirectedSubgraph


    }

    //if (!supp.isEmpty()) {
    // Now find a cycle in the subgraph created by supp:
    DirectedGraph<GroundLiteral, DefaultEdge> subGraph =
        new DirectedSubgraph(getDependencyGraph(), supp, getDependencyGraph().edgeSet());
    // For some reason getDependencyGraph().edgeSet() does not work in the constructor
    // of DirectedSubraph, it returns an empty set instead of the subgraph with all of its
    // edges, hence we manually fill the edge set:
    DirectedGraph<GroundLiteral, DefaultEdge> depGraph = getDependencyGraph();


    for (DefaultEdge e : depGraph.edgeSet()) {
      if (supp.contains(depGraph.getEdgeSource(e)) && supp.contains(depGraph.getEdgeTarget(e))) {
        subGraph.addEdge(depGraph.getEdgeSource(e), depGraph.getEdgeTarget(e));
      }
    }

    //System.out.println(supp);

    StrongConnectivityInspector connInsp =
        new StrongConnectivityInspector(subGraph);

    List<Set<GroundLiteral>> tempLoopSet = connInsp.stronglyConnectedSets();
    List<Set<GroundLiteral>> loopSet = new ArrayList<Set<GroundLiteral>>();

    // Check whether the singleton strongly connected components are truly cycles
    for (Set<GroundLiteral> loop : tempLoopSet) {
      if (loop.size() == 1) {
        Iterator<GroundLiteral> it = loop.iterator();
        GroundLiteral l = it.next();
        if (subGraph.containsEdge(l, l)) {
          loopSet.add(loop);
        }
      } else {
        loopSet.add(loop);
      }
View Full Code Here


            if(n.stateInfo!=null) {
                State s = n.stateInfo.spec.stateFactory.makeState(conf, context, context.getThisTaskIndex(), thisComponentNumTasks);
                context.setTaskData(n.stateInfo.id, s);
            }
        }
        DirectedSubgraph<Node, Object> subgraph = new DirectedSubgraph(_graph, _nodes, null);
        TopologicalOrderIterator it = new TopologicalOrderIterator<Node, Object>(subgraph);
        int stateIndex = 0;
        while(it.hasNext()) {
            Node n = (Node) it.next();
            if(n instanceof ProcessorNode) {
View Full Code Here

            if(n.stateInfo!=null) {
                State s = n.stateInfo.spec.stateFactory.makeState(conf, context, context.getThisTaskIndex(), thisComponentNumTasks);
                context.setTaskData(n.stateInfo.id, s);
            }
        }
        DirectedSubgraph<Node, Object> subgraph = new DirectedSubgraph(_graph, _nodes, null);
        TopologicalOrderIterator it = new TopologicalOrderIterator<Node, Object>(subgraph);
        int stateIndex = 0;
        while(it.hasNext()) {
            Node n = (Node) it.next();
            if(n instanceof ProcessorNode) {
View Full Code Here

TOP

Related Classes of org.jgrapht.graph.DirectedSubgraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.