Skip to main content

Computing on Topological Domains

Project description

Computing with Relational Data Abstracted as Topological Domains

Scope and FunctionalityMain FeaturesInstalling TopoNetXGetting StartedReferencesAcknowledgements

Test Lint Codecov Docs Python license slack

DOI

toponetx

Many complex systems, ranging from socio-economic systems such as social networks, over to biological systems (e.g., proteins) and technical systems can be abstracted as a set of entities with are linked to each other via a set of relations. For instance, a social network may be abstracted as a set vertices corresponding to people linked via various social interactions, including pairwise relationships such as friendships and higher-order relationships involving multiple people. This relational data can be abstracted as a topological domain such as a graph, hypergraph, simplicial, cellular path or combinatorial complex, which enables the principled analysis of such data.

TopoNetX provides a unified platform to compute with such relational data.

🎯 Scope and functionality

TopoNetX (TNX) is a package for computing with topological domains and studying their properties.

With its dynamic construction capabilities and support for arbitrary attributes and data, TopoNetX allows users to easily explore the topological structure of their data and gain insights into its underlying geometric and algebraic properties.

Available functionality ranges from computing boundary operators and Hodge Laplacians on simplicial/cell/combinatorial complexes to performing higher-order adjacency calculations.

TNX is similar to NetworkX, a popular graph package, and extends its capabilities to support a wider range of mathematical structures, including cell complexes, simplicial complexes and combinatorial complexes. The TNX library provides classes and methods for modeling the entities and relations found in higher-order networks such as simplicial, cellular, CW and combinatorial complexes. This package serves as a repository of the methods and algorithms we find most useful as we explore the knowledge that can be encoded via higher-order networks.

TNX supports the construction of many topological structures including the CellComplex, PathComplex, "ColoredHyperGraph" SimplicialComplex and CombinatorialComplex classes. These classes provide methods for computing boundary operators, Hodge Laplacians and higher-order adjacency operators on cell, simplicial and combinatorial complexes, respectively. The classes are used in many areas of mathematics and computer science, such as algebraic topology, geometry, and data analysis.

TNX is developed by the pyt-team

🛠️ Main features

  1. Dynamic construction of cell, simplicial and combinatorial complexes, allowing users to add or remove objects from these structures after their initial creation.
  2. Compatibility with the NetworkX and gudhi packages, enabling users to leverage the powerful algorithms and data structures provided by these packages.
  3. Support for attaching arbitrary attributes and data to cells, simplices and other entities in a complex, allowing users to store and manipulate a versatile range of information about these objects.
  4. Computation of boundary operators, Hodge Laplacians and higher-order adjacency operators on a complex, enabling users to study the topological properties of the space.
  5. Robust error handling and validation of input data, ensuring that the package is reliable and easy to use.
  6. Package dependencies are kept to a minimum, to facilitate easy installation and to reduce future installation issues arising from such dependencies.

🤖 Installing TopoNetX

TopoNetX is available on PyPI and can be installed using pip:

pip install toponetx

🦾 Getting Started

Example 1: creating a simplicial complex

import toponetx as tnx

# Instantiate a SimplicialComplex object with a few simplices
sc = tnx.SimplicialComplex([[1, 2, 3], [2, 3, 4], [0, 1]])

# Compute the incidence matrix between 1-skeleton and 0-skeleton
B1 = sc.incidence_matrix(1)

# Compute the incidence matrix between 2-skeleton and 1-skeleton
B2 = sc.incidence_matrix(2)

Example 2: creating a cell complex

import toponetx as tnx

# Instantiate a CellComplex object with a few cells
cx = tnx.CellComplex([[1, 2, 3, 4], [3, 4, 5, 6, 7, 8]], ranks=2)

# Add an edge (cell of rank 1) after initialization
cx.add_edge(0, 1)

# Compute the Hodge Laplacian matrix of dimension 1
L1 = cx.hodge_laplacian_matrix(1)

# Compute the Hodge Laplacian matrix of dimension 2
L2 = cx.hodge_laplacian_matrix(2)

Example 3: creating a combinatorial complex

import toponetx as tnx

# Instantiate a combinatorial complex object with a few cells
cc = tnx.CombinatorialComplex()

# Add some cells of different ranks after initialization
cc.add_cell([1, 2, 3], rank=2)
cc.add_cell([3, 4, 5], rank=2)
cc.add_cells_from([[2, 3, 4, 5], [3, 4, 5, 6, 7]], ranks=3)

# Compute the incidence matrix between cells of rank 0 and 2
B02 = cc.incidence_matrix(0, 2)

# Compute the incidence matrix between cells of rank 0 and 3
B03 = cc.incidence_matrix(0, 3)

🧑‍💻 Install from source

To install the latest version from source, follow these steps:

  1. Clone a copy of TopoNetX from source:
git clone https://github.com/pyt-team/TopoNetX
cd TopoNetX
  1. If you have already cloned TopoNetX from source, update it:
git pull
  1. Install TopoNetX in editable mode (requires pip ≥ 21.3 for PEP 660 support):
pip install -e '.[all]'
  1. Install pre-commit hooks:
pre-commit install

🔍 References

TopoNetX is a part of TopoX, a suite of Python packages for machine learning on topological domains. If you find TopoNetX useful please consider citing our software paper:

@article{hajij2024topox,
  title={TopoX: A Suite of Python Packages for Machine Learning on Topological Domains},
  author={PYT-Team},
  journal={arXiv preprint arXiv:2402.02441},
  year={2024}
}

To learn more about topological domains, and how they can be used in deep learning:

@misc{hajij2023topological,
      title={Topological Deep Learning: Going Beyond Graph Data},
      author={Mustafa Hajij and Ghada Zamzmi and Theodore Papamarkou and Nina Miolane and Aldo Guzmán-Sáenz and Karthikeyan Natesan Ramamurthy and Tolga Birdal and Tamal K. Dey and Soham Mukherjee and Shreyas N. Samaga and Neal Livesay and Robin Walters and Paul Rosen and Michael T. Schaub},
      year={2023},
      eprint={2206.00606},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}
@misc{papillon2023architectures,
      title={Architectures of Topological Deep Learning: A Survey on Topological Neural Networks},
      author={Mathilde Papillon and Sophia Sanborn and Mustafa Hajij and Nina Miolane},
      year={2023},
      eprint={2304.10031},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

⭐ Acknowledgements

TopoNetX has been built with the help of several open-source packages. All of these are listed in setup.py. Some of these packages include:

Funding

Partially funded by the European Union (ERC, HIGH-HOPeS, 101039827). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.

Partially funded by the National Science Foundation (DMS-2134231, DMS-2134241).

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

toponetx-0.4.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

toponetx-0.4.0-py3-none-any.whl (132.7 kB view details)

Uploaded Python 3

File details

Details for the file toponetx-0.4.0.tar.gz.

File metadata

  • Download URL: toponetx-0.4.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toponetx-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a6517a3bea440ce983cb38ca246f47cc06d67c70655a0e39f7ddf1e7861bbf5e
MD5 fc7fb515050702195c7c99f5046ae1a5
BLAKE2b-256 59f0b60ad2ff768096cb826397207730ef2203cc55e0f225bd16fd0d6be63d0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for toponetx-0.4.0.tar.gz:

Publisher: deploy.yml on pyt-team/TopoNetX

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

File details

Details for the file toponetx-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: toponetx-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 132.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for toponetx-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71b04a8e9feeb6f6bfabd8a7bcd96e07652d817fda2cc7de7bf3a55baef2d6be
MD5 865d8e267ccaf8b8d8380b1308da08e4
BLAKE2b-256 39d5c27155a73b427c2244cc42c7fd1847fadd767a038cf9ba6a24a31e00dcdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for toponetx-0.4.0-py3-none-any.whl:

Publisher: deploy.yml on pyt-team/TopoNetX

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