pygsti.circuits.subcircuit_selection.random_connected_subgraph#
- random_connected_subgraph(G, width, rand_state=None)#
Generates a random set of nodes that form a connected subgraph of a specified width from a given graph.
- Parameters:
G (networkx.Graph) – The graph from which to generate the connected subgraph.
width (int) – The target width of the subgraph to be generated.
rand_state (Optional[_np.random.RandomState]) – A random state for reproducibility. Default is None.
- Returns:
A set of nodes representing the generated connected subgraph.
- Return type:
set[int or str]