edsger 0.1.5__cp311-cp311-macosx_11_0_arm64.whl → 0.1.6__cp311-cp311-macosx_11_0_arm64.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/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,40 @@
1
+ edsger-0.1.6.dist-info/RECORD,,
2
+ edsger-0.1.6.dist-info/WHEEL,sha256=qxQkdhERtGxJzqnVOBnucx1aUmU2n3HmuzYdln_LyOw,109
3
+ edsger-0.1.6.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
4
+ edsger-0.1.6.dist-info/METADATA,sha256=i2o0CNUcmx7lGlsDzZch3nh0v91NXNZrOUwd1OVV3vE,10258
5
+ edsger-0.1.6.dist-info/licenses/LICENSE,sha256=eNjfz5CInLrVdczJbhazCKtb8-0qB0UaXZ3bXN0zio0,1111
6
+ edsger-0.1.6.dist-info/licenses/AUTHORS.rst,sha256=9lqpqjiC4XukK7jdxXwKJJrddqwCV2DjpYTqhpP6znA,105
7
+ edsger/spiess_florian.c,sha256=olSuOMSR8ee-iFBmUC2gYBAx9zRYNCfVGCVhTXhWl0s,1367225
8
+ edsger/dijkstra.c,sha256=EuQkqlHjl6o9SoEdIDMAMn9Jy2w1NH6Zjm6XRFsNVg0,1686208
9
+ edsger/bellman_ford.pyx,sha256=lFNLfuy85ZEyWFaJ4pf8xblNjp1UmL804Tem8rNot7c,17056
10
+ edsger/_version.py,sha256=l1lWRV5fzx6-C3xpWdEYCx3Y5TNykf_HgoEs12q6cfQ,21
11
+ edsger/bellman_ford.c,sha256=Yr95RS-kzzGYtkzKDR8_FjwSQhH3ijTDY0uiG98ndEA,1392627
12
+ edsger/spiess_florian.cpython-311-darwin.so,sha256=VLRDlEAd-5QgiI9hEj5Hu13pTLVWHZHu1lKh5bVR1hg,275880
13
+ edsger/commons.c,sha256=pBHEAwbniCTmdBnDAUZrGhEf2D08MJrtsuZV3Q8gPtk,343338
14
+ edsger/star.c,sha256=fwNKxz48TsKTFLk68PjJxEbnjtCROf-Rf9DPgg8Z28I,1337551
15
+ edsger/path_tracking.cpython-311-darwin.so,sha256=HqrwRlWTHL7AqS2lc3GYakc1XIsotTbAoFiYZ0P88P4,191504
16
+ edsger/commons.pyx,sha256=NokCkVYss7f1Q9VRFeruByZwp7IXBmqXLzsVVORQ3oU,977
17
+ edsger/pq_4ary_dec_0b.pxd,sha256=MbQuP1y1t6_2fJRkpqRPV2lmatwfqOxjsrb1GLfEudA,1065
18
+ edsger/__init__.py,sha256=CoqO_GHq5NC94S2JrYjf6dVGOKnxJ2TRBDOjikyscOY,40
19
+ edsger/prefetch_compat.h,sha256=6HfoyHI0dQE_MDsYHjUiX77Hg_z8eH6kRwN_5RAhbYo,806
20
+ edsger/path_tracking.c,sha256=HD79UvkDecuUs43XVc6Hhzt44KKr2bgnJSUiN-BCkUA,1148355
21
+ edsger/spiess_florian.pyx,sha256=INTaELmQxvAAF_QilEwe_hQwIAW7034A4TIA-U5oaBw,9738
22
+ edsger/bfs.cpython-311-darwin.so,sha256=s-2ZOZfAaUWQxS8meAdLIA6nJfXAZivNuGjs6Ga-MkQ,231368
23
+ edsger/pq_4ary_dec_0b.c,sha256=WAEzh-ABau9h-nkgq3FaooHaYm1aHN0OphXbDvvJX00,1374148
24
+ edsger/dijkstra.cpython-311-darwin.so,sha256=CUwR1f49z1_9XbIkK-BIDeamPmUEjP-wV7rjn-fDl7g,366624
25
+ edsger/networks.py,sha256=brp1iX1rafW8O6bEyKn2BFxmY5z8WWBJxKXdPRyohXI,10372
26
+ edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
27
+ edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
28
+ edsger/utils.py,sha256=FIe8ZQ_FMDJR1zPapHXz2sbjoq9vrIAPtkeFmM5YBJw,4711
29
+ edsger/pq_4ary_dec_0b.pyx,sha256=b8JgVZzwx0eq42-Q85OwwwosmKBuCR6AYHDLGKl7hSk,17968
30
+ edsger/graph_importer.py,sha256=qhKYY8Zsb_yKU9qPkWSG7ugEVJ5w8_7CDO5cCTmSP4M,11485
31
+ edsger/bfs.pyx,sha256=UJ8X16G7NSylIw900a1n1_oVa2sl6LQltUEHwO3lnz0,7768
32
+ edsger/commons.cpython-311-darwin.so,sha256=ubK9bumZZsKmp8S5uUcrKL3qbrj8WvtU2-GDDmCv_Ao,58096
33
+ edsger/path_tracking.pyx,sha256=Cmb4w-0BUyM7uxCP-4PfVi4OaLspu_FVdjSSOCiDRe8,1979
34
+ edsger/star.cpython-311-darwin.so,sha256=zvvYcDI51FmPDFsKiAc3zDM1DAdAmDEuWLGFrpNOjwU,251000
35
+ edsger/path.py,sha256=weKm16O3xNU5n4QWSpKgiefczw5DdFpC86OP0dH0R5o,78877
36
+ edsger/dijkstra.pyx,sha256=nxhbZJoohCaIVbQArsC4kTVzMTogMz1u44La_rc08h4,36685
37
+ edsger/star.pyx,sha256=jCCwjELvm19dYPtZyB7q5TVRz4ZrR5FsO116yy_tiNY,9418
38
+ edsger/bellman_ford.cpython-311-darwin.so,sha256=XUyNd77gaADldctXpCRl7MIwMkPbvInErQQkntC1OdE,267072
39
+ edsger/pq_4ary_dec_0b.cpython-311-darwin.so,sha256=twz6P7igpgZYfhOF_JkJikBBNBBs4gwj4lkcdt9y07o,231208
40
+ edsger/bfs.c,sha256=njGDEeOvujzHod-5T9wzMZcTV4Q80iYMrRZ0MMgDgvQ,1306768
@@ -1,36 +0,0 @@
1
- edsger-0.1.5.dist-info/RECORD,,
2
- edsger-0.1.5.dist-info/WHEEL,sha256=qxQkdhERtGxJzqnVOBnucx1aUmU2n3HmuzYdln_LyOw,109
3
- edsger-0.1.5.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
4
- edsger-0.1.5.dist-info/METADATA,sha256=LF7X-0Qgi0OuVqY_I_uNsKr5xfCnPHYbOJ-AuPXN9jY,7111
5
- edsger-0.1.5.dist-info/licenses/LICENSE,sha256=eNjfz5CInLrVdczJbhazCKtb8-0qB0UaXZ3bXN0zio0,1111
6
- edsger-0.1.5.dist-info/licenses/AUTHORS.rst,sha256=9lqpqjiC4XukK7jdxXwKJJrddqwCV2DjpYTqhpP6znA,105
7
- edsger/spiess_florian.c,sha256=bAxIe7SjZi3TDAdwT5py4LMiz_S14NOm_z62l-ZP8ts,1356425
8
- edsger/dijkstra.c,sha256=KKT9sI0KGYnvDyEhP_Wr0j2GoMPSVfCWEQypIkBQP6c,1658053
9
- edsger/bellman_ford.pyx,sha256=swabcGIjYIeFBud5VdlPAQENv3_AXULnSNLXaQSpE3U,16884
10
- edsger/_version.py,sha256=Nmswip0IUvJenHIhdfSyTYurDcwWTvOQ8mPDREtwE1o,21
11
- edsger/bellman_ford.c,sha256=S10CgCkQO7hv9o2Ie_rfe7Cl2fytw_CtL7B-Zro66CA,1374207
12
- edsger/spiess_florian.cpython-311-darwin.so,sha256=kc0blCEvg75DAovaJnV5p7lEdQUhu7P83IKeYCgFka8,276280
13
- edsger/commons.c,sha256=li8n04xPc7bKullEhjVHTxS6s_WN8jCncKeWb3hJEjI,343126
14
- edsger/star.c,sha256=VHQUKaeAxlXGRY5NZt0Xyl6gUNZetjk598JX6MKuj98,1319723
15
- edsger/path_tracking.cpython-311-darwin.so,sha256=Uhy-5yTJjbP-xERsiqbizdRCfS0ZsfaFmgp6CAGU0XY,191152
16
- edsger/commons.pyx,sha256=rPWrq1zfN_IuTgLgvvQe8ma7bU1e3V8lWbBEFH5Vaw8,805
17
- edsger/pq_4ary_dec_0b.pxd,sha256=MbQuP1y1t6_2fJRkpqRPV2lmatwfqOxjsrb1GLfEudA,1065
18
- edsger/__init__.py,sha256=CoqO_GHq5NC94S2JrYjf6dVGOKnxJ2TRBDOjikyscOY,40
19
- edsger/prefetch_compat.h,sha256=6HfoyHI0dQE_MDsYHjUiX77Hg_z8eH6kRwN_5RAhbYo,806
20
- edsger/path_tracking.c,sha256=LESlwOk6leVuhrMy0CNN01Hgk_Bghi7G0oRBM8zuZrk,1144589
21
- edsger/spiess_florian.pyx,sha256=9CrcMyzwSXaC_EdSl1uiD9yhFH6ACtooZOMfYw6vhvA,9566
22
- edsger/pq_4ary_dec_0b.c,sha256=jNibkKCmxgC8Q_Y-lerC-SbqjIoDH7J6YgY6ohPJdLE,1367901
23
- edsger/dijkstra.cpython-311-darwin.so,sha256=8cixMXjmFRYZtMAqQ1Bn-aMDQsCQOeyTMKf6C9A1HFc,366992
24
- edsger/networks.py,sha256=o_dKC6fcxsqWr3fE0m5sUQkpZO-0B2x-w51l_1fyzAc,10316
25
- edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
26
- edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
27
- edsger/utils.py,sha256=C38-cgHUPf5XEjT7359vu5xO8hl-fYAZsYL_mcp8Gts,4601
28
- edsger/pq_4ary_dec_0b.pyx,sha256=fRJCT79GsCocZgpostfn7t5nkNQALK0A93OJK4fxJR0,17796
29
- edsger/commons.cpython-311-darwin.so,sha256=ERBQGGHVxdBdlO2TWSLHql-S6SZKtHPaXowj2aikGF4,58016
30
- edsger/path_tracking.pyx,sha256=uO06fzL8V5KeI3w5FPVJJ13ZtdFGTol6oUjVX4Jjxxs,1807
31
- edsger/star.cpython-311-darwin.so,sha256=ucRFvAIuEsinmmr5nFY2hbbZDazqU9Pl0PNKcwdL0G4,250648
32
- edsger/path.py,sha256=MJTK4QJKfJnX0FjRC8HnDm0RDOKcoAOdY1a6mQq5LpU,57316
33
- edsger/dijkstra.pyx,sha256=R8DM9LlHXUOZ38t7qINaB1t_QBP_aeWBOqIHHVN9W10,36513
34
- edsger/star.pyx,sha256=MVS4kylmMAXOHm8liTfTMLzrr0jhA3cRU3-KCfVjNNM,9246
35
- edsger/bellman_ford.cpython-311-darwin.so,sha256=8tTxOMqamB43XPboGfMU3j6ZyIiCs2wwyA155D5Qntw,250816
36
- edsger/pq_4ary_dec_0b.cpython-311-darwin.so,sha256=C-1t3STU2-O-Fo5ArssE7ZR4TI6J4s4WqzhgTeEEzkI,214440
File without changes