Array node

Array Compare

Compare two arrays element by element and report differences. Returns whether the arrays are equal, how many elements differ, which indices differ, and whether the lengths match. Float comparison uses epsilon tolerance.

Inputs

PortTypeDefault
Array AThe first list. Compared element by element against B; positions past the shorter list count as differences.any—
Array BThe second list, compared against A at the same positions.any—
EpsilonHow far two numbers may drift and still count as equal. Not clamped; keep it small, around 0.0001, since large values make everything look identical.float0.0001

Outputs

PortType
Equalbool
Diff Countint
Diff Indicesany
Length Matchbool

How It Works

Array Compare performs element-wise comparison between two arrays:

  • Equal: True only if both arrays have the same length AND every corresponding pair of elements matches (within Epsilon for floats).
  • Diff Count: Number of positions where elements differ.
  • Diff Indices: Array of indices where differences were found.
  • Length Match: True if both arrays have the same number of elements (even if values differ).

Use Cases

  • Change detection: Compare current sensor data with a previous snapshot to detect which channels changed.
  • Validation: Verify that a processed array matches an expected result.
  • State monitoring: Track when and where array values change over time.
  • A/B testing: Compare outputs of two different processing chains.

Tips

  • Increase Epsilon to ignore small floating-point differences (e.g., 0.01 to tolerate 1% variation).
  • Diff Indices can be fed into Array Get to extract the actual differing values from either array.

Open Array Compare in the interactive catalog →

Array Compare is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Array nodes