-
Notifications
You must be signed in to change notification settings - Fork 0
3.11 Node
Jonas de Luna Skulberg edited this page Aug 7, 2024
·
4 revisions
A node which can connect to other nodes with directed and undirected edges.
- Circle
- none
-
x: numberx-coordintae of node. -
y: numbery-coordintae of node. -
radius: numberRadius of the node. -
adjacentcyList: Edge[]Adjacency list of the node. ( type Edge = { node: Node; line: Line; weight?: number; } )
-
label: stringLabel inside node -
color: numberColor of the node
label: ""
color: 0xfaa307
- none
-
isAdjacentTo(node: Node): booleanReturns whether this node is adjacent to another node -
connectTo(other: Node, options?: {directed: false, value: number, color: 0x080007}): voidConnect this node to other node with an edge -
disconnectFrom(other: Node): voidRemoves edge between this and other node -
getEdgeWeight(other: Node): (number | undefined)Returns weight of edge between this and other node -
static addEdgeWeight(node: Node, other: Node, value: number): voidAdds weight to the edge between two nodes -
static setEdgeWeight(node: Node, other: Node, value: number): voidSets weight for the edge between two nodes -
setLabel(label: string): voidSets the label for this node -
static setColor(node: Node, color: number): voidSets the color of this node -
static setEdgeColor(node: Node, other: Node, color: number): voidSets the color of the edge between two nodes -
getEdge(other: Node): (Edge | null)Returns the edge between this and other node