en.wikipedia.org
Maybe your problem is actually a graph coloring problem...
Reply on news.ycombinator.com