public function getRootNodes()
    {
        $roots = [];
        foreach ($this->all() as $node) {

            $isRoot = true;

            foreach ($node->getEdges() as $edge) {
                if ($edge->getTo() == $node) {
                    $isRoot = false;
                }
            }


            if ($isRoot) {
                array_push($roots, $node);
            }
        }

        return $roots;
    }
public function getRootNodes()
    {
        $roots = [];
        foreach ($this->all() as $node) {

            $isRoot = true;

            foreach ($node->getEdges() as $edge) {
                if ($edge->getTo() == $node) {
                    $isRoot = false;
                }
            }


            if ($isRoot) {
                array_push($roots, $node);
            }
        }

        return $roots;
    }
public function getRootNodes ( ) { $ roots = [ ] ; foreach ( $ this -> all ( ) as $ node ) { $ isRoot = true ; foreach ( $ node -> getEdges ( ) as $ edge ) { if ( $ edge -> getTo ( ) == $ node ) { $ isRoot = false ; } } if ( $ isRoot ) { array_push ( $ roots , $ node ) ; } } return $ roots ; }
Get the list of all root nodes

we can have array of roots : graph can be a "forest"

@return array
Get the list of all root nodes