Math Operation Array
Min, max, mean, or median across a whole list at once
- values
- *
If several branches of your graph each compute a candidate number and you want one sane answer out of the bunch - the smallest, the biggest, the average, or the typical one that isn't thrown off by an outlier - this is the node that reduces a list down to a single value.
It's from JNComfy (jn-jairo/jn_comfyui), a large one-person pack that quietly bundles audio, face restoration, sampling utilities, and a whole family of small logic primitives like this one. It has essentially no footprint in the wider community - nobody's really talking about it - which is worth knowing going in: you're working from the README and the node's own inputs, not a pile of community troubleshooting threads.
How it works
operation picks the reduction: min, max, mean, or median. values is where your numbers come in - and, like several other nodes in this same family, it leans on JNComfy's own "Easy multiple inputs" patch, so instead of being boxed into two or three fixed sockets, you wire in as many values as you actually have and they arrive as a list. Pick the operation, and out comes one number.
The obvious use is exactly what the operations suggest: if three branches each compute a candidate resize target, or three passes each produce a confidence-ish score, taking the median keeps one outlier branch from dragging the result somewhere wrong, while mean smooths across all of them evenly. min/max are for when you specifically want the extreme rather than a compromise - clamping to the smallest of several bounds, say.
The inputs and outputs that matter
operation(required, one ofmin/max/mean/median) - the reduction applied.values(optional, any type, multiple) - the numbers going in.- Output: a single reduced value.
Installing it
ComfyUI Manager: search "JNComfy". Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui
Restart ComfyUI. No models, no extra dependencies - it's arithmetic, nothing more.
Common issues & troubleshooting
Non-numeric input. Because values is typed generically, nothing stops you from wiring in a string or something else that isn't a number - expect a Python error in the console rather than a graceful fallback, since this node is doing real math on whatever it's handed.
Median on an even-length list isn't one of your actual inputs. Standard statistics convention applies: with an even number of values, the median is the average of the two middle ones, not necessarily a value that was actually one of your inputs. If you were expecting the output to match one of the wires exactly, that's the reason it sometimes doesn't.
Only one value wired in. Min, max, mean, and median of a single number are all just that number - not an error, just worth knowing if you're testing the node with one wire before scaling up to a real multi-value case.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| operation | COMBO | 4 options: min, max, mean, median | |
| valuesopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |