protected function getPathsRecursion(Vertex $start, DirectedEdge $edge)
    {
        // We don't want to visit the same vertex twice within a single path. (avoid loops)
        if (in_array($start->get_data(), $this->current_path)) {
            $this->paths[] = array_reverse($this->current_path);

            return;
        }

        $this->current_path[] = $start->get_data();

        if ($start->incoming_edges->count() == 0) {
            $this->paths[] = array_reverse($this->current_path);

            return;
        }

        /**
         * @var DirectedEdge
         */
        foreach ($start->incoming_edges as $edge) {
            $this->getPathsRecursion($edge->get_source(), $edge);

            //remove the item that was added by the child
            array_pop($this->current_path);
        }
    }
protected function getPathsRecursion(Vertex $start, DirectedEdge $edge)
    {
        // We don't want to visit the same vertex twice within a single path. (avoid loops)
        if (in_array($start->get_data(), $this->current_path)) {
            $this->paths[] = array_reverse($this->current_path);

            return;
        }

        $this->current_path[] = $start->get_data();

        if ($start->incoming_edges->count() == 0) {
            $this->paths[] = array_reverse($this->current_path);

            return;
        }

        /**
         * @var DirectedEdge
         */
        foreach ($start->incoming_edges as $edge) {
            $this->getPathsRecursion($edge->get_source(), $edge);

            //remove the item that was added by the child
            array_pop($this->current_path);
        }
    }
protected function getPathsRecursion ( Vertex $ start , DirectedEdge $ edge ) { // We don't want to visit the same vertex twice within a single path. (avoid loops) if ( in_array ( $ start -> get_data ( ) , $ this -> current_path ) ) { $ this -> paths [ ] = array_reverse ( $ this -> current_path ) ; return ; } $ this -> current_path [ ] = $ start -> get_data ( ) ; if ( $ start -> incoming_edges -> count ( ) == 0 ) { $ this -> paths [ ] = array_reverse ( $ this -> current_path ) ; return ; } /**
         * @var DirectedEdge
         */ foreach ( $ start -> incoming_edges as $ edge ) { $ this -> getPathsRecursion ( $ edge -> get_source ( ) , $ edge ) ; //remove the item that was added by the child array_pop ( $ this -> current_path ) ; } }
Recurse on all paths from the start point

@param Vertex $start The Vertex to get started from
@param DirectedEdge $edge
Recurse on all paths from the start point