filter.edges.predicate
predicate(fn: EdgePredicateFn, options?: { on?: Scope; invert?: boolean; id?: string }): FilterHandlePredicate (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:
includeNullis 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) => boolean | Pure predicate. Return true to keep, false to hide. |
options.on | string | string[] | '*' | Restrict to a subset of edge relationships. Default: '*' (all). |
options.invert | boolean | Invert pass/fail. Default: false. |
options.id | string | Override the auto-generated handle id. |
Returns: FilterHandle
Example
// Hide self-loops
const noSelfLoops = api.filter.edges.predicate(
(edge) => edge.source !== edge.target,
);