Q-Distance Matrix Compression
Documentation for QDistanceMatrixCompression.
\[\begin{aligned} L_{n-1} &= C C^\top \\ L_{n-1}^{-1} &= C^{-\top} C^{-1} \\ L_{n-1}^{-1} b_q &= C^{-\top} C^{-1} b_q \\ \end{aligned}\]
This is why we do C \ b_q
.
QDistanceMatrixCompression.GraphicalDistanceMatrix
QDistanceMatrixCompression._subidentity_csc
QDistanceMatrixCompression.graph
QDistanceMatrixCompression.resistance_distance
QDistanceMatrixCompression.spsolve
QDistanceMatrixCompression.GraphicalDistanceMatrix
— TypeGraphicalDistanceMatrix{T<:Real}
A structure representing a graphical distance matrix computed from a graph. This specialized matrix type allows efficient storage and computation of resistance distances, similar to how ToeplitzMatrices.jl defines specialized matrices.
Fields
graph::SimpleGraph
: The underlying graphmatrix::Matrix{T}
: The precomputed resistance distance matrix (can be lazily evaluated)algorithm::Symbol
: The algorithm used to compute resistance distances (:naive, :vectorized, :backsolve, :sparse, :compact)computed::Bool
: Whether the matrix has been computed
Examples
using GraphicalDistance, Graphs
g = barabasi_albert(100, 5)
R = GraphicalDistanceMatrix(g)
# Access as a standard matrix
R[1, 2]
# Or compute on demand using a specific algorithm
R = GraphicalDistanceMatrix(g, :compact)
QDistanceMatrixCompression._subidentity_csc
— Method_subidentity_csc(n, cols)
Build the nxm sparse matrix whose columns are e{cols[1]},…,e{cols[m]} by directly constructing the internal CSC arrays.
QDistanceMatrixCompression.graph
— Methodgraph(R::GraphicalDistanceMatrix)
Get the underlying graph.
QDistanceMatrixCompression.resistance_distance
— Methodresistance_distance(R::GraphicalDistanceMatrix, i::Integer, j::Integer)
Get the resistance distance between vertices i and j.
QDistanceMatrixCompression.spsolve
— Functionspsolve(A::SparseMatrixCSC, B::SparseMatrixCSC) -> SparseMatrixCSC
Solve the system AX = B where A is a lower triangular sparse matrix (SparseMatrixCSC) and B is a sparse matrix (SparseMatrixCSC) representing the right-hand side.
Arguments
A::SparseMatrixCSC
: A lower triangular sparse matrix.B::SparseMatrixCSC
: A sparse matrix representing the right-hand side.
Returns
X::SparseMatrixCSC
: The solution matrix in sparse format.
Notes
- Assumes that
A
is lower triangular and non-singular.