/** * Adds a new vertex to the current graph. * * @param Graph\Vertex $vertex * @return Congow\Orient\Graph * @throws Congow\Orient\Exception */ public function add(Vertex $vertex) { foreach ($this->getVertices() as $oldVertex) { if ($oldVertex->getId() == $vertex->getId()) { $message = 'Unable to insert multiple Vertices with the same ID in a Graph'; throw new Exception($message); } } $this->vertices[$vertex->getId()] = $vertex; return $this; }