Skip to content

Commit

Permalink
Allow override of static method Dijkstra::distance
Browse files Browse the repository at this point in the history
  • Loading branch information
PapsOu authored Jul 18, 2019
1 parent f5df426 commit e6fcece
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Dijkstra.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ protected function calculateWeight(Point $parent, Point $child): void
* ENDIF
*/
if (! $this->weights[$child->ref]['passed']
&& ($this->weights[$parent->ref]['weight'] + self::distance($parent, $child) < $this->weights[$child->ref]['weight']
&& ($this->weights[$parent->ref]['weight'] + static::distance($parent, $child) < $this->weights[$child->ref]['weight']
|| $this->weights[$child->ref]['weight'] === -1)) {
$this->weights[$child->ref]['weight'] = $this->weights[$parent->ref]['weight'] + self::distance($parent, $child);
$this->weights[$child->ref]['weight'] = $this->weights[$parent->ref]['weight'] + static::distance($parent, $child);
$this->predecessors[$child->ref]['previous'] = $parent;
}
}
Expand Down

0 comments on commit e6fcece

Please sign in to comment.