Algorithm to find most nodes in distinct cycles

I am trying to design a program where people trade objects within a fixed set of objects. They offer a single product, and designate a set of products they are willing to accept for that product. The job of the program is to involve as many people in a trade as possible.

To do this, I create a directed graph, where each edge points from a person who will give a product to a person who wants that product.

I want to find the distinct cycles (they don't share a node) that cover the largest subset.

How would I do that?

• Your problem is very closely related to looking for disjoint cycle covers. Aug 18, 2014 at 0:09
• What have you tried and where did you get stuck? Do you know how to find any cycle? Aug 18, 2014 at 10:39
• @Raphael To find a cycle I would recursively follow each node, keeping a list of visited nodes, and if the neighbor has already been visiting, then my history is a cycle. Iterating through every possible set of cycles seems like the wrong way to go about it at that step, though. Aug 18, 2014 at 13:00