<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=95.209.155.37</id>
	<title>formulasearchengine - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.formulasearchengine.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=95.209.155.37"/>
	<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/wiki/Special:Contributions/95.209.155.37"/>
	<updated>2026-07-19T01:43:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.47.0-wmf.7</generator>
	<entry>
		<id>https://en.formulasearchengine.com/w/index.php?title=M-spline&amp;diff=24266</id>
		<title>M-spline</title>
		<link rel="alternate" type="text/html" href="https://en.formulasearchengine.com/w/index.php?title=M-spline&amp;diff=24266"/>
		<updated>2013-03-16T22:52:24Z</updated>

		<summary type="html">&lt;p&gt;95.209.155.37: minor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;: &#039;&#039;This article is about the heuristic algorithm for the graph partitioning problem. For a heuristic for the traveling salesperson problem, see [[Lin–Kernighan heuristic]].&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;Kernighan–Lin&#039;&#039;&#039; is a O(n&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&amp;amp;nbsp;) [[heuristic algorithm]] for solving the [[graph partitioning problem]]. The algorithm has important applications in the layout of digital circuits and components in [[VLSI]].&amp;lt;ref name=&amp;quot;kl&amp;quot;/&amp;gt;&amp;lt;ref name=&amp;quot;ravikumar&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Let &amp;lt;math&amp;gt;G(V,E)&amp;lt;/math&amp;gt; be a graph, and let &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; be the set of nodes and &amp;lt;math&amp;gt;E&amp;lt;/math&amp;gt; the set of edges. The algorithm attempts to find a partition of &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; into two disjoint subsets &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; of equal size, such that the sum &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the weights of the edges between nodes in &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; is minimized. Let &amp;lt;math&amp;gt;I_{a}&amp;lt;/math&amp;gt; be the &#039;&#039;internal cost&#039;&#039; of &#039;&#039;a&#039;&#039;, that is, the sum of the costs of edges between &#039;&#039;a&#039;&#039; and other nodes in &#039;&#039;A&#039;&#039;, and let &amp;lt;math&amp;gt;E_{a}&amp;lt;/math&amp;gt; be the &#039;&#039;external cost&#039;&#039; of &#039;&#039;a&#039;&#039;, that is, the sum of the costs of edges between &#039;&#039;a&#039;&#039; and nodes in &#039;&#039;B&#039;&#039;. Furthermore, let &lt;br /&gt;
:&amp;lt;math&amp;gt;D_{a} = E_{a} - I_{a}&amp;lt;/math&amp;gt;&lt;br /&gt;
be the difference between the external and internal costs of &#039;&#039;a&#039;&#039;. If &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039; are interchanged, then the reduction in cost is&lt;br /&gt;
:&amp;lt;math&amp;gt;T_{old} - T_{new} = D_{a} + D_{b} - 2c_{a,b}&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;c_{a,b}&amp;lt;/math&amp;gt; is the cost of the possible edge between &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The algorithm attempts to find an optimal series of interchange operations between elements of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;B&amp;lt;/math&amp;gt; which maximizes &amp;lt;math&amp;gt;T_{old} - T_{new}&amp;lt;/math&amp;gt; and then executes the operations, producing a partition of the graph to &#039;&#039;A&#039;&#039; and &#039;&#039;B&#039;&#039;.&amp;lt;ref name=&amp;quot;kl&amp;quot;&amp;gt;{{cite journal|first1=B. W.|last1=Kernighan|authorlink1=Brian Kernighan|first2=Shen|last2=Lin|authorlink2=Shen Lin| year = 1970 | title = An efficient heuristic procedure for partitioning graphs | journal = Bell Systems Technical Journal|volume=49|pages=291–307}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pseudocode==&lt;br /&gt;
See &amp;lt;ref name=&amp;quot;ravikumar&amp;quot;&amp;gt;{{cite book|last=Ravikumār|first=Si. Pi|coauthors=Ravikumar, C.P|title=Parallel methods for VLSI layout design|publisher=Greenwood Publishing Group|year=1995|pages=73|isbn=978-0-89391-828-6|oclc=2009-06-12|url=http://books.google.com/?id=VPXAxkTKxXIC}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  1  &#039;&#039;&#039;function&#039;&#039;&#039; Kernighan-Lin(&#039;&#039;G(V,E)&#039;&#039;):&lt;br /&gt;
  2      determine a balanced initial partition of the nodes into sets A and B&lt;br /&gt;
  3      A1 := A; B1 := B&lt;br /&gt;
  4      &#039;&#039;&#039;do&#039;&#039;&#039;&lt;br /&gt;
  5         compute D values for all a in A1 and b in B1&lt;br /&gt;
  6         &#039;&#039;&#039;for (n := 1 to |V|/2)&#039;&#039;&#039;&lt;br /&gt;
  7            find a[i] from A1 and b[j] from B1, such that g[n] = D[a[i]] + D[b[j]] - 2*c[a[i]][b[j]] is maximal&lt;br /&gt;
  8            move a[i] to B1 and b[j] to A1&lt;br /&gt;
  9            remove a[i] and b[j] from further consideration in this pass&lt;br /&gt;
  10           update D values for the elements of A1 = A1 \ a[i] and B1 = B1 \ b[j]&lt;br /&gt;
  11        &#039;&#039;&#039;end for&#039;&#039;&#039;&lt;br /&gt;
  12        find k which maximizes g_max, the sum of g[1],...,g[k]&lt;br /&gt;
  13        &#039;&#039;&#039;if (g_max &amp;gt; 0)&#039;&#039;&#039; &#039;&#039;&#039;then&#039;&#039;&#039;&lt;br /&gt;
  14           Exchange a[1],a[2],...,a[k] with b[1],b[2],...,b[k]&lt;br /&gt;
  15     &#039;&#039;&#039;until (g_max &amp;lt;= 0)&#039;&#039;&#039;&lt;br /&gt;
  16  &#039;&#039;&#039;return G(V,E)&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Kernighan-Lin algorithm}}&lt;br /&gt;
[[Category:Combinatorial optimization]]&lt;br /&gt;
[[Category:Combinatorial algorithms]]&lt;br /&gt;
[[Category:Heuristic algorithms]]&lt;/div&gt;</summary>
		<author><name>95.209.155.37</name></author>
	</entry>
</feed>