/** * create new clone/copy of this graph - copy all attributes and vertices, but do NOT copy edges * * using this method is faster than creating a new graph and calling createEdgeClone() yourself * * @return Graph */ public function createGraphCloneEdgeless() { $graph = new Graph(); $graph->getAttributeBag()->setAttributes($this->getAttributeBag()->getAttributes()); // TODO: set additional graph attributes foreach ($this->getVertices() as $originalVertex) { $vertex = $graph->createVertexClone($originalVertex); // $graph->vertices[$vid] = $vertex; } return $graph; }