Exemplo n.º 1
0
        public void GetMaxFlowTest_FourVertex_CorrectMaxFlow()
        {
            var endmondKarp = new EdmondKarp.EdmondKarp();

            var startName = "S";

            var endName = "T";

            var actual = endmondKarp.GetMaxFlow(avlTree, startName, endName);

            var expected = 9;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Write("Enter path to file: ");
            var pathToFile = Console.ReadLine();

            try
            {
                var fileManager = new FileManager();
                var avlTree     = fileManager.GetAVL(pathToFile);
                var startCity   = "S";
                var endCity     = "T";
                var edmondKarp  = new EdmondKarp();
                var maxFlow     = edmondKarp.GetMaxFlow(avlTree, startCity, endCity);

                Console.WriteLine($"maximum network flow: {maxFlow}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }