MCPcopy Create free account
hub / github.com/Tencent/embedx / get_node_label_str

Method get_node_label_str

demo/data/scripts/embedx_graph.py:71–84  ·  view source on GitHub ↗
(cls, node)

Source from the content-addressed store, hash-verified

69
70 @classmethod
71 def get_node_label_str(cls, node):
72 node_str = str(node.node_id)
73 label = node.label
74 if isinstance(label, int):
75 node_str += " " + str(label)
76 elif isinstance(label, list):
77 node_str += " " + " ".join([str(int(x)) for x in label])
78 elif isinstance(label, np.ndarray):
79 label_nnz = np.nonzero(label)[0]
80 if np.isscalar(label_nnz):
81 node_str += " " + str(np.asscalar(label_nnz.a))
82 else:
83 node_str += " " + " ".join([str(int(x)) for x in label])
84 return node_str
85
86
87class Context:

Callers 1

write_node_labelMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected