direction = $direction; return $this; } protected function getVerticesAdjacent(Vertex $vertex) { if ($this->direction === self::DIRECTION_FORWARD) { return $vertex->getVerticesEdgeTo(); } elseif ($this->direction === self::DIRECTION_REVERSE) { return $vertex->getVerticesEdgeFrom(); } elseif ($this->direction === self::DIRECTION_BOTH) { return $vertex->getVerticesEdge(); } else { throw new DomainException('Should not happen. Invalid direction setting'); } } /** * get set of all Vertices that can be reached from start vertex * * @return Vertices */ abstract public function getVertices(); }