neighbayes.graph.network_weights

neighbayes.graph.network_weights(G)[source]

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

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

Parameters:
G

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

Returns:

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

Return type:

scipy.sparse.csr_matrix