I am doing a link prediction problem using the adamic_adar index. The dataset is a grid network(edgelist with 1000 links). I randomly selected 80% (800) of the edges from the observed dataset. I need to select the highest 200 predicted links from preds as below and also calculate the precision ratio. I dont know what to do next. How would I do..help!
import numpy as np
import networkx as nx
G = nx.read_edgelist('Grid.txt', create_using=nx.Graph(), nodetype=int)
preds = nx.adamic_adar_index(G);
for u, v, p in preds:
'(%d, %d) -> %.8f' % (u, v, p)
print(u, v, p)