A graph convolutional network (GCN) updates each node by combining its features with information from neighboring nodes. In a molecule, nodes can represent atoms and edges represent connectivity; shared weights let the same layer recognize patterns wherever they occur. Neighbor aggregation is permutation invariant, so changing node numbering does not change the result. section 11.4
A practical GCN workflow for drug-target affinity prediction is:
- Store node features in x and graph connectivity in edge_index; use an additional edge-feature tensor when bonds or relationships carry features. section 11.4
- Apply several GCN layers so node vectors incorporate progressively more distant neighborhood information. section 11.5.2
- Use global mean pooling to turn variable-sized molecular or protein graphs into fixed-size vectors, then combine them for affinity prediction. section 11.5.2
- Evaluate with cross-validation, validation MSE, checkpointing, and early stopping rather than treating a single training score as sufficient. section 11.5.6
Three-layer molecular branch
A molecular encoder can refine 78 atom features, expand them to 156 and then 312 features, pool across atoms, and compress the pooled vector through fully connected layers to a 128-dimensional embedding. Dropout follows the fully connected layers to reduce overfitting. section 11.5.2 section 11.5.6
The layer equation makes the update explicit: aggregate a node's neighbors and itself, apply a shared learned matrix, and pass the result through a nonlinearity. section 11.4
Listing 11.7 Process Molecular Graph through GCN Layers
def forward_mol(self, data_mol):
mol_x, mol_edge_index, mol_batch = \
data_mol.x, data_mol.edge_index, data_mol.batch
x = self.relu(self.mol_conv1(mol_x, mol_edge_index))
x = self.relu(self.mol_conv2(x, mol_edge_index))
x = self.relu(self.mol_conv3(x, mol_edge_index))
x = global_mean_pool(x, mol_batch)
x = self.relu(self.mol_fc_g1(x))
x = self.dropout(x)
x = self.mol_fc_g2(x)
x = self.dropout(x)
return xThe implementation applies three graph convolutions, ReLU activations, batch-aware global mean pooling, and dense projection to produce a molecular embedding. section 11.5.2





