Skip to content

moduleColors

moduleColors(nodes, opts?): string[]

Defined in: network/module-colors.ts:42

Per-node CSS colours (indexed by node id) for a module hierarchy. A node takes the hue of its enclosing module (path minus the final rank), so all nodes in a module share a colour and sibling modules get neighbouring hues within their parent’s arc.

A colour belongs to a module, so each is computed once per module (#428): O(nodes · depth) integer work to find every node’s module (see internModules), plus one HCL conversion per module that holds a node — not one per node. For a 325k-node, ~40k-module Infomap map: 0.2 s → 58-66 ms in a production browser build (cold), 0.22 s → 24-26 ms in Node once warm.

ArrayLike<ModulePathNode>

ModuleColorOptions = {}

string[]