-
Notifications
You must be signed in to change notification settings - Fork 1
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
Possible error in calculation - unaccounted for capacity increases with FlowNetwork. #9
Comments
Here is a playground link: https://go.dev/play/p/6eMOdx6Quqd |
As far as I have seen, there is no error in how you're inputting the edge weights -- at least based on the data in your main method. VisuAlgo is very clearly coming up with the right answer -- the s-t cut they compute is smaller than 29, so it's not clear why this is happening at the moment. It's possible that something strange is happening with the remapping that you are performing in your example, but I haven't looked closely enough to be able to tell. |
Strange -- somehow after running what's very weird is that the capacity being mapped to is precisely the... right answer? Play link here: https://go.dev/play/p/42RS-yqvTdN
EDIT: prior to running Outflow here are the capacities reported:
So something is 100% wrong. |
Few more remarks about the visualgo:
Also, here is a simplified getMaxFlow: https://go.dev/play/p/6eMOdx6Quqd |
Also, for the simplest graph source -> sink with edge capacity 1 the library gives answer 0 🤔 |
Awesome!! All of these can go into some of the unit test cases. |
Hello!
I was toying with visualgo.net to create some test cases, and I found this example which per visualgo should have maxflow of 28 from node 0 to 7, and your library calculates it as 29:
This text can be pasted in Edit graph -> Input graph, in the lower left corner. Note that you should choose 0-based indexing there.
Also, be aware that graph editing is quite buggy there, what I mean is that visualgo will often complain that the 0 node is not the leftmost one, and 7 node is not a rightmost one. Although it is drawn the graph itself. Just repeat pressing Input graph -> paste -> Submit few times, until it will draw them the way it wants.
And then from the same corner you can start one of the three algorithms. All three give 28.
The text was updated successfully, but these errors were encountered: