Reputation: 251
Is it O(eloge) or is it O(V^2) since the whole matrix has to be iterated over to retrieve the edges in order for them to be sorted?
Upvotes: 0
Views: 1698
Reputation: 59323
It's O(V2 + E log E), because it takes O(V2) to find the edges, and O(E log E) to sort them.
Note that this is at least O(V2), but no more than O(V2 log E), and in the worst case of dense graphs it is the same as O(E log E), because V2 is O(E) in those cases.
Upvotes: 2