How to identify clusters after multiple runs? Suppose I run an unsupervised clustering algorithm. After multiple runs, I find clusters and would like to know if the same cluster was found more than once.

For example:



I can figure out A-orange, B-green and C-blue are probably the same because their centroids are close together.

However, take the following example:



How can I programmatically figure out that A-blue and C-orange are the same? That A-orange and C-blue are the same? But B-orange and B-blue are not similar to any in A and C?
Use the famous Hungarian algorithm.

It computers the best match permutation.

You can find more details on Wikipedia:

https://en.wikipedia.org/wiki/Hungarian_algorithm