/** * {@inheritdoc} */ public function transpose() { $graph = new self(); foreach ($this->edges() as $edge) { $graph->ensureArc($edge[1], $edge[0]); } return $graph; }