May someone provide me with an efficient algorithm for finding longest cycle in a directed or undirected graph?
I think the problem is NP complete. It can be solved by Bitmask DP. I think this(see problem 3) and this (see question 4) can prove that there is no polynomial time solution to this problem. Once you are sure that this problem does not have a polynomial time solution, do a smart bruteforce on all subsets.
Refer to this for a very detailed analysis of use of Bitmask in dealing with cycles in a graph.
I visited some of the above mentioned sites and found that jhonson’s algorithm is the most efficient algorithm to find out longest cycle.But I am not able to understand how to use Jhonson’s algorithm to find out longest cycle in the given graph
Brother you may visit:-
& read the ‘related’ section given on right side of the page while you scroll down.