/**
  * g must form a circuit
  *
  * @param g a directed graph variable
  * @return a circuit constraint
  */
 public static Constraint circuit(IDirectedGraphVar g) {
   if (g.getMandatoryNodes().getSize() == g.getNbMaxNodes()) {
     return hamiltonian_circuit(g);
   }
   return new Constraint(
       "circuit",
       new PropNodeDegree_AtLeast_Incr(g, Orientation.SUCCESSORS, 1),
       new PropNodeDegree_AtLeast_Incr(g, Orientation.PREDECESSORS, 1),
       new PropNodeDegree_AtMost_Incr(g, Orientation.SUCCESSORS, 1),
       new PropNodeDegree_AtMost_Incr(g, Orientation.PREDECESSORS, 1),
       new PropNbSCC(g, g.getSolver().ONE),
       new PropCircuit(g));
 }