开发者

reverse operation to "Union and find"

开发者 https://www.devze.com 2023-03-14 10:24 出处:网络
We 开发者_运维知识库know there is \"Union and find\" for disjoint sets. http://en.wikipedia.org/wiki/Union_find

We 开发者_运维知识库know there is "Union and find" for disjoint sets. http://en.wikipedia.org/wiki/Union_find

But how to do reverse operation ? Consider a set with N nodes connected with E edges( which is in fact a graph ). And at each step we want to delete some edge and check if this delete operation leads to have another disjoint set. Is it possible to do it fastly like in "Union and find"?

P.S this is not homework, we have holiday :)


This is known as the online edge deletion problem or online connectivity problem. Some links to algorithms are in this section of the Wikipedia article on graph connectivity.


So your question is how to efficiently detect a Bridge? This can be done in linear time (also see the link).


Union-find is used in Kruskal algorithm, which repeatedly adds edge of minimum weight which doesn't make a cycle. A reverse idea - removing edges of maximum weight as long as it doesn't disconnect the graph - is used in reverse-delete algorithm, which seemingly can make use of some complicated data structure (see Wikipedia).

0

精彩评论

暂无评论...
验证码 换一张
取 消