我正在使用引文网络,我想计算在随机漫步中从网络中的任何其他节点访问网络中给定节点的概率总和。我的理解是currentflow_betweeness_centrality是一个类似于这个想法的指标,但它似乎不适用于直接的grpahs:
import networkx as nx
import pandas as pd
df = pd.read_csv(open("PATH TO CSV","rb"))
DG = nx.DiGraph()
DG.add_edges_from(zip(df.citing.values, df.cited.values))
largest_component = nx.weakly_connected_component_subgraphs(DG)[0]
random_walk = nx.current_flow_betweenness_centrality(largest_component)
外出时,我得到:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/networkx/algorithms/centrality/current_flow_betweenness.py", line 223, in current_flow_betweenness_centrality
'not defined for digraphs.')
networkx.exception.NetworkXError: ('current_flow_betweenness_centrality() ', 'not defined for digraphs.')
关于如何存在此限制的任何想法?
答案 0 :(得分:1)
对于有向图,没有正式定义当前流中介中心性。 也许在你的情况下,你正在寻找其他中心性措施,如PageRank或学位中心性?请参阅http://networkx.lanl.gov/reference/algorithms.link_analysis.html http://networkx.lanl.gov/reference/algorithms.centrality.html