GraphPartitioningConfig¶
- class GraphPartitioningConfig(max_n_nodes_per_cluster=None, minimum_n_clusters=None, partitioning_algorithm='spectral')[source]¶
Bases:
objectConfiguration for graph partitioning algorithms.
This class defines the parameters and constraints for partitioning large graphs into smaller subgraphs for quantum algorithm execution. It supports multiple partitioning algorithms and allows specification of size constraints.
- Variables:
max_n_nodes_per_cluster – Maximum number of nodes allowed in each cluster. If None, no upper limit is enforced. Must be a positive integer.
minimum_n_clusters – Minimum number of clusters to create. If None, no lower limit is enforced. Must be a positive integer.
partitioning_algorithm – Algorithm to use for partitioning. Options are: - “spectral”: Spectral partitioning using Fiedler vector (default) - “metis”: METIS graph partitioning library - “kernighan_lin”: Kernighan-Lin algorithm
Note
At least one of max_n_nodes_per_cluster or minimum_n_clusters must be specified. Both constraints cannot be None.
Examples
>>> # Partition into clusters of at most 10 nodes >>> config = GraphPartitioningConfig(max_n_nodes_per_cluster=10)
>>> # Create at least 5 clusters using METIS >>> config = GraphPartitioningConfig( ... minimum_n_clusters=5, ... partitioning_algorithm="metis" ... )
>>> # Both constraints: clusters of max 8 nodes, min 3 clusters >>> config = GraphPartitioningConfig( ... max_n_nodes_per_cluster=8, ... minimum_n_clusters=3 ... )
Attributes Summary
Attributes Documentation