Graph Analysis with NetworkX
The environment.yml
YAML file in the root folder has the exact conda environment I used for this project.
The requirements.txt
text file in the root folder has the exact Python environment I used for this project.
-
Option 1: Run below with conda to create a new environment to have the exact same environment I used for running the notebooks:
conda env create -f environment.yml
will create a conda environment callednetwork_analysis
.
Then, you can runconda env list
to view your existing environments.
You can runconda activate network_analysis
to use the new environment. -
Option 2: If you don't want to use conda to create a environment, you can try install Python packages I used with the following command:
pip install -r requirements.txt
Click here to see the notebook
This notebook covers how to create the following graphs using NetworkX:
- Undirected graph
- Directed graph
- Signed graph
- Weighted graph
- Multigraph
- Bipartite Graph
- Projected Graph
Click here to see the notebook
This notebook covers how to create visualization using the spring layout in NetworkX for Genshin Impact character network:
Click here to see the notebook part 1
Notebook 3 part 1 covers how to calculate and interpret graph statistics for the following topic:
- Triadic Closer:
- Local Clustering Coefficient (LCC)
- Global Clustering Coefficient (GCC): Average LCC and Transitivity
- Distance Measures:
- Average Distance (Average Shortest Path Length)
- Eccentricity
- Diameter
- Radius
- Center
- Periphery
Click here to see the notebook part 2
Notebook 3 part 2 covers how to calculate and interpret graph statistics for the following topic:
- Connectivity:
- Strongly Connected
- Weakly Connected
- Robustness:
- Density
- Node Connectivity
- Min Node CUt
- Edge Connectivity
- Min Edge Cut
- Isolates
Click here to see the notebook part 3
Notebook 3 part 3 covers how to calculate and interpret graph statistics for the following topic:
- Centreality (Node Importance):
- Degree Centrality
- CLoseness Centrality
- Node Betweenness Centrality
- Edge Betweenness Centrality
- PageRank Centrality with PageRank Algorithm
- Auth and Hub Centrality with HITS Algorithm
- Centrality Ranking by Averging Centrality Measures
Click here to see the notebook part 1
Notebook 4 part 1 covers how to calculate and interpret the below common link prediction features:
- Non-community Based Measures
- The Number of Common Neighbors
- Jaccard Coefficient
- Resource Allocation Index
- Adamic-Adar Index
- Preferential Attachment
Click here to see the notebook
Notebook 5 covers how to use implemented community detection algorithms in NetworkX, python-louvain, and leidenalg
- Community Detection Algorithms:
- Girvan-Newman
- Label-Propagation
- Louvain
- Leiden
Click here to see the notebook
Stanford Network Analysis Project dataset is used for comparing performance: DBLP collaboration network
node total | edge total | Average clustering coefficient |
---|---|---|
317,080 | 1,049,866 | 0.6324 |
Notebook 6 compares the community detection results using Louvain and Leiden algorithms in open source Python package called python-louvain and leidenalg. The notebook will highlight the disadvanatge sof Louvain algorithm and demonstrate why Leiden may be the algorithm you want to use for community detection.
Louvain | Leiden | |
---|---|---|
Modularity | 0.821751 | 0.830028 |
Louvain | Leiden | |
---|---|---|
Disconnected Community | 5 | 0 |