Can somebody please help me out with this problem? The solution is apparently using network flow but I am not very familiar with network flow. How does network flow help you solve this?
A crab is an undirected graph which has two kinds of vertices: 1 head, and K feet , and exactly K edges which join the head to each of the legs.( 1 <= K <= T, where T is given)
Given an undirected graph, you have to find in it some vertex-disjoint subgraphs where each one is a crab . The goal is to select those crabs in such a way that the total number of vertices covered by them is maximized.
Note: two graphs are vertex-disjoint if they do not have any vertex in common.
ex . input
8 2 7
1 4
2 4
3 4
5 4
5 8
5 7
5 6
Solving the above problem by vertex cover approach results in exponential tim algorithm but this can be solved by maximizing flows using Ford Fulkerson algorithm Above problem can be solved using Ford Fulkerson.
Ford Fulkerson Algorithm to find max flow in the given Graph
Repeat the above 4 steps till no augmenting path possible.
Chose one possible path and identify the edge with the smallest capacity. Record this number Substract this number from each number on that path. This is the new capacity for each arc long the path. Chose another route and repeat step 1 once again record the smallest capacity. Repeat untill all possible path are exhausted. Add the smallest capacities of all routes. This is the minimum carrying capacity of the network
Reference
http://anandtechblog.blogspot.in/search/label/Ford%20Fulkerson%20algorithm