Create nodes: source , boys, girls, sink . Edges:
with capacity for each boy.
with capacity if boy likes girl .
with capacity for each girl.
Max flow through this network equals the maximum number of pairs. Each unit of flow represents one pair dancing together. The capacity ensures each person dances at most once.