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?