public void PushRelabel_Smoke_Test() { var graph = new WeightedDiGraph <char, int>(); graph.AddVertex('S'); graph.AddVertex('A'); graph.AddVertex('B'); graph.AddVertex('C'); graph.AddVertex('D'); graph.AddVertex('T'); graph.AddEdge('S', 'A', 10); graph.AddEdge('S', 'C', 10); graph.AddEdge('A', 'B', 4); graph.AddEdge('A', 'C', 2); graph.AddEdge('A', 'D', 8); graph.AddEdge('B', 'T', 10); graph.AddEdge('C', 'D', 9); graph.AddEdge('D', 'B', 6); graph.AddEdge('D', 'T', 10); var algo = new PushRelabelMaxFlow <char, int>(new PushRelabelOperators()); var result = algo.ComputeMaxFlow(graph, 'S', 'T'); Assert.AreEqual(result, 19); }
public void PushRelabel_AdjacencyMatrixGraph_Smoke_Test() { var graph = new Advanced.Algorithms.DataStructures.Graph.AdjacencyMatrix.WeightedDiGraph <char, int>(); graph.AddVertex('S'); graph.AddVertex('A'); graph.AddVertex('B'); graph.AddVertex('C'); graph.AddVertex('D'); graph.AddVertex('T'); graph.AddEdge('S', 'A', 10); graph.AddEdge('S', 'C', 10); graph.AddEdge('A', 'B', 4); graph.AddEdge('A', 'C', 2); graph.AddEdge('A', 'D', 8); graph.AddEdge('B', 'T', 10); graph.AddEdge('C', 'D', 9); graph.AddEdge('D', 'B', 6); graph.AddEdge('D', 'T', 10); var algorithm = new PushRelabelMaxFlow <char, int>(new PushRelabelOperators()); var result = algorithm.ComputeMaxFlow(graph, 'S', 'T'); Assert.AreEqual(result, 19); }