}
//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);
}