/// <summary>
        /// asserts that the treewidth that the algorithm finds is the graph's actual treewidth
        /// </summary>
        /// <param name="g">the graph to test</param>
        /// <param name="treewidth">the graph's actual tree width</param>
        private void AssertCorrectTreewidth(Graph g, int treewidth)
        {
            Treewidth.completeHeuristically                   = false;
            Treewidth.moreThan2ComponentsOptimization         = true;
            Treewidth.keepOnlyPTDsWithLargerInletIfSameOutlet = true;
            Treewidth.testOutletIsCliqueMinor                 = true;
            PTD.testIfAddingOneVertexToBagFormsPMC            = false;
            ImmutableGraph h = new ImmutableGraph(g);   // copy for check if treewidth is correct

            Assert.AreEqual(treewidth, Treewidth.TreeWidth(g, out PTD output));

            output.AssertValidTreeDecomposition(h);
        }
        private static int Run(string filepath, bool printTD = true, bool printStats = true)
        {
            Graph g = new Graph(filepath);

            Stopwatch stopwatch = new Stopwatch();

            SafeSeparator.size3SeparationStopwatch       = new Stopwatch();
            SafeSeparator.size3separators                = 0;
            SafeSeparator.cliqueSeparatorStopwatch       = new Stopwatch();
            SafeSeparator.cliqueSeparators               = 0;
            SafeSeparator.almostCliqueSeparatorStopwatch = new Stopwatch();
            SafeSeparator.almostCliqueSeparators         = 0;
            stopwatch.Start();
            int treeWidth = Treewidth.TreeWidth(g, out PTD output, printTD);

            stopwatch.Stop();

            if (printTD)
            {
                output.Print();
            }

            if (printStats)
            {
                Console.WriteLine("Tree decomposition of {0} found in {1} time. Treewidth is {2}.\n" +
                                  "Found {3} size 3 separators in {4} total time.\n" +
                                  "Found {5} clique Separators in {6} total time.\n" +
                                  "Found {7} almost clique separators in {8} total time.\n",
                                  filepath, stopwatch.Elapsed, treeWidth, SafeSeparator.size3separators, SafeSeparator.size3SeparationStopwatch.Elapsed,
                                  SafeSeparator.cliqueSeparators - SafeSeparator.almostCliqueSeparators, SafeSeparator.cliqueSeparatorStopwatch.Elapsed - SafeSeparator.almostCliqueSeparatorStopwatch.Elapsed,
                                  SafeSeparator.almostCliqueSeparators, SafeSeparator.almostCliqueSeparatorStopwatch.Elapsed);
            }
            g = new Graph(filepath);
            output.AssertValidTreeDecomposition(new ImmutableGraph(g));
            return(treeWidth);
        }