27 int[,] costs = { { 90, 75, 75, 80 }, { 35, 85, 55, 65 }, { 125, 95, 90, 105 }, { 45, 110, 95, 115 } };
28 int expectedCost = 275;
30 Assert.NotNull(minCostFlow);
31 for (
int source = 0; source < numSources; ++source)
33 for (
int target = 0; target < numTargets; ++target)
39 for (
int source = 0; source < numSources; ++source)
43 for (
int target = 0; target < numTargets; ++target)
50 Assert.Equal(expectedCost, totalFlowCost);
58 int[] tails = { 0, 0, 0, 0, 1, 2, 3, 3, 4 };
59 int[] heads = { 1, 2, 3, 4, 3, 4, 4, 5, 5 };
60 int[] capacities = { 5, 8, 2, 0, 4, 5, 6, 0, 4 };
61 int[] expectedFlows = { 4, 4, 2, 0, 4, 4, 0, 6, 4 };
62 int expectedTotalFlow = 10;
64 Assert.NotNull(maxFlow);
65 for (
int i = 0; i < numArcs; ++i)
74 Assert.Equal(expectedTotalFlow, totalFlow);
76 Assert.Equal(numArcs, maxFlow.
NumArcs());
77 for (
int i = 0; i < numArcs; ++i)
79 Assert.Equal(maxFlow.
Flow(i), expectedFlows[i]);