此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

CommunityModularity

CommunityModularity[g, partition]
gives the community modularity of a partition.
CommunityModularity[g, assignment]
gives the community modularity of an assignment.
  • A community in a network is a group of vertices such that there is a higher density of edges within the group than between them.
  • Given a graph g={V, E}, let the vertex set V be partitioned into k subsets V=UnionVi such that each subset belongs to one community. The community modularity Q of this partition is defined as
  • Q= (eii - aii2)
  • where eii is the percentage of number of edges that has both ends in community Vi, and ai is the percentage of edges that start from community Vi. In other words,
  • eii = |{(u, v)|uElementVi, v ElementVi, (u, v)ElementE}|/|E|
  • and
  • ai = |{(u, v)|uElementVi, (u, v)ElementE}|/|E|.
  • The community modularity Q is a number less than or equal to 1. A large positive value indicates that the vertex partition gives significant community structure.
  • The following option can be given:
WeightedFalsewhether edges with higher weights are preferred during matching
This defines a small graph:
Needs["GraphUtilities`"]
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
This gives the community modularity, assuming a partition {{1, 2, 3}, {4, 5, 6}}:
In[4]:=
Click for copyable input
Out[4]=
This gives the community modularity, assuming a partition {{1, 2, 5}, {4, 3, 6}}:
In[5]:=
Click for copyable input
Out[5]=