@@ -43,16 +43,12 @@ public function createGraph()
43
43
if ($ edge ->getWeight () < 0 ) {
44
44
$ flow = $ edge ->getCapacity ();
45
45
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 );
56
52
}
57
53
58
54
$ edge ->setFlow ($ flow );
@@ -114,30 +110,6 @@ public function createGraph()
114
110
return $ resultGraph ;
115
111
}
116
112
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
-
141
113
/**
142
114
*
143
115
*
0 commit comments