Search in sources :

Example 1 with StrongConnectivityInspector

use of org.jgrapht.alg.StrongConnectivityInspector in project graal by graphik-team.

the class GraphPositionDependencies method initFiniteRank.

public void initFiniteRank() {
    if (this.isFiniteRank == null) {
        this.isFiniteRank = new TreeSet<PredicatePosition>();
        StrongConnectivityInspector<PredicatePosition, DefaultEdge> sccInspector = new StrongConnectivityInspector<PredicatePosition, DefaultEdge>(graph);
        List<Set<PredicatePosition>> sccList = sccInspector.stronglyConnectedSets();
        for (Set<PredicatePosition> scc : sccList) {
            boolean componentIsFiniteRank = true;
            for (PredicatePosition p1 : scc) {
                for (PredicatePosition p2 : scc) {
                    for (DefaultEdge edge : graph.getAllEdges(p1, p2)) {
                        if (edge instanceof SpecialEdge) {
                            componentIsFiniteRank = false;
                        }
                    }
                }
            }
            // store information
            if (componentIsFiniteRank) {
                for (PredicatePosition p : scc) {
                    this.isFiniteRank.add(p);
                }
            }
        }
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) StrongConnectivityInspector(org.jgrapht.alg.StrongConnectivityInspector) DefaultEdge(org.jgrapht.graph.DefaultEdge) PredicatePosition(fr.lirmm.graphik.graal.rulesetanalyser.util.PredicatePosition)

Aggregations

PredicatePosition (fr.lirmm.graphik.graal.rulesetanalyser.util.PredicatePosition)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 StrongConnectivityInspector (org.jgrapht.alg.StrongConnectivityInspector)1 DefaultEdge (org.jgrapht.graph.DefaultEdge)1