filteredges

filter.edges.predicate

predicate(fn: EdgePredicateFn, options?: { on?: Scope; invert?: boolean; id?: string }): FilterHandle

Predicate (escape-hatch) filter on edges.

The supplied function receives each EdgeData and returns true to keep the edge visible, false to hide it. Use this for any logic that cannot be expressed via range, dateRange, or match.

Notes:

  • includeNull is intentionally absent — the predicate sees raw data and decides null-handling itself.
  • The predicate is invoked on every visibility recomputation. Keep it pure and cheap.
fn(edge: EdgeData) => booleanPure predicate. Return true to keep, false to hide.
options.on string | string[] | '*'Restrict to a subset of edge relationships. Default: '*' (all).
options.invert booleanInvert pass/fail. Default: false.
options.id stringOverride the auto-generated handle id.

Returns: FilterHandle

Example

// Hide self-loops
const noSelfLoops = api.filter.edges.predicate(
  (edge) => edge.source !== edge.target,
);