Neo4j Visualization Library
    Preparing search index...

    Interface ClusteringOptions

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

    Only used by the 'forceDirected' layout. The hierarchical layout has its own HierarchicalOptions.clusterBy without decorations. Clusters can be clicked and hit-tested (see NVL.getHits), but are not hoverable elements.

    import { NVL } from '@neo4j-nvl/base'

    const nvl = new NVL(document.getElementById('frame'), [{ id: 'a:1' }, { id: 'a:2' }], [])

    const clusterBy = (nodeId: string) => nodeId.split(':')[0]
    nvl.setLayoutOptions({ clustering: { clusterBy, drawOutline: true } })
    interface ClusteringOptions {
        clusterBy?: ClusterByFn;
        crossClusterRelationshipMultiplier?: number;
        drawHalo?: boolean;
        drawOutline?: boolean;
    }
    Index
    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