I have a large graph (the number of vertices, edges can be in the range of 50,000-100,000). Have 3 queries:
1 .add one adges
remove one adges
2 vertices x, y belong to one connected component?
Give an answer for each query type 3 ?
Sorry for my bad English.
Google the "Dynamic Connectivity problem"
Tommorow wiil be birhtday of tourist!!!))))
really?
if you don't believe to Hafiz_BB watch in http://en.wikipedia.org/wiki/Gennady_Korotkevich
I read in e-maxx that it can be solved offline using sqrt decomposition.
ok thank you !
I think there is a very cool solution with O(N * logQ * logN) complexity but it's offline. The problem is known as Dynamic Connectivity Problem as far as I know, and I'd love to see some efficient not-too-hard to implement solution for the online version :)
Please even once vote up my comment ! I'd be happy.
You can solve it with a Link-Cut Tree (http://en.wikipedia.org/?title=Link/cut_tree)
thank you very much :D