问题
I have a network that could look like this:

Basically, I want to know the minimum number of green circles that can disconnect the source and drain if removed/disabled. (in this case 1)
I have already succesfully implemented the Edmonds-Karp algrorithm, but I don't know how to model the network with directed edges, so I get the desired result.
If I just replace each connection between the nodes with two opposite directed edges with capacity 1, I get a max flow of 2 with EdmondsKarp, but I only need to remove 1 green circle to break the network.
How do I model my network as nodes and directed edged?
回答1:
You can reduce this problem to the standard s–t cut problem in directed graphs, which can then solved e.g. by the Edmonds–Karp algorithm. For each vertex v, create two vertices v_in and v_out and a directed edge (v_in, v_out), and for each edge {v,w}, add two directed edges (v_out ,w_in) and (w_out , v_in). It is then not hard to see that a maximum flow from s_in to t_out corresponds to a minimum vertex cut between s and t.
回答2:
You have correctly determined maximum flow - it is 2 for your network.
From definition of flow network
A flow must satisfy the restriction that the amount of flow into a node equals the amount of flow out of it, except when it is a source, which has more outgoing flow, or sink, which has more incoming flow
So for your middle node you have 2 as max flow (coming in and going out). So knowing only the max flow will not give you the answer for minimal cut.
The theorem
max-flow min-cut theorem states that in a flow network, the maximum amount of flow passing from the source to the sink is equal to the minimum capacity which when removed in a specific way from the network causes the situation that no flow can pass from the source to the sink
so, yes you know the amount of flow you need to remove, but you don't know in which way to remove it. I think this is not so trivial and that you will need to specifically look for min-cut.
来源:https://stackoverflow.com/questions/4203529/modeling-network-as-directed-graph