Skip to main content

TAU is a genetic algorithm for graph clustering.

Project description

Tel Aviv University (TAU)

TAU ia a Python package that provides advanced graph clustering using a combination of the igraph library, the Leiden algorithm, and a genetic algorithm. It is designed to achieve superior modularity compared to the standard Leiden algorithm.

Features

  • High Modularity: Achieve better modularity scores than the Leiden algorithm alone.
  • Genetic Algorithm Optimization: Utilizes a genetic algorithm to refine clustering results.
  • Parallel Processing: Supports multi-threaded execution to speed up computations.

Requirements

  • Python version 3.8 or higher is required.
  • For optimal performance, it is recommended to run on Linux or macOS. On Windows, performance may be significantly slower due to architectural differences.
  • The tool requires a minimum of 2 threads to run correctly.

Installation

The tool is available on PyPI and can be installed using pip:

pip install tau-graph-clustering

Usage

Importing the Tool

To use the tool, import the necessary classes and functions:

from tau import GeneticOptimizer

Creating a Clustering Instance

Create an instance of the GraphClustering class with the following parameters:

  • `G_ig`: The igraph graph object.
  • `population_size` (default=60): The number of partitions in the genetic algorithm's population.
  • `n_workers` (default=-1): The number of worker threads. Use -1 to utilize all available cores. The minimal requered number of workers is 2.
  • `max_generations` (default=500): The maximum number of generations for the genetic algorithm.
  • `selection_power` (default=5): The power of selection pressure in the genetic algorithm.
  • `p_elite` (default=0.1): The proportion of elite partitions to carry over to the next generation.
  • `p_immigrants` (default=0.15): The proportion of new random partitions introduced each generation.
  • `stopping_criterion_generations` (default=10): The number of generations without a significant improvement to stop the algorithm.
  • `stopping_criterion_similarity` (default=0.98): The threshold for similarity considered insignificant, which increments the counter from the previous point.
  • `elite_similarity_threshold` (default=0.9): The threshold for similarity among elite solutions; we select partitions as elite that are not more similar to each other than this value.
  • `logging` (default=False): Enable logging for detailed process information.

Example:

clustering = GraphClustering(G_ig=my_graph, population_size=100, max_generations=200)

Finding the Optimal Partition

Use the find_partition method to perform the clustering:

partition = clustering.find_partition()

Examples

For more examples and use cases, refer to the examples directory.

Citation

If you use TAU in your research, please cite:

Gal Gilad, Roded Sharan, From Leiden to Tel-Aviv University (TAU): exploring clustering solutions via a genetic algorithm, PNAS Nexus, Volume 2, Issue 6, June 2023, pgad180, https://doi.org/10.1093/pnasnexus/pgad180.

License

This project is licensed under the terms of the GNU General Public License.

Contributions

Contributions are welcome! Please submit pull requests or open issues for any bugs or feature requests.

Contact

For questions or support, please contact berdichevskaya.a.g@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tau_graph_clustering-1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tau_graph_clustering-1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file tau_graph_clustering-1.0.tar.gz.

File metadata

  • Download URL: tau_graph_clustering-1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for tau_graph_clustering-1.0.tar.gz
Algorithm Hash digest
SHA256 f70e6d7fe989823a536301ddced66a50f86eda52473031431f31cf9da381a1e1
MD5 1904b77b572de475c25934a815391afe
BLAKE2b-256 9e1a79cde1ff3bec3ab02049d350bfa1319389d1ec0255d3255cfe42d3f29bc9

See more details on using hashes here.

File details

Details for the file tau_graph_clustering-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tau_graph_clustering-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f754fb3a0828dacfb68e830ac7de9557d40ef9cb00d8e5ad95ba6958b45191dd
MD5 3808fadcf517cbe39d8c3a30330dddbf
BLAKE2b-256 4ecb84768fce6cef7c3faf2e5fa68403b1faaeca4f30d663a43a6e83153e584d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page