NETWORK Procedure
Example 2.7 Recursive Community Detection on Zachary’s Karate Club Data
This example illustrates the use of the RECURSIVE option in PROC NETWORK for community detection on Zachary’s Karate Club data (Zachary 1977). The data table appears in Community Detection on Zachary’s Karate Club Data. The current example forces each community to contain no more than five nodes and limits the number of links between any pair of nodes within any community to be no greater than 2.
proc network
links = mylib.LinkSetIn
outNodes = mylib.NodeSetOut;
community
resolutionList = 1.0
recursive (maxCommSize = 5 maxDiameter = 2 relation = AND)
outCommunity = mylib.CommOut;
run;
The output data table mylib.NodeSetOut contains the community identifier of each node, as shown in Output 2.7.1.
Output 2.7.1: Community Nodes Output
| node | community_1 |
|---|---|
| 0 | 4 |
| 1 | 7 |
| 2 | 8 |
| 3 | 6 |
| 4 | 5 |
| 5 | 1 |
| 6 | 1 |
| 7 | 1 |
| 8 | 6 |
| 9 | 3 |
| 10 | 6 |
| 11 | 1 |
| 12 | 7 |
| 13 | 5 |
| 14 | 5 |
| 15 | 2 |
| 16 | 2 |
| 17 | 1 |
| 18 | 8 |
| 19 | 2 |
| 20 | 8 |
| 21 | 4 |
| 22 | 7 |
| 23 | 2 |
| 24 | 9 |
| 25 | 9 |
| 26 | 9 |
| 27 | 4 |
| 28 | 9 |
| 29 | 10 |
| 30 | 4 |
| 31 | 3 |
| 32 | 10 |
| 33 | 2 |
The output data table mylib.CommOut contains the number of nodes in each community, as shown in Output 2.7.2.
Output 2.7.2: Community Number of Nodes Output
| level | resolution | community | nodes | intra_links | inter_links | density | cut_ratio | conductance |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 5 | 6 | 4 | 0.60000 | 0.02759 | 0.25000 |
| 1 | 1 | 2 | 5 | 4 | 12 | 0.40000 | 0.08276 | 0.60000 |
| 1 | 1 | 3 | 2 | 1 | 7 | 1.00000 | 0.10938 | 0.77778 |
| 1 | 1 | 4 | 4 | 4 | 17 | 0.66667 | 0.14167 | 0.68000 |
| 1 | 1 | 5 | 3 | 2 | 9 | 0.66667 | 0.09677 | 0.69231 |
| 1 | 1 | 6 | 3 | 2 | 12 | 0.66667 | 0.12903 | 0.75000 |
| 1 | 1 | 7 | 3 | 2 | 15 | 0.66667 | 0.16129 | 0.78947 |
| 1 | 1 | 8 | 3 | 2 | 10 | 0.66667 | 0.10753 | 0.71429 |
| 1 | 1 | 9 | 4 | 4 | 7 | 0.66667 | 0.05833 | 0.46667 |
| 1 | 1 | 10 | 2 | 1 | 7 | 1.00000 | 0.10938 | 0.77778 |