0

I recently came across algorithms to find all cycles in an undirected graph, and was confused when i saw that they are running linear time (example), It seem easy to use one of these to find hamilton cycle (for each cycle we find just check if it is of n nodes, e.g contains all nodes) in polynomial time, but hamilton problem is a known NP complete problem so i gotta be missing something... what am i missing here?

Thanks!

Ofek Ron
  • 8,354
  • 13
  • 55
  • 103
  • Hint: Which of the cycles found is Hamiltonian? – Caleth Jan 28 '22 at 10:27
  • @Caleth as i wrote in the original question, the ones that have all nodes (n nodes) – Ofek Ron Jan 28 '22 at 10:28
  • I'm not convinced that algorithm finds all the cycles in `O(Nodes + Edges)` time, because there can be more cycles than that. E.g. a graph where every node connects to every other node has `Nodes^2 - Nodes` edges, but `Nodes!` cycles – Caleth Jan 28 '22 at 10:44

0 Answers0