unigraph
Graph data structures and classic graph algorithms for Python, backed by the native UniGraph engine written in Nim.
unigraph provides a compact, concrete graph for signed 64-bit vertex labels
and float64 edge weights. Graphs may be directed or undirected; the Python
surface uses simple-graph semantics, so self-loops and parallel edges are
rejected. Traversals, shortest paths, spanning forests, strongly connected
components, TSP solvers, and DOT/ASCII rendering all run in the native core.
Install
pip install unigraph
Prebuilt wheels include the native UniGraph library for Linux, macOS, and Windows on CPython 3.10–3.14. Installing a wheel needs neither Nim nor a C compiler.
Quick start
import unigraph
g = unigraph.Graph(directed=False)
paris = g.add_vertex(75)
lyon = g.add_vertex(69)
marseille = g.add_vertex(13)
g.add_edge(paris, lyon, 465.0)
g.add_edge(lyon, marseille, 315.0)
g.add_edge(paris, marseille, 775.0)
g.bfs(paris) # [paris, lyon, marseille]
g.dijkstra(paris)[marseille] # 775.0
g.shortest_path(paris, marseille) # ([paris, marseille], 775.0)
g.kruskal() # two edges, total weight 780.0
print(g.to_dot()) # Graphviz DOT
Vertex IDs are stable handles returned by add_vertex; labels remain
available through get_vertex_data. Algorithms consume IDs, not labels, so
duplicate labels are allowed without making vertices ambiguous.
What's included
| Category | Python API |
|---|---|
| Graph construction | Graph, add_vertex, add_edge, remove_edge, vertex_count, edge_count |
| Inspection | vertices, edges, neighbors, in_neighbors, out_neighbors, get_vertex_data, get_edge_weight, has_edge |
| Traversal | bfs, dfs, reachable, is_connected |
| Shortest paths | dijkstra, shortest_path, a_star, bellman_ford |
| Spanning forest | prim, kruskal on undirected graphs |
| Components | strongly_connected_components, kosaraju, articulation_points |
| Traveling salesperson | tsp_naive, tsp_nearest, tsp_2opt |
| Presentation | to_ascii, to_dot, degree_distribution |
shortest_path returns None when the goal is unreachable. Bellman–Ford
returns (distances, has_negative_cycle); when the flag is true, do not treat
the partial distances as shortest paths. Prim, Kruskal, and articulation
points reject directed graphs with ValueError. Exact TSP is intentionally
limited to at most ten vertices; the nearest-neighbor and 2-opt methods are
heuristics and do not promise the optimum.
The full Nim API is generic over vertex data, edge data, and four storage kernels. Python deliberately exposes one stable ABI specialization; use the Nim API when custom payload types, multigraphs, or kernel selection are required.
Links
- Source, Nim API, C ABI, ADRs, and teaching book: https://github.com/lituus-lab/UniGraph
- Documentation: https://lituus-lab.github.io/UniGraph/
- Issues: https://github.com/lituus-lab/UniGraph/issues
- License: Apache-2.0
Development
Building from source requires Nim 2.2, Nimble, a C compiler, Cython, and Python development headers.
nimble install -y
nimble pyLib
cd py
python3 -m pip install -e .
python3 -m pytest -q
On Windows, run the commands from a Developer Command Prompt and use python
if python3 is not available.
Metadata
Release files for unigraph 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unigraph-1.0.1.tar.gz | 144.4 kB | Details |
Built distributions (wheels)
Total release size: 3.9 MB
Release files / unigraph-1.0.1.tar.gz
| Download URL | unigraph-1.0.1.tar.gz |
|---|---|
| Size | 144.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa433470aa762e9b8fcdda84ad7d601ba684050a7a6bbb6d3f0a1ebd217985e4
|
|
BLAKE2b-256 checksum How to use checksums |
1124f0c8bc9ffd9c715b3a4cd532ffa118fc28e911db329da39605a6de8f3e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp314-cp314-win_amd64.whl
| Download URL | unigraph-1.0.1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 137.4 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8340332a4a25ef8a79a95af2e9864ceefc8f12e8b405142b58b1f1a67e3830a8
|
|
BLAKE2b-256 checksum How to use checksums |
b66ebbab57d1bf3137f8a2fbc1556817708951fe321d5a8e12ed834ac045cf35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | unigraph-1.0.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 437.4 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
17f07704b8db8c93362b6a22291ef261a3810446ea03a0569dc2c1b8405fe899
|
|
BLAKE2b-256 checksum How to use checksums |
96eea82f7ff273bd99c7776e88d6a10d4f5ba563d1685855d3c4c58bca124ab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp314-cp314-macosx_26_0_arm64.macosx_10_15_x86_64.whl
| Download URL | unigraph-1.0.1-cp314-cp314-macosx_26_0_arm64.macosx_10_15_x86_64.whl |
|---|---|
| Size | 183.7 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dabe984fc172371b873bab697292113b4c29fbe76f5bf637c1c7d32ea1a36aab
|
|
BLAKE2b-256 checksum How to use checksums |
e6b733d49150c25619cdf33db4a05bd156105b2c2facae26ea8dc80c7a9605f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp313-cp313-win_amd64.whl
| Download URL | unigraph-1.0.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 133.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f9c6f291b79a1f6aee8cc271aa69916d6a3a1998d67391def4e35aa579c2e04d
|
|
BLAKE2b-256 checksum How to use checksums |
ae019d0418bd06e43753904668eb6fa1a549281e97f10cf8c8f160afadc77c6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | unigraph-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 439.0 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
27e87d043791157d3953698af0b47fd382ef77ae73a660fec7d5e014f39b0398
|
|
BLAKE2b-256 checksum How to use checksums |
c32326067a8bb7f5b803634e63dcd2dad44cee201f099a9c8dde9eb77406ce98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp313-cp313-macosx_26_0_arm64.macosx_10_13_x86_64.whl
| Download URL | unigraph-1.0.1-cp313-cp313-macosx_26_0_arm64.macosx_10_13_x86_64.whl |
|---|---|
| Size | 182.9 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
259f7481eb9fac5136670b47e4d25c81c588e6de2f8fc6041b032a682be289a3
|
|
BLAKE2b-256 checksum How to use checksums |
34385832c94a7477c7dcef28070df01682e100bdf6845d2d461a69b762b32762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp312-cp312-win_amd64.whl
| Download URL | unigraph-1.0.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 134.5 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
03f7bad6c96765d706a3620d163f1914d708f2a3777786314f0647a289446273
|
|
BLAKE2b-256 checksum How to use checksums |
86772a75546ce5809ffcfe3ea80bc181e9837620b92e00c4969580cd380045d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | unigraph-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 439.5 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
086ebe8e06ee6e5acb84c353581c5d7f0822585e5335fc559ddb565c63932ee4
|
|
BLAKE2b-256 checksum How to use checksums |
368b47f4b3e8f37955f2977f44d9d2be8a48f5184cd50348d9539c9c509d718d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp312-cp312-macosx_26_0_arm64.macosx_10_13_x86_64.whl
| Download URL | unigraph-1.0.1-cp312-cp312-macosx_26_0_arm64.macosx_10_13_x86_64.whl |
|---|---|
| Size | 184.8 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6c5140ac3f528e0bd629b938bd58ddeba471db65ba106dc3b10e9add8048cf41
|
|
BLAKE2b-256 checksum How to use checksums |
2f5519e7be0c9dce0901ae65b80de234ea6d21bb331d068dbea9954f87381695
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp311-cp311-win_amd64.whl
| Download URL | unigraph-1.0.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 133.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
232b80c22b46620c61ebe971836cfbf93369f48bfde49a95dc4ad2cfb7decb52
|
|
BLAKE2b-256 checksum How to use checksums |
af50206f1bc9134c8f4562bf4f3917a3aaa783ccb1a84bb12cb08defe8baa07f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | unigraph-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 436.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2fa70188e1b374a580ecd075cd8dc2fb891e1b471c33eb6f1747dc452651da9b
|
|
BLAKE2b-256 checksum How to use checksums |
7b6f79cb2c05c9acb1dae0b51ff84d272c045f3add9dd898a890a26bef81b297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp311-cp311-macosx_26_0_arm64.macosx_10_9_x86_64.whl
| Download URL | unigraph-1.0.1-cp311-cp311-macosx_26_0_arm64.macosx_10_9_x86_64.whl |
|---|---|
| Size | 184.4 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d373a185c37fd51cc682a44cdbd9d09d8f185809f172c15fe555003f911cab4b
|
|
BLAKE2b-256 checksum How to use checksums |
6dad50357b44150c97a90ec4f647a16210e3fa6235028fed45b8b1ae8da7c0a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp310-cp310-win_amd64.whl
| Download URL | unigraph-1.0.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 133.9 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6b92484815f0f7fb65d736792741b682e0b6b4c69212b638069dad9ae8ae7ba3
|
|
BLAKE2b-256 checksum How to use checksums |
48e25880655d3e4b867a6e9ee511fd9b85e40ebc4303ab36f479b5c5f7fcfe43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | unigraph-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 418.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7f17ca3c366dbfe4e7310e62a396e46683af8bec4397474338c6a86097d42638
|
|
BLAKE2b-256 checksum How to use checksums |
386f825c5c9db68f8e11572ccdcdd262b3516bb422bc59b610ae847db5d318cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unigraph-1.0.1-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl
| Download URL | unigraph-1.0.1-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl |
|---|---|
| Size | 184.8 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f6e647359b059fbebe29d24cf2518785bc8a30f45c004a997dbe9b1589bc4774
|
|
BLAKE2b-256 checksum How to use checksums |
ff68bd72b3100cc09689c92c2c28fc1fb9f14bc218276e88e6d8c40c714576df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log