Fastconsensus is a Python package that implements a fast consensus clustering algorithm for complex networks. It provides an efficient way to perform community detection on large-scale networks using the igraph library.
To install fastconsensus from source, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/fastconsensus.git cd fastconsensus
-
Create a conda environment (optional but recommended):
conda env create -f environment.yml conda activate fastconsensus
-
Install the package:
pip install -e .
Here's a basic example of how to use fastconsensus:
import igraph as ig
from fastconsensus import fast_consensus_clustering, read_graph_from_file
# Read a graph from a file
graph = read_graph_from_file("path/to/your/graph.gml", format="gml")
# Perform fast consensus clustering
partition = fast_consensus_clustering(graph, n_partitions=20, threshold=0.2)
# Print the resulting partition
print(partition)
For more detailed examples and usage scenarios, please refer to the Jupyter notebooks in the notebooks/
directory.
To run the example notebooks:
-
Ensure you have Jupyter installed in your environment:
conda install jupyter
-
Navigate to the
notebooks/
directory and start Jupyter:cd notebooks jupyter notebook
-
Open and run the notebook
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.