We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9a334c commit 77d4c45Copy full SHA for 77d4c45
src/MinimumCostFlow/Base.php
@@ -4,6 +4,7 @@
4
5
use Fhaculty\Graph\Algorithm\BaseGraph;
6
use Fhaculty\Graph\Algorithm\Weight as AlgorithmWeight;
7
+use Fhaculty\Graph\Algorithm\Flow as AlgorithmFlow;
8
use Fhaculty\Graph\Exception\UnderflowException;
9
use Fhaculty\Graph\Edge\Base as Edge;
10
use Fhaculty\Graph\Set\Edges;
@@ -20,7 +21,9 @@ abstract class Base extends BaseGraph
20
21
*/
22
protected function checkBalance()
23
{
- $balance = $this->graph->getBalance();
24
+ $alg = new AlgorithmFlow($this->graph);
25
+ $balance = $alg->getBalance();
26
+
27
$tolerance = 0.000001;
28
if ($balance >= $tolerance || $balance <= -$tolerance) {
29
throw new UnexpectedValueException('The given graph is not balanced value is: ' . $balance);
0 commit comments