/** * create a new Vertex in this Graph from the given input Vertex of another graph * * @param Vertex $originalVertex * @return Vertex new vertex in this graph * @throws RuntimeException if vertex with this ID already exists */ public function createVertexClone(Vertex $originalVertex) { $id = $originalVertex->getId(); if ($this->vertices->hasVertexId($id)) { throw new RuntimeException('Id of cloned vertex already exists'); } $newVertex = new Vertex($this, $id); // TODO: properly set attributes of vertex $newVertex->setLayout($originalVertex->getLayout()); $newVertex->setBalance($originalVertex->getBalance()); $newVertex->setGroup($originalVertex->getGroup()); return $newVertex; }