MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / _add_one_node

Method _add_one_node

easygraph/classes/graph.py:808–818  ·  view source on GitHub ↗
(self, one_node_for_adding, node_attr: dict = {})

Source from the content-addressed store, hash-verified

806 self._clear_cache()
807
808 def _add_one_node(self, one_node_for_adding, node_attr: dict = {}):
809 node = one_node_for_adding
810 if node not in self._node:
811 self._node_index[node] = self._id
812 self._id += 1
813 self._adj[node] = self.adjlist_inner_dict_factory()
814 attr_dict = self._node[node] = self.node_attr_dict_factory()
815 attr_dict.update(node_attr)
816 else: # If already exists, there is no complain and still updating the node attribute
817 self._node[node].update(node_attr)
818 self._clear_cache()
819
820 def add_edge(self, u_of_edge, v_of_edge, **edge_attr):
821 """Add one edge.

Callers 3

add_nodeMethod · 0.95
add_nodesMethod · 0.95
_add_one_edgeMethod · 0.95

Calls 2

_clear_cacheMethod · 0.95
updateMethod · 0.80

Tested by

no test coverage detected