| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public static function maxDegree(Graph $graph) |
||
| 18 | { |
||
| 19 | // init |
||
| 20 | $max = 0; |
||
| 21 | // get vertices |
||
| 22 | $vertices = $graph->getVertices(); |
||
| 23 | // iterate over the set of vertices |
||
| 24 | for ($vertex = 0; $vertex < $vertices; $vertex++) { |
||
| 25 | // local var |
||
| 26 | $degree = $graph->degree($vertex); |
||
| 27 | // check if this vertex degrees are greater than the current max |
||
| 28 | if ($degree > $max) { |
||
| 29 | // update the max |
||
| 30 | $max = $degree; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | // return the max found |
||
| 34 | return $max; |
||
| 35 | } |
||
| 76 |