import networkx as nx

#创建有向图
G = nx.DiGraph()  #nx.Graph() 无向图
#有向图之间边的关系
edges = [("A", "B"), ("A", "C"), ("A", "D"), ("B", "A"), ("B", "D"), ("C", "A"), ("D", "B"), ("D", "C")]
for edge in edges:
    G.add_edge(edge[0],edge[1])
pagerank_list = nx.pagerank(G,alpha=1)
print('PR value is:',pagerank_list)
