Reputation: 5773
How do you find the maximum bipartite matching when your graph has several components ? Each component can be colored in two ways. How do you decide the two sets X and Y in order to run the maximum matching routine ?
Upvotes: 3
Views: 1361
Reputation: 69934
Don't look at a matching from the point of view of the edges, look at is as a set of edges. This point of view makes it clearer that no matter how you join the subresults it will still be OK latter on.
Separate your graph into connected components
Find a maximum matching for each graph component, using your algorithm of choice.
The union of the matchings found is a maximum matching of the whole graph.
Upvotes: 1
Reputation: 372784
If your graph has several different connected components, you can find the maximum matching in the graph by just finding the maximum matching in each of those components and returning their union.
As for how to decide the sets X and Y, many algorithms exist for detecting whether a particular graph is bipartite and, if so, assigning labels to the nodes to recover those two groups. You can do this with a modified DFS or BFS fairly easily. Consequently, an algorithm for your problem might be
Hope this helps!
Upvotes: 1
Reputation: 12592
I don't know about disconnected graph but if you have a complete graph like I have this might be interesting for you: http://wilanw.blogspot.com/2009/09/maximumminimum-weighted-bipartite.html. It's using a modified Floyd-Warshall algorithm to find the maximum matching. I don't know about the difference between this and the Hungarian algorithm.
Upvotes: 0