mindspore_gl.BatchedGraphField
- class mindspore_gl.BatchedGraphField(src_idx, dst_idx, n_nodes, n_edges, ver_subgraph_idx, edge_subgraph_idx, graph_mask)[source]
The data container for a batched graph.
The edge information are stored in COO format.
- Parameters
src_idx (Tensor) – A tensor with shape \((N\_EDGES)\), with int dtype, represents the source node index of COO edge matrix.
dst_idx (Tensor) – A tensor with shape \((N\_EDGES)\), with int dtype, represents the destination node index of COO edge matrix.
n_nodes (int) – An integer, represent the nodes count of the graph.
n_edges (int) – An integer, represent the edges count of the graph.
ver_subgraph_idx (Tensor) – A tensor with shape \((N\_NODES)\), with int dtype, indicates each node belonging to which subgraph.
edge_subgraph_idx (Tensor) – A tensor with shape \((N\_EDGES,)\), with int dtype, indicates each edge belonging to which subgraph.
graph_mask (Tensor) – A tensor with shape \((N\_GRAPHS,)\), with int dtype, indicates whether the subgraph is exist.
- Supported Platforms:
GPU
Examples
>>> import mindspore as ms >>> from mindspore_gl import BatchedGraphField >>> n_nodes = 9 >>> n_edges = 11 >>> src_idx = ms.Tensor([0, 2, 2, 3, 4, 5, 5, 6, 8, 8, 8], ms.int32) >>> dst_idx = ms.Tensor([1, 0, 1, 5, 3, 4, 6, 4, 8, 8, 8], ms.int32) >>> ver_subgraph_idx = ms.Tensor([0, 0, 0, 1, 1, 1, 1, 2, 2], ms.int32) >>> edge_subgraph_idx = ms.Tensor([0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2], ms.int32) >>> graph_mask = ms.Tensor([1, 1, 0], ms.int32) >>> batched_graph_field = BatchedGraphField(src_idx, dst_idx, n_nodes, n_edges, ... ver_subgraph_idx, edge_subgraph_idx, graph_mask)