{"id":17606584,"url":"https://github.com/peekxc/simplextree-py","last_synced_at":"2025-04-30T12:21:04.124Z","repository":{"id":189595071,"uuid":"678969459","full_name":"peekxc/simplextree-py","owner":"peekxc","description":"Python bindings to Simplex Tree data structure (w/ C++)","archived":false,"fork":false,"pushed_at":"2024-12-11T21:30:53.000Z","size":2400,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T07:48:15.592Z","etag":null,"topics":["graph-datastructures","simplicial-complex","topological-data-analysis"],"latest_commit_sha":null,"homepage":"https://peekxc.github.io/simplextree-py/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peekxc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-15T20:10:32.000Z","updated_at":"2024-12-11T21:30:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"29c2ed26-d610-4012-90d4-1e0bb0a3b0b5","html_url":"https://github.com/peekxc/simplextree-py","commit_stats":null,"previous_names":["peekxc/simplextree-py"],"tags_count":6,"template":false,"template_full_name":"allenai/python-package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fsimplextree-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fsimplextree-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fsimplextree-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peekxc%2Fsimplextree-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peekxc","download_url":"https://codeload.github.com/peekxc/simplextree-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251700610,"owners_count":21629839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graph-datastructures","simplicial-complex","topological-data-analysis"],"created_at":"2024-10-22T15:45:17.018Z","updated_at":"2025-04-30T12:21:04.105Z","avatar_url":"https://github.com/peekxc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simplextree\n\n[![](https://img.shields.io/badge/docs-quarto-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAABDCAMAAADwFEhBAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB2lBMVEUAAABxvP90vP9zu/90u/90u/90u/90u/91uv91vP9zuv91v/91uv91u/9zvP90u/90uv92uv+As/91u/91u/90u/90u/90vP+Aqv90u/91u/9zuv90uf90u/90u/90u/9zuf9ttv90u/90u/91vP8A//92uv90u/95tv9zuv90u/90vP9zuv90u/91uv91u/90u/90vP90uf9zvP90u/93vv90u/90u/93u/9qv/90u/9zu/91vP90u/90vP95vP9Vqv90u/90u/91u/90u/90uf+Av/91u/90u/9xvf90u/91vP92vv90u/+AgP90u/9zu/91vP9vvP90u/90uv90u/94tP90u/9zvP90uv90u/90u/91u/90vP9zu/90uv91u/90uv9zvP9zuv9xu/9zvP90u/90u/90vP9zvP90uf9xxv90u/90uv90u/9zvf90u/90u/90u/90uv91uv90vP90uf90u/91vP90u/9wuP9zu/9zvP9zuv90u/92v/90uv90vP9y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JK2AmFsg56B7QWjHbrGjp15IhnQNrArb+yGvhHeYxsdDAN7c8Q+cIz9nVbjAMvAQasR5BmHzEKX4BndZqEHPOPwEaJepoEU0VGu0UxUwTWOER3nGn1kgGucoMk4YwjuMz1JVM01ThGd5hpniM5yjQaifq5xjug804ibY2jEeMYFqzHAMy5ajUssI5S2GpkYx7hsv6pXOMZV27iW1Teud+bPzA194+b/c3crq2vUJwuH97aukRodgDt39YyBsStyT+gY9wcdU/RAwxAPnXOW7FA3Ho3fxOhjVaPPmDCsT56qGc8yLuv8PKBivCh3nfjBbnlj6KXHd6LllaQReu39VxjpD8sYb96SX0rfFTdqo+Sf5PsP/kbwIxVPa90nb+Pzl4gEYaZq+GvWzYgnvskBdtLtI9+dxo/Ez4yKYOdXz+8/Q9bFSNnfVFr9fpX8A/gO4x9ExakgAAAAUGVYSWZNTQAqAAAACAACARIAAwAAAAEAAQAAh2kABAAAAAEAAAAmAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABDoAMABAAAAAEAAABDAAAAAEC2TfoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjMtMDgtMjJUMDI6MDg6MTgrMDA6MDDjF9jVAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIzLTA4LTIyVDAyOjA4OjE4KzAwOjAwkkpgaQAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyMy0wOC0yMlQwMjowODoxOSswMDowMGMoSgIAAAARdEVYdGV4aWY6Q29sb3JTcGFjZQAxD5sCSQAAABJ0RVh0ZXhpZjpFeGlmT2Zmc2V0ADM4rbi+IwAAABd0RVh0ZXhpZjpQaXhlbFhEaW1lbnNpb24ANjeFsWfdAAAAF3RFWHRleGlmOlBpeGVsWURpbWVuc2lvbgA2N1gnvlgAAAASdEVYdHRpZmY6T3JpZW50YXRpb24AMber/DsAAAAASUVORK5CYII=)](https://peekxc.github.io/simplextree-py/pages/)\n[![coverage_badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/peekxc/ef42349965f40edf4232737026690c5f/raw/coverage_info.json)](https://coveralls.io/github/peekxc/simplextree-py) \n[![build_macos](https://img.shields.io/github/actions/workflow/status/peekxc/simplextree-py/build_macos.yml?logo=apple\u0026logoColor=white)](https://github.com/peekxc/simplextree-py/actions/workflows/build_macos.yml) \n[![build_windows](https://img.shields.io/github/actions/workflow/status/peekxc/simplextree-py/build_windows.yml?logo=windows\u0026logoColor=white)](https://github.com/peekxc/simplextree-py/actions/workflows/build_windows.yml) \n[![build_linux](https://img.shields.io/github/actions/workflow/status/peekxc/simplextree-py/build_linux.yml?logo=linux\u0026logoColor=white)](https://github.com/peekxc/simplextree-py/actions/workflows/build_linux.yml)\n[![PyPI Version](https://img.shields.io/pypi/v/simplextree)](https://pypi.org/project/simplextree)\n[![Python versions](https://img.shields.io/badge/python-%E2%89%A5%203.8-blue.svg)](https://github.com/peekxc/simplextree-py/actions)\n\n`simplextree` is an Python package that simplifies computation for general [simplicial complexes](https://en.wikipedia.org/wiki/Simplicial_complex) of any dimension by providing [pybind11](https://github.com/pybind/pybind11) bindings to a *Simplex Tree* data structure implemented in modern C++17.\n\nA *Simplex Tree* is an ordered, [trie](https://en.wikipedia.org/wiki/Trie)-like structure whose nodes are in bijection with the faces of the complex. Here's a picture of a simplicial 3-complex (left) and its corresponding Simplex Tree (right):\n\n![simplex tree picture](./docs/static/simplextree.png)\n\nThe *Simplex Tree* was originally introduced in the following paper:\n\n\u003e Boissonnat, Jean-Daniel, and Clément Maria. \"The simplex tree: An efficient data structure for general simplicial complexes.\" Algorithmica 70.3 (2014): 406-427.\n\nThe `SimplexTree` class exported by the package includes support for many tree operations, e.g. insertions, removals, expansions, collapses, star/link enumerations, and other traversals.\n\n## Install\n\nThe easiest way to install the package is via the platform-specific [wheels](https://pythonwheels.com/) on [pypi](https://pypi.org/project/simplextree/).\n\n``` bash\npython -m pip install simplextree \n```\n\nYou can also install the package manually by downloading the appropriate wheel (or sdist) from the [releases](https://github.com/peekxc/simplextree-py/releases/).\n\nFor installation instructions for developers looking to extend the package, see [Building \u0026 Developing](#building--developing).\n\n## Quickstart\n\n``` python\n## The SimplexTree class provides light wrapper around the extension module\nfrom simplextree import SimplexTree \nst = SimplexTree([[0,1,2], [0,1], [4,5]]) \nprint(st) \n# Simplex Tree with (5, 4, 1) (0, 1, 2)-simplices\n\n## Batch insertion, removal, and membership queries are supported\nst.insert([[1,4], [1,5], [6]])\n# Simplex Tree with (6, 6, 1) (0, 1, 2)-simplices \n\nst.remove([[6]])\n# Simplex Tree with (5, 6, 1) (0, 1, 2)-simplices\n\nst.find([[6], [0,1]])\n# array([False,  True])\n\n## Collections of simplices are returned as simple lists-of-lists\nprint(st.simplices())\n# [[0],[1],[2],[4],[5], [0,1],[0,2],[1,2],[1,4],[1,5],[4,5],[0,1,2]])\n\nprint(st.skeleton(1)) \n# [[0],[1],[2],[4],[5], [0,1],[0,2],[1,2],[1,4],[1,5],[4,5]])\n\n## Familiar Pythonic collection semantics are supported, including contains and iteration\n[0,1,2] in st\n# True \n\n[len(simplex) for simplex in st]\n# [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3]\n\n## Various subsets of the complex can be enumerated\nst.cofaces([1])\n# [[1], [0,1], [1,2], [1,4], [1,5], [0,1,2], [1,4,5]]\n\nst.maximal()\n# [[0, 1, 2], [1, 4], [1, 5], [4, 5]]\n\n## Basic properties are also available as attributes \nst.connected_components \n# [1,1,1,1,1]\n\nst.vertices\n# [0,1,2,4,5]\n\nst.n_simplices, st.dimension\n# [5, 6, 1], 2\n\n## Interoperability with numpy is provided whenever possible\nall(np.all(st.triangles == np.array(st.simplices(p=2)), axis=0))\n# True \n\n## Other complex-wide operations are supported, like k-expansions \nst.insert([[1,4]]) \nst.expand(2)       \n# Simplex Tree with (6, 6, 2) (0, 1, 2)-simplices\n\n## The trie-structure can also be inspected on the python side \nst.print_tree()\n# 0 (h = 2): .( 1 2 )..( 2 )\n# 1 (h = 1): .( 2 4 5 )\n# 2 (h = 0): \n# 4 (h = 1): .( 5 )\n# 5 (h = 0): \n\nst.print_cousins()\n# (last=1, depth=2): { 0 1 } \n# (last=2, depth=2): { 0 2 } { 1 2 } \n# (last=4, depth=2): { 1 4 } \n# (last=5, depth=2): { 4 5 } { 1 5 } \n# (last=2, depth=3): { 0 1 2 } \n```\n\n## Building \u0026 Developing\n\nIf you would like to build the package yourself for development reasons, a typical workflow is to install the [build-time dependencies](https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#build-time-dependencies) first:\n\n``` bash\npython -m pip install meson-python ninja pybind11 numpy\n```\n\nThen, build and install the package in [editable mode](https://peps.python.org/pep-0660/) (see also [meson-python notes](https://meson-python.readthedocs.io/en/latest/how-to-guides/editable-installs.html)), optionally without build isolation for speed:\n\n``` bash\npython -m pip install --no-build-isolation --editable .\n```\n\nUnit testing is handled with [pytest](https://docs.pytest.org/en/7.4.x/). See the [gh-workflows](https://github.com/peekxc/simplextree-py/actions) for platform-specific configuration.\n\n## Native Extensions\n\nThe underlying C++ library is [header-only](https://en.wikipedia.org/wiki/Header-only) and may be included as a dependency by [extension modules](https://docs.python.org/3/extending/extending.html) in other Python packages.\n\nThus, to modify or extending the complex in C++, it is sufficient to add the package as a build-time dependency and append the include directory to the compilation target.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeekxc%2Fsimplextree-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeekxc%2Fsimplextree-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeekxc%2Fsimplextree-py/lists"}