bayespecon.graph.network_weights

bayespecon.graph.network_weights(G)[source]

Build the N×N network weight matrix \(W_w = W \otimes W\).

Captures joint origin-destination neighbourhood structure: a non-zero entry at \((i \cdot n + j,\; k \cdot n + l)\) indicates that origin k neighbours i AND destination l neighbours j.

Parameters:
G

Row-standardised libpysal.graph.Graph of shape n×n.

Returns:

\(N \times N\) network weight matrix (\(N = n^2\)).

Return type:

scipy.sparse.csr_matrix