import { Edge } from "./edge.js"; import { Node } from "./node.js"; import type { EdgeInterface, NodeInterface, GraphProps } from "./graph.js"; import { Graph } from "./graph.js"; import type { PlainGraphData } from "../graph-data/graph-data.js"; export type ClassicGraphProps = GraphProps & { data: PlainGraphData; }; /** Basic graph data structure */ export declare class ClassicGraph extends Graph { /** List object of nodes. */ private _nodeMap; /** List of object edges. */ private _edgeMap; /** * Identifies whether performing dirty check when streaming new data. If * the name of the graph is not specified, will fall back to current time stamp. */ private _name; /** Version the graph. A version is a number that is incremented every time the graph is updated. */ version: number; /** Cached data: create array data from maps. */ private _cache; private _suspendVersionUpdates; /** * The constructor of the graph class. * @param props - */ constructor(props: ClassicGraphProps); /** * Set graph name * @param name */ setGraphName(name: string): void; /** Get the name of the graph. Default value is the time stamp when creating this graph. * @return graph name. */ getGraphName(): string; /** * Perform a batch of operations defined by cb before indicating graph is updated * @param {function} cb - a callback function containing the operations to perform */ transaction(cb: (...args: unknown[]) => T): T; /** * Add a new node to the graph. * @paramnode - expect a Node object to be added to the graph. */ addNode(node: Node): void; /** * Batch add nodes to the graph. * @param nodes - a list of nodes to be added. */ batchAddNodes(nodes: Node[]): void; /** * Get all the nodes of the graph. * @return {Node[]} - get all the nodes in the graph. */ getNodes(): NodeInterface[]; /** * Get the node map of the graph. The key of the map is the ID of the nodes. * @return - a map of nodes keyed by node IDs. */ getNodeMap(): Record; /** * Find a node by id * @param nodeId The id of the node * @return Node */ findNode(nodeId: string | number): Node | undefined; findNodeById(nodeId: string | number): NodeInterface | undefined; /** * Update the indicated node to the provided value * @param node */ updateNode(node: Node): void; /** * Add a new edge to the graph. * @param edge - expect a Edge object to be added to the graph. */ addEdge(edge: Edge): void; /** * Batch add edges to the graph * @param edges - a list of edges to be added. */ batchAddEdges(edges: Edge[]): void; /** * Update the indicated edge to the provided value * @param edge */ updateEdge(edge: Edge): void; /** * Remove a node from the graph by node ID * @param nodeId - the ID of the target node. */ removeNode(nodeId: string | number): void; /** * Get all the edges of the graph. * @return get all the edges in the graph. */ getEdges(): EdgeInterface[]; destroy(): void; /** * Get the edge map of the graph. The key of the map is the ID of the edges. * @return - a map of edges keyed by edge IDs. */ getEdgeMap(): Record; /** * Remove an edge from the graph by the edge ID * @param {String|Number} edgeId - the target edge ID. */ removeEdge(edgeId: string | number): void; /** * Find the edge by edge ID. * @param id - the target edge ID * @return - the target edge. */ findEdge(edgeId: string | number): Edge; /** * Return all the connected edges of a node by nodeID. * @param nodeId - the target node ID * @return - an array of the connected edges. */ getConnectedEdges(nodeId: string | number): EdgeInterface[]; /** * Return all the sibling nodes of a node by nodeID. * @param nodeId - the target node ID * @return - an array of the sibling nodes. */ getNodeSiblings(nodeId: string | number): Node[]; /** * Get the degree of a node. * @param nodeId - the target node ID. * @return - the degree of the node. */ getDegree(nodeId: string | number): number; /** * Clean up all the nodes in the graph. */ resetNodes(): void; /** * Clean up all the edges in the graph. */ resetEdges(): void; /** * Clean up everything in the graph. */ reset(): void; /** * @deprecated Prefer interacting with this instance directly. */ getClassicGraph(): ClassicGraph; /** * Trigger an update to the graph. */ triggerUpdate(): void; /** * Return true if the graph is empty. * @return {Boolean} Return true if the graph is empty. */ isEmpty(): boolean; /** * Check the equality of two graphs data by checking last update time stamp * @param graph Another graph to be compared against itself * @return true if the graph is the same as itself. */ equals(graph: ClassicGraph): boolean; _bumpVersion(): void; _updateCache(key: 'nodes' | 'edges', updateValue: unknown): void; } //# sourceMappingURL=classic-graph.d.ts.map