This repository contains a Python-based implementation of the Black Hole Strategy applied to community detection in networks. The main goal is to identify and remove nodes from a graph based on a gravity metric, which takes into account degree centrality, betweenness centrality, and edge weights. The method allows for the removal of a percentage of nodes with the lowest gravity in each community based on a specified threshold.
Below is an example of the Black Hole Strategy in action, showing the graph as nodes are highlighted based on their gravity:
- Community Detection: First, the graph is divided into communities using the Girvan-Newman algorithm.
- Gravity Calculation: For each community, the gravity score for each node is computed using normalized degree centrality, betweenness centrality, and edge weights.
- Stratified Sampling: Nodes are categorized into bins according to their PLD (Pore Limiting Diameter) values, and a proportional number of nodes are selected from each bin to maintain the PLD distribution. (PLD, being a critical parameter in MOFs data, can be substituted or complemented by other properties depending on the application.)
- Node Removal: Nodes with the lowest gravity are removed based on a configurable threshold, representing the percentage of nodes to be removed in each community.
- Results: The remaining nodes are analyzed, and the reduced graph is visualized.
- MOFGalaxyNet:
To access the related code for MOFGalaxyNet, visit the following GitHub repository:
MOFGalaxyNet GitHub Repository