Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove louvain depedency #10

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ g = reader.read()

### Running Algorithms

We need to install louvain and graspologic first, to run louvain and leiden algorithm that are not included in NetworkX(not like Pagerank etc).

```bash
pip3 install python-louvain graspologic
```

Then we can run the algorithms.

```python
import networkx as nx
import community as community_louvain
Expand All @@ -123,6 +131,14 @@ pr = nx.pagerank(
# Run Louvain community detection
ug = g.to_undirected()
louvain = community_louvain.best_partition(ug)

# Run Leiden community detection

from graspologic.partition import hierarchical_leiden

# Cast Multi-Graph to Homogeneous Graph
g = nx.Graph(g)
community_hierarchical_clusters = hierarchical_leiden(ug, max_cluster_size=10)
```

### Writing Results Back to NebulaGraph
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ dependencies = [
"pandas>=1.3.5",
"numpy>=1.21.6",
"scipy>=1.7.3",
"python-louvain>=0.16",
]
requires-python = ">=3.7.1"
readme = "README.md"
Expand Down