filter.filterByNeighborhood
filterByNeighborhood(_nodeId: string, _depth?: number): never_nodeId | string | |
_depth | number |
Returns: never
api.filter.filterByNeighborhood was misnamed in the legacy API. The previous
implementation was a minimum-degree filter, not a hop-distance neighbourhood
filter. Calling this method now throws a TypeError with a migration hint —
it does not provide an alternative behaviour.
Migration
If you were using filterByNeighborhood to hide low-degree nodes, use the new
topology filter instead:
// BEFORE (legacy, threw or hid by minimum degree)
api.filter.filterByNeighborhood("alice", 2);
// AFTER (explicit minimum-degree filter)
const wellConnected = api.filter.nodes.degree({ min: 2 });
See filter.nodes.degree for the full API.
True hop-distance filtering
True hop-distance neighbourhood filtering (keep nodes within N hops of a seed
set) is not yet implemented. File an issue if you need this — it will land
as a dedicated method (likely filter.nodes.withinHops) rather than reviving
the misnamed legacy name.