/*************************/ // Algorithm for computing table values /*************************/ // Returns the optimal value given a sigma,rho problem, and a binary decomposition tree of a graph public int Compute(IOptimal optimum, SigmaRhoInstance sigmaRhoInstance) { SigmaRhoInstance = sigmaRhoInstance; Optimum = optimum; // Initialize the static parameters for our D-Neighborhoods class, i.e. the parameters that tell us how many neighbor we should check // in order to validate a sigma-rho set dNeighborhood.Initialize(sigmaRhoInstance); // Compute the full table of representatives // Cuts[A] gives us a list of all D-representatives at cut G(A, V\A)) Cuts = new RepresentativeTable(Graph, Tree); // Initialize the empty table Tables = new Dictionary<BitSet, Table>(); // Fill the entire table in a bottom up fashion FillTable(Graph.Vertices); // The final result will be found at T[V][empty, empty], since there is only one equivalence class at the root of the decomposition tree (namely the empty set) BitSet emptySet = new BitSet(0, Graph.Size); return Tables[Graph.Vertices][emptySet, emptySet]; }
/*************************/ // General methods /*************************/ // Calculating the boolean dimension is done by computing all representatives private long CalculateBooleanWidth() { dNeighborhood.Initialize(new IndependentSet(2)); RepresentativeTable cuts = new RepresentativeTable(Graph, Tree); return cuts.MaxDimension; }