Result#

class Result(state: TState, samples: List[Tuple[TNum, ...]] | None = None)#

Class for collecting results.

Parameters:
  • state (State) – The resulting simulated state.

  • samples (list[tuple[int or float]]) – The generated samples.

to_subgraph_nodes() List[List[int]]#

Convert samples to subgraph modes.

Assuming that a graph’s adjacency matrix is embedded into the circuit, the samples from particle number measurement naturally favor dense subgraphs. The samples could be converted to subgraph modes using this method.

The resulting subgraph node indices correspond to the indices in the adjacency matrix.

Only meaningful for discrete samples generated by ParticleNumberMeasurement.

References

Returns:

The list of subgraph node indices.

Return type:

list[list[int]]