kosmos.partitioning.algorithms.spectral_partitioner

Classes

class SpectralPartitioner(network: kosmos.topology.net.Network | None, num_partitions: int | None)

Bases: kosmos.partitioning.algorithms.partitioning_algorithm.PartitioningAlgorithm

Graph partitioning using the Laplacian spectral method.

Initialize the partitioning algorithm.

Parameters:
  • network (Network | None) – The network topology. Required if num_partitions is None.

  • num_partitions (int | None) – Number of partitions to create. If None, the number of quantum nodes in the network is used.


Methods

partition(circuit: kosmos.partitioning.graph.Graph | qiskit.QuantumCircuit) dict[int, int]

Compute a partitioning for the given circuit.

Parameters:

circuit (Graph | QuantumCircuit) – Circuit to partition.

Returns:

A mapping from each node index to the partition identifier it is

assigned to.

Return type:

dict[int, int]