# GraphForeachCallback type · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.graphforeachcallback/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Called once per vertex during a traversal.

**Signature:**

```typescript
export type GraphForeachCallback<T> = (vertex: T, visited: Map<T, boolean>) => false | void;
```

## Remarks

Returning `false` prunes the walk at that vertex — its own edges are not followed — rather than ending the traversal. Anything else, `undefined` included, carries on. The second argument is the live visited map, so a callback can see what has already been reached, and add to it to steer the walk away from a vertex it does not want visited.

