pypsa.SubNetwork.incidence_matrix

pypsa.SubNetwork.incidence_matrix#

SubNetwork.incidence_matrix(branch_components: Collection[str] | None = None, busorder: pd.Index | None = None) sp.sparse.csr_matrix#

Construct a sparse incidence matrix (directed).

Parameters:
  • branch_components (iterable sublist of branch_components) – Buses connected by any of the selected branches are adjacent (default: branch_components (network) or passive_branch_components (sub_network))

  • busorder (pd.Index subset of n.buses.index) – Basis to use for the matrix representation of the adjacency matrix (default: buses.index (network) or buses_i() (sub_network))

Returns:

  • incidence_matrix (sp.sparse.csr_matrix)

  • Directed incidence matrix

Examples

>>> n.incidence_matrix()
<Compressed Sparse Row sparse matrix of dtype 'float64'
        with 22 stored elements and shape (9, 11)>