I want to perform personlized pagerank (ppr) in python using networkx
as explained here
I have a dataframe that contains the edgelist between two nodes i
and j
df
i j
0 A B
1 B C
2 B A
3 C A
4 C B
and for each node I have a label 0
or 1
.
dfN
Node Label
0 A 0
1 B 1
2 C 0
I created the network
import networkx as nx
g = nx.from_pandas_edgelist(df, 'A', 'B')
Now I want to run the ppr
ppr1 = nx.pagerank(g,personalization={A:0, B:1, C:0})
How can I create the dict
{A:0, B:1, C:0}
directly from dfN
?