コード例 #1
0
 /**
  * @param Digraph $graph
  * @param int $vertex
  */
 private function depthSearch(Digraph $graph, int $vertex)
 {
     $this->marked[$vertex] = true;
     foreach ($graph->adjacent($vertex) as $item) {
         if ($this->marked($item)) {
             continue;
         }
         $this->depthSearch($graph, $item);
     }
 }