// // Small test to generate isomorphs of a graph (automorph?) // // key generator is // - f[i] = x is mapping/renaming of vertex i as vertex x, consequently // - if f[i] = x and f[j] = y then A[x][y] = adj[i][j] // // to make canonical the renaming must produce a "minimal" adjacency matrix A // import java.io.File; import java.io.IOException; import java.util.Scanner; import org.chocosolver.solver.*; import org.chocosolver.solver.variables.*; import org.chocosolver.solver.constraints.*; public class Canonical { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File(args[0])); int n = sc.nextInt(); // vertices Solver solver = new Solver("canonical"); IntVar[] f = VF.enumeratedArray("f",n,0,n-1,solver); // n variables with values 0 to n-1 IntVar[][] A = VF.enumeratedMatrix("A",n,n,0,1,solver); // adjacency matrix int [][] adj = new int[n][n]; while (sc.hasNext()){ int i = sc.nextInt(); int j = sc.nextInt(); adj[i][j] = adj[j][i] = 1; } sc.close(); // // read in edges // for (int i=0;i