GitHub / python-graphblas / python-graphblas
Python library for GraphBLAS: high-performance sparse linear algebra for scalable graph analytics
JSON API: http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-graphblas%2Fpython-graphblas
PURL: pkg:github/python-graphblas/python-graphblas
Stars: 139
Forks: 15
Open issues: 68
License: apache-2.0
Language: Jupyter Notebook
Size: 3.74 MB
Dependencies parsed at: Pending
Created at: about 6 years ago
Updated at: 19 days ago
Pushed at: 22 days ago
Last synced at: 3 days ago
Commit Stats
Commits: 768
Authors: 11
Mean commits per author: 69.82
Development Distribution Score: 0.163
More commit stats: https://commits.ecosyste.ms/hosts/GitHub/repositories/python-graphblas/python-graphblas
Topics: complex-networks, graph-algorithms, graph-analysis, graph-datastructures, graph-theory, graphblas, linear-algebra, numba, pydata, python, python-wrapper, sparse, sparse-data, sparse-matrix, suitesparse
2022.5.0
2022.5.0
Deprecations
require_monoid=keyword inewise_addhas been deprecated (#236)- New behavior is like
require_monoid=Falseand will no longer raise
- New behavior is like
Improvements
- Add
IndexUnaryOpandgb.indexunarynamespace (#229)- Apply works with both
IndexUnaryOpandSelectOp
- Apply works with both
- Add UDF support for
IndexUnaryOpandSelectOp(#233) - Add
x.getmethod to Scalar, Vector, and Matrix objects, with optional default value (#241)- These return a Python scalar of the element at the location, or default value if element is missing
- Make aggregators callable (#242)
agg.sum(A)same asA.reduce_scalar(agg.sum)agg.max(A, rowwise=True)same asA.reduce_rowwise(agg.max)
- Add
mask.new(), which can also merge two masks efficiently (#240)- The result is True wherever the mask(s) would have been applied, and empty otherwise
complement=Truereturns the complement
- Allow
A << 1to create dense (iso-valued) matrices (this used to raise) (#243) - Add “index” and “value” strings to Vector repr (#226)
- Add
cbrtfrom SuiteSparse:GraphBLAS 7.1.0 to compute principal cube root (#244)- For example,
cbrt(-8) == -2, and the result is a float - Also, add numpy ufuncs
cbrt,float_power, andpositiveto thenumpynamespaces (#237)
- For example,
op.from_stringnow includes aggregators (last priority) (#235)- e.g.,
op.from_string("count")now works
- e.g.,
- Allow record dtypes to be created via dicts, such as
{'x': int, 'y': float}(#227) - Allow scalars with record dtypes to be created from dicts (#228)
- e.g.,
Scalar.from_value({'x': 1, 'y': True}, dtype=udt)
- e.g.,
- Added
scripts/folder in repo to help developers/contributors perform useful tasks (#231)
Download
2022.4.2
2022.4.2
- Improvements to operators and user-defined functions (UDFs):
- Allow Python functions to be passed as BinaryOp or UnaryOp, which will be automatically jitted
- Add
register_newandregister_anonymousfunctions to e.g.gb.binaryandgb.semiringnamespaces - Add
binary.binomto compute binomial coefficients exactly
- Improvements to dtypes and user-defined types (UDTs):
- Auto-register UDTs, which means non-builtin NumPy dtypes may be passed as the dtype
- Improved default names of UDTs
- Improved dtype inference for
first,second, andpairbinary operators- For example,
firstuses the dtype of the first argument, andpairdefaults to INT64
- For example,
- Add
.reposition(...)to Matrix and Value objects, which “shift” or reposition elements - Broadcasting Vector to Matrix (such as
plus(A & v)) has better repr and is more efficient with masks - Add
sort=Truekeyword to.to_vector(...)method on vectors and matrices - Deprecate
mask.maskand rename tomask.parent - Added git pre-commit hooks to make it easier for contributors
Download
2022.4.1
2022.4.1
Renamed project to Python-graphblas and package to graphblas (#204)
$ conda install python-graphblas$ pip install python-graphblas>>> import graphblas as gb
Deprecations (#205)
- Deprecate how we create empty objects:
Scalar.new(dtype)->Scalar(dtype)Vector.new(dtype)->Vector(dtype)Matrix.new(dtype)->Matrix(dtype)- Also, dtype argument is now optional (default
FP64)
Features
- Support select! (#207)
gb.select.tril(A)A.select("diag", 1)gb.select.row(A < 3)- More to come; this is part 1 of the plan
- Support user-defined types! (#177)
gb.dtypes.register_new(name, dtype)(andregister_anonymous)- Any NumPy dtype that Numba can handle in no-python mode is valid
- For example, record dtypes and subarray dtypes
- Many operations such as
eq,first,positioni, andagg.countthat you expect to work, do.
- Auto-broadcast vectors with diag and outer product (#203)
plus(A & v)->any_plus(A @ v.diag())- and infix, such as
A + vandv - A(using normal infix rules)
- Support ewise-union in infix (#203)
plus(x | y, left_default=1, right_default=2)
- Add
x.ss.iter{keys,values,items}(#201)- This exposes fast SuiteSparse:GraphBLAS iteration
- The object should not be mutated during iteration
Bug fixes
- Fixed segfault from using complex scalars and complex monoids (#164, #210)
- Misc
Download
2022.4.0
2022.4.0
Deprecation cycle! (#190)
- Removed:
matrix.reduce_rows(usematrix.reduce_rowwiseinstead)matrix.reduce_columns(usematrix.reduce_columnwiseinstead)matrix.ss.scan_rows(usematrix.ss.scan_rowwiseinstead)matrix.ss.scan_columns(usematrix.ss.scan_columnwiseinstead)grblas.backendsremoved
- Deprecate:
vector.ss.diag(A)(renamed tovector.ss.build_diag(A); useA.diaginstead)matrix.ss.diag(v)(renamed tomatrix.ss.build_diag(v); usev.diaginstead)
Other changes
- Autocompute scalar expressions in
x.update(expr)if valid (#192) - Improve tab-completion of operator namespaces (#191)
- Add missing semirings that were the commutation of existing semirings (#191)
- This added semirings with
rpow,rtruediv,rfloordiv, andabssecondbinary operators.
- This added semirings with
- Update
v += exprto dov(plus) << exprinstead ofv << plus(v | expr)whenexpris not scalar-like (#193) - Add
x.ss.iso_valueto Vector and Matrix objects (#194) - Improved
gb.io.from_networkx(#195)- Expose arguments to
networkx.to_scipy_sparse_array - Use
Matrix.ss.import_csrfor faster importing of data when using “suitesparse” backend - Determine whether the matrix is iso-valued when using “suitesparse” backend
- Expose arguments to
Download
2022.3.0
2022.3.0
Lot’s of changes this release!
- Switch versioning to use Calendar versioning (calver)
- Support (and test on) Python 3.10
- Update to SuiteSparse:GraphBLAS 6.2.X
- Breaking change: reductions to scalar on empty collections now result in empty scalars by default (#162)
- This affects
my_vector.reduceandmy_matrix.reduce_scalar - To get old behavior where the monoid identity is returned, do e.g.
v.reduce(allow_empty=False).
- This affects
- Add support for
GrB_Scalarobjects (#163)- A
Scalarobject ingrblasmay be a C scalar orGrB_Scalar(the default). - Use
is_cscalar=Trueupon creating the Scalar to get a C scalar - Scalars may now be passed to
gb.ss.concatas length-1 vectors or shape (1, 1) matrices - Scalars now have
c.is_cscalarandc.is_grbscalarattributes
- A
- Add
ewise_unionmethod (#159)- This is like
ewise_addwith a Binary Operator and user-provided defaults for the left and right values. - Subtraction infix
x - yon Matrices or Vectors now useewise_unionwith default values of 0.
- This is like
- Add
.ss.compactifyto Vector and Matrix objects (144)- For example, this can shift all (or N) values contiguously to the left.
- Supported operations:
first,last,smallest,largest,random.
- Add
.is_positionalattribute to operators (#161)- For example,
unary.positioni,binary.firsti, andsemiring.any_secondjare “positional”
- For example,
- Autocompute
A[idx]as extract (#166)- Also, add better reprs for indexed expressions
- Support deleting many items using slice or indexing notation (#163)
- For example,
del A[[1, 2], :3]
- For example,
- Support negative indices (#143)
- Allow resolved indices to be converted back to Python indices (#142)
- Add
__sizeof__method to Matrix, Vector, and Scalar objects to get memory usage ($145) - Added a code of conduct (#167)
Download
1.3.15
1.3.15
- Update to SuiteSparse:GraphBLAS 6.1.3
- Add format such as
"csr"to object reprs - Much faster import time!
- All
grblasobjects may now be pickled/serialized grblas.ss.concatcan now concatenate Vectors:gb.ss.concat([v, v]) # Vector, size=2*Ngb.ss.concat([[v], [v]]) # Matrix, nrows=2*N, ncols=1gb.ss.concat([[v, v]]) # Matrix, nrows=N, ncols=2
- Add
Vector.ss.splitto split a Vector into sub-Vectors - Add
.ndimattribute to Scalar, Vector, and Matrix objects and expressions
Download
1.3.14
1.3.14
- Support infix between non-scalar (i.e., Matrix and Vector) objects! Here are the rules:
- monoids with identity 0 use
ewise_add:+,^, and|. A - Bwill useGxB_eWiseUnionwith0as the defaults (not yet supported!)- others use
ewise_mult
- monoids with identity 0 use
- Use numpy rules for unifying types, including when scalars are used.
- For example,
A + cwithA.dtype == 'INT8'andc.dtype == 'INT64'will result inINT8dtype by default. - See: https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html
- For example,
- Allow
ss.concatto use expressions, such asss.concat([[A, A.T, A + 1]]) - Fix: removed
op.div, addedop.truediv, and made sureopnamespace matches other operator namespaces
Download
1.3.13
1.3.13
Deprecations:
- Changed e.g.
reduce_rowstoreduce_rowwiseand deprecate the former
Updates:
- Added
x.ss.selectk(how, k)methods for vectors and matriceshowcan be"random","first","last". Vector also supports"largest"and"smallest"
- Allow operators to be given as strings, such as
A.mxm(B, 'min.+[float]')- Also added from_string functions such as
gb.binary.from_string('+')
- Also added from_string functions such as
x | y,x & y,x ^ y, and~xinfix is only value-y for bool dtypesx | yandx ^ yuses ewise_add,x & yuses ewise_mult
- Add
op.commutes_toandop.is_commutativeto binaryops, monoids, and semirings - Support slices from SuiteSparse (can now perform huge slices on huge objects!)
- Recorder now logs exceptional C calls and their errors
- Improved
get_semiring(monoid, binaryop)to better handle ops from numpy namespaces. - Make
dtype=an optional positional argument (like NumPy does), not keyword-only - Map numpy ops in e.g. gb.binary.numpy to GraphBLAS ops (by default)
Fixes:
- Fixed
truedivon complex dtypes - Fixed displaying of
nanin reprs - Fixed repr of large iso-valued objects
- Fixed types of
land,lor, andlxorbinary operators (not bool only)
Download