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

Method get_nodes

graphlearn/python/graph.py:658–679  ·  view source on GitHub ↗

Get nodes from the graph. Args: node_type (string): Type of nodes, which should has been added by `Graph.node()`. ids (numpy.ndarray): ids of nodes. In sparse case, it must be 1D. offsets: (list): To get `SparseNodes`, whose dense shape is 2D, `offsets` indicat

(self, node_type, ids, offsets=None, shape=None)

Source from the content-addressed store, hash-verified

656 return self._edge_decoders
657
658 def get_nodes(self, node_type, ids, offsets=None, shape=None):
659 '''Get nodes from the graph.
660
661 Args:
662 node_type (string): Type of nodes, which should has been added by
663 `Graph.node()`.
664 ids (numpy.ndarray): ids of nodes. In sparse case, it must be 1D.
665 offsets: (list): To get `SparseNodes`, whose dense shape is 2D,
666 `offsets` indicates the number of nodes for each line.
667 Default None means it is a dense `Nodes`.
668 shape (tuple, Optional): Indicates the shape of nodes ids, attrs, etc.
669 For dense case, default None means ids.shape. For sparse case, it
670 must has a value which indicates the 2D dense shape.
671
672 Return:
673 A `Nodes` object or a `SparseNodes` object.
674 '''
675 if offsets is None:
676 nodes = data.Nodes(ids, node_type, shape=shape, graph=self)
677 else:
678 nodes = data.SparseNodes(ids, offsets, shape, node_type, graph=self)
679 return nodes
680
681 def get_edges(self, edge_type, src_ids, dst_ids, edge_ids=None, offsets=None,
682 shape=None, reverse=False):

Callers 15

feed_valuesMethod · 0.45
test_labeledMethod · 0.45
test_attributedMethod · 0.45
test_query_existMethod · 0.45
test_query_not_existMethod · 0.45
test_weightedMethod · 0.45
test_weighted_labeledMethod · 0.45
getMethod · 0.45
getMethod · 0.45

Calls

no outgoing calls

Tested by 10

test_labeledMethod · 0.36
test_attributedMethod · 0.36
test_query_existMethod · 0.36
test_query_not_existMethod · 0.36
test_weightedMethod · 0.36
test_weighted_labeledMethod · 0.36
mainFunction · 0.36