Construct an edge list from given information and use FindIndependentEdgeSet
:
fruits = {pear, apple, plum, grape, banana};
colors = {{Red, Green, Yellow}, {Red, Green}, {Purple}, {Red, Green,
Purple}, {Blue, Yellow}};
edges = Flatten @ MapThread[Thread @* UndirectedEdge, {fruits, colors}];
FindIndependentEdgeSet @ edges
Graph[edges, GraphLayout -> "BipartiteEmbedding", VertexLabels -> Automatic]
To get all matchings, we can use this method by Szabolcs:
lg = LineGraph[edges];
edges[[#]] & /@ FindIndependentVertexSet[lg,
Length /@ FindIndependentVertexSet[lg], All]