我正在使用一个引文网络,我想计算在随机游走时,从网络中的任何其他节点访问网络中的给定节点的概率之和。我的理解是,中心性是一个与此概念类似的度量,但它似乎不适用于定向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.')对于为什么会存在这种限制,有什么想法吗?
发布于 2014-02-23 20:03:43
对于有向图,没有正式定义当前流之间的中心性。也许在您的情况下,您正在寻找其他中心性度量之一,如PageRank或度中心性?见analysis.html http://networkx.lanl.gov/reference/algorithms.centrality.html
https://stackoverflow.com/questions/21921608
复制相似问题