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

Method __init__

graphlearn/python/data/values.py:601–646  ·  view source on GitHub ↗

Sparse Edges.

(self,
               src_ids=None,
               src_type=None,
               dst_ids=None,
               dst_type=None,
               edge_type=None,
               offsets=None,
               dense_shape=None,
               edge_ids=None,
               src_nodes=None,
               dst_nodes=None,
               int_attrs=None,
               float_attrs=None,
               string_attrs=None,
               weights=None,
               labels=None,
               graph=None)

Source from the content-addressed store, hash-verified

599 """
600
601 def __init__(self,
602 src_ids=None,
603 src_type=None,
604 dst_ids=None,
605 dst_type=None,
606 edge_type=None,
607 offsets=None,
608 dense_shape=None,
609 edge_ids=None,
610 src_nodes=None,
611 dst_nodes=None,
612 int_attrs=None,
613 float_attrs=None,
614 string_attrs=None,
615 weights=None,
616 labels=None,
617 graph=None):
618 """ Sparse Edges.
619 """
620 Edges.__init__(self, src_ids=src_ids,
621 src_type=src_type,
622 dst_ids=dst_ids,
623 dst_type=dst_type,
624 edge_type=edge_type,
625 edge_ids=edge_ids,
626 src_nodes=src_nodes,
627 dst_nodes=dst_nodes,
628 int_attrs=None,
629 float_attrs=None,
630 string_attrs=None,
631 weights=weights,
632 labels=labels,
633 shape=None,
634 graph=graph)
635 SparseBase.__init__(self, offsets, dense_shape)
636 if not src_nodes:
637 num_edges = sum(offsets)
638 if src_ids is not None and src_ids.shape[0] != num_edges:
639 raise ValueError("Ids must be the same length of indices")
640 self._src_nodes = SparseNodes(src_ids, offsets, dense_shape,
641 src_type, graph=graph)
642 self._dst_nodes = SparseNodes(dst_ids, offsets, dense_shape,
643 dst_type, graph=graph)
644 else:
645 self._dense_shape = dst_nodes.dense_shape
646 self._offsets = dst_nodes.offsets
647
648 def __next__(self):
649 if self._it < len(self._offsets):

Callers

nothing calls this directly

Calls 2

SparseNodesClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected