Skip to main content

A Python library for computing topological indices from SMILES using NetworkX

Project description

🧠 TopoIndex

TopoIndex is a Python library for computing topological indices of molecular and graph structures using NetworkX and RDKit. It supports input via SMILES strings and is designed for mathematical chemistry, cheminformatics, and graph theory applications.


📦 Features

  • Wiener Index
  • Zagreb Indices (First & Second)
  • Hyper-Wiener Index
  • Randic Index
  • Balaban Index
  • Eccentric Connectivity Index
  • Graph Invariants
    • Node & edge count, diameter, radius, girth
    • Spectral radius, Estrada index, Graph energy
    • Optional distance matrix output
  • Command-Line Interface (CLI)
  • 📘 More indices coming soon!

🚀 Installation

Once released on PyPI:

pip install topoindex

For manual installation:

git clone https://github.com/avimallick/topoindex.git
cd topoindex
pip install -e .

⚠️ Requires networkx and rdkit.


🧪 Example Usage (Python)

from topoindex import (
    wiener_index,
    first_zagreb_index,
    second_zagreb_index,
    hyper_wiener_index,
    randic_index,
    balaban_index,
    eccentric_connectivity_index,
)
from topoindex.graphs.invariants import compute_invariants

smiles = "CCO"  # Ethanol

print("Wiener:", wiener_index(smiles))
print("Zagreb-1:", first_zagreb_index(smiles))
print("Zagreb-2:", second_zagreb_index(smiles))
print("Hyper-Wiener:", hyper_wiener_index(smiles))
print("Randic:", randic_index(smiles))
print("Balaban:", balaban_index(smiles))
print("Eccentric Connectivity:", eccentric_connectivity_index(smiles))

invariants = compute_invariants(smiles, include_matrix=True, matrix_format="pandas")
print("Graph Invariants:", invariants)

🖥️ CLI Usage

TopoIndex also provides a command-line interface:

topoindex --smiles "C1=CC=CC=C1" --matrix --matrix-format pandas

Example Output (JSON):

{
  "num_nodes": 6,
  "num_edges": 6,
  "diameter": 3,
  "radius": 3,
  "girth": 6,
  "spectral_radius": 2.0,
  "estrada_index": 9.38,
  "graph_energy": 8.47,
  "distance_matrix": [[0, 1, 2, 1, 2, 3], [1, 0, 1, 2, 3, 2], ...]
}

🧠 What are Topological Indices?

Topological indices are numerical descriptors of graph structure widely used in:

  • Molecular property prediction
  • Graph similarity comparison
  • Cheminformatics and QSPR/QSAR
  • Network analysis

📝 License

Licensed under the MIT License.


🤝 Contributing

Pull requests are welcome. If you'd like to contribute a new index or optimization, please open an issue first.


👨‍💻 Author

Developed by Avinash Mallick.

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

topoindex-0.1.6.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

topoindex-0.1.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file topoindex-0.1.6.tar.gz.

File metadata

  • Download URL: topoindex-0.1.6.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for topoindex-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0d185b86e85b723387835f3a2f199fa2205cb271f71b10905cb4455208b87c17
MD5 5292ad01a48c2fe5fe020aea99a05689
BLAKE2b-256 6b00bf747385d2cd2bc69c80d2823f4964625bc2c189a4225b155eaf8503f81b

See more details on using hashes here.

Provenance

The following attestation bundles were made for topoindex-0.1.6.tar.gz:

Publisher: publish.yml on avimallick/topoindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file topoindex-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: topoindex-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for topoindex-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d59a5e4742440a9767747db941c85b252d6a3856fa11c27d572aad3484654192
MD5 677483ed6d1ea79c3370c7c930d968f8
BLAKE2b-256 85257573c7c72cb7e961b25d8d22513aa7edec536335ae3fad8462a69b48dc53

See more details on using hashes here.

Provenance

The following attestation bundles were made for topoindex-0.1.6-py3-none-any.whl:

Publisher: publish.yml on avimallick/topoindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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