var tryGetPath = graph.ShortestPathsBellmanFord(e => e.Weight, "USD", out var hasNegativeCycle);
if (hasNegativeCycle) {
Console.WriteLine("IS NEGATIVE");
}
if (tryGetPath("PLN", out var edges)) {
Console.WriteLine($"PATH {string.Join("-->", edges.Select(e => e.Source).ToList())}");
}
but I have a problem, it is that there is an infinite loop in the following line. (EdgeExtensions.cs:265)
You can see that it stays between USD <--> MXN and never leaves the while.
I tried to fix it, but I don't know where the error.... is
If you need the source code, let me know and I'll post it here.
I'm sad it's causing you issues. I wil indeed appreciate if you provide the source code associated to your tests so we can have a look into more details :-)
Describe the bug
I am trying to reproduce this strategy from the article below. https://anilpai.medium.com/currency-arbitrage-using-bellman-ford-algorithm-8938dcea56ea
Then I generated the following grap
but I have a problem, it is that there is an infinite loop in the following line. (EdgeExtensions.cs:265) You can see that it stays between USD <--> MXN and never leaves the while.
I tried to fix it, but I don't know where the error.... is
If you need the source code, let me know and I'll post it here.
Thank you.