MCPcopy Create free account
hub / github.com/alibaba/euler / add_node

Method add_node

tf_euler/python/dataset/cora.py:63–78  ·  view source on GitHub ↗
(id, type, weight, label, feature)

Source from the content-addressed store, hash-verified

61
62 def convert2json(self, convert_dir, out_dir):
63 def add_node(id, type, weight, label, feature):
64 node_buf = {}
65 node_buf["id"] = id
66 node_buf["type"] = type
67 node_buf["weight"] = weight
68 node_buf["features"] = [{}, {}]
69 node_buf['features'][0]['name'] = 'label'
70 node_buf['features'][0]['type'] = 'dense'
71 node_buf['features'][0]['value'] = label.astype(
72 float).tolist()
73 node_buf['features'][1]['name'] = 'feature'
74 node_buf['features'][1]['type'] = 'dense'
75 feature = feature.astype(float)
76 feature /= np.sum(feature) + 1e-7
77 node_buf['features'][1]['value'] = feature.tolist()
78 return node_buf
79
80 def add_edge(src, dst, type, weight):
81 edge_buf = {}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected