Feature engineering converts graph structures into numerical vectors that conventional machine-learning algorithms can process. Manual feature extraction selects or computes interpretable features from graph properties and domain knowledge, trading creation effort for explainability. section 9.3 section 10.0
A practical graph feature-engineering pipeline proceeds as follows:
- Define the prediction task, such as node classification, link prediction, or graph classification. section 9.3 section 9.4
- Represent nodes or relationships with interpretable measurements, combining local metrics, global measures, node attributes, or domain-specific patterns. section 10.4 section 10.0
- Convert the representations into vectors and apply the same featurization during training and prediction. section 9.3.1
- Train and evaluate a downstream classifier, inspecting precision, recall, F-score, and the confusion matrix. section 9.3.1
- Prune or select features by considering correlation, relevance, interpretability needs, computational resources, and available domain expertise. section 10.4
Karate club node classification
Representing each node only by total degree produces unstable, weak predictions. A three-element vector—total degree, connections to the “Mr. Hi” group, and connections to the “Officer” group—uses homophily to encode social context and yields results close to 100% across repeated runs. The example demonstrates that domain-informed representation can matter more than changing the classifier. section 9.3.1
Path-based relationship features
In the Hetionet biomedical graph, compound–disease pairs are represented by metapaths of lengths two to four. Degree-weighted path count (DWPC) summarizes these paths while discounting highly connected nodes, producing features for treatment-probability prediction even without a direct compound–disease connection. section 10.2.2
Figure 9.6 A graph-based classification approach (collective) versus traditional algorithms for classification
Compare direct graph algorithms with the traditional pipeline that featurizes graph structures before passing vectors to standard machine-learning algorithms. section 9.3















