Adds a node to the graph.

 @param [Abuelo::Node] node to add

 @return [Abuelo::Graph] the graph

 @raise [Abuelo::Exceptions::NodeAlreadyExistsError] if the node is
   already contained in the graph
558333
def add_node(node)
      raise Abuelo::Exceptions::NodeAlreadyExistsError if has_node?(node)

      @nodes[node.name] = node
      node.graph = self

      self
    end
112997
def insert_node(self, node):
        
        if self._is_node_reserved(node):
            return False

        # Put node in map
        self._node_map[node.get_id()] = node
        return True
1062357
def add_node(self, node):
        
        if self.controllers.get(node.controller_type, None):
            raise RuntimeError("Cannot add node {} to the node group. A node for {} group is already assigned".format(
                node,
                node.controller_type
            ))
        self.nodes.append(node)
        if node.controller:
            self.controllers[node.controller_type] = node.controller
            setattr(self, node.controller_type, node.controller)
1234361
public synchronized Node addNode(@NonNull Node node) {
        version++;

        if (buildMode == MeshBuildMode.MESH) {
            // :)
            val candidate = fillQueue.poll();

            // adding node to the candidate
            candidate.addDownstreamNode(node);

            // adding this node for future connections
            for (int e = 0; e < MAX_DOWNSTREAMS; e++)
                fillQueue.add(node);

            sortedNodes.add(node);
            Collections.sort(sortedNodes);
        } else {
            rootNode.addDownstreamNode(node);
        }

        // after all we add this node to the flattened map, for future access
        nodeMap.put(node.getId(), node);

        return node;
    }
1056926
def _add_node(self, node):
        
        node_id = len(self.node_list)
        self.node_to_id[node] = node_id
        self.node_list.append(node)
        self.adj_list[node_id] = []
        self.reverse_adj_list[node_id] = []
        return node_id
805178
def add_edge(self, p_from, p_to, p_id=None):
        
        if not self.has_edge(p_from, p_to):
            if not self.has_node(p_from):
                self.add_node(p_from)

            if not self.has_node(p_to):
                self.add_node(p_to)

            self._edges[p_from].add(p_to)
            self._edge_numbers[(p_from, p_to)] = p_id
546209
def add(object)
      key, id = to_key_and_id(object)

      @graph[key] ? @graph[key] << id : @graph[key] = [id]
    end
485543
def add_node(self, p_id):
        
        if not self.has_node(p_id):
            self._edges[p_id] = set()
1107937
def node(o)
      @nodes.fetch(o.object_id) do
        new_node = @g.add_nodes new_node_name, node_options(o)
        @nodes[o.object_id] = new_node
        each_child_node_of(o) {|_| new_node << node(_) }
        new_node
      end
    end
996172
def add_node(self, node):
        """"""
        for predecessor in self._most_recent_predecessors_to(node):
            predecessor.connect(whom=node)
1188710
def add_node(self, node_id, name, labels):
        '''  '''
        if node_id not in self.node_cache:
            self.workbench.add_node(node_id, name, labels)
            self.node_cache.add(node_id)
431057
def add_node(self, binary_descriptor):
        

        try:
            node_string = parse_binary_descriptor(binary_descriptor)
        except:
            self._logger.exception("Error parsing binary node descriptor: %s", binary_descriptor)
            return _pack_sgerror(SensorGraphError.INVALID_NODE_STREAM)  # FIXME: Actually provide the correct error codes here

        try:
            self.graph.add_node(node_string)
        except NodeConnectionError:
            return _pack_sgerror(SensorGraphError.STREAM_NOT_IN_USE)
        except ProcessingFunctionError:
            return _pack_sgerror(SensorGraphError.INVALID_PROCESSING_FUNCTION)
        except ResourceUsageError:
            return _pack_sgerror(SensorGraphError.NO_NODE_SPACE_AVAILABLE)

        return Error.NO_ERROR
90716
def exist_node(self, graph, node, branch, turn, tick, extant):
        
        if (branch, turn, tick) in self._btts:
            raise TimeError
        self._btts.add((branch, turn, tick))
        self._nodes2set.append((self.pack(graph), self.pack(node), branch, turn, tick, extant))
902601
def add_node(self, node_name: str, external_id: Optional[str] = None) -> None:
        
        self._nodes.add_node_by_name(node_name, external_id)
796076
def add_child(self, node):
        
        if not issubclass(node.__class__, Node):
            raise TypeError("{}.add_child: arg «node»=«{}», type {} not valid.".format(self.__class__.__name__, node, type(node)))
        self.childs.append(node)
        node.parent = self
        return node
1076472
public void add(Node node) {
    if (node==null) return;
    if( node instanceof InnerNode ) {
      throw new IllegalArgumentException(
        "Not allow to add an inner node: "+NodeBase.getPath(node));
    }
    netlock.writeLock().lock();
    try {
      Node rack = getNode(node.getNetworkLocation());
      if (rack != null && !(rack instanceof InnerNode)) {
        throw new IllegalArgumentException("Unexpected data node " 
                                           + node.toString() 
                                           + " at an illegal network location");
      }
      if (clusterMap.add(node)) {
        LOG.info("Adding a new node: "+NodeBase.getPath(node));
        if (rack == null) {
          String rackName = node.getNetworkLocation();
          if (!racks.contains(rackName)) {
            racks.add(rackName);
          } else {
            LOG.error("Discrepancy between network topology and list of racks. "
                + "New rack was already in the list of racks: " + rackName);
          }
        }
      }
      LOG.debug("NetworkTopology became:\n" + this.toString());
    } finally {
      netlock.writeLock().unlock();
    }
  }
39441
def add_node(self, node, adapter_number, port_number, label=None, dump=True):
        

        port = node.get_port(adapter_number, port_number)
        if port is None:
            raise aiohttp.web.HTTPNotFound(text="Port {}/{} for {} not found".format(adapter_number, port_number, node.name))
        if port.link is not None:
            raise aiohttp.web.HTTPConflict(text="Port is already used")

        self._link_type = port.link_type

        for other_node in self._nodes:
            if other_node["node"] == node:
                raise aiohttp.web.HTTPConflict(text="Cannot connect to itself")

            if node.node_type in ["nat", "cloud"]:
                if other_node["node"].node_type in ["nat", "cloud"]:
                    raise aiohttp.web.HTTPConflict(text="It's not allowed to connect a {} to a {}".format(other_node["node"].node_type, node.node_type))

            # Check if user is not connecting serial => ethernet
            other_port = other_node["node"].get_port(other_node["adapter_number"], other_node["port_number"])
            if other_port is None:
                raise aiohttp.web.HTTPNotFound(text="Port {}/{} for {} not found".format(other_node["adapter_number"], other_node["port_number"], other_node["node"].name))
            if port.link_type != other_port.link_type:
                raise aiohttp.web.HTTPConflict(text="It's not allowed to connect a {} to a {}".format(other_port.link_type, port.link_type))

        if label is None:
            label = {
                "x": -10,
                "y": -10,
                "rotation": 0,
                "text": html.escape("{}/{}".format(adapter_number, port_number)),
                "style": "font-size: 10; font-style: Verdana"
            }

        self._nodes.append({
            "node": node,
            "adapter_number": adapter_number,
            "port_number": port_number,
            "port": port,
            "label": label
        })

        if len(self._nodes) == 2:
            yield from self.create()
            for n in self._nodes:
                n["node"].add_link(self)
                n["port"].link = self
            self._created = True
            self._project.controller.notification.emit("link.created", self.__json__())

        if dump:
            self._project.dump()