pivotick - v2.0.1
    Preparing search index...

    Class Node

    Represents a single node (vertex) in a graph.

    Index

    Constructors

    • Create a new Node instance.

      Parameters

      • id: string

        Unique identifier for the node

      • Optionaldata: NodeData

        Optional data payload associated with the node

      • Optionalstyle: Partial<NodeStyle>
      • domID: string = ...
      • children: Node[] = []

      Returns Node

    Methods

    • The node's clusters, outermost first — empty for a node of the root graph.

      Returns Node[]

    • The node the canvas actually draws for this one: itself when every cluster above it is expanded, otherwise the outermost collapsed cluster — the box hiding it.

      This answers "which dot on screen stands for this node", not "is it visible": an expanded cluster renders a separate subgraph built from toDict() data, so a nested node is never drawn by this graph even when its cluster is open.

      Returns Node

    • Every node below this one, depth first.

      Returns Node[]

    • The node's rectangular border grown by outset, or undefined when the node is anchored as a circle.

      Parameters

      • outset: number = 0

      Returns NodeBorderBox | undefined

    • Distance from the node's centre to its border along the unit direction (dirX, dirY), grown by outset — where an edge leaving in that direction should start. Rectangular for a measured node, the circle radius otherwise. Deliberately free of style resolution: this runs for both ends of every edge on every tick.

      Parameters

      • dirX: number
      • dirY: number
      • outset: number = 0

      Returns number

    • Returns number

    • Returns number

    • Returns SVGGElement | null

    • The potential declared for one pivot, or — with no argument — the total declared for no particular pivot. undefined when none was.

      Parameters

      • pivotId: string = SUMMARY_POTENTIAL

      Returns number | undefined

    • Every declared potential on this node, keyed by pivot id.

      Returns Map<string, number>

    • The sources vouching for this node — pivot ids, plus 'seed' for data that was here to begin with. A node can be vouched for by several pivots at once, and graph.removeBySource deletes it only when the last one goes.

      Returns string[]

    • Returns boolean

    • Whether source vouches for this node. 'seed' is true for un-pivoted data.

      Parameters

      • source: string

      Returns boolean

    • Parameters

      • parentNode: Node
      • childrenDepth: number

      Returns void

    • Drop one child, and its own subtree with it. Returns the removed child so the caller can clean up after its descendants.

      Parameters

      • id: string

      Returns Node | undefined

    • Declare that the node's border is the centred width×height rectangle it actually renders as, so edges stop on it instead of on the bounding circle. Call it after setCircleRadius, which clears it.

      Parameters

      • width: number
      • height: number

      Returns void

    • Parameters

      Returns void

    • Set the node's circle radius. Also drops any measured rectangular border: the radius is the coarser fact, so every caller that resizes a node keeps anchoring correct by default, and only the drawers that know the rendered shape opt back in through setBorderBox.

      Parameters

      • radius: number

      Returns void

    • Parameters

      • radius: number

      Returns void

    • Declare how much more there is for this node, without asking for any of it — what the rim badge shows. 0 clears the declaration.

      With a pivot id it is that pivot's number, and its badge opens that pivot. With a count alone it is the total across everything, which is the number the 'summary' rim badge prefers — the one to declare when there are more providers than a rim could ever name.

      Marks the node dirty like every other setter here, so the badge appears on the next render — call graph.renderer.update() if nothing else is about to.

      node.setPotential('correlations', 2143) // this provider has this much
      node.setPotential(2199) // everything has this much

      Parameters

      • count: number

      Returns void

    • Declare how much more there is for this node, without asking for any of it — what the rim badge shows. 0 clears the declaration.

      With a pivot id it is that pivot's number, and its badge opens that pivot. With a count alone it is the total across everything, which is the number the 'summary' rim badge prefers — the one to declare when there are more providers than a rim could ever name.

      Marks the node dirty like every other setter here, so the badge appears on the next render — call graph.renderer.update() if nothing else is about to.

      node.setPotential('correlations', 2143) // this provider has this much
      node.setPotential(2199) // everything has this much

      Parameters

      • pivotId: string
      • count: number

      Returns void

    • Update the node's data.

      Parameters

      Returns void

    • Convert node to a simple JSON object representation.

      Parameters

      • dataOnly: boolean = false

        default: false

      Returns Record<string, unknown>

    • Parameters

      • Optionalexpanded: boolean

      Returns void

    • Parameters

      • visible: boolean

      Returns void

    • Structured-cloneable payload for the simulation worker (no live parent/children/_subgraph refs, unlike clone()). The style is stripped of functions: every resolvable channel may hold one, and no force reads them, so sending them only risks a DataCloneError.

      Returns SimulationNodeDTO

    • Merge children in by id: new ones are added, matching ones are left untouched — their own children merged in turn — and none are ever removed. The union is how a pivot re-discovering a container adds what it found without disturbing what is already there.

      Parameters

      Returns Node[]

      every node newly added, at any depth, so the caller can register and tag them.

    • Merge partial data into the current node data. Useful for updating only parts of the data.

      Parameters

      • partialData: Partial<NodeData>

        Partial data object to merge

      Returns void

    • Merge partial data into the current node data. Useful for updating only parts of the data.

      Parameters

      • partialStyle: Partial<NodeStyle>

        Partial data object to merge

      Returns void

    Properties

    children: Node[]
    childrenDepth: number
    defaultCircleRadius: number = 10
    domID: string
    expanded?: boolean
    frozen?: boolean
    fx?: number
    fy?: number
    id: string
    isChild: boolean

    True if this node is a child within a collapsed cluster

    isParent: boolean

    True if this node has child nodes

    parentNode?: Node

    Reference to the parent cluster node (if this node is a child)

    visible: boolean
    vx?: number
    vy?: number
    weight?: number
    x?: number
    y?: number