Options that control physical clustering and cluster decorations for the force-directed layout.

interface ClusteringOptions {
    clusterBy?: ClusterByFn;
    crossClusterRelationshipMultiplier?: number;
    drawHalo?: boolean;
    drawOutline?: boolean;
}

Properties

clusterBy?: ClusterByFn

Optional function to group nodes into physical clusters based on a custom identifier. Nodes returning the same string or number will be grouped together in the layout. Nodes returning undefined will be treated as independent.

Ensure this function has a stable reference to avoid evaluation on every render.

crossClusterRelationshipMultiplier?: number

Spring force multiplier for relationships that cross a ClusteringOptions.clusterBy cluster boundary. Capped between 0 and 1. 0 disables cross-cluster spring pull. 1 is full strength. Intra-cluster edges are always full strength. Only applies when ClusteringOptions.clusterBy is set.

0
@experimental

Can cause unstable layouts when set to close to 1 in highly connected graphs.

drawHalo?: boolean

Fills a soft glowing halo around each cluster.

Halo color is the same as the nodes in the cluster. If the nodes in the cluster have different colors, the halo won't be shown.

false
drawOutline?: boolean

Draws a convex-hull outline around each cluster.

Outline color is the same as the nodes in the cluster. If the nodes in the cluster have different colors, the outline uses NvlOptions.styling.overlayLineColor.

false