Available on crate feature
algorithms only.Expand description
Connected components of a hypergraph (xgi/algorithms/connected.py).
Components are extracted by a deterministic node-neighbour BFS (III.7:
ordered by node_ids()), while number_connected_components delegates the
count to rustworkx_core::connectivity on the 1-skeleton — a genuine
rustworkx-core plugin reuse. A test asserts the two agree.
Functions§
- connected_
components - All connected components, each a node list in
node_ids()order, the components themselves ordered by their first-seen node. XGI parity:xgi.connected_components(H)(connected.py:48-82). - is_
connected - Whether the hypergraph is connected (one component; empty ⇒ trivially so is
undefined — matches XGI, which indexes
list(H.nodes)[0], so guard empty). XGI parity:xgi.is_connected(H)(connected.py:16-45). - largest_
connected_ component - The largest connected component (ties broken by first-seen order).
XGI parity:
largest_connected_component(connected.py:124-151). - node_
connected_ component - The connected component containing node
n, innode_ids()order, orNoneif the node is absent. XGI parity:node_connected_component(connected.py:154-188) — XGI raises; we returnNone. - number_
connected_ components - Number of connected components, delegated to rustworkx-core on the skeleton.
XGI parity:
xgi.number_connected_components(H)(connected.py:85-121).