python-graphblas / graphblas-algorithms

Graph algorithms written in GraphBLAS
Apache License 2.0
73 stars 4 forks source link

Redo/refactor calculations and caching of properties such as degrees #86

Open eriknw opened 9 months ago

eriknw commented 9 months ago

We compute and cache many properties such as has_self_edges, degrees- (w/o diagonals), degrees+ (with diagonals), etc., which is actually very handy. However, the code is a little complicated (cough cough, my bad) and may be error prone (see: https://github.com/python-graphblas/graphblas-algorithms/issues/82#issuecomment-1840040146). It would be great if we could refactor this to be more clear, maintainable, and safe. I imagine such a solution would be more declarative and less procedural.