pivotick / Node
Class: Node
Defined in: Node.ts:42
Represents a single node (vertex) in a graph.
Accessors
isGroup
Get Signature
get isGroup():
boolean
Defined in: Node.ts:441
True for a group drawn by graph.simplify: a stand-in for its members, never part of the data.
Returns
boolean
Constructors
Constructor
new Node(
id,data?,style?,domID?,children?):Node
Defined in: Node.ts:108
Create a new Node instance.
Parameters
id
string
Unique identifier for the node
data?
Optional data payload associated with the node
style?
Partial<NodeStyle>
domID?
string = ...
children?
Node[] = []
Returns
Node
Methods
ancestorChain()
ancestorChain():
Node[]
Defined in: Node.ts:400
The node's clusters, outermost first — empty for a node of the root graph.
Returns
Node[]
canvasRepresentative()
canvasRepresentative():
Node
Defined in: Node.ts:419
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 — and in either case the closed group that dot is folded into, if any.
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
clone()
clone():
Node
Defined in: Node.ts:284
Returns
Node
collapse()
collapse():
void
Defined in: Node.ts:388
Returns
void
degree()
degree():
number
Defined in: Node.ts:395
Returns
number
descendants()
descendants():
Node[]
Defined in: Node.ts:709
Every node below this one, depth first.
Returns
Node[]
expand()
expand():
void
Defined in: Node.ts:381
Returns
void
freeze()
freeze():
void
Defined in: Node.ts:335
Returns
void
getBorderBox()
getBorderBox(
outset):NodeBorderBox|undefined
Defined in: Node.ts:513
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
getBorderDistance()
getBorderDistance(
dirX,dirY,outset):number
Defined in: Node.ts:525
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
getCircleRadius()
getCircleRadius():
number
Defined in: Node.ts:465
Returns
number
getCircleRadiusCollapsed()
getCircleRadiusCollapsed():
number
Defined in: Node.ts:473
Returns
number
getConnectedNodes()
getConnectedNodes():
Node[]
Defined in: Node.ts:184
Returns
Node[]
getConnectingNodes()
getConnectingNodes():
Node[]
Defined in: Node.ts:190
Returns
Node[]
getData()
getData():
NodeData
Defined in: Node.ts:129
Get the node's data.
Returns
getEdgesIn()
getEdgesIn():
Edge[]
Defined in: Node.ts:200
Returns
Edge[]
getEdgesOut()
getEdgesOut():
Edge[]
Defined in: Node.ts:196
Returns
Edge[]
getGraphElement()
getGraphElement():
SVGGElement|null
Defined in: Node.ts:230
Returns
SVGGElement | null
getLayoutRadius()
getLayoutRadius():
number
Defined in: Node.ts:496
The radius the layout spaces this node by: its declared footprint where it has one, and otherwise whatever the drawing measured. Every force reads this; the drawers read getCircleRadius, which is the drawn size.
Returns
number
getLayoutSize()
getLayoutSize():
number|undefined
Defined in: Node.ts:487
The declared footprint half-width, or undefined when the drawing owns the spacing.
Returns
number | undefined
getPotential()
getPotential(
pivotId):number|undefined
Defined in: Node.ts:647
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
getPotentials()
getPotentials():
Map<string,number>
Defined in: Node.ts:652
Every declared potential on this node, keyed by pivot id.
Returns
Map<string, number>
getSources()
getSources():
string[]
Defined in: Node.ts:538
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[]
getStyle()
getStyle():
Partial<NodeStyle>
Defined in: Node.ts:207
Get the node's data.
Returns
Partial<NodeStyle>
hasChildren()
hasChildren():
boolean
Defined in: Node.ts:723
Returns
boolean
hasSource()
hasSource(
source):boolean
Defined in: Node.ts:543
Whether source vouches for this node. 'seed' is true for un-pivoted data.
Parameters
source
string
Returns
boolean
hide()
hide():
void
Defined in: Node.ts:360
Returns
void
markAsChild()
markAsChild(
parentNode,childrenDepth):void
Defined in: Node.ts:727
Parameters
parentNode
Node
childrenDepth
number
Returns
void
markAsParent()
markAsParent():
void
Defined in: Node.ts:733
Returns
void
removeChildById()
removeChildById(
id):Node|undefined
Defined in: Node.ts:698
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
setBorderBox()
setBorderBox(
width,height):void
Defined in: Node.ts:505
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
setChildren()
setChildren(
children):void
Defined in: Node.ts:656
Parameters
children
Node[]
Returns
void
setCircleRadius()
setCircleRadius(
radius):void
Defined in: Node.ts:460
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
setCircleRadiusCollapsed()
setCircleRadiusCollapsed(
radius):void
Defined in: Node.ts:469
Parameters
radius
number
Returns
void
setData()
setData(
newData):void
Defined in: Node.ts:137
Update the node's data.
Parameters
newData
New data to set
Returns
void
setLayoutSize()
setLayoutSize(
halfWidth):void
Defined in: Node.ts:482
Declare the box this node reserves in the layout, as a half-width in graph units. Unlike setCircleRadius this is constant: the drawing can change inside it without anything moving.
Parameters
halfWidth
number | undefined
Returns
void
setPotential()
Call Signature
setPotential(
count):void
Defined in: Node.ts:627
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 muchParameters
count
number
Returns
void
Call Signature
setPotential(
pivotId,count):void
Defined in: Node.ts:628
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 muchParameters
pivotId
string
count
number
Returns
void
setStyle()
setStyle(
newStyle):void
Defined in: Node.ts:215
Update the node's data.
Parameters
newStyle
Partial<NodeStyle>
New data to set
Returns
void
show()
show():
void
Defined in: Node.ts:356
Returns
void
toDict()
toDict(
dataOnly):Record<string,unknown>
Defined in: Node.ts:239
Convert node to a simple JSON object representation.
Parameters
dataOnly
boolean = false
default: false
Returns
Record<string, unknown>
toggleExpand()
toggleExpand(
expanded?):void
Defined in: Node.ts:364
Parameters
expanded?
boolean
Returns
void
toggleVisibility()
toggleVisibility(
visible):void
Defined in: Node.ts:347
Parameters
visible
boolean
Returns
void
toSimulationDTO()
toSimulationDTO():
SimulationNodeDTO
Defined in: Node.ts:267
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
unfreeze()
unfreeze():
void
Defined in: Node.ts:341
Returns
void
unionChildren()
unionChildren(
children):Node[]
Defined in: Node.ts:674
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
children
Node[]
Returns
Node[]
every node newly added, at any depth, so the caller can register and tag them.
updateData()
updateData(
partialData):void
Defined in: Node.ts:147
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
updateStyle()
updateStyle(
partialStyle):void
Defined in: Node.ts:225
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
children:
Node[]
Defined in: Node.ts:45
childrenDepth
childrenDepth:
number
Defined in: Node.ts:64
defaultCircleRadius
defaultCircleRadius:
number=10
Defined in: Node.ts:49
domID
readonlydomID:string
Defined in: Node.ts:101
expanded?
optionalexpanded:boolean
Defined in: Node.ts:61
frozen?
optionalfrozen:boolean
Defined in: Node.ts:59
fx?
optionalfx:number
Defined in: Node.ts:56
fy?
optionalfy:number
Defined in: Node.ts:57
id
readonlyid:string
Defined in: Node.ts:43
isChild
isChild:
boolean
Defined in: Node.ts:63
True if this node is a child within a collapsed cluster
isParent
isParent:
boolean
Defined in: Node.ts:66
True if this node has child nodes
parentNode?
optionalparentNode:Node
Defined in: Node.ts:68
Reference to the parent cluster node (if this node is a child)
visible
visible:
boolean
Defined in: Node.ts:60
vx?
optionalvx:number
Defined in: Node.ts:54
vy?
optionalvy:number
Defined in: Node.ts:55
weight?
optionalweight:number
Defined in: Node.ts:58
x?
optionalx:number
Defined in: Node.ts:52
y?
optionaly:number
Defined in: Node.ts:53