edsger 0.1.5__cp312-cp312-macosx_11_0_arm64.whl → 0.1.6__cp312-cp312-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=CltXN3lQvXbHxKDtiDwW0RNzF8s2WyBuPbOAX_ZeQlA,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/commons.cpython-312-darwin.so,sha256=YBfQw2I87Gl-fGZ87b9y27HNNi2mPm9HhMiY8HOElEs,57744
8
+ edsger/star.cpython-312-darwin.so,sha256=hq6JN7_va3kwDxr5LkOpW8gKmAeMoxqUkCUXONXMsmE,242760
9
+ edsger/spiess_florian.c,sha256=lMSjVtG0fnXfUkERvhXMJLl3SRlhCz1RrR0m0ldkcjk,1367225
10
+ edsger/dijkstra.c,sha256=Jn-Py0PerI7UyAjF53PIm5UO2KgZ6t_iZoLWUbrH5oA,1686208
11
+ edsger/bellman_ford.pyx,sha256=lFNLfuy85ZEyWFaJ4pf8xblNjp1UmL804Tem8rNot7c,17056
12
+ edsger/_version.py,sha256=l1lWRV5fzx6-C3xpWdEYCx3Y5TNykf_HgoEs12q6cfQ,21
13
+ edsger/pq_4ary_dec_0b.cpython-312-darwin.so,sha256=W02Qe-2Rt72TAaIQhztGKs4YSweAi3SRGFZ6dbh4t7Y,229656
14
+ edsger/bellman_ford.c,sha256=g-L3BhFlYPs1LGSlhMWiaqWITUMKVrq-nst5RErCk9U,1392627
15
+ edsger/bellman_ford.cpython-312-darwin.so,sha256=-Ls0bBAj_luGi1es4fv11ZwXZZlY9woBPCaEE9Ojmis,261424
16
+ edsger/dijkstra.cpython-312-darwin.so,sha256=AQyamcnttL27D2QUymAbTdGtg2yWSdiLp1R5GSyi5Ko,348352
17
+ edsger/commons.c,sha256=GMPjrZjaGyQmQcEibsUjR_llaQpDbiWGPfPpy7-HNYk,343338
18
+ edsger/star.c,sha256=DlApfSK8QwYVxpiiqiiZVaAFuvEgrE-fYUn7yw51I6E,1337551
19
+ edsger/commons.pyx,sha256=NokCkVYss7f1Q9VRFeruByZwp7IXBmqXLzsVVORQ3oU,977
20
+ edsger/pq_4ary_dec_0b.pxd,sha256=MbQuP1y1t6_2fJRkpqRPV2lmatwfqOxjsrb1GLfEudA,1065
21
+ edsger/__init__.py,sha256=CoqO_GHq5NC94S2JrYjf6dVGOKnxJ2TRBDOjikyscOY,40
22
+ edsger/prefetch_compat.h,sha256=6HfoyHI0dQE_MDsYHjUiX77Hg_z8eH6kRwN_5RAhbYo,806
23
+ edsger/path_tracking.c,sha256=8ExAukXyveSwXqg-vUQhm16Y2gvERJH_2W4Nyy0f6Dc,1148355
24
+ edsger/spiess_florian.pyx,sha256=INTaELmQxvAAF_QilEwe_hQwIAW7034A4TIA-U5oaBw,9738
25
+ edsger/pq_4ary_dec_0b.c,sha256=Jt8DuK3lyx5PF9-u9gzgSuwBzPpCcuzXag_OkPy-iYc,1374148
26
+ edsger/spiess_florian.cpython-312-darwin.so,sha256=G_u0iB65Us6kpySn503IziomspcKGy-fzmzkpDNllBY,260984
27
+ edsger/networks.py,sha256=brp1iX1rafW8O6bEyKn2BFxmY5z8WWBJxKXdPRyohXI,10372
28
+ edsger/path_tracking.cpython-312-darwin.so,sha256=BI84HY-sCTnOXskbd6a8Ma8PbkOVXtJgtV4BFaHtic8,190736
29
+ edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
30
+ edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
31
+ edsger/utils.py,sha256=FIe8ZQ_FMDJR1zPapHXz2sbjoq9vrIAPtkeFmM5YBJw,4711
32
+ edsger/pq_4ary_dec_0b.pyx,sha256=b8JgVZzwx0eq42-Q85OwwwosmKBuCR6AYHDLGKl7hSk,17968
33
+ edsger/graph_importer.py,sha256=qhKYY8Zsb_yKU9qPkWSG7ugEVJ5w8_7CDO5cCTmSP4M,11485
34
+ edsger/bfs.cpython-312-darwin.so,sha256=azLoMA9dSAjIz-YlbPXq3T2tgOxS5aDZiZNUggS_Dm4,242664
35
+ edsger/bfs.pyx,sha256=UJ8X16G7NSylIw900a1n1_oVa2sl6LQltUEHwO3lnz0,7768
36
+ edsger/path_tracking.pyx,sha256=Cmb4w-0BUyM7uxCP-4PfVi4OaLspu_FVdjSSOCiDRe8,1979
37
+ edsger/path.py,sha256=weKm16O3xNU5n4QWSpKgiefczw5DdFpC86OP0dH0R5o,78877
38
+ edsger/dijkstra.pyx,sha256=nxhbZJoohCaIVbQArsC4kTVzMTogMz1u44La_rc08h4,36685
39
+ edsger/star.pyx,sha256=jCCwjELvm19dYPtZyB7q5TVRz4ZrR5FsO116yy_tiNY,9418
40
+ edsger/bfs.c,sha256=pkAzftqw51Q6K3aNJLHTVyUpY2bco3CQ_dSlHzAQ9q4,1306768
@@ -1,36 +0,0 @@
1
- edsger-0.1.5.dist-info/RECORD,,
2
- edsger-0.1.5.dist-info/WHEEL,sha256=CltXN3lQvXbHxKDtiDwW0RNzF8s2WyBuPbOAX_ZeQlA,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/commons.cpython-312-darwin.so,sha256=MUrJKpzTFzwPUjYphx-liLHKhcdOznXZVr1VtsqbWKs,57680
8
- edsger/star.cpython-312-darwin.so,sha256=YdiZNgk7FxzK0UDPnwycLZCFLFzE1o6emVm362jfwU4,242408
9
- edsger/spiess_florian.c,sha256=XYjBcU0sAO4d5V7eh3LC0leQTSIxw364AJMqUNkoLec,1356425
10
- edsger/dijkstra.c,sha256=59tzoGy0wT-TWv9z6lwbEppQvQWxjpHmYZPWq5BdoUo,1658053
11
- edsger/bellman_ford.pyx,sha256=swabcGIjYIeFBud5VdlPAQENv3_AXULnSNLXaQSpE3U,16884
12
- edsger/_version.py,sha256=Nmswip0IUvJenHIhdfSyTYurDcwWTvOQ8mPDREtwE1o,21
13
- edsger/pq_4ary_dec_0b.cpython-312-darwin.so,sha256=-t6lCKFY2jD4UqDCmtA-BdtPgFUVtvnHNLdwznSPFgc,229400
14
- edsger/bellman_ford.c,sha256=Q0Hp4OR43o7aoTfH9RJbTMgGz8vQgCpIDdoLjSIzf6c,1374207
15
- edsger/bellman_ford.cpython-312-darwin.so,sha256=FGPS2yW5BwqZe4E0Wvl2dOV4QXo0DukFQ4z-w7BRXHs,261680
16
- edsger/dijkstra.cpython-312-darwin.so,sha256=kfvwsXovaddXkmBR0_Le9d0DIEUfnePoBaFImPnvT84,348720
17
- edsger/commons.c,sha256=lg9m1wt2uHuXHdK4WP0uNle50Sph9OhvUz2nWhUHEoQ,343126
18
- edsger/star.c,sha256=xMoB3g-QFPPLq6sy3DfGCLHh1meN_1qpAJcmsHqlSQ0,1319723
19
- edsger/commons.pyx,sha256=rPWrq1zfN_IuTgLgvvQe8ma7bU1e3V8lWbBEFH5Vaw8,805
20
- edsger/pq_4ary_dec_0b.pxd,sha256=MbQuP1y1t6_2fJRkpqRPV2lmatwfqOxjsrb1GLfEudA,1065
21
- edsger/__init__.py,sha256=CoqO_GHq5NC94S2JrYjf6dVGOKnxJ2TRBDOjikyscOY,40
22
- edsger/prefetch_compat.h,sha256=6HfoyHI0dQE_MDsYHjUiX77Hg_z8eH6kRwN_5RAhbYo,806
23
- edsger/path_tracking.c,sha256=pT6hotzCbGseKO05WqbtiT-ZrA7kouIp9pnLC1isqWQ,1144589
24
- edsger/spiess_florian.pyx,sha256=9CrcMyzwSXaC_EdSl1uiD9yhFH6ACtooZOMfYw6vhvA,9566
25
- edsger/pq_4ary_dec_0b.c,sha256=iZ0M7MQ-SmmINuysAf3wmppvnaig0THR8qGHPC1JV5g,1367901
26
- edsger/spiess_florian.cpython-312-darwin.so,sha256=_Pc8HPbprwStQdP_pMF8DxIkdx9CoSfFsJw2mOFwbYc,261400
27
- edsger/networks.py,sha256=o_dKC6fcxsqWr3fE0m5sUQkpZO-0B2x-w51l_1fyzAc,10316
28
- edsger/path_tracking.cpython-312-darwin.so,sha256=g6EiedfGuJ9zh7wXChmFcrjofVK88CoYXcDgkfbpGOU,190384
29
- edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
30
- edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
31
- edsger/utils.py,sha256=C38-cgHUPf5XEjT7359vu5xO8hl-fYAZsYL_mcp8Gts,4601
32
- edsger/pq_4ary_dec_0b.pyx,sha256=fRJCT79GsCocZgpostfn7t5nkNQALK0A93OJK4fxJR0,17796
33
- edsger/path_tracking.pyx,sha256=uO06fzL8V5KeI3w5FPVJJ13ZtdFGTol6oUjVX4Jjxxs,1807
34
- edsger/path.py,sha256=MJTK4QJKfJnX0FjRC8HnDm0RDOKcoAOdY1a6mQq5LpU,57316
35
- edsger/dijkstra.pyx,sha256=R8DM9LlHXUOZ38t7qINaB1t_QBP_aeWBOqIHHVN9W10,36513
36
- edsger/star.pyx,sha256=MVS4kylmMAXOHm8liTfTMLzrr0jhA3cRU3-KCfVjNNM,9246
File without changes