filter.nodes.degree
degree(spec: DegreeSpec): FilterHandle<DegreeSpec>Topology (degree) filter on nodes.
Hides nodes whose degree falls outside [min, max]. direction selects the metric:
"in"→inDegree"out"→outDegree"both"(default) → totaldegree
Defaults: min: 0, max: Infinity.
No on scope is exposed by design — topology applies to all nodes uniformly. Use this method (not the deprecated filterByNeighborhood) when you want to hide low-degree nodes.
spec.min | number | Minimum degree (inclusive). Default: 0. |
spec.max | number | Maximum degree (inclusive). Default: Infinity. |
spec.direction | 'in' | 'out' | 'both' | Which degree metric to use. Default: 'both'. |
spec.invert | boolean | Invert pass/fail. Default: false. |
spec.id | string | Override the auto-generated handle id. |
Returns: FilterHandle<DegreeSpec>
Examples
// Hide isolated nodes (degree < 1)
const connected = api.filter.nodes.degree({ min: 1 });
// Show only hub nodes (in-degree >= 5)
const hubs = api.filter.nodes.degree({ min: 5, direction: "in" });