Repository navigation
Conversation
Closed
vkutuev
force-pushed
the
graph-algorithms
branch
from
November 28, 2026 08:57
38e0140 to
5621300
Compare
2 of 10 tasks
Expose the new spla_Vector_fill_with C API and wrap the existing spla_Vector_set_fill_value in the Python Vector class. Also add Python wrappers for the existing spla_Exec_v_eadd_fdb and spla_Exec_v_count_mf C functions, which the graph algorithms rely on.
Add spla_Descriptor_make, spla_Descriptor_set_struct_only and spla_Descriptor_set_early_exit to the C API (src/binding/c_descriptor.cpp) and expose them in Python: Descriptor() now creates a real descriptor instead of a null handle, plus set_struct_only()/set_early_exit().
MtxLoader now parses edge weights from Matrix Market files and detects the "symmetric" attribute from the header. The default of make_undirected is flipped to false: symmetrization now happens automatically only for files declared symmetric in the header. The sssp example reads edge weights and the tc example uses the upper triangle.
The sp and dn paths of v_count_mf accessed the device vector without calling validate_rw first, crashing when the vector was not already in the required format. Add the missing validate_rw calls (AccCoo/AccDense) to match the other kernels.
Add BFS, PageRank, SSSP and transitive closure as both classic (pure-Python) and SPLA-backed implementations under python/algorithms/, together with a comparison harness (test_compare.py), a sample graph (graph.txt), a README with usage instructions, and CPU/GPU result plots.
vkutuev
force-pushed
the
graph-algorithms
branch
from
November 28, 2026 15:14
5621300 to
eca8a9e
Compare
- tc_spla: default to the Sandia algorithm (L*L masked by L) — exact for any edge orientation and immune to edge weights; keep the mxmT-based variant (mirrors C++ spla::tc, requires upper-triangle unit-weight input) as tc_spla_mxmT - test_compare: TC tests read with unit weights and cross-check against NetworkX (skipped when not installed); dataset paths point to python/algorithms/data/ (local fixtures, not committed) - main_spla: fix IndentationError in the sssp vectors branch - ruff: fix import sorting and unused imports, apply ruff format
Replace the legacy setup.py/MANIFEST.in with a PEP 621 pyproject.toml (setuptools backend) and manage the dev environment with uv: - version/readme now come from VERSION.md/README.md via [tool.setuptools.dynamic] - dev tools (pytest, scipy, networkx, ruff) declared as a PEP 735 dependency group, locked in uv.lock - gitignore .venv/ and staged native libraries (build artifacts that get packaged into wheels) - document the uv-based dev workflow in python/README.md
Add a [tool.ruff] configuration (E/F/I/W rules, line-length 120) and bring the whole python/ tree to a clean baseline: - fix import sorting (I001) and unused imports (F401) - apply ruff format across the tree - E741 ignored: I/J/V is standard COO notation for sparse matrices - per-file ignores for the star-import re-export pattern in pyspla/__init__.py, the documented star import in example.py, and sys.path setup in test files
The subtraction operator was implemented with addition, so a - b returned a + b.
Replace the ad-hoc algorithms/test_compare.py with a proper test suite under python/tests/: - test_pyspla.py exercises the installed package: scalar/vector/matrix containers, element-wise and sparse operations, format conversion, descriptors and wrapper-level error handling. - test_algorithms.py checks the SPLA graph algorithms (BFS, SSSP, PageRank, triangle counting) against classic pure-Python references on small committed Matrix Market fixtures, with a NetworkX cross-check for triangle counting. Wire pytest into pyproject.toml and point the algorithms README at the new suite.
bridge.initialize() relied on the import system attaching the pyspla.bridge submodule to the package namespace as a side effect of the star import. After a failed first import (e.g. missing native library), the submodule stays in sys.modules but is not re-attached to the fresh package object, so a retry raised a misleading NameError instead of the real 'no compiled spla file' error.
Two jobs on pushes/PRs touching the Python side (and the C++ sources it builds against): - lint: ruff check + ruff format --check via uv - test: build libspla (CPU config), stage the shared library into the package and run the pytest suite
Document every algorithm module and function: the classic reference implementations, the spla frontier-based versions (bfs, sssp), PageRank, triangle counting (Sandia and masked mxmT variants), the graph loaders, and the CLI driver. The tc_spla.py docstrings previously shipped inside the triangle-counting fix commit are moved here so all documentation lives in a single commit.
vkutuev
force-pushed
the
graph-algorithms
branch
from
November 28, 2026 17:08
eca8a9e to
a959a50
Compare
- drop the stale venv/pip installation section (the project uses uv; ../README.md documents the current workflow) - correct the 'on GPU' claim: spla is OpenCL-based (GPU, PoCL CPU, or pure-CPU builds) - extend the undirected-graph warning from SSSP to BFS and explain why: the pull step (mxv) walks each edge i -> j backwards, so it is only correct for symmetric graphs; push-only mode is directed-safe - point the examples at files that actually ship (graph.txt, ../tests/data/undirected.mtx) instead of a nonexistent graph.mtx - document the index-base difference (vectors 0-based, Matrix Market 1-based) and the square-graph assumption - replace the doctored --help dump with the real one
gsvgit
reviewed
Nov 29, 2026
| @@ -0,0 +1,113 @@ | |||
| """Graph loaders for the spla algorithm examples. | |||
Member
There was a problem hiding this comment.
I hope, Spla (C++ core) has own loaders. May they be shared?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Python graph algorithms with classic/SPLA comparison
Supersedes #243 (rebased onto
main, cleaned up, and extended with themaintainer fixes and Python infrastructure below).
The C++ bug fixes found along the way (LIL
valuescounter,set_fill_valuedata loss) were extracted to #285 and are already inmain.Graph algorithms (from #243)
python/algorithms/: BFS, SSSP, PageRank and triangle counting on SPLAmatrices, compared against classic pure-Python implementations on
Matrix Market fixtures (push/pull variants where applicable).
MtxLoader: edge-weight support for Matrix Market input.pysplabindings:Descriptorcreation/setters,Vector.fill_with,Vector.set_fill_value.cl_v_count_mf.Maintainer fixes
failed its own test);
main_splafixed; lint cleanup.fix(python):Scalar.__sub__performed addition.Python infrastructure
pyproject.toml(setuptools, dynamic version fromVERSION.md), dev tools as a PEP 735 group inuv.lock;setup.py/MANIFEST.inremoved.python/tree brought to a clean baseline.python/tests/—pysplaAPI coverage(containers, sparse ops, format conversion, descriptors, error paths) and
algorithm tests against classic references on small committed fixtures,
with a NetworkX cross-check for triangle counting. Replaces the ad-hoc
algorithms/test_compare.py..github/workflows/python.yml— lint job (ruff check + format)and test job (CPU build of
libspla, staged into the package, full pytestrun).
Verification
.so; ruff clean.