Is there an efficient way to calculate the matrix score for common neighbors(CC) and preferential attachment(PA) in python? I'm using igraph to calculate score matrixes for other methods such as jaccard's coefficient (Graph.similarity_jaccard()), dice (Graph.similarity_dice) and adamic/adar (Graph.similarity_inverse_log_weighted()), but I haven't found any function to compute score matrixes for CC and PA.
Currently I'm doing:
#Preferential attachment score between nodes i and j in a graph g
len(g.neighbors(i))*len(g.neighbors(j))
#Common neighbors score between nodes i and j in a graph g
len(g.neighbors(i) and g.neighbors(j))
but I have to do this for all edges(i,j) in the network which in my case is really large.
If anyone knows any mathematical matrix operation that generates such score matrixes I'm looking for, I would appreciate as well.