edsger 0.1.5__cp39-cp39-win_amd64.whl → 0.1.6__cp39-cp39-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.
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
 
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.5
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
  [![Python 3.9 | 3.10 | 3.11 | 3.12 | 3.13](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://pypi.org/project/edsger/)
49
49
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
50
50
  [![Cython lint: cython-lint](https://img.shields.io/badge/cython--lint-enabled-brightgreen.svg)](https://github.com/MarcoGorelli/cython-lint)
51
+ [![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
51
52
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 François Pacull at [francois.pacull@architecture-performance.fr](mailto:francois.pacull@architecture-performance.fr).
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.cp39-win_amd64.pyd,sha256=Fd9TyYVyVlVqfHEm_rkEKYv3fR2_x95vGNEBZnjjjoA,185344
5
+ edsger/bellman_ford.pyx,sha256=kscWdAKBhL9TC44PzWbHhMfkIYq6vvSW_DM8UWlnPeI,17607
6
+ edsger/bfs.cp39-win_amd64.pyd,sha256=mdVxqiYMl3wFvYx6VXfhQ_1_vDwQ5yaNca0neEZ09dk,166912
7
+ edsger/bfs.pyx,sha256=UJsghsI_1IEAxxTYSSsu-v9lxRP2nTEBUH2m4bX9qkg,8011
8
+ edsger/commons.cp39-win_amd64.pyd,sha256=ypv3a2sp9BBcyaxP81iugKZoYo0PtIpggSS90y6StGI,23040
9
+ edsger/commons.pxd,sha256=UshKjr5ve3Or9u75xGyGPKRz1RwCCb5N-xgNevXZ4j4,464
10
+ edsger/commons.pyx,sha256=rj7A-6soxKrONHOncaujC3ameKJVe1LhfD6s8RI5CDo,1018
11
+ edsger/dijkstra.cp39-win_amd64.pyd,sha256=WMQ93rVfDiRft_dbAVBVFRfA5Nx-H-Apwjv1myumwtM,252416
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.cp39-win_amd64.pyd,sha256=Vx7abqWNJs5_oUI4bkdQqoVFnhApoVlFGDB18SVBfAE,135168
17
+ edsger/path_tracking.pyx,sha256=DlCgv6B8qGYQCut6EXMb1Ck7Cz3pHLiAHgOiagUQ1Es,2079
18
+ edsger/pq_4ary_dec_0b.cp39-win_amd64.pyd,sha256=nSgHRmjXp31ERePdAdeql91np5qxdRyywO4kr5YeWrE,162304
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.cp39-win_amd64.pyd,sha256=SOaTcGYm1j_UHC-yN6xo0cN5hhx0NAQhKr5TPZc-oE4,198144
23
+ edsger/spiess_florian.pyx,sha256=7gsd8vLjwA2r7NPxKVYC3Fenm-31KZP8Ttui1o5A1bU,10113
24
+ edsger/star.cp39-win_amd64.pyd,sha256=9pGgLkKjx9Mcv5fbks35FDePyNplGbS31Tm605Q6jOs,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=XkFE14KmFh7mutkkb-qn_ueuH2lwfT8rLdfc5xpQ7wE,99
31
+ edsger-0.1.6.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
32
+ edsger-0.1.6.dist-info/RECORD,,
@@ -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.cp39-win_amd64.pyd,sha256=h-1LWtqSQpznOORp_pX9AQaPdjA4sMFSsBkOsImafWo,188928
5
- edsger/bellman_ford.pyx,sha256=Wep9yc2G6f14IqwFvedSApZGreQIoBLPEXLHGgXOHk8,17428
6
- edsger/commons.cp39-win_amd64.pyd,sha256=8R9aC9K7DnHSnf8SYuxoAkmLMPZf9N5RaU-xVQ_8dEA,23552
7
- edsger/commons.pxd,sha256=UshKjr5ve3Or9u75xGyGPKRz1RwCCb5N-xgNevXZ4j4,464
8
- edsger/commons.pyx,sha256=6Ze22eE_zwXPRAe550DEhEvu-b7hvKmwQu73rzzWMUE,839
9
- edsger/dijkstra.cp39-win_amd64.pyd,sha256=lJ4UyB4CEZesLxKjm17-Y9kedmBqA_TArvN4HQ7TWQ0,261632
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.cp39-win_amd64.pyd,sha256=-lbw2ndBWe0t17aa-orNup10dv8VsVHVBOXGVYyZ3uw,137216
14
- edsger/path_tracking.pyx,sha256=H24TLmC53I8LjbM1S5E7gS8WEb5uE_PZ8nhG6BteMYA,1900
15
- edsger/pq_4ary_dec_0b.cp39-win_amd64.pyd,sha256=TWnSmtvvbI2OUJlv-e59Dwqh6Ei-eGoeznBBcnwFWDQ,164864
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.cp39-win_amd64.pyd,sha256=9-cWfz-y9SgqjCYyzHoHfHTldyCHJMDgGaFveaa-S4U,201216
20
- edsger/spiess_florian.pyx,sha256=tjfF9Iv8nqpp4lnv4KAjF-37ij0_SgQ0fnacVVKx-CE,9934
21
- edsger/star.cp39-win_amd64.pyd,sha256=e0uVU2Quc4lvoTa2TXTqU0dg9uBGAGwqCKai_3Bh_FU,184832
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=XkFE14KmFh7mutkkb-qn_ueuH2lwfT8rLdfc5xpQ7wE,99
28
- edsger-0.1.5.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
29
- edsger-0.1.5.dist-info/RECORD,,
File without changes