import type { NodeState } from "../core/constants.js"; import type { EdgeInterface, NodeInterface } from "./graph.js"; /** Properties for creating a new node */ export interface NodeOptions { /** the unique ID of the node */ id: number | string; selectable?: boolean; highlightConnectedEdges?: boolean; data?: Record; } /** Basic data structure of a node */ export declare class Node implements NodeInterface { readonly id: string | number; /** Keep a reference to origin data. */ private _data; /** List edges. */ private _connectedEdges; /** Interaction state of the node. */ state: NodeState; /** Can the node be selected? */ private _selectable; /** Should the state of this node affect the state of the connected edges? */ private _highlightConnectedEdges; /** Check the type of the object when picking engine gets it. */ readonly isNode = true; /** * The constructor of a node */ constructor({ id, selectable, highlightConnectedEdges, data }: NodeOptions); /** * Return the ID of the node * @return - the ID of the node. */ getId(): string | number; /** * Return the degree of the node -- includes in-degree and out-degree * @return {Number} - the degree of the node. */ getDegree(): number; /** * Return the in-degree of the node. * @return - the in-degree of the node. */ getInDegree(): number; /** * Return the out-degree of the node. * @return - the out-degree of the node. */ getOutDegree(): number; /** * Return all the IDs of the sibling nodes. * @return [description] */ getSiblingIds(): (string | number)[]; /** * Return all the connected edges. * @return - an array of the connected edges. */ getConnectedEdges(): EdgeInterface[]; /** * Return of the value of the selected property key. * @param key - property key. * @return - the value of the property or undefined (not found). */ getPropertyValue(key: string): unknown; /** * Set the new node data. * @param data - the new data of the node */ setData(data: Record): void; /** * Update a data property. * @param key - the key of the property * @param value - the value of the property. */ setDataProperty(key: string, value: unknown): void; /** * Set node state * @param state - the new interaction state of the node */ setState(state: NodeState): void; /** * Get node state * @returns state - the current interaction state of the node */ getState(): NodeState; /** * Add connected edges to the node * @param edge an edge or an array of edges to be added to this._connectedEdges */ addConnectedEdges(edge: EdgeInterface | EdgeInterface[]): void; /** * Remove edges from this._connectedEdges * @param edge an edge or an array of edges to be removed from this._connectedEdges */ removeConnectedEdges(edge: EdgeInterface | EdgeInterface[]): void; /** * Clear this._connectedEdges */ clearConnectedEdges(): void; isSelectable(): boolean; shouldHighlightConnectedEdges(): boolean; } //# sourceMappingURL=node.d.ts.map