public function removeVertex($vertex)
{
if (!$this->hasVertex($vertex)) {
throw new NonexistentVertexException('Vertex is not in the graph, it cannot be removed.', E_WARNING);
}
foreach ($this->vertices[$vertex] as $adjacent) {
$this->vertices[$adjacent]->detach($vertex);
}
unset($this->vertices[$vertex]);
}