Network.L

Network.L(weight=None, flow=None, reduced: bool = False, return_as: str = 'csr', **kwargs) scipy.sparse.base.spmatrix[source]

Get weighted Laplacian.

Parameters
weightnp.ndarray, optional

If None, weigths are determined based on flow. The Laplace weight of an edge e for a flow x_e is defined as 1 / c''(x_e), where c’’ is the second derivative of the edge costs.

flownp.ndarray, optional

Use flow to determine weights if weights is None.

reducedbool, default=False

Whether to return the reduced form, i.e., without first row and first column.

return_asstr, default=’csr’

Return format for sparse matrix.

Returns
spmatrix

Laplacian matrix of shape (n, n) if reduced is False, else of shape (n-1, n-1). Type of return matrix is determined by parameter return_as.

See also

Network.laplacian
paminco.net.cost.NetworkCost.laplace_weights
paminco.net.cost.PiecewiseQuadraticCost.laplace_weights