| Conditions | 4 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 145 | public function getOwner(): FibonacciHeap |
||
| 146 | { |
||
| 147 | if ($this->heap->other != $this->heap) { |
||
|
|
|||
| 148 | // find root |
||
| 149 | $root = $this->heap; |
||
| 150 | while ($root != $root->other) { |
||
| 151 | $root = $root->other; |
||
| 152 | } |
||
| 153 | // path-compression |
||
| 154 | $cur = $this->heap; |
||
| 155 | while ($cur->other != $root) { |
||
| 156 | $next = $cur->other; |
||
| 157 | $cur->other = $root; |
||
| 158 | $cur = $next; |
||
| 159 | } |
||
| 160 | $this->heap = $root; |
||
| 161 | } |
||
| 162 | return $this->heap; |
||
| 163 | } |
||
| 165 |