use of fr.lirmm.graphik.util.graph.DefaultHyperEdge in project graal by graphik-team.
the class BCCScheduler method constructHyperGraph.
/**
* The HyperGraph of variables of h. There is an hyper edge between a set of
* variables if they appear in a same atom.
*
* @param h
* @return the HyperGraph of variables of h.
*/
protected static HyperGraph constructHyperGraph(InMemoryAtomSet h, int nbVariables, Term[] inverseMap, Map<Term, Integer> map, Iterable<Term> ans) {
HyperGraph graph = new DefaultHyperGraph(nbVariables + 1);
CloseableIteratorWithoutException<Atom> it = h.iterator();
while (it.hasNext()) {
Atom a = it.next();
DefaultHyperEdge edge = new DefaultHyperEdge();
int arity = 0;
for (Variable t : a.getVariables()) {
++arity;
edge.addVertice(map.get(t));
}
if (arity >= 2) {
graph.add(edge);
}
}
return graph;
}
Aggregations