public void AlgoTest_IsFullMatchBicupsidGraph_False_NotFullMatch() { var graph = Factory.BuildBicupsidGraph(new StringReader(Test4)); var result = Algo.IsFullMatchBicupsidGraph(graph); Assert.IsFalse(result.Item1); Assert.AreEqual(2, result.Item2.First().Item1); }
static void Main(string[] args) { using (var reader = new StreamReader("in.txt")) { var graph = Factory.BuildBicupsidGraph(reader); var result = Algo.IsFullMatchBicupsidGraph(graph); var writer = new StreamWriter("out.txt"); Reporter.Report(writer, result.Item1, result.Item2); writer.Flush(); writer.Dispose(); } }
public void AlgoTest_IsFullMatchBicupsidGraph_True_1() { var graph = Factory.BuildBicupsidGraph(new StringReader(Test2)); var result = Algo.IsFullMatchBicupsidGraph(graph); var expected = new[] { Tuple.Create(1, 1), Tuple.Create(2, 3), Tuple.Create(3, 2), }; Assert.IsTrue(result.Item1, "Is full match"); Assert.IsTrue(result.Item2.SequenceEqual(expected)); }
public void AlgoTest_MaxFlow() { var graph = Factory.BuildBicupsidGraph(new StringReader(Test1)); var network = Factory.BuildOneThroughputNetwork(graph); var flow = Algo.MaxFlow(network); var expectedEdges = new TestFlow { { Tuple.Create(0, 1), 1 }, { Tuple.Create(0, 2), 1 }, { Tuple.Create(1, 3), 1 }, { Tuple.Create(2, 5), 1 }, { Tuple.Create(3, 6), 1 }, { Tuple.Create(5, 6), 1 }, }; Assert.AreEqual(2, flow.Value); Assert.IsTrue(Equals(expectedEdges, flow)); }