Closed ktnr closed 5 years ago
Unit tests for EdmondsKarpMaximumFlow have passed before: https://ci.appveyor.com/project/gsvgit/quickgraph#L3812 Are the unit tests insufficient?
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.
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 https://github.com/FubarDevelopment/QuickGraph/issues/149#issue-331292856. 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.