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

Find or improve a linearization for a cluster&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename SetType&gt;
std::tuple&lt;std::vector&lt;DepGraphIndex&gt;, bool, uint64&lowbar;t&gt;
Linearize(
    xref:cluster_linearize/DepGraph.adoc[DepGraph&lt;SetType&gt;] const& depgraph,
    uint64&lowbar;t max&lowbar;cost,
    uint64&lowbar;t rng&lowbar;seed,
    auto const& fallback&lowbar;order,
    std::span&lt;DepGraphIndex const&gt; old&lowbar;linearization = &lcub;&rcub;,
    bool is&lowbar;topological = true) noexcept;
----

== Return Value

A tuple of&colon; &hyphen; The resulting linearization&period; It is guaranteed to be at least as good (in the feerate diagram sense) as old&lowbar;linearization&period; &hyphen; A boolean indicating whether the result is guaranteed to be optimal with minimal chunks&period; &hyphen; How many optimization steps were actually performed&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *depgraph* [in]
| Dependency graph of the cluster to be linearized&period;
| *max&lowbar;cost* [in]
| Upper bound on the amount of work that will be done&period;
| *rng&lowbar;seed* [in]
| A random number seed to control search order&period; This prevents peers from predicting exactly which clusters would be hard for us to linearize&period;
| *fallback&lowbar;order* [in]
| A comparator to order transactions, used to sort equal&hyphen;feerate chunks and transactions&period; See SpanningForestState&colon;&colon;GetLinearization for details&period;
| *old&lowbar;linearization* [in]
| An existing linearization for the cluster, or empty&period;
| *is&lowbar;topological* [in]
| (Only relevant if old&lowbar;linearization is not empty) Whether old&lowbar;linearization is topologically valid&period;
|===


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