Add algorithms - #243
Conversation
| @@ -0,0 +1,16 @@ | |||
| # Install ruff to check your code style : | |||
| @@ -0,0 +1,21 @@ | |||
| from collections import deque | |||
|
|
|||
| INF = int(1e9) | |||
There was a problem hiding this comment.
Why you need distance and infinite in BFS?
| depth += 1 | ||
| count += front_size | ||
| v.assign(front, depth, op_assign=INT.SECOND, op_select=INT.NQZERO) | ||
| front = front.vxm(v, A, op_mult=INT.LAND, op_add=INT.LOR, op_select=INT.EQZERO) |
There was a problem hiding this comment.
How you prevent repeated visiting of vertices?
There was a problem hiding this comment.
I copypasted this code from __init__.py. It says there is a mask to prevent repeating. I think it is op_select=INT.EQZERO
| return graph, n | ||
|
|
||
|
|
||
| def read_mtx_weighted(filename): |
There was a problem hiding this comment.
Is it helper for MTX reading? Can we use standard functions to do it?
| from pyspla import FLOAT, INT, Matrix | ||
|
|
||
|
|
||
| def read_mtx_int(filename): |
There was a problem hiding this comment.
Too many helpers with duplicated code. There are standard functions for mtx reading.
| read_vectors_weighted, | ||
| ) | ||
| from pr_classic import pagerank_classic | ||
| from sssp_classic import INF as SSSP_INF |
| from tc_spla import cohen | ||
|
|
||
|
|
||
| def main(): |
| import math | ||
|
|
||
|
|
||
| def pagerank_classic(adj_in, out_degree, n, alpha, eps): |
There was a problem hiding this comment.
What is the reason to implement it again? can you use existing reference implementation?
| @@ -0,0 +1,14 @@ | |||
| INF = 1e9 | |||
| @@ -0,0 +1,41 @@ | |||
| from pyspla import FLOAT, Matrix, Scalar, Vector | |||
|
|
|||
| INF = float(1e9) | |||
There was a problem hiding this comment.
infinity can be represented in floats.
Implemented graph algorithms and test coverage for result comparison between Classic and SPLA versions.
Added project documentation with usage instructions and input format examples.
Added graph input readers for both vectors (.txt) and Matrix Market (.mtx) formats.