The HTMLElement that will serve as the main container for the graph.
Optionaldata: RelaxedGraphDataThe graph data, including nodes and edges, to render.
Optionaloptions: Partial<GraphOptions.GraphOptions>Optional configuration for the graph's behavior, UI, styling, simulation, etc.
Adds an edge to the graph.
Both the source (from) and target (to) nodes must already exist in the graph.
Throws an error if an edge with the same ID already exists.
Destroy all UI components.
The ID of the app
Retrieves an edge from the graph by its ID.
Returns a deep clone of the edge to prevent external mutations.
The ID of the edge.
A cloned Edge if found, otherwise undefined.
Returns the number of edges currently in the graph.
The total edge count.
Retrieves all edges in the graph.
Returns clones of the edges to prevent external modifications.
An array of cloned Edge objects.
Retrieves an edge from the graph by its ID.
Returns the actual edge instance, allowing direct modifications.
Warning: Directly modifying edges using this method may lead to unexpected behavior.
It is generally safer to use getEdge which returns a cloned instance.
The ID of the edge.
The Edge if found, otherwise undefined.
Retrieves a node from the graph by its ID.
Returns the actual node instance, allowing direct modifications.
Warning: Directly modifying nodes using this method may lead to unexpected behavior.
It is generally safer to use getNode which returns a cloned instance.
The ID of the node or a Node object.
The Node if found, otherwise undefined.
Retrieves all nodes in the graph.
Returns the actual node instances, allowing direct modifications.
An array of Node objects.
Returns the number of nodes currently in the graph.
The total node count.
Retrieves all nodes in the graph.
Returns clones of the nodes to prevent external modifications.
An array of cloned Node objects.
Returns the current configuration options of the graph.
Trigger the next render update of the graph.
Removes an edge from the graph by its ID.
The ID of the edge to remove.
Triggers onChange after the edge is removed.
Removes a node from the graph by its ID.
Also removes any edges connected to the node.
The ID of the node to remove.
Triggers onChange after the node and its edges are removed.
Replaces all current nodes and edges in the graph with the provided data.
Clears existing nodes and edges before setting the new ones.
Triggers the onChange callback after the update.
Updates the graph with new nodes and/or edges.
Existing nodes or edges with matching IDs are replaced; new ones are added.
Triggers the onChange callback if any updates were applied.
Initializes a graph inside the specified container using the provided data and options.