コード例 #1
0
ファイル: PushRelabelTests.cs プロジェクト: arst/AandDS
        public void BaselineWithHugeCapacity()
        {
            var sut   = new PushRelabel();
            var graph = new int[4][];

            for (var i = 0; i < graph.Length; i++)
            {
                graph[i] = new int[graph.Length];
            }

            graph[0][1] = 1;
            graph[0][2] = 100;
            graph[1][3] = 100;
            graph[1][2] = 100;
            graph[2][1] = 1;
            graph[2][3] = 1;

            Assert.Equal(3, sut.GetMaxFlow(graph));
        }
コード例 #2
0
ファイル: PushRelabelTests.cs プロジェクト: arst/AandDS
        public void Baseline()
        {
            var sut   = new PushRelabel();
            var graph = new int[6][];

            for (var i = 0; i < graph.Length; i++)
            {
                graph[i] = new int[graph.Length];
            }

            graph[0][1] = 16;
            graph[0][2] = 13;
            graph[1][2] = 10;
            graph[1][3] = 12;
            graph[2][1] = 4;
            graph[2][4] = 14;
            graph[3][2] = 9;
            graph[3][5] = 20;
            graph[4][3] = 7;
            graph[4][5] = 4;

            Assert.Equal(23, sut.GetMaxFlow(graph));
        }