My task is to calculate the maximum throughput in a graph.
The easiest way to describe a graph is int[][]. The internal array is the nodes in the graph, and the external array is the distance connecting each node in the graph, for example:
new int[][] {
{0, 5, 0, 0},
{0, 0, 4, 0},
{0, 0, 0, 8},
{0, 0, 0, 0}
}
So, to get from node 0(source) to node 3(destination, “maximum throughput” will be 4 per turn, because:
- 5 packets can go from node from 0 to node 1
- 4 packages can go from node 1 to node 2
- 8 packages can go from node 2 to node 3
On a per-turn basis, the bottleneck is between node 1and node 2, where the maximum throughput is 4.
- , " " int[][] source destination ?
"" " ", "".
"".