This repository contains materials, assignments, and projects from my Social Network Analysis course as a fourth-year Data Science student.
- Introduction
- Repository Structure
- Technologies Used
- Installation & Usage
- Course Content
- Contributing
- License
- Contact
This repository showcases various aspects of Social Network Analysis, including:
- Network structure analysis
- Key metrics calculation (PageRank, HITS, Centrality)
- Community detection
- Text analysis and topic modeling
- Real-world SNA applications
The code and materials here demonstrate both theoretical understanding and practical implementation of SNA concepts.
social-network-analysis/
│
├── data/ # Sample data and datasets
├── notebooks/ # Jupyter notebooks for analysis
├── src/ # Source code
│ ├── page_rank_hits_demo.py
│ ├── tf_idf_lda_demo.py
│ └── overview.py
├── docs/ # Course materials
│ └── 01. Introduction to Social Networks.pdf
├── results/ # Analysis outputs
├── requirements.txt # Project dependencies
└── README.md
-
Core Technologies:
- Python 3.8+
- NetworkX for graph analysis
- Scikit-learn for machine learning
- Pandas for data manipulation
- NumPy for numerical computations
- Matplotlib/Plotly for visualization
-
Key Libraries:
import networkx as nx
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
- Clone the repository:
git clone https://github.com/your-username/social-network-analysis.git
cd social-network-analysis
- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Graph theory basics
- Network types and properties
- Social network characteristics
- Data collection methods
-
Centrality Measures:
- Degree centrality
- Betweenness centrality
- Closeness centrality
- Eigenvector centrality
-
Ranking Algorithms:
- PageRank
- HITS (Hyperlink-Induced Topic Search)
- Preferential Attachment
- Louvain method
- Girvan-Newman algorithm
- Modularity optimization
- Clique percolation
- TF-IDF implementation
- Topic modeling with LDA
- Sentiment analysis
- Network text visualization
- Friend network analysis
- Influence measurement
- Information diffusion
- Recommendation systems
import networkx as nx
# Create sample graph
G = nx.DiGraph()
G.add_edges_from([("A", "B"), ("B", "C"), ("C", "A")])
# Calculate PageRank
pagerank = nx.pagerank(G, alpha=0.85)
print("PageRank:", pagerank)
# Calculate HITS
hubs, authorities = nx.hits(G)
print("Hubs:", hubs)
print("Authorities:", authorities)
Contributions are welcome! To contribute:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.