algorithms

algorithms.degree

degree(options: CommonAlgorithmOptions & AlgorithmWriteOptions): NodeScalarResult

Compute the degree (total edge count) for each node synchronously.

Unlike the heavy algorithms this runs on the main thread and returns immediately. When writeTo is supplied degree values are written to node properties via ApplyAlgorithmResultCommand (recorded in history, undoable). Does not emit algorithm lifecycle events.

optionsCommonAlgorithmOptions & AlgorithmWriteOptionsCommonAlgorithmOptions merged with AlgorithmWriteOptions.

Returns: NodeScalarResult

Example

const deg = api.algorithms.degree({ writeTo: "degree" });