import java.util.*; import java.io.*; public class SIP0 { long nodes; // number of decisions long timeLimit; // milliseconds long cpuTime; // milliseconds int[] solution; // as it says boolean matched; // is there a matching? boolean trace; // trace, anyone for trace? boolean timeout; // true if timed out boolean firstSolution; // only wanting 1st solution? boolean verbose; // want solution displayed? boolean induced; // induced or (default) partial? int solutions; // number of solutions found int fails; // something like a failed node Graph P; // the pattern graph Graph T; // the target graph SIP0 (String fnameP,String fnameT) throws IOException { P = new Graph(fnameP); T = new Graph(fnameT); nodes = cpuTime = solutions = fails = 0; matched = trace = timeout = firstSolution = verbose = induced = false; solution = new int[P.n]; } Variable select(Variable[] U){ int smallest = 0; for (int i=1;i uLabel,ArrayList vLabel){ if (uLabel.size() > vLabel.size()) return false; for (int i=0;i vLabel.get(i)) return false; return true; } // // a vertex in the pattern graph with the label uLabel // is compatible with a vertex in the target graph with vLabel // if uLabel is subsumed by vLabel, where a label is neighbourhood degree sequence // void solve(){ cpuTime = System.currentTimeMillis(); Variable[] U = new Variable[P.n]; for (int i=0;i 0 && System.currentTimeMillis() - cpuTime >= timeLimit) throw new TimeOutException(); int n = U.length; if (n == 0){solutions++; if (verbose) display(); return firstSolution;} nodes++; Variable[] newU = new Variable[n-1]; Variable u = select(U); boolean consistent = false; for (int i = u.domain.nextSetBit(0);i>=0 && !consistent;i=u.domain.nextSetBit(i+1)){ consistent = true; solution[u.index] = i; for (int j=0,k=0;j