Add a vertex to the graph

        :param v: vertex name
        :param partition: partition to add to
357031
def add_vertex(self, v, partition):
        
        self.graph.add_vertex(v)
        self.partitions[partition].add(v)
720331
private void addVirtualEdges(IntObjectMap<VirtualEdgeIterator> node2EdgeMap, EdgeFilter filter, boolean base,
                                 int node, int virtNode) {
        VirtualEdgeIterator existingIter = node2EdgeMap.get(node);
        if (existingIter == null) {
            existingIter = new VirtualEdgeIterator(10);
            node2EdgeMap.put(node, existingIter);
        }
        EdgeIteratorState edge = base
                ? virtualEdges.get(virtNode * 4 + VE_BASE)
                : virtualEdges.get(virtNode * 4 + VE_ADJ_REV);
        if (filter.accept(edge))
            existingIter.add(edge);
    }
246796
def add_vertex(*args)
      vertex = Digraph::Vertex.new(self, @vertices.length)
      apply_arg_conventions(vertex, args)
      @vertices << vertex
      vertex
    end
576785
def insert_into_graph(self, graph):
        
        u = self.source.as_bel()
        v = self.target.as_bel()

        if self.evidence:
            return graph.add_qualified_edge(u, v, **json.loads(self.data))
        else:
            return graph.add_unqualified_edge(u, v, self.relation)
282132
public void addDependency(Vertex<T> v)
    {
        if (!m_dependencies.contains(v))
        {
            m_dependencies.add(v);
        }
    }
301532
def add(self, key):
        
        if key in self._vertices:
            raise ValueError('vertex exists')
        self._vertices.add(key)
        self._forwards[key] = set()
        self._backwards[key] = set()
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
362157
def add_vertex(self, vertex, **attr):
        
        self.vertices[vertex] = []
        if attr:
            self.nodes[vertex] = attr
539909
def add_edge(self, edge):
        
        u, v = edge

        both_exist = u in self.vertices and v in self.vertices
        # Using `is` because if they belong to the same component, they MUST
        # share the same set object!
        if both_exist and self.components[u] is self.components[v]:
            # Both vertices are part of the same connected component.
            raise InvariantError('Adding %r would form a cycle' % (edge,))
        if u == v:
            raise InvariantError('Cannot add loop: %r' % (edge,))

        # Ensure the vertices exist in the graph.
        self.add_vertex(u)
        self.add_vertex(v)

        # Add the edges to each other.
        self._vertices[u].add(v)
        self._vertices[v].add(u)

        # Add all of the smaller components to the bigger one.
        smaller_component, bigger_component = self.sort_components(u, v)
        for vertex in smaller_component:
            bigger_component.add(vertex)
            # And with this assignment, say bye-bye to the smaller component.
            self.components[vertex] = bigger_component
1015684
def add_load(self, lv_load):
        
        if lv_load not in self._loads and isinstance(lv_load,
                                                     MVLoadDing0):
            self._loads.append(lv_load)
            self.graph_add_node(lv_load)
804125
def insert_graph(self, graph: BELGraph, store_parts: bool = True, use_tqdm: bool = False) -> Network:
        
        if not graph.name:
            raise ValueError('Can not upload a graph without a name')

        if not graph.version:
            raise ValueError('Can not upload a graph without a version')

        log.debug('inserting %s v%s', graph.name, graph.version)

        t = time.time()

        self.ensure_default_namespace()

        namespace_urls = graph.namespace_url.values()
        if use_tqdm:
            namespace_urls = tqdm(namespace_urls, desc='namespaces')

        for namespace_url in namespace_urls:
            if namespace_url not in graph.uncached_namespaces:
                self.get_or_create_namespace(namespace_url)

        for keyword, pattern in graph.namespace_pattern.items():
            self.ensure_regex_namespace(keyword, pattern)

        annotation_urls = graph.annotation_url.values()
        if use_tqdm:
            annotation_urls = tqdm(annotation_urls, desc='annotations')

        for annotation_url in annotation_urls:
            self.get_or_create_annotation(annotation_url)

        network = Network(**{
            key: value
            for key, value in graph.document.items()
            if key in METADATA_INSERT_KEYS
        })

        network.store_bel(graph)

        if store_parts:
            network.nodes, network.edges = self._store_graph_parts(graph, use_tqdm=use_tqdm)

        self.session.add(network)
        self.session.commit()

        log.info('inserted %s v%s in %.2f seconds', graph.name, graph.version, time.time() - t)

        return network
363160
def _add_to_graph(self, term, parents):
        
        if self._frozen:
            raise ValueError(
                "Can't mutate %s after construction." % type(self).__name__
            )

        # If we've seen this node already as a parent of the current traversal,
        # it means we have an unsatisifiable dependency.  This should only be
        # possible if the term's inputs are mutated after construction.
        if term in parents:
            raise CyclicDependency(term)

        parents.add(term)

        self.graph.add_node(term)

        for dependency in term.dependencies:
            self._add_to_graph(dependency, parents)
            self.graph.add_edge(dependency, term)

        parents.remove(term)
891740
def addNode(self, node):
        
        self.msg(4, "addNode", node)

        try:
            self.graph.restore_node(node.graphident)
        except GraphError:
            self.graph.add_node(node.graphident, node)
1149000
def add_subgraph(self, sgraph):
        

        if not isinstance(sgraph, Subgraph) and not isinstance(sgraph, Cluster):
            raise TypeError('add_subgraph() received a non subgraph class object:' + str(sgraph))
            
        if self.obj_dict['subgraphs'].has_key(sgraph.get_name()):
        
            sgraph_list = self.obj_dict['subgraphs'][ sgraph.get_name() ]
            sgraph_list.append( sgraph.obj_dict )
                
        else:
            self.obj_dict['subgraphs'][ sgraph.get_name() ] = [ sgraph.obj_dict ]
         
        sgraph.set_sequence( self.get_next_sequence_number() )
        
        sgraph.set_parent_graph( self.get_parent_graph() )
482683
static Partition createListPartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in) {
        Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA);
        Partition partition = new Partition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null);
        partition.createListPartitionOnDb();
        if (abstractLabel instanceof VertexLabel) {
            TopologyManager.addVertexLabelPartition(
                    sqlgGraph,
                    abstractLabel.getSchema().getName(),
                    abstractLabel.getName(),
                    name,
                    in,
                    PartitionType.NONE,
                    null);
        } else {
            TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null);
        }
        partition.committed = false;
        return partition;
    }
775648
def add_edge(self, fr, to):
        
        if fr not in set(self.graph.vs):  # ToDo: find out why item can be in set but not dict
            raise ValueError('can not connect unknown vertices in n-partite graphs, {!r} missing'.format(fr))
        elif to not in set(self.graph.vs):
            raise ValueError('can not connect unknown vertices in n-partite graphs, {!r} missing'.format(to))
        self.graph.add_edge(fr, to)
767335
def add_bond(self, particle_pair):
        
        if self.root.bond_graph is None:
            self.root.bond_graph = BondGraph()

        self.root.bond_graph.add_edge(particle_pair[0], particle_pair[1])