edsger 0.1.5__cp310-cp310-macosx_11_0_arm64.whl → 0.1.6__cp310-cp310-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=wyHf6UDzyHyUK-aDYscyyyExpYI7SeEZ9xjyEiU4cnw,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.cpython-310-darwin.so,sha256=bueUOceujPXgJTmGfI5LLyUT9HsNE7Rwc0ttJKRSsuA,275864
8
+ edsger/path_tracking.cpython-310-darwin.so,sha256=WrdI1B5W7UnUcJ-g_6xbISKvapf1BsS_E2qiTw2KI74,191824
9
+ edsger/spiess_florian.c,sha256=fTErXYuwPrRpPavM0qwD4fjqES5AZlqTrUWdYEbgIYw,1367370
10
+ edsger/dijkstra.c,sha256=9L7o_gHpZugSO6DUCgs61kY1uN2oYLgxg71LeKMEeJI,1686353
11
+ edsger/bellman_ford.pyx,sha256=lFNLfuy85ZEyWFaJ4pf8xblNjp1UmL804Tem8rNot7c,17056
12
+ edsger/_version.py,sha256=l1lWRV5fzx6-C3xpWdEYCx3Y5TNykf_HgoEs12q6cfQ,21
13
+ edsger/bellman_ford.c,sha256=Zlt5isC0MycMdysoBmiK-1A3ydugE6CP1AZhQPhBC08,1392772
14
+ edsger/bfs.cpython-310-darwin.so,sha256=Qn-5W216Qd2sq72GiYouz6Bcv8EbUnG_52IVnND6JW0,231400
15
+ edsger/commons.c,sha256=e6drAKxCDAgNU-8Kt6O-bG8aVPA4V4TlMTkljZNsHno,343483
16
+ edsger/star.c,sha256=aHrCxKKy8xNpHZDLyX4WyMiUfydeWdAbGPC8FcGSMZQ,1337696
17
+ edsger/commons.pyx,sha256=NokCkVYss7f1Q9VRFeruByZwp7IXBmqXLzsVVORQ3oU,977
18
+ edsger/pq_4ary_dec_0b.pxd,sha256=MbQuP1y1t6_2fJRkpqRPV2lmatwfqOxjsrb1GLfEudA,1065
19
+ edsger/__init__.py,sha256=CoqO_GHq5NC94S2JrYjf6dVGOKnxJ2TRBDOjikyscOY,40
20
+ edsger/prefetch_compat.h,sha256=6HfoyHI0dQE_MDsYHjUiX77Hg_z8eH6kRwN_5RAhbYo,806
21
+ edsger/path_tracking.c,sha256=bk4fXNuyL8hJxR1uzcuD3Tmpl72MFlYGJC0314YENtw,1148500
22
+ edsger/spiess_florian.pyx,sha256=INTaELmQxvAAF_QilEwe_hQwIAW7034A4TIA-U5oaBw,9738
23
+ edsger/pq_4ary_dec_0b.c,sha256=zAOYxIhiZGuqu8USRugl8wq0NMRXxdJ4jroZjUb_mOw,1374293
24
+ edsger/commons.cpython-310-darwin.so,sha256=GQneLT5CbMdIxaTpTkbjIHrMXs73z87kwaIlqxCGFVA,58384
25
+ edsger/networks.py,sha256=brp1iX1rafW8O6bEyKn2BFxmY5z8WWBJxKXdPRyohXI,10372
26
+ edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
27
+ edsger/star.cpython-310-darwin.so,sha256=d2lcyvi3JB5UeyUz5XivATQxoxtgHTyD3VxFSRN-n2c,251032
28
+ edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
29
+ edsger/utils.py,sha256=FIe8ZQ_FMDJR1zPapHXz2sbjoq9vrIAPtkeFmM5YBJw,4711
30
+ edsger/pq_4ary_dec_0b.pyx,sha256=b8JgVZzwx0eq42-Q85OwwwosmKBuCR6AYHDLGKl7hSk,17968
31
+ edsger/graph_importer.py,sha256=qhKYY8Zsb_yKU9qPkWSG7ugEVJ5w8_7CDO5cCTmSP4M,11485
32
+ edsger/pq_4ary_dec_0b.cpython-310-darwin.so,sha256=SmqQ9aMUUQ1Mcy-qGL1_WDi3L2xvNPw9NRy2IGUylZ8,230888
33
+ edsger/bellman_ford.cpython-310-darwin.so,sha256=1w36UdkBMt4tXTXaw-k2buL6tQQLupiwxleWZr2NcjQ,266896
34
+ edsger/bfs.pyx,sha256=UJ8X16G7NSylIw900a1n1_oVa2sl6LQltUEHwO3lnz0,7768
35
+ edsger/dijkstra.cpython-310-darwin.so,sha256=ulwyZL_9kQCtVP75mr1IYe_RzWuzW_sWzt_1Z0vx824,366528
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=cC6xiFAFMghpAGNhJO3C4akBCAP1ieNJGd97ZetMwH8,1306913
@@ -1,36 +0,0 @@
1
- edsger-0.1.5.dist-info/RECORD,,
2
- edsger-0.1.5.dist-info/WHEEL,sha256=wyHf6UDzyHyUK-aDYscyyyExpYI7SeEZ9xjyEiU4cnw,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.cpython-310-darwin.so,sha256=gG3yJ1bnMdshQoEw6u0J6wyENa2jwDj0X8mShUV9pdw,276264
8
- edsger/path_tracking.cpython-310-darwin.so,sha256=fqJFP9GXvcrxxoovPAqRbBjHo-ahLO7_MZveLWrtKqo,191472
9
- edsger/spiess_florian.c,sha256=sokJVlGhLt6jZeV_fL2DuqRbQsjbRJDDc6ZJ6EBFnHc,1356570
10
- edsger/dijkstra.c,sha256=mPQ9vHItqVq-svzTT0Y3AuTnTEB9fLakVgerO8JYIbU,1658198
11
- edsger/bellman_ford.pyx,sha256=swabcGIjYIeFBud5VdlPAQENv3_AXULnSNLXaQSpE3U,16884
12
- edsger/_version.py,sha256=Nmswip0IUvJenHIhdfSyTYurDcwWTvOQ8mPDREtwE1o,21
13
- edsger/bellman_ford.c,sha256=dn0taoekFM-vZ7sKU8wsAXb2gxMuy3TjROjEe_Q3RFs,1374352
14
- edsger/commons.c,sha256=qNpdBFqZdHzf0zr61MEYoiOllh-pEfXyNVdnvLFgBio,343271
15
- edsger/star.c,sha256=GnaX_faHEBpnJBj6T5m8VgJmcVASvoOMNYXBkz-dKFs,1319868
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=NarsMeQpHPd5xNhAfPWiJ8Vf7fS6JfrUM4E5t7BJqVw,1144734
21
- edsger/spiess_florian.pyx,sha256=9CrcMyzwSXaC_EdSl1uiD9yhFH6ACtooZOMfYw6vhvA,9566
22
- edsger/pq_4ary_dec_0b.c,sha256=n6ibomDZRAuu-5u02Ss4dPQTqSRWuPm_qSqCx7k_dAI,1368046
23
- edsger/commons.cpython-310-darwin.so,sha256=j5H3ok_W-1TsCuQGlqAClNT4M6yPgXJWcTN_gFWzaPg,58320
24
- edsger/networks.py,sha256=o_dKC6fcxsqWr3fE0m5sUQkpZO-0B2x-w51l_1fyzAc,10316
25
- edsger/commons.pxd,sha256=P9-n7ChbSIMSBRRY_lY3gBwXYUSvqJG-S_6e0dZTYU8,439
26
- edsger/star.cpython-310-darwin.so,sha256=3y9Lqfuu1gSC14YN3erk4ufExVeFBfREjRKncvI6NcY,250680
27
- edsger/.gitignore,sha256=tWvEr3sBkY2ODntRp4_IUz3cidH-xu1efiOQK9DfK04,12
28
- edsger/utils.py,sha256=C38-cgHUPf5XEjT7359vu5xO8hl-fYAZsYL_mcp8Gts,4601
29
- edsger/pq_4ary_dec_0b.pyx,sha256=fRJCT79GsCocZgpostfn7t5nkNQALK0A93OJK4fxJR0,17796
30
- edsger/pq_4ary_dec_0b.cpython-310-darwin.so,sha256=21Gf7N56ebIt-hiSZ_RcumEGHXzzjm63yfT09MckAq0,214120
31
- edsger/bellman_ford.cpython-310-darwin.so,sha256=2lDd5b7CsaFc92gf-anbJbUAE-xd7-cAVGCcAp3Unf0,250656
32
- edsger/dijkstra.cpython-310-darwin.so,sha256=5scv_N3AhzBsVRn_x0kv3gmi7N5eCOoWeHdr0mz-Bi8,366896
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