Skip to content

Commit 0e69ba4

Browse files
committed
add: hierarchical clustering
1 parent 6ebb7dc commit 0e69ba4

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

doc/source/community_detection_guide/notebooks/community_detection_algorithms.ipynb

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"Modularity maximization methods are a prominent class of algorithms in community detection that aim to discover partitions of a network by optimizing a specific quality function called modularity.\n",
1111
"<div style=\"background-color: #e6ffe6; padding: 0px; border-radius: 5px;\">\n",
1212
" \n",
13-
"**NOTE:** You can find a more detailed explanation of **modularity** [here](./modularity.ipynb).\n",
13+
"**NOTE:** You can find a more detailed explanation of **modularity** [here](./modularityZ.ipynb).\n",
1414
"\n",
1515
"</div>\n",
1616
"\n",
@@ -45,7 +45,7 @@
4545
" - γ > 1: Leads to more, smaller, and well-connected communities.\n",
4646
"\n",
4747
" - 0 < γ < 1: Leads to fewer, larger, and potentially less well-connected communities.\n",
48-
"\n",
48+
" \n",
4949
"\n",
5050
"### __community_fastgreedy__\n",
5151
"\n",
@@ -60,6 +60,34 @@
6060
"- _Hierarchical insights are valuable:_ As an agglomerative method, it constructs a dendrogram (a hierarchical tree of merges). In `igraph`, this function directly returns a `VertexDendrogram` object, which can be used to visualize community formation. From this dendrogram, the partition with the highest modularity found throughout the merging process can be easily extracted (e.g., using the `.as_clustering()` method), or other levels of granularity can be explored.\"\n",
6161
"\n",
6262
"- _Baseline comparison:_ Due to its historical significance and speed, it's often used as a baseline algorithm to compare the performance and results of newer, more complex community detection methods.\n",
63+
" \n",
64+
"\n",
65+
"## __Hierarchical clustering__\n",
66+
"Hierarchical clustering methods are a class of algorithms that build a hierarchy of partitions, either by merging smaller communities into larger ones or by subdividing a large network into smaller ones. The result of these methods is typically a **dendrogram**, which visually represents the nested community structure.\n",
67+
"\n",
68+
"These methods don't require you to pre-specify the number of communities. Instead, you choose the final partition by cutting the dendrogram at a particular level, which defines the number and size of the resulting communities.\n",
69+
"<div style=\"background-color: #e6ffe6; padding: 0px; border-radius: 5px;\">\n",
70+
" \n",
71+
"**NOTE:** You can find a more detailed explanation of **hierarchical clustering** [here](./hierarchical_clustering.ipynb).\n",
72+
"\n",
73+
"</div>\n",
74+
"\n",
75+
"\n",
76+
"### __community_edge_betweenness (The Girvan-Newman Algorithm)__\n",
77+
"\n",
78+
"#### When is community_edge_betweenness applied?\n",
79+
"\n",
80+
"The Edge Betweenness (Girvan-Newman) algorithm is typically applied when:\n",
81+
"\n",
82+
"- _Identifying \"Bridge\" Edges is Key:_ The fundamental idea behind edge betweenness for community detection is that edges connecting different communities will have a high betweenness centrality because many shortest paths between nodes in separate communities must pass through them. Therefore, it's used when the goal is to pinpoint and remove these inter-community \"bottleneck\" connections to reveal the underlying groups.\n",
83+
"\n",
84+
"- _For a Divisive Approach to Community Detection:_ Unlike algorithms that build communities up (agglomerative), community_edge_betweenness employs a \"top-down\" or \"divisive\" strategy. It iteratively removes the most central \"bridge\" edges, causing the network to naturally break apart into its constituent communities. This is useful when you want to understand how communities are _separated_ rather than how they are _formed_.\n",
85+
"\n",
86+
"- _To Understand Hierarchical Community Structure:_ A significant strength of this method is that it intrinsically generates a hierarchical decomposition of the network. As edges are progressively removed, you can observe the community structure at different levels of granularity – from a few large communities to many smaller ones. This makes it ideal for analyses where understanding the nested relationships between groups is important, often visualized as a dendrogram.\n",
87+
"\n",
88+
"- _For Moderate-Sized Networks (or when computational resources allow for larger ones):_ A key consideration is the computational cost. Calculating and recalculating edge betweenness after each edge removal can be computationally intensive, especially for very large networks (it has a high time complexity, often cited as O(MN2) or O(N3) in dense graphs, where N is the number of nodes and M is the number of edges). Therefore, it's often more practical for small to medium-sized networks, or when approximate versions are available or high-performance computing resources can be leveraged.\n",
89+
"\n",
90+
"## __Other methods__\n",
6391
"\n",
6492
"\n",
6593
"### __community_voronoi__\n",
@@ -105,21 +133,6 @@
105133
"- _Computational efficiency for large graphs is a priority:_ The algorithm is generally quite efficient and scalable, making it a viable option for large networks where other methods might be too slow. It converges relatively quickly.\n",
106134
"\n",
107135
"\n",
108-
"### __community_edge_betweenness (The Girvan-Newman Algorithm)__\n",
109-
"\n",
110-
"#### When is community_edge_betweenness applied?\n",
111-
"\n",
112-
"The Edge Betweenness (Girvan-Newman) algorithm is typically applied when:\n",
113-
"\n",
114-
"- _Identifying \"Bridge\" Edges is Key:_ The fundamental idea behind edge betweenness for community detection is that edges connecting different communities will have a high betweenness centrality because many shortest paths between nodes in separate communities must pass through them. Therefore, it's used when the goal is to pinpoint and remove these inter-community \"bottleneck\" connections to reveal the underlying groups.\n",
115-
"\n",
116-
"- _For a Divisive Approach to Community Detection:_ Unlike algorithms that build communities up (agglomerative), community_edge_betweenness employs a \"top-down\" or \"divisive\" strategy. It iteratively removes the most central \"bridge\" edges, causing the network to naturally break apart into its constituent communities. This is useful when you want to understand how communities are _separated_ rather than how they are _formed_.\n",
117-
"\n",
118-
"- _To Understand Hierarchical Community Structure:_ A significant strength of this method is that it intrinsically generates a hierarchical decomposition of the network. As edges are progressively removed, you can observe the community structure at different levels of granularity – from a few large communities to many smaller ones. This makes it ideal for analyses where understanding the nested relationships between groups is important, often visualized as a dendrogram.\n",
119-
"\n",
120-
"- _For Moderate-Sized Networks (or when computational resources allow for larger ones):_ A key consideration is the computational cost. Calculating and recalculating edge betweenness after each edge removal can be computationally intensive, especially for very large networks (it has a high time complexity, often cited as O(MN2) or O(N3) in dense graphs, where N is the number of nodes and M is the number of edges). Therefore, it's often more practical for small to medium-sized networks, or when approximate versions are available or high-performance computing resources can be leveraged.\n",
121-
"\n",
122-
"\n",
123136
"### __community_label_propagation__\n",
124137
"\n",
125138
"#### When is community_label_propagation applied?\n",

0 commit comments

Comments
 (0)