public function linkedTo(string $variable = null, array $labels = []): self
    {
        $path = new self;
        $path->elements = $this
            ->elements
            ->add(Relationship::both())
            ->add(new Node($variable, $labels));
        $path->lastOperation = Node::class;

        return $path;
    }
public function linkedTo(string $variable = null, array $labels = []): self
    {
        $path = new self;
        $path->elements = $this
            ->elements
            ->add(Relationship::both())
            ->add(new Node($variable, $labels));
        $path->lastOperation = Node::class;

        return $path;
    }
public function linkedTo ( string $ variable = null , array $ labels = [ ] ) : self { $ path = new self ; $ path -> elements = $ this -> elements -> add ( Relationship :: both ( ) ) -> add ( new Node ( $ variable , $ labels ) ) ; $ path -> lastOperation = Node :: class ; return $ path ; }
Create a relationship to the given node

@param string $variable
@param array $labels

@return self
Create a relationship to the given node