/** * Compares the weights of two edges and returns -1, 0, 1 depending * on which is the largest first, equal, or second * * @param Edge $edge1 first Edge to compare * @param Edge $edge2 second Edge to compare * @return int -1,-0,1 as described above */ function compare($edge1, $edge2) { $values1 = $edge1->getCost(); $values2 = $edge2->getCost(); if ($values1 == $values2) { return 0; } return $values1 > $values2 ? -1 : 1; }