Access node features and edges in the RelBench graph
mainThe data object is a HeteroData instance where node types are identified by their originating table name.
- Node Features: Access a node type's features via
data[node_type]. This returns a tuple containing aTensorFrame(analogous to a feature matrix) and a timestamp. You can index theTensorFramedirectly:data["races"].tf[10]. - Edges: Access edges between node types using the syntax
data[(source_node_type, edge_type, target_node_type)]. Edge types follow thef2pconvention (e.g.,f2p_circuitId), wherefstands for foreign key andpfor primary key.
# Access TensorFrame for features
features = data["races"].tf[10:20]
# Access edges between 'races' and 'circuits'
edges = data[("races", "f2p_circuitId", "circuits")]