public function setWeight($weight)
    {
        if ($weight !== NULL && !is_float($weight) && !is_int($weight)) {
            throw new InvalidArgumentException('Invalid weight given - must be numeric or NULL');
        }
        $this->weight = $weight;

        return $this;
    }
public function setWeight($weight)
    {
        if ($weight !== NULL && !is_float($weight) && !is_int($weight)) {
            throw new InvalidArgumentException('Invalid weight given - must be numeric or NULL');
        }
        $this->weight = $weight;

        return $this;
    }
public function setWeight ( $ weight ) { if ( $ weight !== NULL && ! is_float ( $ weight ) && ! is_int ( $ weight ) ) { throw new InvalidArgumentException ( 'Invalid weight given - must be numeric or NULL' ) ; } $ this -> weight = $ weight ; return $ this ; }
set new weight for edge

@param  float|int|NULL           $weight new numeric weight of edge or NULL=unset weight
@return self                     $this (chainable)
@throws InvalidArgumentException if given weight is not numeric
set new weight for edge