【发布时间】:2013-03-15 05:05:16
【问题描述】:
我想在一个无向多重图中列出一个从根节点(Tarjan 的索引 0)开始的循环,它在根节点处开始和结束,而不会通过以前访问过的节点返回某个循环。
我使用这些指令Cycle detection in a Multigraph 在 perl 中编写了Tarjan's strongly connected components algorithm。 这是我的图表
V E E E
1 2 3 4
2 1 3
3 1 2
4 1
我得到了这个结果
1 root
3 2 1
------------
2 root
3 1 2
------------
3 root
2 1 3
------------
4 root
3 2 1 4
------------
When 4 is selected as index 0 or the root I would like it to return 1 4 because the path must pass through 1 twice to complete the cycle with the solution of 3 2 1 4.
谢谢
【问题讨论】: