@@ -43,16 +43,12 @@ public function createGraph()
4343 if ($ edge ->getWeight () < 0 ) {
4444 $ flow = $ edge ->getCapacity ();
4545
46- if ($ edge instanceof EdgeDirected) {
47- $ startVertex = $ edge ->getVertexStart ();
48- $ endVertex = $ edge ->getVertexEnd ();
49-
50- // add balance to start- and end-vertex
51- $ this ->addBalance ($ startVertex , $ flow );
52- $ this ->addBalance ($ endVertex , - $ flow );
53- } else {
54- throw new UnexpectedValueException ('Undirected Edges not suported ' );
55- }
46+ $ startVertex = $ edge ->getVertexStart ();
47+ $ endVertex = $ edge ->getVertexEnd ();
48+
49+ // add balance to start- and end-vertex
50+ $ this ->addBalance ($ startVertex , $ flow );
51+ $ this ->addBalance ($ endVertex , - $ flow );
5652 }
5753
5854 $ edge ->setFlow ($ flow );
@@ -114,30 +110,6 @@ public function createGraph()
114110 return $ resultGraph ;
115111 }
116112
117- /**
118- * check if balance on each vertex of the given graph matches the original graph's
119- *
120- * @param Graph $graph
121- * @return boolean
122- * @throws Exception if given graph is not a clone of the original graph (each vertex has to be present in both graphs)
123- * @uses Graph::getNumberOfVertices()
124- * @uses Graph::getBalanace()
125- * @uses Graph::getVertex()
126- */
127- private function isBalanceReached (Graph $ graph )
128- {
129- if ($ graph ->getNumberOfVertices () !== $ this ->graph ->getNumberOfVertices ()) {
130- throw new DomainException ('Given graph does not appear to be a clone of input graph ' );
131- }
132- foreach ($ this ->graph ->getVertices ()->getMap () as $ vid => $ vertex ) {
133- if ($ vertex ->getBalance () !== $ graph ->getVertex ($ vid )->getBalance ()) {
134- return false ;
135- }
136- }
137-
138- return true ;
139- }
140-
141113 /**
142114 *
143115 *
0 commit comments