edsger 0.1.5__cp311-cp311-win_amd64.whl → 0.1.6__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edsger/_version.py +1 -1
- edsger/bellman_ford.cp311-win_amd64.pyd +0 -0
- edsger/bellman_ford.pyx +7 -0
- edsger/bfs.cp311-win_amd64.pyd +0 -0
- edsger/bfs.pyx +243 -0
- edsger/commons.cp311-win_amd64.pyd +0 -0
- edsger/commons.pyx +7 -0
- edsger/dijkstra.cp311-win_amd64.pyd +0 -0
- edsger/dijkstra.pyx +7 -0
- edsger/graph_importer.py +340 -0
- edsger/networks.py +4 -2
- edsger/path.py +676 -129
- edsger/path_tracking.cp311-win_amd64.pyd +0 -0
- edsger/path_tracking.pyx +7 -0
- edsger/pq_4ary_dec_0b.cp311-win_amd64.pyd +0 -0
- edsger/pq_4ary_dec_0b.pyx +7 -0
- edsger/spiess_florian.cp311-win_amd64.pyd +0 -0
- edsger/spiess_florian.pyx +7 -0
- edsger/star.cp311-win_amd64.pyd +0 -0
- edsger/star.pyx +7 -0
- edsger/utils.py +9 -8
- {edsger-0.1.5.dist-info → edsger-0.1.6.dist-info}/METADATA +124 -2
- edsger-0.1.6.dist-info/RECORD +32 -0
- edsger-0.1.5.dist-info/RECORD +0 -29
- {edsger-0.1.5.dist-info → edsger-0.1.6.dist-info}/WHEEL +0 -0
- {edsger-0.1.5.dist-info → edsger-0.1.6.dist-info}/licenses/AUTHORS.rst +0 -0
- {edsger-0.1.5.dist-info → edsger-0.1.6.dist-info}/licenses/LICENSE +0 -0
- {edsger-0.1.5.dist-info → edsger-0.1.6.dist-info}/top_level.txt +0 -0
Binary file
|
edsger/path_tracking.pyx
CHANGED
@@ -14,6 +14,13 @@ cdef functions:
|
|
14
14
|
Compute the sequence of vertices forming a path.
|
15
15
|
"""
|
16
16
|
|
17
|
+
# cython: language_level=3
|
18
|
+
# cython: boundscheck=False
|
19
|
+
# cython: wraparound=False
|
20
|
+
# cython: embedsignature=False
|
21
|
+
# cython: cdivision=True
|
22
|
+
# cython: initializedcheck=False
|
23
|
+
|
17
24
|
import numpy as np
|
18
25
|
cimport numpy as cnp
|
19
26
|
|
Binary file
|
edsger/pq_4ary_dec_0b.pyx
CHANGED
@@ -35,6 +35,13 @@ cdef functions:
|
|
35
35
|
|
36
36
|
"""
|
37
37
|
|
38
|
+
# cython: language_level=3
|
39
|
+
# cython: boundscheck=False
|
40
|
+
# cython: wraparound=False
|
41
|
+
# cython: embedsignature=False
|
42
|
+
# cython: cdivision=True
|
43
|
+
# cython: initializedcheck=False
|
44
|
+
|
38
45
|
cimport numpy as cnp
|
39
46
|
from libc.stdlib cimport free, malloc
|
40
47
|
|
Binary file
|
edsger/spiess_florian.pyx
CHANGED
@@ -17,6 +17,13 @@ cdef functions:
|
|
17
17
|
|
18
18
|
"""
|
19
19
|
|
20
|
+
# cython: language_level=3
|
21
|
+
# cython: boundscheck=False
|
22
|
+
# cython: wraparound=False
|
23
|
+
# cython: embedsignature=False
|
24
|
+
# cython: cdivision=True
|
25
|
+
# cython: initializedcheck=False
|
26
|
+
|
20
27
|
import numpy as np
|
21
28
|
cimport numpy as cnp
|
22
29
|
|
edsger/star.cp311-win_amd64.pyd
CHANGED
Binary file
|
edsger/star.pyx
CHANGED
@@ -26,6 +26,13 @@ cdef functions:
|
|
26
26
|
- _coo_to_csc_float64
|
27
27
|
"""
|
28
28
|
|
29
|
+
# cython: language_level=3
|
30
|
+
# cython: boundscheck=False
|
31
|
+
# cython: wraparound=False
|
32
|
+
# cython: embedsignature=False
|
33
|
+
# cython: cdivision=True
|
34
|
+
# cython: initializedcheck=False
|
35
|
+
|
29
36
|
import numpy as np
|
30
37
|
cimport numpy as cnp
|
31
38
|
|
edsger/utils.py
CHANGED
@@ -2,19 +2,20 @@
|
|
2
2
|
graphs.
|
3
3
|
"""
|
4
4
|
|
5
|
+
from typing import Tuple
|
5
6
|
import numpy as np
|
6
7
|
import pandas as pd
|
7
8
|
|
8
9
|
|
9
10
|
def generate_random_network(
|
10
|
-
n_edges=100,
|
11
|
-
n_verts=20,
|
12
|
-
seed=124,
|
13
|
-
sort=True,
|
14
|
-
allow_negative_weights=False,
|
15
|
-
negative_weight_ratio=0.3,
|
16
|
-
weight_range=(0.1, 1.0),
|
17
|
-
):
|
11
|
+
n_edges: int = 100,
|
12
|
+
n_verts: int = 20,
|
13
|
+
seed: int = 124,
|
14
|
+
sort: bool = True,
|
15
|
+
allow_negative_weights: bool = False,
|
16
|
+
negative_weight_ratio: float = 0.3,
|
17
|
+
weight_range: Tuple[float, float] = (0.1, 1.0),
|
18
|
+
) -> pd.DataFrame:
|
18
19
|
"""
|
19
20
|
Generate a random network with a specified number of edges and vertices.
|
20
21
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: edsger
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.6
|
4
4
|
Summary: Graph algorithms in Cython.
|
5
5
|
Author-email: François Pacull <francois.pacull@architecture-performance.fr>
|
6
6
|
Maintainer-email: François Pacull <francois.pacull@architecture-performance.fr>
|
@@ -48,6 +48,7 @@ Dynamic: license-file
|
|
48
48
|
[](https://pypi.org/project/edsger/)
|
49
49
|
[](https://github.com/psf/black)
|
50
50
|
[](https://github.com/MarcoGorelli/cython-lint)
|
51
|
+
[](https://microsoft.github.io/pyright/)
|
51
52
|
[](https://opensource.org/licenses/MIT)
|
52
53
|
|
53
54
|
# Edsger
|
@@ -155,6 +156,53 @@ except ValueError as e:
|
|
155
156
|
|
156
157
|
Error: Negative cycle detected in the graph
|
157
158
|
|
159
|
+
## Breadth-First Search: Unweighted Directed Graphs
|
160
|
+
|
161
|
+
The BFS (Breadth-First Search) algorithm finds shortest paths in directed graphs where edge weights are ignored (or all edges are treated as having equal weight). It's particularly efficient for finding paths based on the minimum number of hops/edges rather than weighted distances.
|
162
|
+
|
163
|
+
```python
|
164
|
+
from edsger.path import BFS
|
165
|
+
|
166
|
+
# Create an unweighted directed graph
|
167
|
+
edges_unweighted = pd.DataFrame({
|
168
|
+
'tail': [0, 0, 1, 2, 2, 3],
|
169
|
+
'head': [1, 2, 3, 3, 4, 4]
|
170
|
+
})
|
171
|
+
edges_unweighted
|
172
|
+
```
|
173
|
+
|
174
|
+
| | tail | head |
|
175
|
+
|---:|-------:|-------:|
|
176
|
+
| 0 | 0 | 1 |
|
177
|
+
| 1 | 0 | 2 |
|
178
|
+
| 2 | 1 | 3 |
|
179
|
+
| 3 | 2 | 3 |
|
180
|
+
| 4 | 2 | 4 |
|
181
|
+
| 5 | 3 | 4 |
|
182
|
+
|
183
|
+
```python
|
184
|
+
# Initialize BFS
|
185
|
+
bfs = BFS(edges_unweighted)
|
186
|
+
|
187
|
+
# Run BFS from vertex 0 with path tracking
|
188
|
+
predecessors = bfs.run(vertex_idx=0, path_tracking=True)
|
189
|
+
print("Predecessors:", predecessors)
|
190
|
+
|
191
|
+
# Extract the path to vertex 4
|
192
|
+
path = bfs.get_path(4)
|
193
|
+
print("Path from 0 to 4:", path)
|
194
|
+
```
|
195
|
+
|
196
|
+
Predecessors: [-9999 0 0 1 2]
|
197
|
+
Path from 0 to 4: [4 2 0]
|
198
|
+
|
199
|
+
The BFS algorithm is ideal for directed graphs when:
|
200
|
+
- All edges should be treated equally (ignoring edge weights)
|
201
|
+
- You need to find paths with the minimum number of edges/hops
|
202
|
+
- You want the fastest path-finding algorithm for unweighted directed graphs (O(V + E) time complexity)
|
203
|
+
|
204
|
+
Note: The predecessor value -9999 indicates either the start vertex or an unreachable vertex. In the path output, vertices are listed from target to source.
|
205
|
+
|
158
206
|
## Installation
|
159
207
|
|
160
208
|
### Standard Installation
|
@@ -163,6 +211,80 @@ except ValueError as e:
|
|
163
211
|
pip install edsger
|
164
212
|
```
|
165
213
|
|
214
|
+
### Development Installation
|
215
|
+
|
216
|
+
For development work, clone the repository and install in development mode:
|
217
|
+
|
218
|
+
```bash
|
219
|
+
git clone https://github.com/aetperf/Edsger.git
|
220
|
+
cd Edsger
|
221
|
+
pip install -r requirements-dev.txt
|
222
|
+
pip install -e .
|
223
|
+
```
|
224
|
+
|
225
|
+
## Development
|
226
|
+
|
227
|
+
This project uses several development tools to ensure code quality:
|
228
|
+
|
229
|
+
### Type Checking
|
230
|
+
|
231
|
+
We use [Pyright](https://github.com/microsoft/pyright) for static type checking:
|
232
|
+
|
233
|
+
```bash
|
234
|
+
# Run type checking
|
235
|
+
make typecheck
|
236
|
+
|
237
|
+
# Or directly with pyright
|
238
|
+
pyright
|
239
|
+
```
|
240
|
+
|
241
|
+
For more details on type checking configuration and gradual typing strategy, see [TYPING.md](TYPING.md).
|
242
|
+
|
243
|
+
### Running Tests
|
244
|
+
|
245
|
+
```bash
|
246
|
+
# Run all tests
|
247
|
+
make test
|
248
|
+
|
249
|
+
# Run with coverage
|
250
|
+
make coverage
|
251
|
+
```
|
252
|
+
|
253
|
+
### Code Formatting and Linting
|
254
|
+
|
255
|
+
```bash
|
256
|
+
# Format code with black
|
257
|
+
make format
|
258
|
+
|
259
|
+
# Check code style
|
260
|
+
make lint
|
261
|
+
```
|
262
|
+
|
263
|
+
### Pre-commit Hooks
|
264
|
+
|
265
|
+
This project uses pre-commit hooks to maintain code quality. The hooks behave differently based on the branch:
|
266
|
+
|
267
|
+
- **Protected branches (main, release*)**: All hooks run including pyright type checking
|
268
|
+
- **Feature branches**: Only formatting hooks run (black, cython-lint) for faster commits
|
269
|
+
- Run `make typecheck` or `pre-commit run --all-files` to manually check types before merging
|
270
|
+
|
271
|
+
```bash
|
272
|
+
# Install pre-commit hooks
|
273
|
+
pre-commit install
|
274
|
+
|
275
|
+
# Run all hooks manually
|
276
|
+
pre-commit run --all-files
|
277
|
+
|
278
|
+
# Skip specific hooks if needed
|
279
|
+
SKIP=pyright git commit -m "your message"
|
280
|
+
```
|
281
|
+
|
282
|
+
### Available Make Commands
|
283
|
+
|
284
|
+
```bash
|
285
|
+
make help # Show all available commands
|
286
|
+
```
|
287
|
+
|
166
288
|
## Why Use Edsger?
|
167
289
|
|
168
290
|
Edsger is designed to be **dataframe-friendly**, providing seamless integration with pandas workflows for graph algorithms. Also it is rather efficient on Linux. Our benchmarks on the USA road network (23.9M vertices, 57.7M edges) demonstrate nice performance:
|
@@ -179,4 +301,4 @@ Edsger is licensed under the MIT License. See the LICENSE file for more details.
|
|
179
301
|
|
180
302
|
## Contact
|
181
303
|
|
182
|
-
For any questions or inquiries, please contact
|
304
|
+
For any questions or inquiries, please contact me at [francois.pacull@architecture-performance.fr](mailto:francois.pacull@architecture-performance.fr).
|
@@ -0,0 +1,32 @@
|
|
1
|
+
edsger/.gitignore,sha256=mr9Izcwvjgv215xjRKhWEZ7vsyrKWhMqvWjSLHRYDjk,13
|
2
|
+
edsger/__init__.py,sha256=lgtGe3cqdwWdO1DLEOx7fX3i8D4Z_2rXHSq7Xecf-NM,41
|
3
|
+
edsger/_version.py,sha256=l1lWRV5fzx6-C3xpWdEYCx3Y5TNykf_HgoEs12q6cfQ,21
|
4
|
+
edsger/bellman_ford.cp311-win_amd64.pyd,sha256=qfuw_sywTcKlDHxK3MvZUJsPAIQoWykf2SLcvAS2Vso,185856
|
5
|
+
edsger/bellman_ford.pyx,sha256=kscWdAKBhL9TC44PzWbHhMfkIYq6vvSW_DM8UWlnPeI,17607
|
6
|
+
edsger/bfs.cp311-win_amd64.pyd,sha256=Wo0AbGcr8Gn4lxZqK_8YN2XQf2z2JzTtm0QuZau2Kok,166912
|
7
|
+
edsger/bfs.pyx,sha256=UJsghsI_1IEAxxTYSSsu-v9lxRP2nTEBUH2m4bX9qkg,8011
|
8
|
+
edsger/commons.cp311-win_amd64.pyd,sha256=F92aAQXHDRFPxm6d_dgEI6Asq1BLZMkiAuLhm05A-gc,23040
|
9
|
+
edsger/commons.pxd,sha256=UshKjr5ve3Or9u75xGyGPKRz1RwCCb5N-xgNevXZ4j4,464
|
10
|
+
edsger/commons.pyx,sha256=rj7A-6soxKrONHOncaujC3ameKJVe1LhfD6s8RI5CDo,1018
|
11
|
+
edsger/dijkstra.cp311-win_amd64.pyd,sha256=bHCKIEgbLeu61_sR7tkcA1kfOZNopuxXK-7fSwBF43o,255488
|
12
|
+
edsger/dijkstra.pyx,sha256=K_jQ4U-sBy72o3anyRHeOUHKILmb22eXkhDlLqgfXfk,37721
|
13
|
+
edsger/graph_importer.py,sha256=wvvwzlW5edjHhVIbfK7sObHPNbbCSsD8I6co-NZ8EG4,11825
|
14
|
+
edsger/networks.py,sha256=RquMB0TXKx_8hupuKaVQ57NCV0X9dfkvkQcNxJF1RyQ,10788
|
15
|
+
edsger/path.py,sha256=5XOs4H4c4oqmVHwpLybzz1NzebJRs_HEUAN7kGr3gS0,80917
|
16
|
+
edsger/path_tracking.cp311-win_amd64.pyd,sha256=kyd9Hh1ZywexPoUEgBJQGb2Ktp0Dy8Uy1XOARcOXko8,134656
|
17
|
+
edsger/path_tracking.pyx,sha256=DlCgv6B8qGYQCut6EXMb1Ck7Cz3pHLiAHgOiagUQ1Es,2079
|
18
|
+
edsger/pq_4ary_dec_0b.cp311-win_amd64.pyd,sha256=8dPGVOvLpP-EaMgqL3irtU41Gdq13qJ-n09XHAGTykQ,163328
|
19
|
+
edsger/pq_4ary_dec_0b.pxd,sha256=VvXcQzJq3OGBptrbawtemagPimuqSCayGQ91Jrad894,1098
|
20
|
+
edsger/pq_4ary_dec_0b.pyx,sha256=EnKhqiob4Jm0IOq2nQ4Qx0PykcKNq8IeuHY5mu2FkGk,18665
|
21
|
+
edsger/prefetch_compat.h,sha256=AyAYq_ZHKk5ChaJDrZOAOYe6SprL0_2byjRbjcBGrsU,826
|
22
|
+
edsger/spiess_florian.cp311-win_amd64.pyd,sha256=ryyk-dVEj40f9uOZELim3K0tnVgKOnGBwNOuKEan1Uw,198144
|
23
|
+
edsger/spiess_florian.pyx,sha256=7gsd8vLjwA2r7NPxKVYC3Fenm-31KZP8Ttui1o5A1bU,10113
|
24
|
+
edsger/star.cp311-win_amd64.pyd,sha256=_i9ktWvfNrDSmoZ-RyaTeKKGPdKkOM_agG3VUnE37l0,181760
|
25
|
+
edsger/star.pyx,sha256=2leWr-5LYI6r7zFVbfJ-aVrt77exqurQDvA3plHSNNQ,9781
|
26
|
+
edsger/utils.py,sha256=YgSDAxAlhXv9bhKs60d-6S_l83Kt2KwBU-38PjUcO6s,4839
|
27
|
+
edsger-0.1.6.dist-info/licenses/AUTHORS.rst,sha256=8udN6bgZHdHYcVzV38y6SPnF-x6Ks0uXxxFsic6Aces,110
|
28
|
+
edsger-0.1.6.dist-info/licenses/LICENSE,sha256=w7gRlruGxK3_4KTZAyJsOR2tML4UQgB-GNm2LerwJS0,1132
|
29
|
+
edsger-0.1.6.dist-info/METADATA,sha256=KwQ635ZRYrTqoSpo4-JSpeIn-c5BeyvLa4HhQ9wxIrE,10562
|
30
|
+
edsger-0.1.6.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
|
31
|
+
edsger-0.1.6.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
|
32
|
+
edsger-0.1.6.dist-info/RECORD,,
|
edsger-0.1.5.dist-info/RECORD
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
edsger/.gitignore,sha256=mr9Izcwvjgv215xjRKhWEZ7vsyrKWhMqvWjSLHRYDjk,13
|
2
|
-
edsger/__init__.py,sha256=lgtGe3cqdwWdO1DLEOx7fX3i8D4Z_2rXHSq7Xecf-NM,41
|
3
|
-
edsger/_version.py,sha256=Nmswip0IUvJenHIhdfSyTYurDcwWTvOQ8mPDREtwE1o,21
|
4
|
-
edsger/bellman_ford.cp311-win_amd64.pyd,sha256=gnzBY8HKy5MCuXWC8MC-5wCBZQgd26tR_am5FUltKu4,188416
|
5
|
-
edsger/bellman_ford.pyx,sha256=Wep9yc2G6f14IqwFvedSApZGreQIoBLPEXLHGgXOHk8,17428
|
6
|
-
edsger/commons.cp311-win_amd64.pyd,sha256=j3eEcIo_6-bBnJmFhTlNN94H9flbE86_gQB06qEM_Dg,23552
|
7
|
-
edsger/commons.pxd,sha256=UshKjr5ve3Or9u75xGyGPKRz1RwCCb5N-xgNevXZ4j4,464
|
8
|
-
edsger/commons.pyx,sha256=6Ze22eE_zwXPRAe550DEhEvu-b7hvKmwQu73rzzWMUE,839
|
9
|
-
edsger/dijkstra.cp311-win_amd64.pyd,sha256=P0bYOestP-dEIXQf0sp1XT99-2QR7c2sqkYtpM_6Ruo,260608
|
10
|
-
edsger/dijkstra.pyx,sha256=kBXFya0bugjp97xas145sZEUXtb89_Sg9v8IdWiURoE,37542
|
11
|
-
edsger/networks.py,sha256=hH9sgT5Ic4TLVCjxPNzMDWNjNDbqpXMxXxLeWxCpdLE,10730
|
12
|
-
edsger/path.py,sha256=P9d4uvz-jn9y8I3vncB7HjUluvRGAsdYvgqeQVbT8ew,58809
|
13
|
-
edsger/path_tracking.cp311-win_amd64.pyd,sha256=9-Y_YWzCKG86saqXWGkPpmPOsrGp6WVeaoE6IlX-06U,136704
|
14
|
-
edsger/path_tracking.pyx,sha256=H24TLmC53I8LjbM1S5E7gS8WEb5uE_PZ8nhG6BteMYA,1900
|
15
|
-
edsger/pq_4ary_dec_0b.cp311-win_amd64.pyd,sha256=8cmNUCbjUtyGNwuvICENBLMOXWAwlHNRJxd7z15KRBU,163840
|
16
|
-
edsger/pq_4ary_dec_0b.pxd,sha256=VvXcQzJq3OGBptrbawtemagPimuqSCayGQ91Jrad894,1098
|
17
|
-
edsger/pq_4ary_dec_0b.pyx,sha256=IzvzQerf-LYy7weQpgI0f28Q8gUrR4ENaedekXs1Jeg,18486
|
18
|
-
edsger/prefetch_compat.h,sha256=AyAYq_ZHKk5ChaJDrZOAOYe6SprL0_2byjRbjcBGrsU,826
|
19
|
-
edsger/spiess_florian.cp311-win_amd64.pyd,sha256=R4v17793qBnQ3NmEr-OU2Ae6aIOhtcJrOF3eU9y3oTw,200192
|
20
|
-
edsger/spiess_florian.pyx,sha256=tjfF9Iv8nqpp4lnv4KAjF-37ij0_SgQ0fnacVVKx-CE,9934
|
21
|
-
edsger/star.cp311-win_amd64.pyd,sha256=8lGbBlTJXEpi5liNYKQps4rlb9Kz7uXoHK3K2RB_Bu8,183808
|
22
|
-
edsger/star.pyx,sha256=9LAIXhlccEeDgT41ico7n57FJ7PKCzhPv4f22Lphn78,9602
|
23
|
-
edsger/utils.py,sha256=I1HJtmbnu9XWiY0rstM_D0NCX0bPjdtK-BeIAXwYjO4,4728
|
24
|
-
edsger-0.1.5.dist-info/licenses/AUTHORS.rst,sha256=8udN6bgZHdHYcVzV38y6SPnF-x6Ks0uXxxFsic6Aces,110
|
25
|
-
edsger-0.1.5.dist-info/licenses/LICENSE,sha256=w7gRlruGxK3_4KTZAyJsOR2tML4UQgB-GNm2LerwJS0,1132
|
26
|
-
edsger-0.1.5.dist-info/METADATA,sha256=ZROC5X1uwWzhe_Q68ASsHpKXZKbBX-MPk6ljEk3BeV4,7293
|
27
|
-
edsger-0.1.5.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
|
28
|
-
edsger-0.1.5.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
|
29
|
-
edsger-0.1.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|