The OPTGRAPH Procedure

Example 1.8 Recursive Community Detection on Zachary’s Karate Club Data

This example illustrates the use of the RECURSIVE option in community detection on Zachary’s Karate Club data. The data set appears in Community Detection on Zachary’s Karate Club Data. This example forces each community to contain no more than five nodes and the number of links between any pair of nodes within any community to be no greater than 2.

proc optgraph
   data_links            = LinkSetIn
   out_nodes             = NodeSetOut
   graph_internal_format = thin;
   community
      resolution_list    = 1.0
      recursive (max_comm_size = 5 max_diameter = 2 relation = AND)
      out_community      = CommOut;
run;

The data set NodeSetOut contains the community identifier of each node. It is shown in Output 1.8.1.

Output 1.8.1: Community Nodes Output

nodecommunity_1
03
92
106
146
153
163
193
205
213
233
249
271
289
298
301
312
328
333
24
15
36
47
50
60
70
87
110
125
137
170
184
224
269
259


The data set CommOut contains the number of nodes contained in each community. It is shown in Output 1.8.2.

Output 1.8.2: Community Number of Nodes Output

levelresolutioncommunitynodes
1105
1112
1122
1137
1143
1153
1163
1173
1182
1194


The community graph is shown in Figure 147, with different node shapes and colors representing different communities.

Figure 147: Karate Club Recursive Communities

Karate Club Recursive Communities


As you can see from Output 1.8.2, Community 3, whose nodes are drawn as black ellipses in Figure 147, contains seven nodes even though the maximum number of nodes in any community is set to be 5. This is because Community 3 has a symmetric shape: Nodes 0 and 33 are in the center, and they symmetrically connect to Nodes 21, 15, 19, 16, and 23. Therefore, this community cannot be further split.

Last updated: August 06, 2020