nomis52.net
View Simon Newton's profile on LinkedIn

Algorithms 300 - Flow Networks

The algorithms 300 project this year was to build a simulator to calculate the maximum flow through a network. The simulator had to allow the user to select between either the Edmonds-Karp or the Relabel to Front algorithm. It wasn't supposed to have a graphical interface, but well, our's did :)

The flow network simulator

Anyway, here is our version. You'll need a grid file, in the following format:

4
0 1 3 4 
0 0 1 0 
0 0 0 2 
0 0 0 0

The first number is the number of vertices, the values in the grid are the weights between the vertices. The program will detect the source and sink vertices and account for multiple sources/sinks. Once the vertices are displayed on screen you can move them around by dragging.

Finally, when using the Edmonds-Karp algorithm, by clicking on a vertex you can change the weights of the outgoing edges. The simulator will account for the changes so that you don't have to restart the algorithm from the beginning (that was the bonus mark bit :)