friendlysam.parts.FlowNetwork.connect

FlowNetwork.connect(n1, n2, bidirectional=False, capacity=None)

Connect two nodes.

Creates a flow and adds it to n1.outflows[resource] and n2.inflows[resource], if it does not already exist. Calling again makes no difference.

The flow must be nonnegative. For bidirectional flows, use bidirectional=True.

Parameters:
  • n1 – The node the flow goes from.
  • n2 – The node the flow goes to.
  • bidirectional (boolean, optional) – Create a two-way flow?
  • capacity (float, optional) – The maximum amount that can flow between the nodes. Creates an upper bound ub=capacity on the flow Variable for each index.