Prepare the graph
Load a representative graph, remove or timestamp edges for a realistic train/test split, and sample negative (non-edge) pairs that match node-degree distribution.
Predict missing edges. Assess ranking quality.
Link prediction estimates which pairs of nodes are likely to form edges in the future or are missing from an observed graph. Typical baselines use topological heuristics (common neighbours, Adamic–Adar, preferential attachment), and stronger systems use supervised models or graph neural networks. Proper evaluation requires negative sampling, temporally aware splits and ranking metrics such as AUC and mean reciprocal rank (MRR).
Learning concept · Not a validated service
Link prediction estimates which pairs of nodes are likely to form edges in the future or are missing from an observed graph. Typical baselines use topological heuristics (common neighbours, Adamic–Adar, preferential attachment), and stronger systems use supervised models or graph neural networks. Proper evaluation requires negative sampling, temporally aware splits and ranking metrics such as AUC and mean reciprocal rank (MRR).
A proposed application is recommending new connections in a social or collaboration graph, where suggestions should be surfaced for user approval rather than applied automatically. The supplied starter does not implement this recommendation pipeline.
Load a representative graph, remove or timestamp edges for a realistic train/test split, and sample negative (non-edge) pairs that match node-degree distribution.
Compute heuristic scores for node pairs (common neighbours, Adamic–Adar, Jaccard, preferential attachment) and optionally concatenate node-level features like degree and PageRank.
Fit a logistic regression or an MLP to predict edge existence from pair features, and measure AUC, precision@k and MRR on held-out pairs.
Analyse false positives/negatives by degree and community, and design an output that requires human review before creating edges in a live system.
The supplied starter builds NetworkX's Karate Club graph, computes per-node properties (degree, clustering coefficient, PageRank), combines those into a single composite 'risk_or_class_score', and prints the top-ranked nodes. It does not create pairwise features, train a link predictor, or evaluate edge-ranking metrics.
graph = nx.karate_club_graph()
features = pd.DataFrame(
{
"node": list(graph.nodes()),
"degree": [graph.degree(node) for node in graph.nodes()],
"clustering": [nx.clustering(graph, node) for node in graph.nodes()],
"pagerank": [nx.pagerank(graph)[node] for node in graph.nodes()],
}The starter computes node-level scores on the Karate Club graph and does not perform link prediction: there is no generation of pairwise features or positive/negative edge splits, no supervised model for predicting edges, and no ranking metrics such as AUC or MRR.
A proposed extension is a minimal edge-scoring prototype that generates positive/negative pairs from a temporal or held-out split, computes heuristic pair features, fits a logistic-regression baseline and compares heuristics against the learned model.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.