@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function hasPathTo(int $vertex) |
143 | 143 | { |
144 | - // validate this vertex in the context of the given graph |
|
144 | + // validate this vertex in the context of the given graph |
|
145 | 145 | Graph::validateVertex($vertex, $this->graph->getVertices()); |
146 | 146 | // return the flag |
147 | 147 | return $this->marked[$vertex]; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function distTo(int $vertex) |
155 | 155 | { |
156 | - // validate this vertex in the context of the given graph |
|
156 | + // validate this vertex in the context of the given graph |
|
157 | 157 | Graph::validateVertex($vertex, $this->graph->getVertices()); |
158 | 158 | // return the value |
159 | 159 | return $this->distTo[$vertex]; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function pathTo(int $vertex) |
167 | 167 | { |
168 | - // validate this vertex in the context of the given graph |
|
168 | + // validate this vertex in the context of the given graph |
|
169 | 169 | Graph::validateVertex($vertex, $this->graph->getVertices()); |
170 | 170 | // check if there is a path |
171 | 171 | if (!$this->hasPathTo($vertex)) { |
@@ -111,7 +111,7 @@ |
||
111 | 111 | // read in the edges |
112 | 112 | for ($i = 0; $i < $edges; $i++) { |
113 | 113 | // fet from source |
114 | - $raw = $lines[$i+2]; |
|
114 | + $raw = $lines[$i + 2]; |
|
115 | 115 | // parse data |
116 | 116 | list ( |
117 | 117 | $v, |
@@ -70,6 +70,6 @@ |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | // self loop appears in adjacency list twice |
73 | - return $count/2; |
|
73 | + return $count / 2; |
|
74 | 74 | } |
75 | 75 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // get the ne |
47 | 47 | if (!empty($adjacencyList)) { |
48 | 48 | // set it |
49 | - $this->adjacencyList= $adjacencyList; |
|
49 | + $this->adjacencyList = $adjacencyList; |
|
50 | 50 | } else { |
51 | 51 | // init |
52 | 52 | $this->adjacencyList = []; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param bool $weight |
161 | 161 | * @return array |
162 | 162 | */ |
163 | - protected static function parseEdge(string $input,int $vertices, bool $weight = false) |
|
163 | + protected static function parseEdge(string $input, int $vertices, bool $weight = false) |
|
164 | 164 | { |
165 | 165 | // clean |
166 | 166 | $trimmed = trim($input); |
@@ -171,7 +171,7 @@ |
||
171 | 171 | // init |
172 | 172 | $taken = []; |
173 | 173 | // iterate over the edges |
174 | - for ($i = 0; $i <$edges; $i++) { |
|
174 | + for ($i = 0; $i < $edges; $i++) { |
|
175 | 175 | // generate an edge |
176 | 176 | do { |
177 | 177 | // generate |
@@ -107,8 +107,7 @@ |
||
107 | 107 | if ($this->hasOrder()) { |
108 | 108 | // return the rank |
109 | 109 | return $this->rank[$vertex]; |
110 | - } |
|
111 | - else { |
|
110 | + } else { |
|
112 | 111 | // is not a DAG |
113 | 112 | return -1; |
114 | 113 | } |
@@ -111,6 +111,6 @@ |
||
111 | 111 | */ |
112 | 112 | public function reversePostorder() |
113 | 113 | { |
114 | - return $this->reversePost; |
|
114 | + return $this->reversePost; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -117,7 +117,7 @@ |
||
117 | 117 | if ($weight < $otherWeight) { |
118 | 118 | // return less than |
119 | 119 | return -1; |
120 | - } else if ($weight == $otherWeight){ |
|
120 | + } else if ($weight == $otherWeight) { |
|
121 | 121 | // return equal |
122 | 122 | return 0; |
123 | 123 | } else { |
@@ -111,7 +111,7 @@ |
||
111 | 111 | // read in the edges |
112 | 112 | for ($i = 0; $i < $edges; $i++) { |
113 | 113 | // fet from source |
114 | - $raw = $lines[$i+2]; |
|
114 | + $raw = $lines[$i + 2]; |
|
115 | 115 | // parse data |
116 | 116 | list ( |
117 | 117 | $v, |