From EK Chapter 3
Triadic closure is the idea that any two “friends” A and B are likely to have some level of connection to each-other’s friends. If A and B are friends and B and C are friends then A and C are likely to become friends over time. This effect is amplified if the bond between A and B is strong and it is amplified if A, B, and C have other friends in common.
Graph Figure 3.21. The B-C edge will be labeled “W” for weak. If it was labeled S then we would expect to see an edge between A and C and between B and D.
The A, B, D triad exemplifies Strong Triadic Closure because the strong A-B and strong A-D edges are accompanied by a weak link between B and D. The D,E,C triad breaks the rule because there is a strong link between D and E and a strong link between C and E, but there is no link between D and C (we would expect at least a week link between D and C). There should also be a link between B and E because of the strong link between B and C and between C and E. Thus nodes C and E violate strong triadic closure.
There should be link between D and C and between B and E because there is a stong link between D-E, E-C, and B-C.
The A-B-C triad exemplifies Strong Triadic Closure. There should be a link between A and E because there is a strong link between A-C and between C-E.
fig314a_Links <- data.matrix(read.table(file = "edgefig314.txt", header = FALSE))
fig314a_Graph <- graph_from_edgelist(fig314a_Links, directed = FALSE)
plot(fig314a_Graph)
fig314a <- cluster_leading_eigen(fig314a_Graph)
modularity(fig314a)
## [1] 0.5034602
membership(fig314a)
## [1] 1 1 1 1 1 1 1 2 2 2 2 3 3 3
fig314a <- cluster_walktrap(fig314a_Graph)
modularity(fig314a)
## [1] 0.5640138
membership(fig314a)
## [1] 4 4 4 3 3 3 1 1 2 2 2 5 5 5
fig314a <- cluster_edge_betweenness(fig314a_Graph)
modularity(fig314a)
## [1] 0.5657439
membership(fig314a)
## [1] 1 1 1 2 2 2 2 3 4 4 4 3 3 3
plot(fig314a, fig314a_Graph)
Note: Why does [R] include node 6 with one partition vs. the other?
fig315_Links <- data.matrix(read.table(file = "edgefig315.txt", header = FALSE))
fig315_Graph <- graph_from_edgelist(fig315_Links, directed = FALSE)
plot(fig315_Graph)
fig315c <- cluster_leading_eigen(fig315_Graph)
modularity(fig315c)
## [1] 0.3933518
membership(fig315c)
## [1] 1 1 1 1 1 1 2 2 2 2 2
fig315c <- cluster_walktrap(fig315_Graph)
modularity(fig315c)
## [1] 0.3933518
membership(fig315c)
## [1] 2 2 2 2 2 1 1 1 1 1 1
fig315c <- cluster_edge_betweenness(fig315_Graph)
modularity(fig315c)
## [1] 0.3933518
membership(fig315c)
## [1] 1 1 1 1 1 2 2 2 2 2 2
plot(fig315c, fig315_Graph)
Note: Deleted first line of “soc-karate”.
Discussion: While these clusters are different from the clusters discussed the text, they are consistent. In the text there are only two clusters after the split, while the cluster measures below split the group into five clusters. Nevertheless, the five clusters below could be simplified into two clusters in the observed world data without invalidating these cluster measures.
Karate_Links <- data.matrix(read.table(file = "soc-karate.mtx", skip = 1, header = FALSE))
fig313_Graph <- graph_from_edgelist(Karate_Links, directed = FALSE)
plot(fig313_Graph)
fig313c <- cluster_leading_eigen(fig313_Graph)
modularity(fig313c)
## [1] 0.3934089
membership(fig313c)
## [1] 1 3 3 3 1 1 1 3 2 2 1 1 3 3 2 2 1 3 2 3 2 3 2 4 4 4 2 4 4 2 2 4 2 2
fig313c <- cluster_walktrap(fig313_Graph)
modularity(fig313c)
## [1] 0.3532216
membership(fig313c)
## [1] 1 1 2 1 5 5 5 1 2 2 5 1 1 2 3 3 5 1 3 1 3 1 3 4 4 4 3 4 2 3 2 2 3 3
fig313c <- cluster_edge_betweenness(fig313_Graph)
modularity(fig313c)
## [1] 0.4012985
membership(fig313c)
## [1] 1 1 2 1 3 3 3 1 4 5 3 1 1 1 4 4 3 1 4 1 4 1 4 4 2 2 4 2 2 4 4 2 4 4
plot(fig313c, fig313_Graph)
Dolphins_Links <- data.matrix(read.table(file = "soc-dolphins.mtx", skip = 1, header = FALSE))
Dolphins_Graph <- graph_from_edgelist(Dolphins_Links, directed = FALSE)
plot(Dolphins_Graph)
Dolphins <- cluster_leading_eigen(Dolphins_Graph)
modularity(Dolphins)
## [1] 0.4911989
membership(Dolphins)
## [1] 1 2 1 3 3 5 5 2 3 5 1 3 4 5 4 3 4 5 3 2 1 3 5 3 3 2 2 2 2 3 2 5 5 4 4 3 3 3
## [39] 4 5 4 5 1 4 1 3 4 1 5 4 4 3 4 4 2 3 5 5 4 3 5 1
fig_dolphins <- cluster_walktrap(Dolphins_Graph)
modularity(Dolphins)
## [1] 0.4911989
membership(Dolphins)
## [1] 1 2 1 3 3 5 5 2 3 5 1 3 4 5 4 3 4 5 3 2 1 3 5 3 3 2 2 2 2 3 2 5 5 4 4 3 3 3
## [39] 4 5 4 5 1 4 1 3 4 1 5 4 4 3 4 4 2 3 5 5 4 3 5 1
fig_dolphins <- cluster_edge_betweenness(Dolphins_Graph)
modularity(Dolphins)
## [1] 0.4911989
membership(Dolphins)
## [1] 1 2 1 3 3 5 5 2 3 5 1 3 4 5 4 3 4 5 3 2 1 3 5 3 3 2 2 2 2 3 2 5 5 4 4 3 3 3
## [39] 4 5 4 5 1 4 1 3 4 1 5 4 4 3 4 4 2 3 5 5 4 3 5 1
plot(Dolphins, Dolphins_Graph)