Adds a node to the graph.
485543
def add_node(self, p_id):
        
        if not self.has_node(p_id):
            self._edges[p_id] = set()
885600
public void add(N node) {
        if (! node.added) {
            nodes.add(node);
            node.added = true;
        }
    }
835060
def add_node(self, node):
        """"""
        nodes = self.nodes()

        # Start with a core of m0 fully-connected agents...
        if len(nodes) <= self.m0:
            other_nodes = [n for n in nodes if n.id != node.id]
            for n in other_nodes:
                node.connect(direction="both", whom=n)

        # ...then add newcomers one by one with preferential attachment.
        else:
            for idx_newvector in xrange(self.m):

                these_nodes = [
                    n for n in nodes if (
                        n.id != node.id and
                        not n.is_connected(direction="either", whom=node))]

                outdegrees = [
                    len(n.vectors(direction="outgoing")) for n in these_nodes]

                # Select a member using preferential attachment
                ps = [(d / (1.0 * sum(outdegrees))) for d in outdegrees]
                rnd = random.random() * sum(ps)
                cur = 0.0
                for i, p in enumerate(ps):
                    cur += p
                    if rnd < cur:
                        vector_to = these_nodes[i]

                # Create vector from newcomer to selected member and back
                node.connect(direction="both", whom=vector_to)
860362
def add_node(self, node):
        
        if _debug: Network._debug("add_node %r", node)

        self.nodes.append(node)
        node.lan = self

        # update the node name
        if not node.name:
            node.name = '%s:%s' % (self.name, node.address)
56177
def add_node_to_network(self, node, network):
        """"""
        network.add_node(node)
        parents = node.neighbors(direction="from")
        if len(parents):
            parent = parents[0]
            parent.transmit()
        node.receive()
209491
def add_load(self, lv_load):
        
        if lv_load not in self._loads and isinstance(lv_load,
                                                     LVLoadDing0):
            self._loads.append(lv_load)
            self.graph_add_node(lv_load)
558333
def add_node(node)
      raise Abuelo::Exceptions::NodeAlreadyExistsError if has_node?(node)

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

      self
    end
359042
public void add(T node) {
		for (int i = 0; i < numberOfReplicas; i++) {
			circle.put(hashFunc.hash(node.toString() + i), node);
		}
	}
1047865
def _add_token(self, token, parent_node='root'):
        """"""
        if parent_node == 'root':
            parent_node = self.root

        token_node_id = 'token:{}'.format(self.token_count)
        self.add_node(token_node_id, layers={self.ns, self.ns+':token'},
                      attr_dict={self.ns+':token': token})
        self.add_edge(parent_node, token_node_id,
                      layers={self.ns},
                      edge_type=EdgeTypes.spanning_relation)
        self.tokens.append(token_node_id)
        self.token_count += 1
1040155
protected void addNode( Node nodeToInsert, Node insertBeforeNode )
    {
        // Insert node.
        nodeToInsert.next = insertBeforeNode;
        nodeToInsert.previous = insertBeforeNode.previous;
        insertBeforeNode.previous.next = nodeToInsert;
        insertBeforeNode.previous = nodeToInsert;
    }
762539
def addNode(self, node):
        
        LOGGER.info('Adding node {}({})'.format(node.name, node.address))
        message = {
            'addnode': {
                'nodes': [{
                    'address': node.address,
                    'name': node.name,
                    'node_def_id': node.id,
                    'primary': node.primary,
                    'drivers': node.drivers,
                    'hint': node.hint
                }]
            }
        }
        self.send(message)
1251342
public Object addNode(Node n) {
        //        System.err.println("addNode(" + n + ")");
        if(n.id == null) {
            n.id = handler.handle(this, n);
        }
        return n.id;
    }
571651
def add(node)
      if @nodes.key?(node.key)
        raise DuplicateNodeError.new(node.key)
      end

      @nodes[node.key] = node
    end
1213316
def add_nodes(self, nodes, nesting=1):
        
        hopNodes = set()  # nodes in this hop
        hopEdges = []     # edges in this hop
        # get nodes and edges for this hop
        for i, n in zip(range(len(nodes)), nodes):
            r, g, b = rainbowcolour(i, len(nodes))
            colour = '#%02X%02X%02X' % (r, g, b)
            for nu in n.uses:
                if nu not in self.added:
                    hopNodes.add(nu)
                hopEdges.append((n, nu, 'dashed', colour))
            if hasattr(n, 'ancestor'):
                if n.ancestor not in self.added:
                    hopNodes.add(n.ancestor)
                hopEdges.append((n, n.ancestor, 'solid', colour))
        # add nodes, edges and attributes to the graph if maximum number of
        # nodes is not exceeded
        if self.add_to_graph(hopNodes, hopEdges, nesting):
            self.dot.attr('graph', size='11.875,1000.0')
48780
public void addNode(Node n)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");

    this.addElement(n);
  }
879261
def add_graph(self, graph):
        """"""
        event = event_pb2.Event(graph_def=graph.SerializeToString())
        self._add_event(event, None)
433665
def add_child(graph, child_id, child_label, parent_id, colour):
    
    node = pydot.Node(child_id, style="filled", fillcolor=colour, label=child_label, shape="polygon", fontname=FONT)
    graph.add_node(node)
    graph.add_edge(pydot.Edge(parent_id, node))