public function getVertexRoot()
    {
        foreach ($this->graph->getVertices() as $vertex) {
            if ($this->isVertexPossibleRoot($vertex)) {
                return $vertex;
            }
        }
        throw new UnderflowException('No possible root found. Either empty graph or no Vertex with proper degree found.');
    }
public function getVertexRoot()
    {
        foreach ($this->graph->getVertices() as $vertex) {
            if ($this->isVertexPossibleRoot($vertex)) {
                return $vertex;
            }
        }
        throw new UnderflowException('No possible root found. Either empty graph or no Vertex with proper degree found.');
    }
public function getVertexRoot ( ) { foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { if ( $ this -> isVertexPossibleRoot ( $ vertex ) ) { return $ vertex ; } } throw new UnderflowException ( 'No possible root found. Either empty graph or no Vertex with proper degree found.' ) ; }
get root vertex for this in-tree

@return Vertex
@throws UnderflowException if given graph is empty or no possible root candidate was found (check isTree()!)
@uses Graph::getVertices() to iterate over each Vertex
@uses self::isVertexPossibleRoot() to check if any Vertex is a possible root candidate
get root vertex for this in - tree