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)
| 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): |
no outgoing calls