pwrs.core.connected_components#
- pwrs.core.connected_components.connected_components_full(C, groups=None, unvisited=None)[source]#
Return
(groups, isolated)with explicit Python semantics.- Parameters:
C (object)
groups (list[ndarray] | None)
unvisited (ArrayLike | None)
- Return type:
tuple[list[ndarray], ndarray]
- pwrs.core.connected_components.connected_components(C, groups=None, unvisited=None, nargout=None)[source]#
Find connected components of a node-branch incidence matrix.
Mirrors MATPOWER’s
connected_componentshelper. It performs a graph traversal on the incidence matrixCto identify connected groups of buses and, when requested, isolated nodes.- Parameters:
C (sparse matrix or array_like) – Node-branch incidence matrix.
groups (list, optional) – Existing group accumulator used by the recursive implementation.
unvisited (array_like, optional) – Remaining one-based node indices to explore.
nargout (int, optional) – MATLAB compatibility flag controlling whether isolated nodes are also returned.
- Returns:
Connected groups, and optionally the isolated node indices.
- Return type:
list or tuple