public function ensureVertex($vertex)
{
if (!is_object($vertex)) {
throw new InvalidVertexTypeException('Vertices must be objects; non-object provided.');
}
if (!$this->hasVertex($vertex)) {
$this->vertices[$vertex] = new \SplObjectStorage();
}
return $this;
}