Gliph\Graph\DirectedAdjacencyList::adjacentTo PHP Method

adjacentTo() public method

public adjacentTo ( $vertex )
    public function adjacentTo($vertex)
    {
        if (!$this->hasVertex($vertex)) {
            throw new NonexistentVertexException('Vertex is not in graph; cannot iterate over its adjacent vertices.');
        }
        $set = $this->getTraversableSplos($this->vertices[$vertex]);
        foreach ($set as $adjacent_vertex) {
            (yield $adjacent_vertex);
        }
        $this->walking->detach($this->vertices);
        // Search inbound arcs
        $set = $this->getTraversableSplos($this->vertices);
        foreach ($set as $v) {
            if ($this->vertices[$v]->contains($vertex)) {
                (yield $v);
            }
        }
        $this->walking->detach($set);
    }