Find all chordless cycles in an undirected graph

前端 未结 5 1368
有刺的猬
有刺的猬 2020-12-04 15:47

How to find all chordless cycles in an undirected graph?

For example, given the graph

0 --- 1
|     | \\
|     |  \\
4 --- 3 - 2

th

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 16:16

    Just a thought:

    Let's say you are enumerating cycles on your example graph and you are starting from node 0.

    If you do a breadth-first search for each given edge, e.g. 0 - 1, you reach a fork at 1. Then the cycles that reach 0 again first are chordless, and the rest are not and can be eliminated... at least I think this is the case.

    Could you use an approach like this? Or is there a counterexample?

提交回复
热议问题