Example #1
0
 public void Init()
 {
     _tg = new TwinGraph();
     _k  = new ABVertexStack();
     _v1 = new ABVertex(VertexType.A, _tg);
     _v2 = new ABVertex(VertexType.B, _tg);
 }
Example #2
0
        static void Main(string[] args)
        {
            var lh = new LoggingHelper();

            lh.ClearLogFile();
            log.Info("=====================================================================");
            var tg = ExampleGraph.GenerateExampleTwinGraph0();

            tg.LogVertices();
            tg.LogArcs();
            _mAugmentingPath = new LinkedList <Arc>();
            var i = 0;
            var _mAugmentingPaths = new LinkedList <LinkedList <Arc> >();

            while (true)
            {
                i++;
                log.Info("ITERATION " + i + " =============================================");
                var k    = new ABVertexStack();
                var l    = new LinkedList <ABVertex>();
                var mdfs = new MDFS(tg, k, l);
                MDFS._step = 0;

                _mAugmentingPath = mdfs.Run();
                if (_mAugmentingPath == null)
                {
                    break;
                }
                _mAugmentingPaths.AddLast(_mAugmentingPath);
                tg.SymmetricDifferenceWith(_mAugmentingPath);
                tg.LogArcs();
                tg.LogVertices();
            }
            LogPaths(_mAugmentingPaths);
        }
Example #3
0
        static void Main(string[] args)
        {
            var lh = new LoggingHelper();

            lh.ClearLogFile();
            Log.Info("=====================================================================");
            var       g0     = ExampleWeightedGraph.GenerateExampleWeightedTwinGraph2();
            TwinGraph g0Star = GenerateG0StarFrom(g0);

            _mAugmentingPath = new LinkedList <Arc>();
            var i = 0;
            var mAugmentingPaths = new LinkedList <LinkedList <Arc> >();

            while (true)
            {
                i++;
                Log.Info("ITERATION " + i + " =============================================");
                var k     = new ABVertexStack();
                var l     = new LinkedList <ABVertex>();
                var mdfsw = new MDFSW(g0Star, k, l);
                MDFSW._step = 0;

                _mAugmentingPath = mdfsw.Run();
                if (_mAugmentingPath == null)
                {
                    //Extension step instead of breaking
                    break;
                }
                mAugmentingPaths.AddLast(_mAugmentingPath);
                g0Star.SymmetricDifferenceWith(_mAugmentingPath);

                g0Star.LogArcsWeighted();
                g0Star.LogVerticesWeighted();
            }
            LogPaths(mAugmentingPaths);
        }