Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Multigraph bug? #57

Open
johna1203 opened this issue Mar 21, 2022 · 1 comment
Open

[BUG] Multigraph bug? #57

johna1203 opened this issue Mar 21, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@johna1203
Copy link

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
test

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.
quickGraph

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.

@johna1203 johna1203 added the bug Something isn't working label Mar 21, 2022
@KeRNeLith
Copy link
Owner

Hello @johna1203!

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants