pypsa.SubNetwork.adjacency_matrix

pypsa.SubNetwork.adjacency_matrix#

SubNetwork.adjacency_matrix(branch_components: Collection[str] | None = None, investment_period: int | str | None = None, busorder: pd.Index | None = None, weights: pd.Series | None = None) sp.sparse.coo_matrix#

Construct a sparse adjacency 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))

  • weights (pd.Series or None (default)) – If given must provide a weight for each branch, multi-indexed on branch_component name and branch name.

Returns:

adjacency_matrix – Directed adjacency matrix

Return type:

sp.sparse.coo_matrix