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

Method __init__

graphlearn/python/data/values.py:232–263  ·  view source on GitHub ↗
(self,
               ids,
               node_type,
               int_attrs=None,
               float_attrs=None,
               string_attrs=None,
               weights=None,
               labels=None,
               shape=None,
               graph=None)

Source from the content-addressed store, hash-verified

230 """
231
232 def __init__(self,
233 ids,
234 node_type,
235 int_attrs=None,
236 float_attrs=None,
237 string_attrs=None,
238 weights=None,
239 labels=None,
240 shape=None,
241 graph=None):
242 super(Nodes, self).__init__(int_attrs=int_attrs,
243 float_attrs=float_attrs,
244 string_attrs=string_attrs,
245 weights=weights,
246 labels=labels,
247 shape=shape,
248 graph=graph)
249
250 ids = np.array(ids)
251 if shape is None:
252 self._shape = ids.shape
253 else:
254 if np.prod(ids.shape) == np.prod(shape):
255 self._shape = shape
256 else:
257 self._shape = ids.shape[0:] if len(shape) == 1 else \
258 (int(np.prod(ids.shape) / np.prod(shape[1:])), ) + shape[-1:]
259 self._ids = self._reshape(ids)
260 self._type = node_type
261
262 self._out_degrees = {} # key: edge_type, value: count
263 self._in_degrees = {}
264
265 def _get_decoder(self):
266 return self._graph.get_node_decoder(self._type)

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

_reshapeMethod · 0.80

Tested by

no test coverage detected