我与一个引文网络一起工作,我想计算随机游动网络中任何其他节点访问网络中给定节点的概率总和。我的理解是currentflow_betweeness_centrality是一个与这个想法类似的度量,但它似乎不适用于有向grpah:
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)
最后,我得到:
^{pr2}$你知道为什么会有这种限制吗?在
有向图的当前流中间度没有正式定义。 也许在你的例子中,你在寻找其他的中心性指标,比如PageRank或者学位中心度?见http://networkx.lanl.gov/reference/algorithms.link_analysis.htmlhttp://networkx.lanl.gov/reference/algorithms.centrality.html
相关问题 更多 >
编程相关推荐