2014-02-20 40 views
1

我正在使用引用網絡,我想計算隨機遊走訪問網絡中任何其他節點的給定節點的概率的總和。我的理解是,currentflow_betweeness_centrality是度量類似於這樣的想法,但它似乎不直接grpahs工作:使用networkx定向圖的current_flow_betweenness_centrality?

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) 

由於outout,我得到:

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.') 

如何任何想法爲什麼這個限制存在?

回答

相關問題