Skip to main content

connected_components

Function connected_components 

Source
pub fn connected_components(ybus: &YBusSparse) -> Vec<Vec<usize>>
Expand description

Groups buses into connected components via the Y-bus’s actual admittance graph — two buses are in the same component iff there’s a path of nonzero off-diagonal Y-bus entries between them (row(i)’s own diagonal self-entry, j == i, is skipped, since it’s a shunt term, not a branch to another bus). Each returned Vec<usize> is one component’s member bus indices, sorted ascending; components are returned in ascending order of their first (lowest-index) member.

Generic over the finished Y-bus rather than any particular input format’s own Line/Transformer/branch-status representation, so it applies uniformly to native JSON, PGM-JSON, and CGMES input with no format-specific code — see classify/mark_unreferenced_islands for what this partition is used for.