# How to linearize your cluster

**URL:** <https://delvingbitcoin.org/t/how-to-linearize-your-cluster/303>\
**Category:** Implementation\
**Tags:** wg-cluster-mempool, mempool\
**Created:** [December 18, 2023, 8:55pm UTC](https://delvingbitcoin.org/t/how-to-linearize-your-cluster/303 "2023-12-18T20:55:14Z")\
**Posts on this page:** 1\
**Showing post:** 30

<div class="post-metadata">

**Author:** ![Lagrang3](https://delvingbitcoin.org/user_avatar/delvingbitcoin.org/lagrang3/32/377_2.png) [@Lagrang3](https://delvingbitcoin.org/u/Lagrang3)\
**Post date:** [February 9, 2025, 10:40am UTC](https://delvingbitcoin.org/t/how-to-linearize-your-cluster/303/30 "2025-02-09T10:40:08Z")

</div>

There several options for implementing preflow-push (Goldberg-Tarjan maxflow/min-cut algorithm). The fastest theoretical bound O(nm \log(n^2/m)) is obtained using a dynamic tree data structure or alternatively one can simply use a queue to process _active_ nodes in FIFO order leading to a provable O(n^3) complexity. The FIFO-preflow-push is actually pretty simple to implement. See for example:

> <https://github.com/Lagrang3/max-density-closure/blob/27c874164a0b457cc4092e64f0fc46457e60ab7e/examples/kattis-maxflow.cpp>

---

_[View the full topic](https://delvingbitcoin.org/t/how-to-linearize-your-cluster/303)._
