Skip to main content

Module connected

Module connected 

Source
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, in node_ids() order, or None if the node is absent. XGI parity: node_connected_component (connected.py:154-188) — XGI raises; we return None.
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).