
max flow or max matching
Moderator: Board moderators
max flow or max matching
please tell me some uva problems with max flow or max matching application to train my skill 

-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
IMO max flow kicks ass
so I started to solve this problems. I didn't have any trouble solving Software Allocation, but I haven't solved #563 Crimewave yet.
First I thought that there will be a graph with s*a vertices, the source will be connected to the banks and the vertices on the border will be connected to a destination. Finding a max flow on this graph means that there will not be 2 robbers going on the same road, but it doesn't stop them going through the same intersection, but on different routes.
Can anybody explain his/her solution? Thanks.

First I thought that there will be a graph with s*a vertices, the source will be connected to the banks and the vertices on the border will be connected to a destination. Finding a max flow on this graph means that there will not be 2 robbers going on the same road, but it doesn't stop them going through the same intersection, but on different routes.
Can anybody explain his/her solution? Thanks.

Attitude is no substitute for competence.
A standard trick to introduce capacity limits on vertices is to split each vertex v into two vertices v_1, v_2. All edges that lead to v will lead to v_1, all edges from v will leave from v_2. Add an edge from v_1 to v_2 with the capacity limit for the original vertex. (In this case the capacity of the new edge will be 1.)greco wrote:First I thought that there will be a graph with s*a vertices, the source will be connected to the banks and the vertices on the border will be connected to a destination. Finding a max flow on this graph means that there will not be 2 robbers going on the same road, but it doesn't stop them going through the same intersection, but on different routes.
Note that I don't know whether this algorithm really solves the problem you mention, I just answer your question on limiting the flow through vertices.

Thanks about the advice... I thought about something like this but the graph already has 2.500 nodes, and the length of the source is already... big.
I don't know if I can write the code with your advice... if I do write it I don't know if I can debug it... and if I debug it I don't know if it will fit the time constraint.
I was wondering if someone thought of another way to use the max flow...
Thanks anyway.

I don't know if I can write the code with your advice... if I do write it I don't know if I can debug it... and if I debug it I don't know if it will fit the time constraint.

I was wondering if someone thought of another way to use the max flow...
Thanks anyway.

Attitude is no substitute for competence.