Skip to content

Commit aa3fcd3

Browse files
committed
fix: fix infinite loops
1 parent 5b8b534 commit aa3fcd3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ The DOI above is a placeholder. After your first release, run `python tools/upda
6767
## Quick start (Python)
6868

6969
```python
70-
>>> from ssspx.io import read_graph
71-
>>> from ssspx import SSSPSolver, SolverConfig
72-
>>> G = read_graph("docs/examples/small.csv")
70+
>>> from ssspx import Graph, SSSPSolver, SolverConfig
71+
>>> G = Graph.from_edges(4, [(0, 1, 1.0), (1, 2, 2.0), (0, 2, 4.0), (2, 3, 1.0)])
7372
>>> solver = SSSPSolver(G, 0, config=SolverConfig())
7473
>>> solver.solve().distances
7574
[0.0, 1.0, 3.0, 4.0]

tests/test_transform.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@ def test_outdegree_bound() -> None:
1111

1212
# Every vertex in G2 must have outdegree <= 2
1313
assert all(len(G2.adj[u]) <= 2 for u in range(G2.n))
14-
# Vertex 0 has ceil(5/2) = 3 clones
15-
assert 0 in mapping and len(mapping[0]) == 3
14+
# Vertex 0 has 5 edges, with delta=2 it needs 4 clones:
15+
# Clone 1: 1 edge + link to clone 2 = 2 edges total
16+
# Clone 2: 1 edge + link to clone 3 = 2 edges total
17+
# Clone 3: 1 edge + link to clone 4 = 2 edges total
18+
# Clone 4: 2 edges (final) = 2 edges total
19+
assert 0 in mapping and len(mapping[0]) == 4

0 commit comments

Comments
 (0)