{"id":32692262,"url":"https://github.com/google-research/tnco","last_synced_at":"2026-06-03T15:31:20.057Z","repository":{"id":320294750,"uuid":"1080134794","full_name":"google-research/tnco","owner":"google-research","description":"TNCO is a heuristic tool that optimizes tensor network contraction paths.","archived":false,"fork":false,"pushed_at":"2026-03-25T00:40:39.000Z","size":349,"stargazers_count":33,"open_issues_count":5,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-30T08:27:27.512Z","etag":null,"topics":["google-quantum","optimization","python","quantum-circuits","tensor-networks"],"latest_commit_sha":null,"homepage":"","language":"Python","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/google-research.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":".github/SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T23:25:17.000Z","updated_at":"2026-04-21T09:45:12.000Z","dependencies_parsed_at":"2025-10-23T02:35:13.794Z","dependency_job_id":"b8397e27-4a3c-4d24-b1db-26ce26a2e769","html_url":"https://github.com/google-research/tnco","commit_stats":null,"previous_names":["google-research/tnco"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/google-research/tnco","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Ftnco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Ftnco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Ftnco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Ftnco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-research","download_url":"https://codeload.github.com/google-research/tnco/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-research%2Ftnco/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33872297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["google-quantum","optimization","python","quantum-circuits","tensor-networks"],"created_at":"2025-11-01T16:00:58.028Z","updated_at":"2026-06-03T15:31:20.052Z","avatar_url":"https://github.com/google-research.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Tensor Network Contraction Optimizer (TNCO)\n\nA High-performance tensor network contraction path optimizer for C++ and Python.\n\n[![Licensed under the Apache 2.0\nlicense](https://img.shields.io/badge/License-Apache%202.0-3c60b1.svg?logo=opensourceinitiative\u0026logoColor=white\u0026style=flat-square)](https://github.com/quantumlib/qsim/blob/main/LICENSE)\n![Compatible with C++17 and higher](https://img.shields.io/badge/C%2B%2B17-fcbc2c.svg?logo=c%2B%2B\u0026logoColor=white\u0026style=flat-square\u0026label=C%2B%2B)\n[![Compatible with Python versions 3.8 and\nhigher](https://img.shields.io/badge/Python-3.8+-fcbc2c.svg?style=flat-square\u0026logo=python\u0026logoColor=white)](https://www.python.org/downloads/)\u003cbr\u003e\n[![run_tests](https://github.com/google-research/tnco/actions/workflows/run_tests.yml/badge.svg)](https://github.com/google-research/tnco/actions/workflows/run_tests.yml)\n[![cpp_linter](https://github.com/google-research/tnco/actions/workflows/cpp_linter.yml/badge.svg)](https://github.com/google-research/tnco/actions/workflows/cpp_linter.yml)\n[![codeql](https://github.com/google-research/tnco/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/google-research/tnco/actions/workflows/github-code-scanning/codeql)\u003cbr\u003e\n[![Published in Nature](https://img.shields.io/badge/10.1038%2Fs41586--025--09526--6-gray.svg?label=Nature\u0026logo=doi\u0026logoColor=white\u0026style=flat-square\u0026colorA=gray\u0026colorB=3c60b1)](https://doi.org/10.1038/s41586-025-09526-6)\u003cbr\u003e\nTry `TNCO` now with: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/google-research/tnco/main?urlpath=%2Fdoc%2Ftree%2Fexamples%2FOptimization.ipynb)\n\n\u003c/div\u003e\n\n`TNCO` is a heuristic tool that optimizes tensor network contraction paths. It\nrepresents the contraction as a tree – with the initial tensors as leaves and\nthe final tensor as the root – and explores possible paths by manipulating\nthis tree's structure. While the optimization is performed using simulated\nannealing, the framework is extensible to other methods. `TNCO` supports\noptimization with or without memory constraints, and can automatically\nparallelize runs on multiple threads.\n\n`TNCO` was used to demonstrate the first verifiable quantum advantage in 2025\n(Abanin et al., \"Observation of constructive interference at the edge of\nquantum ergodicity\", [Nature vol. 646, 2025](https://doi.org/10.1038/s41586-025-09526-6)).\n\n## Installation\n\n### Prerequisites\n\nBefore installing `TNCO`, you must have the following system-level dependencies:\n\n* C++17 compiler (`gcc \u003e= 11`, `clang \u003e= 13`)\n* CMake (`cmake \u003e= 3.5`)\n* Python \u003e= 3.8\n* [boost::dynamic_bitset](https://github.com/boostorg/dynamic_bitset)\n* GMP and MPFR (optional, for `float1024`)\n\n### Install `TNCO` using `pip`\n\n`TNCO` can be easily installed using `pip`:\n```\npip install \"tnco @ git+https://github.com/google-research/tnco\"\n```\nfor the latest development version, or\n```\npip install \"tnco @ git+https://github.com/google-research/tnco@version\"\n```\nwhere `version` is one of the available\n[versions](https://github.com/google-research/tnco/tags). `TNCO` can also be installed\nfrom a [zip](https://github.com/google-research/tnco/archive/refs/heads/main.zip) file:\n```\npip install tnco-main.zip\n```\n`TNCO` uses `joblib` to parallelize runs on multiple CPUs. This is an optional\ndependency and is not installed by default. To install TNCO with joblib, use\nthe `[parallel]` extra:\n```\npip install \"tnco[parallel] @ git+https://github.com/google-research/tnco\"\n```\n\n### Install `TNCO` using `conda`\n\n`TNCO` can also be installed using `conda` environments. Clone the `TNCO`\nrepository and execute the following from the project's root folder:\n```\nconda env create\n```\n\n### Install `TNCO` using `docker`\n\nFinally, `TNCO` can also be installed in a `docker` container. Clone the `TNCO`\nrepository and execute the following from the project's root folder:\n```\ndocker build . -t tnco\n```\n\n## How To Use\n\nThe library provides a user-friendly Python front-end for most common use\ncases:\n```\nfrom tnco.app import Optimizer\n\ntn = \"\"\"\n2 a b\n2 b c\n2 c d\n\"\"\"\n\n# Load optimizer\nopt = Optimizer(method='sa')\n\n# Perform the optimization\ntn, res = opt.optimize(tn, betas=(0, 100), n_steps=100, n_runs=8)\n```\n\nMultiple input formats are supported; see `tnco.app.load_tn` for further details. For\na more detailed example, see\n[examples/Optimization.ipynb](examples/Optimization.ipynb).\n\nThe same front-end can be used from command line:\n```\n$ tnco optimize '[(2, \"a\", \"b\"), (2, \"b\", \"c\"), (2, \"c\", \"d\")]' \\\n                --betas='(0, 100)' \\\n                --n-steps=100 \\\n                --n-runs=8 \\\n                --verbose=10\n```\nFor all the possible options run:\n```\n$ tnco --help\n```\n\n## Contact\n\nTNCO was developed by [Salvatore Mandrà](https://github.com/s-mandra) in 2024.\nFor any questions or concerns not addressed here, please email\n[smandra@google.com](mailto:smandra@google.com).\n\n## Disclaimer\n\nThis is not an officially supported Google product. This project is not\neligible for the [Google Open Source Software Vulnerability Rewards\nProgram](https://bughunters.google.com/open-source-security).\n\nCopyright 2025 Google LLC.\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://quantumai.google\"\u003e\n    \u003cimg width=\"15%\" alt=\"Google Quantum AI\"\n         src=\"./docs/images/quantum-ai-vertical.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Ftnco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-research%2Ftnco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-research%2Ftnco/lists"}