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

Method __init__

graphlearn/python/data/values.py:368–405  ·  view source on GitHub ↗

Sparse Nodes. Args: ids: A 1D numpy array, the ids of the nodes. offsets: A python list, each elem of list is an int, which indicates the number of nodes. dense_shape: The shape of the the corresponding dense Nodes. For example, ids=[5, 2, 1, 6, 2, 4], offs

(self,
               ids,
               offsets,
               dense_shape,
               node_type,
               int_attrs=None,
               float_attrs=None,
               string_attrs=None,
               weights=None,
               labels=None,
               graph=None)

Source from the content-addressed store, hash-verified

366 """
367
368 def __init__(self,
369 ids,
370 offsets,
371 dense_shape,
372 node_type,
373 int_attrs=None,
374 float_attrs=None,
375 string_attrs=None,
376 weights=None,
377 labels=None,
378 graph=None):
379 """ Sparse Nodes.
380 Args:
381 ids: A 1D numpy array, the ids of the nodes.
382 offsets: A python list, each elem of list is an int,
383 which indicates the number of nodes.
384 dense_shape: The shape of the the corresponding dense Nodes.
385 For example, ids=[5, 2, 1, 6, 2, 4],
386 offsets=[3, 2, 1],
387 dense_shape=[3, 5].
388 The corresponding dense Nodes is
389 [[ 5, 2, 1, -1, -1],
390 [ 6, 2, -1, -1, -1],
391 [ 4, -1, -1, -1, -1]]
392 """
393 Nodes.__init__(self, ids,
394 node_type,
395 int_attrs=None,
396 float_attrs=None,
397 string_attrs=None,
398 weights=weights,
399 labels=labels,
400 shape=None,
401 graph=graph)
402 SparseBase.__init__(self, offsets, dense_shape)
403 num_nodes = sum(offsets)
404 if ids.shape[0] != num_nodes:
405 raise ValueError("Ids must be the same length of indices")
406
407 def __next__(self):
408 if self._it < len(self._offsets):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected