Preprocessing transforms raw data into a graph-aware form suitable for GNN training and inference. It connects graph construction with model execution by organizing representations, splits, and data loading. section 1.5.1 section 7.2
A practical preprocessing pipeline typically includes:
- Choose nodes, edges, features, and a storage representation for the raw data. section 1.5.1
- Represent graph structure with an adjacency list, adjacency matrix, edge list, or subgraph. section 8.3
- Split examples into training, validation, and test subsets, often using Boolean masks or index arrays. section 1.5.1 section 8.3
- Sample or batch data when the graph or dataset cannot be processed efficiently as one whole input. section 1.5.1 section 4.3.2
Converting a graph for GNN training
A representative workflow creates train/test indices, converts a NetworkX graph into a PyTorch Geometric data object, assigns feature and label tensors, and applies the indices to the converted data. A GCN can then consume the complete graph during forward propagation while using a training mask to calculate loss. section 4.3.2
Figure 1.14 Mental model of the GNN project. We start with raw data, which is transformed into a graph data model that can be stored in a graph database or used in a graph processing system. From the graph processing system (and some graph databases), exploratory data analysis and visualization can be done. Finally, for graph machine learning, data is preprocessed into a form that can be submitted for training.
Follow the end-to-end mental model from raw data through graph representation, exploration, and preprocessing for model training. section 1.5.1
Figure 8.7 Summary of steps in the data pipeline process in this section
Use the pipeline summary to inspect how problem-specific data and storage choices become a preprocessed dataset. section 8.3





















