Prune
The Prune node removes existing branches when certain conditions are met.
- Conditional Removal: Evaluates attributes on internodes and marks them for deletion.
- Time-Varying: Can re-evaluate conditions over multiple cycles, allowing branches to be pruned later in their life (e.g., when they get too old or crowded).
- Delayed: Supports a start delay to allow initial growth before pruning begins.
Concept
Iterative Evaluation
Unlike a one-shot filter, Prune is designed to work within the iterative growth loop. It checks every internode against its rules multiple times (Test Lifetime), allowing for dynamic behaviors like "survival of the fittest" where branches compete for space over time.
Conditions Pruning logic can be simple (Thresholds) or complex (Mappings/Wrangles).
- Threshold:
Height > 10 - Attribute:
Width < Length - Mapping:
Density > Map(u)
Inputs
- Input 0 — Graph The incoming Apex graph.
- Output — Graph The graph with pruned internodes removed.
Parameters
Condition
- Compare Attribute: The attribute to test (e.g.,
height,age). - Operator: The comparison type (
>,<,==). - Test Value: The value to compare against. Can be a Float, another Attribute, or a Mapping.
Timing
- Test Lifetime: How many times to re-evaluate the condition for each internode.
- Start Delay: How many steps/iterations to wait before starting the checks.
Advanced
- Snippet Condition: Inline VEX for custom logic.
Attributes
Prune consumes attributes but does not typically emit new ones.
- Common Inputs:
height,age,u,generation,density(custom).
Workflow
- Place a Prune node after your growth logic (e.g., inside a Repeat block).
- Select an attribute to test (e.g.,
height). - Set the condition (e.g.,
> 5.0). - (Optional) Use a Wrangle before the Prune node to calculate complex metrics like "local density" and store them in an attribute for Prune to check.
Related Nodes
Grow
The primary growth node. Encapsulates core operations (growth, repetition, branching, switching) into a single interface. Defines one or more growth steps with time-varying attributes.
Repeat
Defines a looping block in the graph. Encapsulates a subgraph between Repeat Begin and Repeat End, re-evaluating it N times with time-varying attributes.