Finding all cycles in an undirected graph

前端 未结 2 1880
情话喂你
情话喂你 2021-01-12 00:11

If I have an undirected graph, how can I get a list of all cycles?

For example, from the following graph, I would want the cycles:

(a,b,d,e,c)
(a,b,c         


        
2条回答
  •  长发绾君心
    2021-01-12 00:18

    You presumably want only simple cycles (those that don't repeat a vertex), or there's an infinite number of them. Even then, there can be an exponential number of cycles. Perhaps this isn't the problem you really want to solve?

提交回复
热议问题