# Creating network of max flow with 10 nodes, 18 directed edges

I'm given the following network: I'm attempting to build a network with maximum flow using weights 1-18 such that the loss of an individual node (not the source or sink) causes the least disruption to the flow.

I know that the max-flow min-cut theorem states that in any network, the value of any maximum flow is equal to the capacity of any minimum cut. With the out-degree of the source and in-degree of the sink to be maximized, I believe I'd want some combination of 18,13,14 coming out of $$a$$ and 12,17,16 into $$j$$, showing a capacity of 45.

However, from there I'm not sure. Any thoughts/directions?

• Have you tried using some known max-flow algorithms already? I'm thinking Edmons-Karp, Dinic or Goldberg-Tarjan. That would give you a maximal flow to start with. – Marcos Modenesi Jan 28 '17 at 23:30

There are four stages in this network, progressing from $A$, to $BCD$, to $EF$, to $GHI$, to $J$.

Among the 18 edges, you have a total of $\sum_{i=1}^{18}i=171$ units of flow to distribute around the network. Therefore it is not possible for each of the four stages to support a flow of 43, since $4*43=172$. So let's aim for a flow of 42.

Playing around with the numbers, it is not too hard to achieve this maximum, for example arranging the flows as follows:

(I hope the diagram is understandable...)

      18 (b)  16                   14  (g) 17
2                    3
(30 through e)
(a)   13 (c)   9                    7  (h) 15   (j)
4                    8
(12 through f)
11 (d)   5                    9  (i) 10
6                    1


Notice that 9 appears twice in that diagram, and 12 does not appear. You can set either of the edges with flow 9 to a weight of 12 (it won't help the flow, but it means you are using each number from 1 to 18 exactly once).

• To optimize for the case of loss of a node, (e) and (f) are likely to be your bottleneck. Ideally, you would like the flow through (e) to be closely matched to the flow through (f), the best case being a flow of 21 through each. Clearly none of the other nodes will have a flow over 18, since they all have either an in- or out-degree of 1. When you say "the least disruption", do you mean you want to maximize the flow under the worst-case node removal, or do you mean you want to minimize the difference between this flow and the flow before the node was removed? – Matt Jan 29 '17 at 1:28
• If you want to minimize the difference, then use weights 1,2,3 for the flows from (a), then the worst case for the flow is that node (d) gets removed, but this results in a reduction of only 3 units of flow. – Matt Jan 29 '17 at 1:30
• It is possible to balance the flow so that both (e) and (f) carry a flow of 21, with the entire network supporting a flow of 42. To do this, in stage two, send 14 and 3 from (b), send 5 and 8 from (c), and send 2 and 10 from (d). Then in stage three, send 14 and 4 to (g), send 6 and 10 to (h), and send 1 and 7 to (i). Stage one sends 17, 13, and 12, while stage four sends 18, 16, and 8. (Too bad comments can't have diagrams...) This double-uses 8, 10, and 14, while skipping 9, 11, and 15, so to use each weight once, increase one 8 to be a 9, one 10 to be an 11, and one 14 to be a 15. – Matt Jan 29 '17 at 2:10
• If you do not care about optimizing the flow in the undamaged network, and only care about the flow after a node has been removed, then break up stage 2 into 2e (going to (e)) and 2f (going to (f)), and break up stage 3 into 3e (from node (e)) and 3f (from node (f)). Then, assuming we will find a solution where (e) and (f) are the worst to lose, we see we are left either with stages 1, 2e, 3e, and 4, or with stages 1, 2f, 3f, and 4. It is not possible for all six of these stages to support a flow above 28 (since we only have 171 units of flow to distribute), so our best hope is to aim for 28. – Matt Jan 29 '17 at 2:19
• But even 28 cannot be achieved, because the flow through e.g. (b) in the damaged case will be limited to the lesser of its in-weight and its remaining out-weight (which must differ, since each weight from 1 to 18 is used only once), and in general the flows must be slightly less than the weights on at least about half the edges in the diagram. Three extra units of flow (as would be available after ensuring that all six stages can just barely carry 28 units of flow) would not be enough to get all the in- and out-weights to differ as needed. – Matt Jan 29 '17 at 2:33