-
Notifications
You must be signed in to change notification settings - Fork 199
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
Broken EdmondsKarpMaximumFlowAlgorithm #183
Comments
Unit tests for EdmondsKarpMaximumFlow have passed before: https://ci.appveyor.com/project/gsvgit/quickgraph#L3812 Unfortunately, I cannot debug the unit tests, I get a System.Xml.XmlException https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmlreadersettings.prohibitdtd?redirectedfrom=MSDN&view=netframework-4.7.2 when running them. |
Fixes broken EdmondsKarpMaximumFlowAlgorithm (Issue #183)
Can be closed. Edited the issue and created a new one for the case if TEdge is a value type, see #186. |
Thank you for continuing the development of QuickGraph!
A colleague of mine found an error in EdmondsKarpMaximumFlowAlgorithm. The current implementation computes wrong maximum flows. Consider the example from Wikipedia:
It yields a flow of 4, but it should be 5. The reason for this is that the check on line 87 of \QuickGraph\Algorithms\MaximumFlow\EdmondsKarpMaximumFlowAlgorithm.cs
if (ReversedEdges != null && ReversedEdges.ContainsKey(e))
always evaluates to false because ReverseEdges is never assigned and is therefore null. This issue also affects \QuickGraph\Algorithms\MaximumBipartiteMatchingAlgorithm.
This issue can already be found on the archived version of QuickGraph (https://archive.codeplex.com/?p=quickgraph#), see FubarDevelopment/QuickGraph#149 (comment). In an earlier version of QuickGraph the constructor of EdmondsKarpMaximumFlowAlgorithm was overloaded with ReversedEdgeAugmentorAlgorithm, see Thread #59583 | Message #228725 | 2009-08-28 on https://archive.codeplex.com/?p=quickgraph, and should have worked as intended.
In the current version the issue can be fixed by changing the constructor from
to
A different fix is proposed in #185.
The text was updated successfully, but these errors were encountered: