src/Node/Node.php
public function addNode(NodeInterface $node): NodeInterface
    {
        $this->_nodes[$node->getId()] = $node;

        if ($this->getParent()) {
            $this->getParent()->addNode($node);
        }

        return $this;
    }
public function addNode(NodeInterface $node): NodeInterface
    {
        $this->_nodes[$node->getId()] = $node;

        if ($this->getParent()) {
            $this->getParent()->addNode($node);
        }

        return $this;
    }
public function addNode ( NodeInterface $ node ) : NodeInterface { $ this -> _nodes [ $ node -> getId ( ) ] = $ node ; if ( $ this -> getParent ( ) ) { $ this -> getParent ( ) -> addNode ( $ node ) ; } return $ this ; }
Adds a node to this graph.

@param NodeInterface $node - Node.

@return NodeInterface
Adds a node to this graph .