DemandVector.sparse

DemandVector.sparse(dtype=None) scipy.sparse.csc.csc_matrix[source]

Get demand as sparse matrix.

Total in/outflow per node (row) per commodity (column), e.g.:

Data:

(0, 2, 100)            [single commodity]
{1: 33, 2: 33, 3: -66} [multi commodity]

Resulting matrix:

[[-100,    0],
 [   0,   33],
 [ 100,   33],
 [   0,  -66]]
Parameters
dtype: dtype, optional

Datatype of returned sparse matrix.

Returns
scipy.sparse.csc_matrix

Demand as sparse matrix.