SparseExtra

SparseExtra.jl is a a series of helper function useful for dealing with sparse matrix, random walk, and shortest path on sparse graphs and some more. Most of this was developed for an unpublished paper which would help explain some of the design choises.

SparseExtra

SparseExtra.skip_row_to — Function
skip_row_to(::IterateNZ, ::S, i) -> S

Move the cursor to the bottom of the i-1th element. Does nothing by default and only makes sense for matrices.

source
SparseExtra.skip_col — Function
skip_col(::IterateNZ, ::S) -> S

Move the cursor to the bottom of the current column. Does nothing by default and only makes sense for matrices.

source
SparseExtra.IterateNZ — Type

Helper structure for iternz, all methods. iternz just returns this wrapper and the Base.iterate method is overloaded.

source
SparseExtra.path_cost — Function
path_cost(::AbstractSparseMatrixCSC, r, n)

return the total weight of the path r[1:n]

source
path_cost(f::Function, ::AbstractSparseMatrixCSC, r, n)

return the total weight of the path r[1:n], with f applied to each weight before summation

source
SparseExtra.path_cost_nt — Function
path_cost_nt(::AbstractSparseMatrixCSC, r, n)

like path_cost, but for matrices that are transposed

source
path_cost_nt(f::Function, ::AbstractSparseMatrixCSC, r, n)

like path_cost, but for matrices that are transposed

source
SparseExtra.Path2Edge — Type
Path2Edge(x, [e=length(x)])

[Unbenchmarked] faster version of zip(view(x, 1:e), view(x, 2:e)). Only works on 1-index based arrays with unit strides

source
SparseExtra.par_solve! — Function

ldiv! but in parallel. use colsto skip columns andf(col, index)` to apply a thread safe function to that column.

source
SparseExtra.dijkstra — Function
dijkstra(distmx::AbstractSparseMatrixCSC, state::DijkstraState, [target]) -> Nothing

Given a distmx such that distmx[j, i] is the distance of the arc i→j and strucutral zeros mean no arc, run the dijkstra algorithm until termination or reaching target (whichever happens first).

source