Doctrine\OrientDB\Graph\Algorithm\Dijkstra::getShortestPath PHP Method

getShortestPath() public method

Reverse-calculates the shortest path of the graph thanks the potentials stored in the vertices.
public getShortestPath ( ) : Array
return Array
    public function getShortestPath()
    {
        $path = array();
        $vertex = $this->getEndingVertex();
        while ($vertex->getId() != $this->getStartingVertex()->getId()) {
            $path[] = $vertex;
            $vertex = $vertex->getPotentialFrom();
        }
        $path[] = $this->getStartingVertex();
        return array_reverse($path);
    }