Adds the edge and its nodes if not already present in the graph.
439204
public void add(E edge) {
        if (! edge.added) { 
            edges.add(edge);
            edge.added = true;
            add(edge.getChild());
            add(edge.getParent());
        }
    }
972902
def complete(self):
        
        for each in self.nodes():
            for other in self.nodes():
                if (each != other and not self.has_edge((each, other))):
                    self.add_edge((each, other))
1283835
final void add(final Cycle cycle) {
        basis.add(cycle);
        edgesOfBasis.or(cycle.edgeVector());
    }
1337830
private void addEdge(int i, int j) {
		if(!nodes.contains(i)){
			nodes.add(i);
			edges.put(i, new HashSet<Integer>());
			size++;
		}else if(!edges.containsKey(i)){
			edges.put(i, new HashSet<Integer>());
		}

		if(!nodes.contains(j)){
			nodes.add(j);
			size++;
		}
		edgesInv.put(j, i);

		if(!edges.get(i).contains(j)){
			edges.get(i).add(j);
		}

	}
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')
1204466
def _help_add_edge(self, u: BaseEntity, v: BaseEntity, attr: Mapping) -> str:
        """"""
        self.add_node_from_data(u)
        self.add_node_from_data(v)

        return self._help_add_edge_helper(u, v, attr)
651920
def add_node(self, graph_node):
        

        if not isinstance(graph_node, Node):
            raise TypeError(
                'add_node() received ' +
                'a non node class object: ' + str(graph_node))


        node = self.get_node(graph_node.get_name())

        if not node:

            self.obj_dict['nodes'][graph_node.get_name()] = [
                graph_node.obj_dict ]

            #self.node_dict[graph_node.get_name()] = graph_node.attributes
            graph_node.set_parent_graph(self.get_parent_graph())

        else:

            self.obj_dict['nodes'][graph_node.get_name()].append(
                graph_node.obj_dict )

        graph_node.set_sequence(self.get_next_sequence_number())
1199943
def add_edge(u, v, flags = EDGE_NORMAL)
      u.join(v)
      u.set_flag(v, flags)
    end
991931
def _add_edge(self, layer, input_id, output_id):
        """"""

        if layer in self.layer_to_id:
            layer_id = self.layer_to_id[layer]
            if input_id not in self.layer_id_to_input_node_ids[layer_id]:
                self.layer_id_to_input_node_ids[layer_id].append(input_id)
            if output_id not in self.layer_id_to_output_node_ids[layer_id]:
                self.layer_id_to_output_node_ids[layer_id].append(output_id)
        else:
            layer_id = len(self.layer_list)
            self.layer_list.append(layer)
            self.layer_to_id[layer] = layer_id
            self.layer_id_to_input_node_ids[layer_id] = [input_id]
            self.layer_id_to_output_node_ids[layer_id] = [output_id]

        self.adj_list[input_id].append((output_id, layer_id))
        self.reverse_adj_list[output_id].append((input_id, layer_id))
668827
@Override
    public void removeEdge(Edge edge) {
        super.removeEdge(edge);

        // Keep track of removed edges.
        if (removedEdgeList == null) {
            removedEdgeList = new LinkedList<>();
        }
        removedEdgeList.add(edge);
    }
666613
def add_node(self, c):
        
        idx = len(self.nodes)
        self.edges[idx] = set()
        self.nodes.append(c)
        return idx
1205090
public void addEdges(Collection<EdgeIteratorState> edges) {
        for (EdgeIteratorState edge : edges) {
            visitedEdges.add(edge.getEdge());
        }
    }
485543
def add_node(self, p_id):
        
        if not self.has_node(p_id):
            self._edges[p_id] = set()
313839
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 ne in n.efferent:
                if ne not in self.added:
                    hopNodes.add(ne)
                hopEdges.append((ne, n, 'solid', colour))
        # add nodes and edges to the graph if maximum number of nodes is not
        # exceeded
        self.add_to_graph(hopNodes, hopEdges, nesting)
381122
def add_undirected_edge(vertex_a, vertex_b, weight)
      add_edge(vertex_a, vertex_b, weight)
      add_edge(vertex_b, vertex_a, weight)
    end
228509
def link(self, node, hyperedge):
        
        if (hyperedge not in self.node_links[node]):
            self.edge_links[hyperedge].append(node)
            self.node_links[node].append(hyperedge)
            self.graph.add_edge(((node,'n'), (hyperedge,'h')))
        else:
            raise AdditionError("Link (%s, %s) already in graph" % (node, hyperedge))
98367
def add_node(self, node_name):
        
        graph = self.graph
        if node_name in graph:
            raise KeyError('node %s already exists' % node_name)
        graph[node_name] = set()