Skip to content

Commit e9024a4

Browse files
authored
Add rustworkx alpha (#2327)
* Add rustworkx alpha * Add C compiler
1 parent b5c528e commit e9024a4

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
4+
export MATURIN_PYTHON_SYSCONFIGDATA_DIR=${PREFIX}/etc/conda/_sysconfigdata__emscripten_wasm32-emscripten.py
5+
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
6+
${PYTHON} -m pip install . -vvv
7+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
context:
2+
name: rustworkx
3+
version: 0.17.0a3
4+
5+
package:
6+
name: ${{name}}
7+
version: ${{ version }}
8+
9+
source:
10+
- url: https://github.com/IvanIsCoding/rustworkx/releases/download/v0.17.0a3/rustworkx-0.17.0a3.tar.gz
11+
sha256: 8bd0c295134e2b0c03808d4e69428b41153849db6488839084a78793c337f191
12+
13+
build:
14+
number: 0
15+
16+
requirements:
17+
build:
18+
- cross-python_${{target_platform}}
19+
- ${{ compiler("c") }}
20+
- cffi
21+
- setuptools-rust
22+
- rust
23+
- rust-src
24+
- maturin
25+
26+
host:
27+
- python
28+
- openssl
29+
- cffi
30+
run:
31+
- cffi
32+
33+
tests:
34+
- script: pytester
35+
requirements:
36+
build:
37+
- pytester
38+
run:
39+
- pytester-run
40+
files:
41+
recipe:
42+
- test_rustworkx.py
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import rustworkx
2+
3+
def test_isomorphism():
4+
# Adapted from tests/graph/test_isomorphic.py to work with pytest
5+
n = 15
6+
upper_bound_k = (n - 1) // 2
7+
for k in range(1, upper_bound_k + 1):
8+
for t in range(k, upper_bound_k + 1):
9+
result = rustworkx.is_isomorphic(
10+
rustworkx.generators.generalized_petersen_graph(n, k),
11+
rustworkx.generators.generalized_petersen_graph(n, t),
12+
)
13+
expected = (k == t) or (k == n - t) or (k * t % n == 1) or (k * t % n == n - 1)
14+
assert result == expected
15+
16+
def test_rayon_works():
17+
# This essentially tests that multi-threading is set to one core and does not panic
18+
graph = rustworkx.generators.cycle_graph(10)
19+
path_lenghts_floyd = rustworkx.floyd_warshall(graph)
20+
path_lenghts_no_self = rustworkx.all_pairs_dijkstra_path_lengths(graph, lambda _: 1.0)
21+
path_lenghts_dijkstra = {k: {**v, k: 0.0} for k, v in path_lenghts_no_self.items()}
22+
assert path_lenghts_floyd == path_lenghts_dijkstra

0 commit comments

Comments
 (0)