graphfinder 0.1.0__tar.gz
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.
- graphfinder-0.1.0/Cargo.lock +265 -0
- graphfinder-0.1.0/Cargo.toml +15 -0
- graphfinder-0.1.0/LICENSE +21 -0
- graphfinder-0.1.0/PKG-INFO +62 -0
- graphfinder-0.1.0/crates/graph-py/Cargo.toml +14 -0
- graphfinder-0.1.0/crates/graph-py/src/lib.rs +537 -0
- graphfinder-0.1.0/crates/graphfinder-core/Cargo.toml +15 -0
- graphfinder-0.1.0/crates/graphfinder-core/examples/basic.rs +63 -0
- graphfinder-0.1.0/crates/graphfinder-core/examples/compare.rs +79 -0
- graphfinder-0.1.0/crates/graphfinder-core/examples/strategies.rs +74 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/domains/graphs.rs +87 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/domains/maze.rs +64 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/domains/mod.rs +8 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/frontier/mod.rs +126 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/graph/csr.rs +92 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/graph/grid.rs +162 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/graph/mod.rs +7 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/heuristic.rs +57 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/lib.rs +47 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/search.rs +371 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/strategies.rs +517 -0
- graphfinder-0.1.0/crates/graphfinder-core/src/traits.rs +72 -0
- graphfinder-0.1.0/crates/graphfinder-core/tests/optimality.rs +113 -0
- graphfinder-0.1.0/crates/graphfinder-core/tests/strategies.rs +130 -0
- graphfinder-0.1.0/pyproject.toml +43 -0
- graphfinder-0.1.0/python/README.md +32 -0
- graphfinder-0.1.0/python/graphfinder/__init__.py +82 -0
- graphfinder-0.1.0/python/graphfinder/viz.py +266 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "getrandom"
|
|
19
|
+
version = "0.2.17"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"cfg-if",
|
|
24
|
+
"libc",
|
|
25
|
+
"wasi",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[[package]]
|
|
29
|
+
name = "graph-py"
|
|
30
|
+
version = "0.1.0"
|
|
31
|
+
dependencies = [
|
|
32
|
+
"graphfinder-core",
|
|
33
|
+
"pyo3",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "graphfinder-core"
|
|
38
|
+
version = "0.1.0"
|
|
39
|
+
dependencies = [
|
|
40
|
+
"rand",
|
|
41
|
+
"rand_chacha",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[[package]]
|
|
45
|
+
name = "heck"
|
|
46
|
+
version = "0.5.0"
|
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "indoc"
|
|
52
|
+
version = "2.0.7"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
55
|
+
dependencies = [
|
|
56
|
+
"rustversion",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "libc"
|
|
61
|
+
version = "0.2.186"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "memoffset"
|
|
67
|
+
version = "0.9.1"
|
|
68
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
69
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
70
|
+
dependencies = [
|
|
71
|
+
"autocfg",
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
[[package]]
|
|
75
|
+
name = "once_cell"
|
|
76
|
+
version = "1.21.4"
|
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
78
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "portable-atomic"
|
|
82
|
+
version = "1.13.1"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "ppv-lite86"
|
|
88
|
+
version = "0.2.21"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"zerocopy",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[[package]]
|
|
96
|
+
name = "proc-macro2"
|
|
97
|
+
version = "1.0.106"
|
|
98
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
100
|
+
dependencies = [
|
|
101
|
+
"unicode-ident",
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
[[package]]
|
|
105
|
+
name = "pyo3"
|
|
106
|
+
version = "0.22.6"
|
|
107
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
108
|
+
checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
|
|
109
|
+
dependencies = [
|
|
110
|
+
"cfg-if",
|
|
111
|
+
"indoc",
|
|
112
|
+
"libc",
|
|
113
|
+
"memoffset",
|
|
114
|
+
"once_cell",
|
|
115
|
+
"portable-atomic",
|
|
116
|
+
"pyo3-build-config",
|
|
117
|
+
"pyo3-ffi",
|
|
118
|
+
"pyo3-macros",
|
|
119
|
+
"unindent",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[[package]]
|
|
123
|
+
name = "pyo3-build-config"
|
|
124
|
+
version = "0.22.6"
|
|
125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
+
checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
|
|
127
|
+
dependencies = [
|
|
128
|
+
"once_cell",
|
|
129
|
+
"target-lexicon",
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
[[package]]
|
|
133
|
+
name = "pyo3-ffi"
|
|
134
|
+
version = "0.22.6"
|
|
135
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
136
|
+
checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
|
|
137
|
+
dependencies = [
|
|
138
|
+
"libc",
|
|
139
|
+
"pyo3-build-config",
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
[[package]]
|
|
143
|
+
name = "pyo3-macros"
|
|
144
|
+
version = "0.22.6"
|
|
145
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
+
checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
|
|
147
|
+
dependencies = [
|
|
148
|
+
"proc-macro2",
|
|
149
|
+
"pyo3-macros-backend",
|
|
150
|
+
"quote",
|
|
151
|
+
"syn",
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
[[package]]
|
|
155
|
+
name = "pyo3-macros-backend"
|
|
156
|
+
version = "0.22.6"
|
|
157
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
+
checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
|
|
159
|
+
dependencies = [
|
|
160
|
+
"heck",
|
|
161
|
+
"proc-macro2",
|
|
162
|
+
"pyo3-build-config",
|
|
163
|
+
"quote",
|
|
164
|
+
"syn",
|
|
165
|
+
]
|
|
166
|
+
|
|
167
|
+
[[package]]
|
|
168
|
+
name = "quote"
|
|
169
|
+
version = "1.0.46"
|
|
170
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
+
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
|
172
|
+
dependencies = [
|
|
173
|
+
"proc-macro2",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "rand"
|
|
178
|
+
version = "0.8.6"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
|
|
181
|
+
dependencies = [
|
|
182
|
+
"libc",
|
|
183
|
+
"rand_chacha",
|
|
184
|
+
"rand_core",
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
[[package]]
|
|
188
|
+
name = "rand_chacha"
|
|
189
|
+
version = "0.3.1"
|
|
190
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
191
|
+
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
|
192
|
+
dependencies = [
|
|
193
|
+
"ppv-lite86",
|
|
194
|
+
"rand_core",
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
[[package]]
|
|
198
|
+
name = "rand_core"
|
|
199
|
+
version = "0.6.4"
|
|
200
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
202
|
+
dependencies = [
|
|
203
|
+
"getrandom",
|
|
204
|
+
]
|
|
205
|
+
|
|
206
|
+
[[package]]
|
|
207
|
+
name = "rustversion"
|
|
208
|
+
version = "1.0.22"
|
|
209
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
210
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
211
|
+
|
|
212
|
+
[[package]]
|
|
213
|
+
name = "syn"
|
|
214
|
+
version = "2.0.118"
|
|
215
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
216
|
+
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
|
217
|
+
dependencies = [
|
|
218
|
+
"proc-macro2",
|
|
219
|
+
"quote",
|
|
220
|
+
"unicode-ident",
|
|
221
|
+
]
|
|
222
|
+
|
|
223
|
+
[[package]]
|
|
224
|
+
name = "target-lexicon"
|
|
225
|
+
version = "0.12.16"
|
|
226
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
227
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
228
|
+
|
|
229
|
+
[[package]]
|
|
230
|
+
name = "unicode-ident"
|
|
231
|
+
version = "1.0.24"
|
|
232
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
234
|
+
|
|
235
|
+
[[package]]
|
|
236
|
+
name = "unindent"
|
|
237
|
+
version = "0.2.4"
|
|
238
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
239
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
240
|
+
|
|
241
|
+
[[package]]
|
|
242
|
+
name = "wasi"
|
|
243
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
244
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
245
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
246
|
+
|
|
247
|
+
[[package]]
|
|
248
|
+
name = "zerocopy"
|
|
249
|
+
version = "0.8.52"
|
|
250
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
251
|
+
checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
|
|
252
|
+
dependencies = [
|
|
253
|
+
"zerocopy-derive",
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
[[package]]
|
|
257
|
+
name = "zerocopy-derive"
|
|
258
|
+
version = "0.8.52"
|
|
259
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
260
|
+
checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
|
|
261
|
+
dependencies = [
|
|
262
|
+
"proc-macro2",
|
|
263
|
+
"quote",
|
|
264
|
+
"syn",
|
|
265
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
resolver = "2"
|
|
3
|
+
members = ["crates/graphfinder-core", "crates/graph-py"]
|
|
4
|
+
|
|
5
|
+
[workspace.package]
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
edition = "2021"
|
|
8
|
+
license = "MIT"
|
|
9
|
+
authors = ["Jose L. Salmeron"]
|
|
10
|
+
repository = "https://github.com/graphfinder/graphfinder.github.io"
|
|
11
|
+
homepage = "https://graphfinder.github.io"
|
|
12
|
+
|
|
13
|
+
[workspace.dependencies]
|
|
14
|
+
rand = "0.8"
|
|
15
|
+
rand_chacha = "0.3" # RNG with reproducible seed (reproducibility matters)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jose L. Salmeron
|
|
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,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: graphfinder
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Science/Research
|
|
6
|
+
Classifier: Intended Audience :: Education
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Rust
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: mkdocs-material ; extra == 'docs'
|
|
14
|
+
Requires-Dist: mkdocstrings[python] ; extra == 'docs'
|
|
15
|
+
Requires-Dist: pillow ; extra == 'viz'
|
|
16
|
+
Requires-Dist: networkx ; extra == 'viz'
|
|
17
|
+
Provides-Extra: docs
|
|
18
|
+
Provides-Extra: viz
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Summary: Graph traversal & pathfinding (informed and uninformed search) with a Rust core
|
|
21
|
+
Keywords: graph,search,pathfinding,astar,bfs,dijkstra
|
|
22
|
+
Author: Jose L. Salmeron
|
|
23
|
+
License: MIT
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
26
|
+
Project-URL: Homepage, https://graphfinder.github.io
|
|
27
|
+
Project-URL: Issues, https://github.com/graphfinder/graphfinder.github.io/issues
|
|
28
|
+
Project-URL: Repository, https://github.com/graphfinder/graphfinder.github.io
|
|
29
|
+
|
|
30
|
+
# graphfinder (Python)
|
|
31
|
+
|
|
32
|
+
Graph traversal & pathfinding (informed and uninformed search) with a Rust core.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import graphfinder as gf
|
|
36
|
+
|
|
37
|
+
# A* on a maze
|
|
38
|
+
r = gf.search(gf.sample_maze("wall"), algorithm="astar", heuristic="manhattan")
|
|
39
|
+
print(r) # SearchResult(found=True, cost=20, expanded=25, ...)
|
|
40
|
+
print(r.cost, r.nodes_expanded, len(r.trace))
|
|
41
|
+
|
|
42
|
+
# Explicit weighted graph from a generator
|
|
43
|
+
edges = gf.gen_barabasi_albert(200, 3, seed=1)
|
|
44
|
+
r = gf.search_graph(200, edges, start=0, goal=199, algorithm="bidirectional")
|
|
45
|
+
|
|
46
|
+
# Implicit graph (lazy successors; states are ints or tuples of ints)
|
|
47
|
+
def successors(s):
|
|
48
|
+
return [(s + 1, 1.0), (s * 2, 1.0)] if s < 1000 else []
|
|
49
|
+
r = gf.search(successors, start=1, goal=27, algorithm="bfs")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Build from source (Rust core via maturin):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install maturin
|
|
56
|
+
maturin develop --release
|
|
57
|
+
python examples/quickstart.py
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See the top-level README and `ROADMAP.md` for the full feature list. A
|
|
61
|
+
visualization layer (`graphfinder.viz`) is planned for Phase 4.
|
|
62
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "graph-py"
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
license.workspace = true
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "graphfinder_native"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
graphfinder-core = { path = "../graphfinder-core" }
|
|
13
|
+
# abi3-py39: build a single wheel compatible with CPython >= 3.9.
|
|
14
|
+
pyo3 = { version = "0.22", features = ["extension-module", "abi3-py39"] }
|