Sunday, August 7, 2011

What is an algorithm to find if there a k distinct edge weights in a graph? O(m log k)?

Given a number k, I need to find if there are exactly k distinct edge weights in an undirected graph G(V, E) with m edges in E and n nodes in V. It must have a worst case runtime of O(m log k). What is an algorithm to fit these requirements?

No comments:

Post a Comment