community简单的例子
来源:互联网 发布:阿里云域名口令 编辑:程序博客网 时间:2024/06/14 22:34
1.下载工具包,并安装。
2.import community到编写的.py文件中。
import communityimport networkx as nximport matplotlib.pyplot as plt#better with karate_graph() as defined in networkx example.#erdos renyi don't have true community structureG = nx.erdos_renyi_graph(30, 0.05)#first compute the best partitionpartition = community.best_partition(G)#drawingsize = float(len(set(partition.values())))pos = nx.spring_layout(G)count = 0.for com in set(partition.values()) : count = count + 1. list_nodes = [nodes for nodes in partition.keys() if partition[nodes] == com] nx.draw_networkx_nodes(G, pos, list_nodes, node_size = 20, node_color = str(count / size))nx.draw_networkx_edges(G,pos, alpha=0.5)plt.show()
【1】API官方文档:
http://perso.crans.org/aynaud/communities/api.html#community.best_partition
1 0
- community简单的例子
- Community Server的问题
- 简单的Timer例子
- c的简单例子
- AJAX的简单例子
- 一个简单的例子
- 重载的例子.....简单
- 简单的AJAX例子
- Struts_DispatchAction简单的例子
- Struts_LookupDispatchAction简单的例子
- Struts_LookupDispatchAction简单的例子
- Struts_DispatchAction简单的例子
- 委托的简单例子
- dwr----简单的例子
- 简单的JavaMail例子
- Proxy的简单例子
- 委托的简单例子
- 简单EJB的例子
- 逆序打印链表
- ios 上传appsStore 申请证书,证书配置
- php快递100查询
- 上传多张照片到服务器
- HDU 1087 Super Jumping! Jumping! Jumping!
- community简单的例子
- 轻松学习正则表达式
- HTML学习笔记1
- V$SESSION
- STL源码剖析笔记-6算法(6.7 其他算法1)
- azkaban安装使用
- 记录一次Android studio Instant Run 问题
- Jenkins 安装与配置
- vue-router 2.0 常用基础知识点之导航钩子