[#cluster_linearize-PostLinearize]
= xref:cluster_linearize.adoc[cluster&lowbar;linearize]::PostLinearize
:relfileprefix: ../
:mrdocs:

Improve a given linearization&period;

== Synopsis

Declared in `&lt;cluster&lowbar;linearize&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename SetType&gt;
void
PostLinearize(
    xref:cluster_linearize/DepGraph.adoc[DepGraph&lt;SetType&gt;] const& depgraph,
    std::span&lt;DepGraphIndex&gt; linearization);
----

== Description

Postlinearization guarantees&colon;

* The resulting chunks are connected&period;
* If the input has a tree shape (either all transactions have at most one child, or all transactions have at most one parent), the result is optimal&period;
* Given a linearization L1 and a leaf transaction T in it&period; Let L2 be L1 with T moved to the end, optionally with its fee increased&period; Let L3 be the postlinearization of L2&period; L3 will be at least as good as L1&period; This means that replacing transactions with same&hyphen;size higher&hyphen;fee transactions will not worsen linearizations through a &quot;drop conflicts, append new transactions, postlinearize&quot; process&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *depgraph* [in]
| Dependency graph of the cluster being linearized&period;
| *linearization* [inout]
| On input, an existing linearization for depgraph&period; On output, a potentially better linearization for the same graph&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
