IGraphDataLoader<T>
Interfaces · AiDotNet.Interfaces
Interface for data loaders that provide graph-structured data for graph neural networks.
Implements: IBatchIterable<GraphData<T>>, IDataLoader<T>
Known implementations: GraphDataLoaderBase<T>
For Beginners
Graphs represent relationships between things:
Example: Social Network
- Nodes: People
- Edges: Friendships
- Node Features: Age, interests, location
- Task: Predict user interests based on their friends
Example: Molecular Structure
- Nodes: Atoms
- Edges: Chemical bonds
- Node Features: Atom type, charge
- Task: Predict molecular properties (toxicity, activity)
The adjacency matrix tells the GNN which nodes are connected so it can aggregate information from neighbors during message passing.
How It Works
This interface is for loading graph-structured data where:
- Nodes have features (attributes for each entity)
- Edges define connections between nodes
- Labels can be per-node (node classification) or per-graph (graph classification)
Properties
| Property | Summary |
|---|---|
Tensor<T> AdjacencyMatrix { get; } |
Gets the adjacency matrix of shape [numNodes, numNodes]. |
Tensor<T> EdgeIndex { get; } |
Gets the edge index tensor in COO format [numEdges, 2]. |
Tensor<T> GraphLabels { get; } |
Gets graph labels for graph classification tasks, or null if not available. |
Tensor<T> NodeFeatures { get; } |
Gets the node feature tensor of shape [numNodes, numFeatures]. |
Tensor<T> NodeLabels { get; } |
Gets node labels for node classification tasks, or null if not available. |
int NumClasses { get; } |
Gets the number of classes for classification tasks. |
int NumEdges { get; } |
Gets the number of edges in the graph (or total across all graphs). |
int NumGraphs { get; } |
Gets the number of graphs in the dataset (1 for single-graph datasets like citation networks). |
int NumNodeFeatures { get; } |
Gets the number of node features. |
int NumNodes { get; } |
Gets the number of nodes in the graph (or total across all graphs). |
Methods
| Method | Summary |
|---|---|
GraphClassificationTask<T> CreateGraphClassificationTask(double trainRatio, double valRatio, int? seed) |
Creates a graph classification task for datasets with multiple graphs. |
LinkPredictionTask<T> CreateLinkPredictionTask(double trainRatio, double negativeRatio, int? seed) |
Creates a link prediction task for predicting missing edges. |
NodeClassificationTask<T> CreateNodeClassificationTask(double trainRatio, double valRatio, int? seed) |
Creates a node classification task with train/val/test split. |