Cycles in a graph

Revision en5, by tgp07, 2022-05-20 05:49:38

Let's you have a graph with n nodes and m bi-directional edges. (n, m <= 1e5). How would I get the cycles in this graph in an efficient way using DFS.

BTW, I've linked an image where I drew what I thought is a cycle. If it's not a cycle, please tell me what a cycle actually is.

https://imgur.com/a/Qrrg8DF

Tags dfs, cycles

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English tgp07 2022-05-20 05:49:38 26 Tiny change: '\nhttps://codeforces.me/5a7fab' -> '\nhttps://imgur.com/a/Qrrg8DF'
en4 English tgp07 2022-05-20 02:54:28 3 Tiny change: 'com/5a7fab/\n' -> 'com/5a7fab'
en3 English tgp07 2022-05-20 02:54:01 77
en2 English tgp07 2022-05-20 02:53:18 69
en1 English tgp07 2022-05-20 02:52:48 299 Initial revision (published)