Kernighan–Lin algorithm
The Kernighan–Lin algorithm is a heuristic algorithm for finding partitions of graphs.[src] The algorithm has important practical application in the layout of digital circuits and components in electronic design automation of VLSI.[src]
The Kernighan–Lin algorithm is a heuristic algorithm for finding partitions of graphs.[src] The algorithm has important practical application in the layout of digital circuits and components in electronic design automation of VLSI.[src] ==Description== The input to the algorithm is an undirected graph with vertex set , edge set , and (optionally) numerical weights on the edges in .[src] The goal of the algorithm is to partition into two disjoint subsets and of equal (or nearly equal) size, in a way that minimizes the sum of the weights of the subset of edges that cross from to .[src] If the graph is unweighted, then instead the goal is to minimize the number of crossing edges; this is equivalent to assigning weight one to each edge.[src] The algorithm maintains and improves a partition, in each pass using a greedy algorithm to pair up vertices of with vertices of , so that moving the paired vertices from one side of the partition to the other will improve the partition.[src] After matching the vertices, it then performs a subset of the pairs chosen to have the best overall effect on the solution quality .[src] Given a graph with vertices, each pass of the algorithm runs in time .[src] In more detail, for each a \in A , let I_{a} be the internal cost of a, that is, the sum of the costs of edges between a and other nodes in A, and let E_{a} be the external cost of a, that is, the sum of the costs of edges between a and nodes in B.[src] Similarly, define I_{b} , E_{b} for each b \in B .[src] Furthermore, let D_{s} = E_{s} - I_{s} be the difference between the external and internal costs of s.[src] If a and b are interchanged, then the reduction in cost is T_{old} - T_{new} = D_{a} + D_{b} - 2c_{a,b} where c_{a,b} is the cost of the possible edge between a and b.[src] The algorithm attempts to find an optimal series of interchange operations between elements of A and B which maximizes T_{old} - T_{new} and then executes the operations, producing a partition of the graph to A and B.[src] ==Pseudocode== Source: function Kernighan-Lin(G(V, E)) is determine a balanced initial partition of the nodes into sets A and B do compute D values for all a in A and b in B let gv, av, and bv be empty lists for n := 1 to |V| / 2 do find a from A and b from B, such that g = D[a] + D[b] − 2×c(a, b) is maximal remove a and b from further consideration in this pass add g to gv, a to av, and b to bv update D values for the elements of A = A \ a and B = B \ b end for find k which maximizes g_max, the sum of gv[1], ..., gv[k] if g_max > 0 then Exchange av[1], av[2], ..., av[k] with bv[1], bv[2], ..., bv[k] until (g_max ≤ 0) return G(V, E) ==See also== Fiduccia–Mattheyses algorithm ==References==[src]
16 sentences · 16 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Kernighan–Lin algorithm." encyclopegia.org, 2025, https://encyclopegia.org/wiki/kernighan-lin-algorithm. Accessed 06 December 2026.
Chicago
"Kernighan–Lin algorithm." encyclopegia.org. Accessed December 6, 2026. https://encyclopegia.org/wiki/kernighan-lin-algorithm.
APA
encyclopegia.org. (2025). Kernighan–Lin algorithm. Retrieved December 6, 2026, from https://encyclopegia.org/wiki/kernighan-lin-algorithm
Accessed December 6, 2026 · CC BY-SA 4.0 · citation page · JSON