edsger 0.1.1__cp310-cp310-win32.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/utils.py ADDED
@@ -0,0 +1,63 @@
1
+ """This module makes it easy to execute common tasks in Python scripts such as generate random
2
+ graphs.
3
+ """
4
+
5
+ import numpy as np
6
+ import pandas as pd
7
+
8
+
9
+ def generate_random_network(n_edges=100, n_verts=20, seed=124, sort=True):
10
+ """
11
+ Generate a random network with a specified number of edges and vertices.
12
+
13
+ Parameters
14
+ ----------
15
+ n_edges : int, optional
16
+ The number of edges in the network. Default is 100.
17
+ n_verts : int, optional
18
+ The number of vertices in the network. Default is 20.
19
+ seed : int, optional
20
+ The seed for the random number generator. Default is 124.
21
+ sort : bool, optional
22
+ Whether to sort the edges by tail and head vertices. Default is True.
23
+
24
+ Returns
25
+ -------
26
+ edges : pandas.DataFrame
27
+ A DataFrame containing the edges of the network with columns 'tail', 'head', and 'weight'.
28
+
29
+ Examples
30
+ --------
31
+ >>> generate_random_network(n_edges=5, n_verts=3, seed=42)
32
+ tail head weight
33
+ 0 0 2 0.975622
34
+ 1 1 0 0.128114
35
+ 2 1 0 0.450386
36
+ 3 1 2 0.786064
37
+ 4 2 0 0.761140
38
+
39
+
40
+ Notes
41
+ -----
42
+ The 'tail' and 'head' columns represent the source and destination vertices of each edge,
43
+ respectively. The 'weight' column represents the weight of each edge, which is a random
44
+ float between 0 and 1.
45
+
46
+ If `sort` is True, the DataFrame is sorted by the 'tail' and 'head' columns and the index
47
+ is reset.
48
+ """
49
+ rng = np.random.default_rng(seed=seed)
50
+ tail = rng.integers(low=0, high=n_verts, size=n_edges)
51
+ head = rng.integers(low=0, high=n_verts, size=n_edges)
52
+ weight = rng.random(size=n_edges)
53
+ edges = pd.DataFrame(data={"tail": tail, "head": head, "weight": weight})
54
+ if sort:
55
+ edges.sort_values(by=["tail", "head"], inplace=True)
56
+ edges.reset_index(drop=True, inplace=True)
57
+ return edges
58
+
59
+
60
+ # author : Francois Pacull
61
+ # copyright : Architecture & Performance
62
+ # email: francois.pacull@architecture-performance.fr
63
+ # license : MIT
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: edsger
3
+ Version: 0.1.1
4
+ Summary: Graph algorithms in Cython.
5
+ Author-email: François Pacull <francois.pacull@architecture-performance.fr>
6
+ Maintainer-email: François Pacull <francois.pacull@architecture-performance.fr>
7
+ License: MIT License
8
+ Project-URL: Repository, https://github.com/aetperf/Edsger
9
+ Project-URL: Documentation, https://edsger.readthedocs.io
10
+ Keywords: python,graph,shortest path,Dijkstra
11
+ Platform: any
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: AUTHORS.rst
26
+ Requires-Dist: setuptools
27
+ Requires-Dist: setuptools_scm
28
+ Requires-Dist: numpy>=1.26
29
+ Requires-Dist: Cython>=3
30
+ Requires-Dist: pandas
31
+ Provides-Extra: dev
32
+ Requires-Dist: black; extra == "dev"
33
+ Provides-Extra: test
34
+ Requires-Dist: pytest; extra == "test"
35
+ Requires-Dist: scipy<1.11; extra == "test"
36
+ Provides-Extra: doc
37
+ Requires-Dist: sphinx; extra == "doc"
38
+ Requires-Dist: sphinx_design; extra == "doc"
39
+ Requires-Dist: sphinx_rtd_theme; extra == "doc"
40
+ Dynamic: license-file
41
+
42
+
43
+ ![Tests Status](https://github.com/aetperf/edsger/actions/workflows/tests.yml/badge.svg?branch=release)
44
+ [![codecov](https://codecov.io/gh/aetperf/edsger/branch/release/graph/badge.svg)](https://codecov.io/gh/aetperf/edsger)
45
+ [![PyPI version](https://img.shields.io/pypi/v/edsger.svg)](https://pypi.org/project/edsger/)
46
+ [![Downloads](https://static.pepy.tech/badge/edsger)](https://pepy.tech/project/edsger)
47
+ [![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/)
48
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
49
+ [![Cython lint: cython-lint](https://img.shields.io/badge/cython--lint-enabled-brightgreen.svg)](https://github.com/MarcoGorelli/cython-lint)
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
51
+
52
+ # Edsger
53
+
54
+ *Graph algorithms in Cython*
55
+
56
+ Welcome to our Python library for graph algorithms. So far, the library only includes Dijkstra's algorithm but we should add a range of common path algorithms later. It is also open-source and easy to integrate with other Python libraries. To get started, simply install the library using pip, and import it into your Python project.
57
+
58
+ Documentation : [https://edsger.readthedocs.io/en/latest/](https://edsger.readthedocs.io/en/latest/)
59
+
60
+ ## Small example : Dijkstra's Algorithm
61
+
62
+ To use Dijkstra's algorithm, you can import the `Dijkstra` class from the `path` module. The function takes a graph and a source node as input, and returns the shortest path from the source node to all other nodes in the graph.
63
+
64
+ ```python
65
+ import pandas as pd
66
+
67
+ from edsger.path import Dijkstra
68
+
69
+ # Create a DataFrame with the edges of the graph
70
+ edges = pd.DataFrame({
71
+ 'tail': [0, 0, 1, 2, 2, 3],
72
+ 'head': [1, 2, 2, 3, 4, 4],
73
+ 'weight': [1, 4, 2, 1, 3, 1]
74
+ })
75
+ edges
76
+ ```
77
+
78
+ | | tail | head | weight |
79
+ |---:|-------:|-------:|---------:|
80
+ | 0 | 0 | 1 | 1 |
81
+ | 1 | 0 | 2 | 4 |
82
+ | 2 | 1 | 2 | 2 |
83
+ | 3 | 2 | 3 | 1 |
84
+ | 4 | 2 | 4 | 3 |
85
+ | 5 | 3 | 4 | 1 |
86
+
87
+
88
+ ```python
89
+ # Initialize the Dijkstra object
90
+ dijkstra = Dijkstra(edges)
91
+
92
+ # Run the algorithm from a source vertex
93
+ shortest_paths = dijkstra.run(vertex_idx=0)
94
+ print("Shortest paths:", shortest_paths)
95
+ ```
96
+
97
+ Shortest paths: [0. 1. 3. 4. 5.]
98
+
99
+ We get the shortest paths from the source node 0 to all other nodes in the graph. The output is an array with the shortest path length to each node. A path length is the sum of the weights of the edges in the path.
100
+
101
+ ## Contributing
102
+
103
+ We welcome contributions to the Edsger library. If you have any suggestions, bug reports, or feature requests, please open an issue on our [GitHub repository](https://github.com/aetperf/Edsger).
104
+
105
+ ## License
106
+
107
+ Edsger is licensed under the MIT License. See the LICENSE file for more details.
108
+
109
+ ## Contact
110
+
111
+ For any questions or inquiries, please contact François Pacull at [francois.pacull@architecture-performance.fr](mailto:francois.pacull@architecture-performance.fr).
@@ -0,0 +1,26 @@
1
+ edsger/.gitignore,sha256=mr9Izcwvjgv215xjRKhWEZ7vsyrKWhMqvWjSLHRYDjk,13
2
+ edsger/__init__.py,sha256=lgtGe3cqdwWdO1DLEOx7fX3i8D4Z_2rXHSq7Xecf-NM,41
3
+ edsger/_version.py,sha256=8oAxKUG747GUokmxjkrWejyJa5yPNEsoJDlXxoedxTw,21
4
+ edsger/commons.cp310-win32.pyd,sha256=6X-DQhF2oKe3sYLdJTD2npOuev0btDXNf3VpGyCUj78,19968
5
+ edsger/commons.pxd,sha256=UshKjr5ve3Or9u75xGyGPKRz1RwCCb5N-xgNevXZ4j4,464
6
+ edsger/commons.pyx,sha256=6Ze22eE_zwXPRAe550DEhEvu-b7hvKmwQu73rzzWMUE,839
7
+ edsger/dijkstra.cp310-win32.pyd,sha256=U-yNnZv-l9QriHWe_0YPqyvUz5MDCk86twWvEkgayeA,164864
8
+ edsger/dijkstra.pyx,sha256=0Hs3ccSGWpKx53md3kHye344u63KaunHj_gmG3_T8EE,16830
9
+ edsger/networks.py,sha256=hH9sgT5Ic4TLVCjxPNzMDWNjNDbqpXMxXxLeWxCpdLE,10730
10
+ edsger/path.py,sha256=OnXbP8Mf1rcO_9m6XsDrdXCRcLMeOb2vOAb1eHcZfM8,30395
11
+ edsger/path_tracking.cp310-win32.pyd,sha256=9kKMjaCBWVrgowVH81YOlkwNl7rkySnjeMgbw7TeDSc,108032
12
+ edsger/path_tracking.pyx,sha256=ZyIJQucG4-pyltgjsfGuZ7B6d0bFeovCuNh34LrBSvM,1900
13
+ edsger/pq_4ary_dec_0b.cp310-win32.pyd,sha256=ydUoDIvthEY5zpyoTCCkzNWprw2M3rG8caH-ExRVrag,131584
14
+ edsger/pq_4ary_dec_0b.pxd,sha256=s0IsejKiG95SPgS3EX8rG86w1gzEyAkXJMaq5zj3HzE,1035
15
+ edsger/pq_4ary_dec_0b.pyx,sha256=x9rDOYMAjS6uCyp_VQYrI1yFBY4va4sTLXn05be4rTo,18521
16
+ edsger/spiess_florian.cp310-win32.pyd,sha256=ETxo1gcIJHH14S7GsbYQ-Dzfsrz5HHffqT8w7w2vfS8,155648
17
+ edsger/spiess_florian.pyx,sha256=tjfF9Iv8nqpp4lnv4KAjF-37ij0_SgQ0fnacVVKx-CE,9934
18
+ edsger/star.cp310-win32.pyd,sha256=TkkN2kvytYbZ7O4VLNeoyPo1V7Rrtw3zFmPkbtdxg1s,145920
19
+ edsger/star.pyx,sha256=50sopL56DnCQokHORsJ4IydQv_Zqs39W3WZLnadwgfk,9602
20
+ edsger/utils.py,sha256=xYfOFIbYpAiZljhUOgGWy0TVNvWaMFCwbCLPBkzdVos,2097
21
+ edsger-0.1.1.dist-info/licenses/AUTHORS.rst,sha256=8udN6bgZHdHYcVzV38y6SPnF-x6Ks0uXxxFsic6Aces,110
22
+ edsger-0.1.1.dist-info/licenses/LICENSE,sha256=w7gRlruGxK3_4KTZAyJsOR2tML4UQgB-GNm2LerwJS0,1132
23
+ edsger-0.1.1.dist-info/METADATA,sha256=I6IBbA-l70HNaSOT9dlFffY90wm0eeXqbukb_-no2qo,4789
24
+ edsger-0.1.1.dist-info/WHEEL,sha256=GWZF0cboiU4MhsG0baPl8rrtCaXFSLW25384gp3vddM,97
25
+ edsger-0.1.1.dist-info/top_level.txt,sha256=QvhzFORJIIot6GzSnDrtGa9KQt9iifCbOC5ULlzY5dg,7
26
+ edsger-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-win32
5
+
@@ -0,0 +1,5 @@
1
+ ============
2
+ Contributors
3
+ ============
4
+
5
+ * François Pacull <francois.pacull@architecture-performance.fr>
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Francois Pacull - Architecture & Performance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ edsger