1

I want to adapt this code from this answer to work with unbalanced bipartite graphs:

g = Graph[
   {1 -> 4, 1 -> 5, 2 -> 4, 2 -> 5,3->4,3->5},  VertexLabels -> "Name", GraphLayout -> "BipartiteEmbedding"];
supplyDemand=If[# <= 3, 1, -1] & /@ VertexList[g];
f = FindMinimumCostFlow[g,
   supplyDemand,
   "OptimumFlowData", EdgeCost -> {1, 2, 3, 4, 5, 6}];

f["CostValue"] f["FlowGraph"]

In the present state, if I give it an unbalanced bipartite graph, it finds an assignment that minimizes the cost but that does not cover the full set of vertices: The node 3 is left unassigned.

enter image description here

What function should I use to allow the algorithm to assign multiple left vertices to a right vertex (while still minimizing the cost to do so)?

I believe it's an instance of the Unbalanced Assignment Problem where machines can see themselves assigned multiple jobs.

WaterFox
  • 185
  • 6
  • 1
    Looking at it quickly. The demand of -1 is delivered with one source node. I would guess you need to increase the demand of sink nodes in order make use of source node 3. – Eisbär Feb 14 '23 at 15:56
  • So the mathematical problem found a solution here. I will try to come with a mathematica code that solves it. – WaterFox Feb 22 '23 at 20:59

0 Answers0