[英]how to detect community in directed weighted Graph using networkX?
I have a directed, weighted graph one connected component and want to detect communities.我有一个有向加权图,一个已连接的组件,并且想要检测社区。
I have tried我试过了
community.best_partition(G)
to get a partition, however, I am getting the type error: Bad graph type, use only non directed graph
.要获得一个分区,但是,我得到类型错误:
Bad graph type, use only non directed graph
。
I converted my graph to undirected and then got the partition.我将图形转换为无向图,然后得到了分区。 Is it some way to solve the problem without converting directed to undirected and use weights as well?
是否有某种解决问题的方法,而无需将定向转换为无向且也使用权重?
In addition, I have another question, how am I able to get top 5 centrality degree nodes in each community of partition?另外,我还有另一个问题,如何获得每个分区社区中排名前5位的中心度节点? For example:
例如:
undirected_strong_partition = community.best_partition(undirectedstrong_community,weight='weight')
undirected_strong_partition
{'node1': 0,
'node2': 0,
'node3': 0,
'node4': 0,
'node5': 1,
'node6': 2,
'node7': 2,
'node8': 2,
'node9': 2,
...}
if it is possible, I want to get top 5 degree nodes in each community.如果可能的话,我想获得每个社区中排名前5位的节点。 for instance:
例如:
{community0: [nodetop1,nodetop2...nodetop5]}
I have a directed, weighted graph one connected component and want to detect communities.我有一个有向加权图,一个已连接的组件,并且想要检测社区。
I have tried我试过了
community.best_partition(G)
to get a partition, however, I am getting the type error: Bad graph type, use only non directed graph
.要获得一个分区,但是,我得到类型错误:
Bad graph type, use only non directed graph
。
I converted my graph to undirected and then got the partition.我将图形转换为无向图,然后得到了分区。 Is it some way to solve the problem without converting directed to undirected and use weights as well?
是否有某种解决问题的方法,而无需将定向转换为无向且也使用权重?
In addition, I have another question, how am I able to get top 5 centrality degree nodes in each community of partition?另外,我还有另一个问题,如何获得每个分区社区中排名前5位的中心度节点? For example:
例如:
undirected_strong_partition = community.best_partition(undirectedstrong_community,weight='weight')
undirected_strong_partition
{'node1': 0,
'node2': 0,
'node3': 0,
'node4': 0,
'node5': 1,
'node6': 2,
'node7': 2,
'node8': 2,
'node9': 2,
...}
if it is possible, I want to get top 5 degree nodes in each community.如果可能的话,我想获得每个社区中排名前5位的节点。 for instance:
例如:
{community0: [nodetop1,nodetop2...nodetop5]}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.