Experimental Study 2
Experimental Study 2
Ruosi Li
k=4 k=8 k = 12 k = 16 k = 24 k = 32
Num of Calls(findPath) 129 1025 3457 8193 27649 65537
Total Time 0.00s 0.03s 0.14s 0.47s 2.70s 9.75s
We have 2k paths group(each red line presents one paths group), and each group has k 2 augmenting path with capacity
1. So the total number of the augmenting paths is 2k × k 2 = 2k 3 And 1 comes from the last test of findPath which
1
returns false.
3. Does the overall running time grow at the rate of you would expect based on the assertion in the notes
that the running time grows in proportion to n5 ? Explain
In the bad-case, we have:
so we have n ≈ 18k, and the running time should be proportion to k 5 . Plot the time which is shown as below:
Second Series:
2
2. How do the worst-case values for the number of augmenting paths compare to the experimental values?
Discuss the differences you observe.
The experimental values are much smaller than the worst-case value for the number of augmenting paths. Because for
the worst case, each time we only have an augmenting path with capacity 1, we can only add 1 to the flow. But for
the random case, the mean edge capacity is 100, which means we can always find an augmenting path with capacity
much larger than 1. In this way, the number of augmenting path will be much smaller.
3. Consider that rate at which the number of augmenting paths grows as you increase n and/or m in each
of the two cases. How does this compare with what you would expect from the worst-case analysis
We can see from the graphs the number of augmenting path grows in proportion to n and m
For the first series, when we increase n we also increase m and mss(the number of source/sink edges)
As we increase the number of edges we added, the number of augmenting path decreases. Since the capacity of each
edge we add are randomly assigned from range [1, C], where C is the maximum capacity(in this case it is k 3 = 4096),
it could be large. If the added edge connects any vertex in the chains from source to any vertex in the chains from the
sink, and skip the bipartite graph in the middle, it will create an augmenting path with very large capacity. This will
significantly reduce the number of augmenting paths needed to find the maxflow.
3
2. Source Code
// usage:
// randExtend r k
// r is the number of random modifications to this graph
// k is the number of vertices pairs we select at each modification
#include "stdinc.h"
#include "flograph.h"
#include "shortPath.h"