normalizeGraph example


  public function testDepthFirstSearch() {
    // The sample graph used is:     // @code     // 1 --> 2 --> 3 5 ---> 6     // | ^ ^     // | | |     // | | |     // +---> 4 <-- 7 8 ---> 9     // @endcode     $graph = $this->normalizeGraph([
      1 => [2],
      2 => [3, 4],
      3 => [],
      4 => [3],
      5 => [6],
      7 => [4, 5],
      8 => [9],
      9 => [],
    ]);
    $graph_object = new Graph($graph);
    $graph = $graph_object->searchAndSort();

    
Home | Imprint | This part of the site doesn't use cookies.