graph->createGraphCloneEdgeless(); foreach ($this->graph->getEdges() as $edge) { if (!($edge instanceof EdgeDirected)) { throw new UnexpectedValueException('Edge is undirected'); } $newgraph->createEdgeCloneInverted($edge); } return $newgraph; } }