Algorithm 如果两个节点使用union find algo连接,我们能找到它们之间的路径吗?

Algorithm 如果两个节点使用union find algo连接,我们能找到它们之间的路径吗?,algorithm,data-structures,graph,union-find,set-union,Algorithm,Data Structures,Graph,Union Find,Set Union,有很多算法可以实现union/find,但从您的问题来看,似乎您指的是不相交集林实现。因此,我将重点讨论这个特定的实现 为了提高并集和查找操作的性能,不相交集林应用了不同的启发式方法,例如路径压缩。这些启发式算法改进了渐进复杂性并集和查找,但结果是您无法再重建原始图结构。因此,您将无法找到两个顶点之间的路径。毕竟,该算法是为了解决这个特殊问题——能够执行并集和查找 但是,您可以使用其他一些联合/查找实现。例如,您可以使用与不相交集林相同的思想,但如果没有路径压缩,您仍然可以使用按秩并集。这当然会

有很多算法可以实现union/find,但从您的问题来看,似乎您指的是不相交集林实现。因此,我将重点讨论这个特定的实现

为了提高并集和查找操作的性能,不相交集林应用了不同的启发式方法,例如路径压缩。这些启发式算法改进了渐进复杂性并集和查找,但结果是您无法再重建原始图结构。因此,您将无法找到两个顶点之间的路径。毕竟,该算法是为了解决这个特殊问题——能够执行并集和查找


但是,您可以使用其他一些联合/查找实现。例如,您可以使用与不相交集林相同的思想,但如果没有路径压缩,您仍然可以使用按秩并集。这当然会增加并集和查找的渐进复杂性,但也会保留图形结构,因此您将能够找到顶点之间的路径

我认为,如果某件事情能够改善最坏情况下的运行时间,那么它就不能被正确地称为启发式。
    I studied the union find algo and found it is very useful in following ways.

    to find out if 2 node are connected or not
    to compress the path. (save space)

    if the problem is to find if 2 node connected or not , then we can use union
 find.But if we have to find out the path between these 2 node, 
then how can we use the data structure which is use to find 
union find ( data structure  use is - it store root element in 
arrays of node. form kind of tree)?

    I tried a lot and found that we have to use graph to find out the path\
between node and can not use union find data structure .

    any other views on it.