1

A simple greedy algorithm to find a maximal independent set, I think it will take O(n) time since no vertex will be visited more than twice. Why wiki said it would take O(m) time?

Greedy(G)
while G is not empty (visited V in an arbitrary order)
    mark v as IS and v's neighbors as Non-IS
return all IS vertices
高翔宇
  • 11
  • 1

1 Answers1

0

If you run it on Kn/2,n/2, the neighbors on the side not chosen each get marked as non-IS n/2 times.

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120