[英]How to create a graph out of biconnected components?
I have a graph and I have identified all of its biconnected components and all of its critical vertexes/articulation points using Tarjan's Algorithm.我有一个图表,我已经使用 Tarjan 算法识别了它的所有双连接组件及其所有关键顶点/关节点。
I am trying to create a new graph using the biconnected components: the components will be the new vertices and two biconnected components are linked if they share at least one articulation point.我正在尝试使用双连通组件创建一个新图:组件将成为新顶点,如果两个双连通组件共享至少一个关节点,则它们将被链接。
For example, for the graph in the image below, the adjacency lists for the new graph would be:例如,对于下图中的图形,新图形的邻接列表将是:
(1, 3) -> (3, 4, 5), (1, 2) (1, 3) -> (3, 4, 5), (1, 2)
(1, 2) -> (1, 3) (1, 2) -> (1, 3)
(3, 4, 5) -> (1, 3) (3, 4, 5) -> (1, 3)
where (1, 3), (1, 2), (3, 4, 5) are the biconnected components and 1, 3 are articulation points.其中 (1, 3), (1, 2), (3, 4, 5) 是双连通分量,1, 3 是关节点。 How could I create the new graph/the adjacency lists in a relatively optimal way?
如何以相对最佳的方式创建新图/邻接列表? Can I do it while I'm running Tarjan on the graph?
我可以在图表上运行 Tarjan 时执行此操作吗?
Edit: A biconnected component is a subset of the vertices of the graph where every vertex in this subset will remain connected even if you remove any vertex of the graph.编辑:双连接组件是图形顶点的子集,即使您删除图形的任何顶点,该子集中的每个顶点都将保持连接。 Wiki page for biconnected component
双连接组件的 Wiki 页面
Yes you can do it quite easily using DSU(Disjoint Set Union, aka Union Find) data structure.是的,您可以使用 DSU(不相交集联合,又名联合查找)数据结构很容易地做到这一点。
The key is noticing some observations:关键是注意到一些观察结果:
Now we can already do some tarjan modifications:现在我们已经可以做一些 tarjan 修改了:
(u,v)
if it's a bridge save it for later use(u,v)
如果它是一座桥,则将其保存以备后用u
and v
belong tou
和v
属于
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.