并查集求最小环:

例题:https://www.luogu.org/problemnew/show/P2661   

原文地址:https://www.cnblogs.com/tyner/p/10801818.html