Fast Dijkstra
Project description
Fast_dijkstra
Fast directed Dijkstra written in C++ with parallelization build in
Function definition
Parameters
----------
indptr : List[int]
indices : List[int]
weights : Sequence[float]
sources : List[int]
cutoff: OPTIONAL float (default = np.inf)
num_threads: OPTIONAL int (default = -1)
-1: maximum allowed threads
Returns
-------
distances : numpy.ndarray
Array of shape (num_sources, num_nodes) with shortest distances
predecessors : numpy.ndarray
Array of shape (num_sources, num_nodes) with predecessor indices
usage
- The graph is passed as a csr_matrix just like scipy. you can reuse scipy to create the graph from edges.
- edges must be integers. starting at 0
- Graph is directed
from scipy.sparse import csr_matrix
from fast_dijkstra import dijkstra
edges = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3)]
weights = [1.0, 4.0, 2.0, 5.0, 1.0]
sources = [0, 1]
row = [e[0] for e in edges]
col = [e[1] for e in edges]
nodelist = sorted({e[0] for e in edges}.union({e[1] for e in edges}))
nlen = len(nodelist)
sparse = csr_matrix((weights, (row, col)), shape=(nlen, nlen))
indptr = sparse.indptr # [0, 2, 4, 5, 5]
indices = sparse.indices # [1, 2, 2, 3, 3]
distances, predecessor = dijkstra(indptr, indices, weights, sources)
distances # [
# [ 0., 1., 3., 4.],
# [inf, 0., 2., 3.]
# ]
predecessor # [
# [-9999, 0, 1, 2],
# [-9999, -9999, 1, 2]
# ]
to deploy
- change the version number in pyproject.toml under [project]
[project]
name = "fast_dijkstra"
version = "1.0.2"
- the poetry config is only used for local dev. to ignore.
- create a new tag starting with "v"
git tag -a 'v1.0.2' -m 'description'
git push origin v1.0.2
Github action will build wheels for windows and Linux.
- when Done, upload to Pypi
./upload v1.0.2
local development build
poetry run python setup.py bdist_wheel
or
poetry run python -m build --wheel
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_dijkstra-2.1.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 69.8 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d10cbc46dab36c350511e63c3613ce3927eab3c403b115888c2e1281c8975a4
|
|
| MD5 |
30051f3fd13c6214bc6c1f6a906e9310
|
|
| BLAKE2b-256 |
5380f986a8ca2b54d008439bd6c0d60f74576af35407b5a6eb4312c290aba182
|
File details
Details for the file fast_dijkstra-2.1.2-cp313-cp313-win32.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp313-cp313-win32.whl
- Upload date:
- Size: 63.9 kB
- Tags: CPython 3.13, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0400466d903f875c717dacea4244c267559f2ff1616034e1ef96119b248f9b6
|
|
| MD5 |
ce568a4e1d823a09a6b67b6fe5d59643
|
|
| BLAKE2b-256 |
4c44429390bd281287c4a4cbf0b1656b2979729a2f1ed01a1b7d3b1ac596f9e7
|
File details
Details for the file fast_dijkstra-2.1.2-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp313-cp313-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 680.9 kB
- Tags: CPython 3.13, manylinux: glibc 2.26+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38fa0e521573d76eb4f1acf9d943aafc7b48fe525e028810edc4584a8f2fb3c4
|
|
| MD5 |
2e30331e2e46427d19987a158e3f24e1
|
|
| BLAKE2b-256 |
e688c3dac3c7e5f8b43c6357483879fe9aa422904ac0acc6a186dcbc12e9bd27
|
File details
Details for the file fast_dijkstra-2.1.2-cp313-cp313-macosx_15_0_arm64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp313-cp313-macosx_15_0_arm64.whl
- Upload date:
- Size: 318.3 kB
- Tags: CPython 3.13, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c85d1ce505dac066f722bf7dca3bb352b69f9bf26f668bf0d1cca9ae0d7ddeb2
|
|
| MD5 |
52ee901ebfdc6e9dedbc4b8047cc13b7
|
|
| BLAKE2b-256 |
381c61abda9e98e7759418d616631690c3bb96f1f0379fa17098b0a1aa23136c
|
File details
Details for the file fast_dijkstra-2.1.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 69.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dcae01587981ce5427a4efe7635701cbfca71980394bd3d7976309346b662cf
|
|
| MD5 |
7fb926a3fe7199c0b660e07c87e4de79
|
|
| BLAKE2b-256 |
9b83c5277b2c3d78a93a4a9b199ddec247d9f6dcd45cc68794c52adc123159e3
|
File details
Details for the file fast_dijkstra-2.1.2-cp312-cp312-win32.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp312-cp312-win32.whl
- Upload date:
- Size: 63.9 kB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
974bdf79b6a3f3da294c9a8083a6d886bdc7c460fcd86c3315d24c56623012ee
|
|
| MD5 |
064b553cd773b873b7a5a4dfde11b693
|
|
| BLAKE2b-256 |
dbc511e8dfcf526dcbdbec124ca97f04e1fd44aba2c0edd3169411617c5e6451
|
File details
Details for the file fast_dijkstra-2.1.2-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 680.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.26+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a9fbd95e197b28d5dd9d76b63aa1a89b94b51db53e16d6abe5a3b6631b685dc
|
|
| MD5 |
77ab67012406212d81b934fb47b0e8f0
|
|
| BLAKE2b-256 |
998267690b2cf26b5e9b3debedf1faf6b3b434f2bed478e6799a542f5bf4293f
|
File details
Details for the file fast_dijkstra-2.1.2-cp312-cp312-macosx_15_0_arm64.whl.
File metadata
- Download URL: fast_dijkstra-2.1.2-cp312-cp312-macosx_15_0_arm64.whl
- Upload date:
- Size: 318.3 kB
- Tags: CPython 3.12, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c95ee62f02db51e1c0caba40167fdf8b30f6f1786414a410435d38b5071c887c
|
|
| MD5 |
8b3763c217ac898f2733f59cab0512e4
|
|
| BLAKE2b-256 |
e3bc2e0b9c37cff601ef8dcbeb0f264f30ade3fd4db51e9f5f1046175fe5b546
|