![]() |
Bitcoin Core
28.1.0
P2P Digital Currency
|
Data structure that holds a transaction graph's preprocessed data (fee, size, ancestors, descendants). More...
#include <cluster_linearize.h>
Classes | |
| struct | Entry |
| Information about a single transaction. More... | |
Public Member Functions | |
| DepGraph () noexcept=default | |
| DepGraph (const DepGraph &) noexcept=default | |
| DepGraph (DepGraph &&) noexcept=default | |
| DepGraph & | operator= (const DepGraph &) noexcept=default |
| DepGraph & | operator= (DepGraph &&) noexcept=default |
| DepGraph (ClusterIndex ntx) noexcept | |
| Construct a DepGraph object for ntx transactions, with no dependencies. More... | |
| DepGraph (const Cluster< SetType > &cluster) noexcept | |
| Construct a DepGraph object given a cluster. More... | |
| auto | TxCount () const noexcept |
| Get the number of transactions in the graph. More... | |
| const FeeFrac & | FeeRate (ClusterIndex i) const noexcept |
| Get the feerate of a given transaction i. More... | |
| FeeFrac & | FeeRate (ClusterIndex i) noexcept |
| Get the mutable feerate of a given transaction i. More... | |
| const SetType & | Ancestors (ClusterIndex i) const noexcept |
| Get the ancestors of a given transaction i. More... | |
| const SetType & | Descendants (ClusterIndex i) const noexcept |
| Get the descendants of a given transaction i. More... | |
| ClusterIndex | AddTransaction (const FeeFrac &feefrac) noexcept |
| Add a new unconnected transaction to this transaction graph (at the end), and return its ClusterIndex. More... | |
| void | AddDependency (ClusterIndex parent, ClusterIndex child) noexcept |
| Modify this transaction graph, adding a dependency between a specified parent and child. More... | |
| FeeFrac | FeeRate (const SetType &elems) const noexcept |
| Compute the aggregate feerate of a set of nodes in this graph. More... | |
| SetType | FindConnectedComponent (const SetType &todo) const noexcept |
| Find some connected component within the subset "todo" of this graph. More... | |
| bool | IsConnected (const SetType &subset) const noexcept |
| Determine if a subset is connected. More... | |
| bool | IsConnected () const noexcept |
| Determine if this entire graph is connected. More... | |
| void | AppendTopo (std::vector< ClusterIndex > &list, const SetType &select) const noexcept |
| Append the entries of select to list in a topologically valid order. More... | |
Private Attributes | |
| std::vector< Entry > | entries |
| Data for each transaction, in the same order as the Cluster it was constructed from. More... | |
Friends | |
| bool | operator== (const DepGraph &, const DepGraph &) noexcept=default |
| Equality operator (primarily for testing purposes). More... | |
Data structure that holds a transaction graph's preprocessed data (fee, size, ancestors, descendants).
Definition at line 36 of file cluster_linearize.h.
|
defaultnoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlineexplicitnoexcept |
Construct a DepGraph object for ntx transactions, with no dependencies.
Complexity: O(N) where N=ntx.
Definition at line 75 of file cluster_linearize.h.
|
inlineexplicitnoexcept |
Construct a DepGraph object given a cluster.
Complexity: O(N^2) where N=cluster.size().
Definition at line 89 of file cluster_linearize.h.
|
inlinenoexcept |
Modify this transaction graph, adding a dependency between a specified parent and child.
Complexity: O(N) where N=TxCount().
Definition at line 149 of file cluster_linearize.h.
|
inlinenoexcept |
Add a new unconnected transaction to this transaction graph (at the end), and return its ClusterIndex.
Complexity: O(1) (amortized, due to resizing of backing vector).
Definition at line 137 of file cluster_linearize.h.
|
inlinenoexcept |
Get the ancestors of a given transaction i.
Complexity: O(1).
Definition at line 128 of file cluster_linearize.h.
|
inlinenoexcept |
Append the entries of select to list in a topologically valid order.
Complexity: O(select.Count() * log(select.Count())).
Definition at line 224 of file cluster_linearize.h.
|
inlinenoexcept |
Get the descendants of a given transaction i.
Complexity: O(1).
Definition at line 130 of file cluster_linearize.h.
|
inlinenoexcept |
Get the feerate of a given transaction i.
Complexity: O(1).
Definition at line 124 of file cluster_linearize.h.
|
inlinenoexcept |
Get the mutable feerate of a given transaction i.
Complexity: O(1).
Definition at line 126 of file cluster_linearize.h.
|
inlinenoexcept |
Compute the aggregate feerate of a set of nodes in this graph.
Complexity: O(N) where N=elems.Count().
Definition at line 169 of file cluster_linearize.h.
|
inlinenoexcept |
Find some connected component within the subset "todo" of this graph.
Specifically, this finds the connected component which contains the first transaction of todo (if any).
Two transactions are considered connected if they are both in todo, and one is an ancestor of the other in the entire graph (so not just within todo), or transitively there is a path of transactions connecting them. This does mean that if todo contains a transaction and a grandparent, but misses the parent, they will still be part of the same component.
Complexity: O(ret.Count()).
Definition at line 188 of file cluster_linearize.h.
|
inlinenoexcept |
Determine if a subset is connected.
Complexity: O(subset.Count()).
Definition at line 209 of file cluster_linearize.h.
|
inlinenoexcept |
Determine if this entire graph is connected.
Complexity: O(TxCount()).
Definition at line 218 of file cluster_linearize.h.
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
Get the number of transactions in the graph.
Complexity: O(1).
Definition at line 122 of file cluster_linearize.h.
|
friend |
Equality operator (primarily for testing purposes).
|
private |
Data for each transaction, in the same order as the Cluster it was constructed from.
Definition at line 58 of file cluster_linearize.h.
1.8.14