Skip to main content

Python bindings for RoutingKit Customizable Contraction Hierarchies (CCH)

Project description

pyroutingkit

Python bindings for RoutingKit Customizable Contraction Hierarchies (CCH).

Provides microsecond-scale shortest-path queries on large road networks (millions of nodes). Pre-compiled wheels for Linux (manylinux) and macOS — no C++ toolchain needed at install time.

Install

pip install pyroutingkit

Usage

import numpy as np
from pyroutingkit import CCH, INF_WEIGHT

# Build topology (one-time, expensive — can be saved/loaded)
cch = CCH()
tail = np.array([0, 1, 2], dtype=np.uint32)
head = np.array([1, 2, 0], dtype=np.uint32)
lat = np.array([9.0, 9.5, 9.2], dtype=np.float32)
lon = np.array([38.7, 39.0, 38.5], dtype=np.float32)
cch.build_topology(tail, head, lat, lon, node_count=3)

# Customize with weights (fast, can be called multiple times)
weights = np.array([100, 150, 120], dtype=np.uint32)
cch.customize_weights(weights)

# Query (microseconds)
distance, path = cch.query(0, 2)
print(f"Distance: {distance}, Path: {path}")

# Many-to-many matrix
sources = np.array([0, 1], dtype=np.uint32)
targets = np.array([1, 2], dtype=np.uint32)
matrix = cch.distances_many_to_many(sources, targets)

# Save/load topology (skip expensive build on next run)
cch.save_topology("/tmp/cch_cache")
cch2 = CCH()
cch2.load_topology("/tmp/cch_cache")
cch2.customize_weights(weights)  # Must re-customize after load

API

CCH class

Method Description
build_topology(tail, head, lat, lon, node_count) Build CCH from graph arrays. Uses inertial flow for node ordering.
customize_weights(weights) Set edge weights (uint32). Can be called multiple times.
query(source, target) Point-to-point query. Returns (distance, path).
distances_many_to_many(sources, targets) NxM distance matrix.
save_topology(dir_path) Save topology to disk (binary format).
load_topology(dir_path) Load topology from disk (skips build).

Properties

Property Type Description
node_count int Number of nodes
arc_count int Number of directed edges
is_built bool Topology has been built or loaded
is_customized bool Weights have been set

Constants

Constant Description
INF_WEIGHT Sentinel value for unreachable pairs

Building from source

Requires CMake 3.20+ and a C++17 compiler.

git clone --recurse-submodules https://github.com/nullbutt/pyroutingkit
cd pyroutingkit
uv build

License

MIT. RoutingKit is also MIT-licensed.

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

pyroutingkit-0.1.0.tar.gz (169.6 kB view details)

Uploaded Source

Built Distributions

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

pyroutingkit-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (271.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pyroutingkit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (198.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyroutingkit-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (271.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pyroutingkit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (198.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyroutingkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (271.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyroutingkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (196.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyroutingkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (270.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyroutingkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (195.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pyroutingkit-0.1.0.tar.gz.

File metadata

  • Download URL: pyroutingkit-0.1.0.tar.gz
  • Upload date:
  • Size: 169.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyroutingkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1024ddbb11430e662e8ebd10fa5bf69bd937ac01b3786751d166c26f3d6902b
MD5 f383fc47cf6732d6406ed72da60697b4
BLAKE2b-256 c20cb427e82bf2ff20e99e8b9e3afa3027e9a1aaf6a7791628344f6384b4cd8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0.tar.gz:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3584b43638354a378f8bc76335dd862bf1393465acce7113632fcd19819dbaca
MD5 a0573aa14cf104fffd96b557b69e4af5
BLAKE2b-256 75e02fe9e6dd8566829279f3c0ef74574692e4b34bbd837c2aa40a87bb2ba0a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b54712b187a8b5283e738e1e6a1d97698712c9b73a99e4a148ab67fd39f04f3
MD5 82453c18df99e555495c49801a93e7aa
BLAKE2b-256 d230b7a9a37993a200846efff0e73a13a8d8e184d4a7bd1534c5e534828ad415

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a76e5b7b9b39c1608aa04200e423346232e8ac33a0d1c562d092d39c015288a1
MD5 ce6453c8e577e633e3b1a1c13510c233
BLAKE2b-256 4291ed858a9c48b7b04dcf846c27c0b3c56a4cf0c14447c1b0bff072b976b904

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43d6722f5126750d064f277076494ca8b26d5ad0a2c82860a6e78b405534741c
MD5 a40891a8801ded55f38c24e3e8fcfdd7
BLAKE2b-256 820e218d791ca9e3313c6323e35a04094c434a54a2ac959bd35a4f77fcf8f9b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 066e7ce31f3b74b660dbb8dd2d077ea2ede9deadcb56cf15e738d6eeadb51ae7
MD5 fbcd8466a7b0531200d4f2d042dee70c
BLAKE2b-256 42554485d60edf6d4a0d29fb1dab61e66420550f414221d89f42f8df9bcd6ab1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 060780eafe734cf99a7d9b26322fa3493da804e6cea5be7a9e59626c05607e46
MD5 004137ef5d78dfd176ac75e729ef03ad
BLAKE2b-256 4719c689bb82739d5b2a629f416d790dcf86392d240eb82f3c564bd24ac351a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f3836b67e0975fdc1a7e9f3cbe37dfe9e01fae117228911df9d1eac9735bcd6
MD5 b518faecdb50db1a6b0c6f055d7bf43e
BLAKE2b-256 2fe26ded869ad8e97c1159afe230f1125eaca3d227bfbea39f3b718611339470

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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

File details

Details for the file pyroutingkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyroutingkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd425db9d674ee14807f237df1fea184ae607ffe33d1542f8653075824f97849
MD5 0cdae4107be22e2a09757dab427d5422
BLAKE2b-256 019ee6dfd209246ca9d700f1aba9bfc70b1fdb3e2d3cb5759daa1717f3f29e25

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyroutingkit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on nullbutt/pyroutingkit

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