Python/C++中的智能本地移动(SLM)社区检测
slmp的Python项目详细描述
Python/C++中的智能本地移动(SLM)社区检测
版本在https://github.com/mneedham/slm
- 开发:https://github.com/iosonofabio/slmpy
- 作者:法比奥·扎尼尼
- 许可证:MIT
- 要求:pybind11>=2.2,numpy,pkgconfig(见requirements.txt)
fromslmpyimportModularityOptimzeredges=[[0,1],[0,2],[0,3],[1,2],[1,3],[2,3],[3,4],[4,5],[4,6],[5,6],[7,8],]mo=ModularityOptimzer(edges)mo.fixed_nodes=[0,4]# This fixes nodes 0 and 4 to be in different communitiescommunities=mo(algorithm='smart_local_moving')# Check answerassert((communities==[0,0,0,0,1,1,1]).all())