|
Template Numerical Library version\ main:4e6e2c1
|
This page provides an overview of all reduction functions available for graph operations, helping to understand the differences between variants and choose the right function for your needs.
A graph vertex reduction performs a reduction operation (like sum, max, min) across the edges connected to each vertex of a graph, producing one result per vertex. This is a fundamental operation for:
Graph reduction functions are organized along three independent axes:
| Category | Graph Modifiable? | Use Case |
|---|---|---|
| Non-const | Yes | Can modify graph edges during reduction |
| Const | No | Read-only access to graph edges |
Note: Each reduction function has both const and non-const overloads. The possibility to modify the graph during reduction allows to fuse reduction with traversing operations into a single pass. This can improve performance by reducing memory accesses.
| Category | Tracks Position? | Use Case |
|---|---|---|
| Basic | No | Only the reduced weight is needed (e.g., vertex sum, vertex max) |
| WithArgument | Yes | Need weight and target vertex index (e.g., max weight location) |
| Scope | Vertices Processed | Parameters |
|---|---|---|
| All | All vertices | No range/array parameters |
| Range | Vertices [begin, end) | begin and end indices |
| Array | Specific vertices | Array of vertex indices |
| If | Vertices filtered by a condition | Process vertices based on vertex-level properties |
All reduction functions follow this naming pattern: reduce[All]Vertices[WithArgument][If]
Each function has both const and non-const overloads (×2 multiplier).
| Function | Scope | Conditional | Tracks Position | Overloads |
|---|---|---|---|---|
| reduceAllVertices | All | No | No | const & non-const |
| reduceVertices (range) | Range [begin,end) | No | No | const & non-const |
| reduceVertices (array) | Vertex array | No | No | const & non-const |
| reduceAllVerticesIf | All | Yes | No | const & non-const |
| reduceVerticesIf | Range [begin,end) | Yes | No | const & non-const |
| Function | Scope | Conditional | Tracks Position | Overloads |
|---|---|---|---|---|
| reduceAllVerticesWithArgument | All | No | Yes | const & non-const |
| reduceVerticesWithArgument (range) | Range [begin,end) | No | Yes | const & non-const |
| reduceVerticesWithArgument (array) | Vertex array | No | Yes | const & non-const |
| reduceAllVerticesWithArgumentIf | All | Yes | Yes | const & non-const |
| reduceVerticesWithArgumentIf | Range [begin,end) | Yes | Yes | const & non-const |
All reduction functions share these common parameters:
Additional parameters: