Not independent. If you have two bachelors and both want one hooker and one blow, you need to make one triplet. Independent distribution could cause the hooker and blow to go to different bachelors and you'd have zero triplets.
Yup, that's one issue. The other issue is say two guys want hooker1 & they're happy with any blow. You could end up matching both of them to hooker1, but hooker1 can only be *used* once
iCyborg, your solution (as stated at least) will not work for the same reason. Say you |F|=|G|=|H|=2 and <f_1,g_1,h_1> and <f_2,g_1,h_2> are both valid triples. Your scheme would produce a matching of size 2, even though g_1 would be used twice. It might be possible to add more edges and/or nodes to resolve this issue? But I don't see it right now.
FYI, the time complexity of maximum matching (on any graph; bipartite doesn't win anything in the unweighted case) is O(sqrt(V)*E). For you current graph, V = |F| + |G|*|H|, E = O(V^2). Even if it did produce the right answer, you can do better.
Pia: Yes, tripartite matching is NP complete. If I could solve tripartite matching, I could solve this problem. But if I could solve this problem, I could not solve tripartite matching. The issue is in the preferences. In this problem, only the gentlemen (F) get preferences. So this problem is a (very) special case of tripartite matching.
Another example if my statement isn't clear: we know subset sum is NP. What about subset sum with exactly 2 integers per subset? 3 integers? 4? (They're all polynomial... granted the power is a function of the number of integers. Neat exercise to derive that function if you haven't seen it.) Knowing how to solve subset sum will solve all of these individual problems, but knowing how to solve these individual problems does not solve subset sum. Even goofier example: traveling salesman on a (circularly) linked list is really easy!
Don't worry, I wouldn't stick an NP problem on here, haha.
Last edited: