rllm.data.GraphData

class rllm.data.GraphData(x: Tensor | None = None, y: Tensor | None = None, adj: FloatTensor | None = None, **kwargs)[source]

Bases: BaseGraph

A class for homogenerous graph data storage which easily fit into CPU memory.

Parameters:
  • x (Tensor, optional) – Node feature matrix.

  • y (Tensor, optional) – Node label matrix.

  • adj (torch.sparse.FloatTensor, optional) – Adjacency matrix.

  • **kwargs (optional) – Additional attributes.

Shapes:

x: (num_nodes, num_node_features) y: (num_nodes,)

property stores

Returns a list of all storages of the graph.

to_hetero(node_type: Tensor | None = None, edge_type: Tensor | None = None, node_type_names: List[str] | None = None, edge_type_names: Tuple | None = None)[source]

Converts a GraphData to a HeteroGraphData. Node and edge attributes are splitted as the node_type and edge_type vectors.

Parameters:
  • node_type (torch.Tensor, optional) – A node-level vector denoting the type of each node.

  • edge_type (torch.Tensor, optional) – An edge-level vector denoting the type of each edge.

  • node_type_names (List[str], optional) – The names of node types.

  • edge_type_names (List[Tuple], optional) – The names of edge types.