MCPcopy Create free account
hub / github.com/alibaba/graph-learn / add_node

Method add_node

graphlearn/python/gsl/dag.py:52–69  ·  view source on GitHub ↗
(self, alias, node, temp=False)

Source from the content-addressed store, hash-verified

50 return node
51
52 def add_node(self, alias, node, temp=False):
53 def unique_append(item_list, item):
54 if item not in item_list:
55 item_list.append(item)
56
57 if alias in self._alias_to_index.keys():
58 raise ValueError("alias {} already existed.".format(alias))
59 self._nodes[alias] = node
60 if not temp:
61 self._ud_alias.append(alias)
62 dag_node_type = node.type
63 if self.topo.is_exist(dag_node_type):
64 unique_append(self._edge_types,
65 (self.topo.get_src_type(dag_node_type),
66 dag_node_type,
67 self.topo.get_dst_type(dag_node_type)))
68 else:
69 unique_append(self._node_types, dag_node_type)
70
71 def list_alias(self):
72 """ Return the list alias of user defined.

Callers 1

_set_aliasMethod · 0.80

Calls 5

is_existMethod · 0.80
get_src_typeMethod · 0.80
get_dst_typeMethod · 0.80
keysMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected