-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPushRelabelTests.cs
More file actions
47 lines (38 loc) · 1.14 KB
/
PushRelabelTests.cs
File metadata and controls
47 lines (38 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using AlgorithmsAndDataStructures.Algorithms.Graph.MaximumFlow;
using Xunit;
namespace AlgorithmsAndDataStructures.Tests.Algorithm.Graph.MaxFlow;
public class PushRelabelTests
{
[Fact]
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));
}
[Fact]
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));
}
}