private function dfs($v) { $this->marked[$v] = true; foreach ($this->graph->getAdjacentTo($v) as $w) { if (!$this->marked[$w]) { $this->dfs($w); $this->edgeTo[$w] = $v; } } }