-
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: number
x-coordintae of node. -
y: number
y-coordintae of node. -
radius: number
Radius of the node. -
adjacentcyList: Edge[]
Adjacency list of the node. ( type Edge = { node: Node; line: Line; weight?: number; } )
-
label: string
Label inside node -
color: number
Color of the node
label: ""
color: 0xfaa307
- none
-
isAdjacentTo(node: Node): boolean
Returns whether this node is adjacent to another node -
connectTo(other: Node, options?: {directed: false, value: number, color: 0x080007}): void
Connect this node to other node with an edge -
disconnectFrom(other: Node): void
Removes 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): void
Adds weight to the edge between two nodes -
static setEdgeWeight(node: Node, other: Node, value: number): void
Sets weight for the edge between two nodes -
setLabel(label: string): void
Sets the label for this node -
static setColor(node: Node, color: number): void
Sets the color of this node -
static setEdgeColor(node: Node, other: Node, color: number): void
Sets the color of the edge between two nodes -
getEdge(other: Node): (Edge | null)
Returns the edge between this and other node