动态连接和union-find怎么关联?
How dynamic connectivity and union-find related?
根据维基百科:
A dynamic connectivity structure is a data structure that dynamically maintains information about the connected components of a graph.
并且:
A union–find data structure is a data structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets.
乍一看,这些数据结构之间没有什么关系。但几乎每篇提到动态连接的文章都会瞥见 union-find。所以,我想知道这两者有什么关系?
来自关于 dynamic connectivity 的维基百科文章:
The set V of vertices of the graph is fixed, but the set E of edges can change. The three cases, in order of difficulty, are:
- Edges are only added to the graph (this can be called incremental connectivity);
- Edges are only deleted from the graph (this can be called decremental connectivity);
- Edges can be either added or deleted (this can be called fully dynamic connectivity).
联合查找数据结构(也称为disjoint set data structure)可用于第一种情况。添加边时可以使用union操作连接两个组件,使用find操作测试两个顶点是否在同一个组件中。然而,union-find 数据结构不支持删除边的操作,将一个组件拆分为两个新断开的组件;所以它不能用来解决其他两种情况的动态连接问题。
根据维基百科:
A dynamic connectivity structure is a data structure that dynamically maintains information about the connected components of a graph.
并且:
A union–find data structure is a data structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets.
乍一看,这些数据结构之间没有什么关系。但几乎每篇提到动态连接的文章都会瞥见 union-find。所以,我想知道这两者有什么关系?
来自关于 dynamic connectivity 的维基百科文章:
The set V of vertices of the graph is fixed, but the set E of edges can change. The three cases, in order of difficulty, are:
- Edges are only added to the graph (this can be called incremental connectivity);
- Edges are only deleted from the graph (this can be called decremental connectivity);
- Edges can be either added or deleted (this can be called fully dynamic connectivity).
联合查找数据结构(也称为disjoint set data structure)可用于第一种情况。添加边时可以使用union操作连接两个组件,使用find操作测试两个顶点是否在同一个组件中。然而,union-find 数据结构不支持删除边的操作,将一个组件拆分为两个新断开的组件;所以它不能用来解决其他两种情况的动态连接问题。