Load Balancer¶
- asunder.load_balancing.column_generation.LB.LoadBalancer(G, R=1, K=2, R_bounds=None, algorithm='greedy', package='networkx', ifc_generator='random', seed=42, must_link=[], cannot_link=[], disable_tqdm=False, verbose=-1)¶
Solve the load-balanced structure detection problem using Asunder’s column generation workflow.
- Parameters:
G (nx.Graph) – NetworkX graph representing the relevant problem.
R (int) – Width of the allowed cluster-size range. Also corresponds to the load balance tightness (smaller R implies tighter load balance). For a selected cluster count, the lower and upper bounds are computed from the corresponding balanced range rule.
K (int) – Number of communities.
R_bounds (tuple[int, int] | None) – Minimum and maximum number of nodes per community (community size constraint).
algo (str) –
Name of heuristic subproblem used to replace the ILP subproblem. Third-party algorithms combine adjacency and dual information intro a unified input while custom algorithms treat adjacency and duals as separate inputs. Supported third-party algorithms are listed under the
packageparameter. Available custom algorithm options include:"spectral":Modified iterative bisection algorithm based on Mark Newman’s eigenvector-based method.
"full_louvain":Modified but Louvain-like algorithm.
"RCCS":This means Reduced Cost Community Search and is a greedy and local search heuristic for finding commiunities that maximize the reduced cost.
package (str or None) –
Package from which non-custom heuristic subproblem is selected. Package and algorithm options include:
"networkx":"louvain","greedy","girvan_newman""sknetwork":"louvain","leiden","lpa""igraph":"leiden","greedy","infomap","lpa","multilevel","voronoi","walktrap"leidenalg:"leiden"None:"signed_louvain","spinglass"
ifc_generator (str) –
"random"if the initial feasible column should be randomly generated (default)."ordered"if the initial feasible column should be generated with some structure-based ordering.seed (int, default=None) – Random seed.
must_link (list[tuple[int, int]]) – List of node pairs that must be together.
cannot_link (list[tuple[int, int]]) – List of node pairs that must not be together.
disable_tqdm (bool) – Whether to disable progress bar or not.
verbose (int or bool) – Controls the level of detail in the printed output.
-1: No outputFalse|0: Minimal outputTrue|1: Detailed output
- Returns:
Column generation result. The final co-clustering matrix is available as
final_partitionand load-balancing summaries are inmetadata.- Return type: