Ive searched a lot on the Internet but i still dont have an intuitive way of doing this. One way i thought of was to make the graph directed so i can use Bellman-Ford to detect negative cycle. But it causes some problems such as infinitely looping the same negative numbers, or just having some inaccessible cycles. Another idea i thought of was adding some constant K to each of the weight such that there will be no negative numbers, and Ill use some algorithm to find the minimum weight cycle, then subtract that weight by K * length of cycle. But that doesnt work as the longer the cycle, the bigger the weight, and the algorithm might detect a cycle whose weight is smaller after the increment K than said longer cycle. Even though before the increment the longer cycle is smaller.
Can someone please help me? Im at my wits end here. Ty