Link prediction estimates whether a relationship between two nodes is likely to appear, or whether a missing relationship should exist. It is useful when networks change over time, such as friendships, and when incomplete networks hide plausible connections, such as drug–disease relationships. In a user–product graph, predicted links can become personalized recommendations. section 10.0 section 10.6
Treat each candidate connection as a pair of nodes, not as an isolated node. Build pair features from combined node properties or embeddings, shortest-path distance, and neighborhood overlap. Common-neighbor counts and Jaccard similarity capture shared local context; degree products capture preferential attachment. section 10.1 section 10.6
Use the workflow diagram to distinguish the feature graph from the labeled relationship samples used to train and test a classifier. section 10.1
Build a link prediction workflow in separate stages:
- Split relationships into a feature set and train/test samples. When timestamps exist, derive features from earlier links and label later links; keep feature relationships out of training and testing to avoid leakage. section 10.2.1 section 10.6
- Create positive samples from observed links and negative samples from pairs without the target relationship. Subsample negatives to avoid severe class imbalance. section 10.4 section 10.6
- Train a binary classifier on the pair features and evaluate it on held-out samples. A random forest is one option; logistic regression and support vector machines are alternatives. section 10.4
Predicting new friendships
If Luke and Rajiv share friends and are close in the network, their pair can receive a higher predicted probability than Jose and Alice. The prediction uses network structure rather than personal characteristics alone, because shared social context helps indicate whether people may meet. section 10.0 section 10.1
Inspect feature distributions before modeling. A feature with little variation, such as a distance that is almost always two hops, may be less useful than a feature with a wider range. Also account for embedding limits: transductive node embeddings cannot represent unseen nodes, so they cannot predict links for nodes absent during training. section 10.4 section 10.6


