Create a new GraphNetwork instance
DOM element ID to render the graph in
Configuration options
Update physics configuration and notify physics engine
Configuration key
New value
Start animation loop
Stop animation loop
Filter graph to show only specified node and its connections
ID of the node to filter by
Connection depth (defaults to config.filterDepth)
Reset filter to show all nodes
Reset all node positions to random locations
Reset view and layout
Zoom in towards the center
Optionalfactor: numberZoom factor (defaults to config-based calculation)
Zoom out from the center
Optionalfactor: numberZoom factor (defaults to config-based calculation)
Zoom to fit all nodes in the viewport
Padding around the content (default: 50px)
Toggle between light and dark themes
Hide tooltip
Configure tooltip behavior
Tooltip configuration
Clear all graph data
Add a single node to the graph with enhanced validation and positioning options
Node data to add
Creation options including initial position
Delete a node from the graph with enhanced orphaned edge handling
ID of the node to delete
Deletion options including animation and redraw control
Add an edge to the graph with enhanced validation and ID tracking
Edge data with required ID
Creation options
Delete an edge from the graph by ID
ID of the edge to delete
Deletion options
Remove a link from the graph by source and target (backward compatibility)
Source node ID
Target node ID
Whether to redraw the graph (default: true)
Get edge by ID
Edge ID
Edge data or null if not found
Check if node exists
Node ID
True if node exists
Check if edge exists
Edge ID
True if edge exists
Update an existing node's properties
ID of the node to update
Partial node data with updates
Update options
Update an existing edge's properties
ID of the edge to update
Partial edge data with updates
Update options
Update multiple nodes in bulk with intelligent batching
Array of node updates with IDs
Bulk update options
Array of successfully updated node IDs
Update multiple edges in bulk with intelligent batching
Array of edge updates with IDs
Bulk update options
Array of successfully updated edge IDs
Enhanced setData with smooth transitions and position preservation
Graph data containing nodes and edges
Data replacement options with animation and layout control
Merge new data with existing graph data intelligently
Graph data to merge
Merge options with conflict resolution
Clear all data from the graph with optional animation
Clear options with animation support
Replace all data atomically - alias for setData for clarity
New graph data
Replacement options
Start a new transaction for atomic operations
Transaction ID for tracking
Commit the current transaction, applying all changes
Transaction summary
Rollback the current transaction, undoing all changes
Transaction summary
Check if currently in a transaction
True if transaction is active
Get graph statistics and metrics
Graph statistics
Update multiple configuration options
Configuration updates
Export graph data in various formats
Export options
Exported data or initiates download
Select a single node
ID of node to select
Optionaloptions: SelectionOptionsSelection options
True if selection changed
Select multiple nodes
Array of node IDs to select
Optionaloptions: SelectionOptionsSelection options
Array of newly selected node IDs
Select a single edge
ID of edge to select
Optionaloptions: SelectionOptionsSelection options
True if selection changed
Select multiple edges
Array of edge IDs to select
Optionaloptions: SelectionOptionsSelection options
Array of newly selected edge IDs
Deselect a node
ID of node to deselect
True if deselection changed
Deselect an edge
ID of edge to deselect
True if deselection changed
Clear all selections
Toggle node selection
ID of node to toggle
True if selection state changed
Toggle edge selection
ID of edge to toggle
True if selection state changed
Check if node is selected
ID of node to check
True if node is selected
Check if edge is selected
ID of edge to check
True if edge is selected
Get all selected node IDs
Array of selected node IDs
Get all selected edge IDs
Array of selected edge IDs
Set selection mode
Selection mode
Get current selection mode
Current selection mode
Set style for a specific node
ID of node to style
Node styles to apply
Set style for a specific edge
ID of edge to style
Edge styles to apply
Update styles for multiple elements
Element selector
Styles to apply
Reset styles to defaults
Optionalelements: ElementSelectorElements to reset (optional, resets all if not provided)
Get current style for a node
ID of node
Node styles or null if not found
Get current style for an edge
ID of edge
Edge styles or null if not found
Highlight a single node
ID of node to highlight
Optionalstyle: HighlightStyleHighlight style options
Highlight multiple nodes
Array of node IDs to highlight
Optionalstyle: HighlightStyleHighlight style options
Highlight a single edge
ID of edge to highlight
Optionalstyle: HighlightStyleHighlight style options
Highlight multiple edges
Array of edge IDs to highlight
Optionalstyle: HighlightStyleHighlight style options
Highlight shortest path between two nodes
Source node ID
Target node ID
Optionaloptions: PathHighlightOptionsPath highlight options
Array of highlighted element IDs or null if no path found
Highlight neighbors of a node
ID of node whose neighbors to highlight
Optionaloptions: NeighborHighlightOptionsNeighbor highlight options
Array of highlighted element IDs
Highlight all connections for a node
ID of node whose connections to highlight
Optionalstyle: HighlightStyleHighlight style options
Array of highlighted element IDs
Clear all highlights
Clear highlight for a specific node
ID of node to clear highlight
Clear highlight for a specific edge
ID of edge to clear highlight
Check if node is highlighted
ID of node to check
True if node is highlighted
Check if edge is highlighted
ID of edge to check
True if edge is highlighted
Get all highlighted node IDs
Array of highlighted node IDs
Get all highlighted edge IDs
Array of highlighted edge IDs
Focus on a single node with smooth animation
ID of node to focus on
Optionaloptions: FocusOptionsFocus animation options
Promise that resolves when animation completes
Focus on multiple nodes by fitting them in view
Array of node IDs to focus on
Optionaloptions: FocusOptionsFocus animation options
Promise that resolves when animation completes
Fit entire graph to view with padding
Optionalpadding: numberPadding around graph in pixels
Promise that resolves when animation completes
Center the view on the graph center
Promise that resolves when animation completes
Check if camera animation is currently running
True if animation is active
Stop current camera animation
Add event listener
Event name
Event callback
Remove event listener
Event name
Event callback to remove
Emit event to all listeners
Event name
Event data
Convert this graph to a serializable object for debugging
Object representation of the graph state
Clean up and destroy the graph
Set the current theme
Theme name or ThemeConfig object
Get list of available theme names
Array of available theme names
Register a new custom theme
Theme name
Theme configuration
Update the current theme with partial configuration
Partial theme updates to apply
Set custom style for a specific node type
Node type to style
Style configuration
Set custom style for a specific edge type
Edge type to style
Style configuration
Enable or disable automatic color generation for undefined node types When enabled, node types without explicit color definitions will automatically receive visually distinct colors using a golden ratio algorithm.
Whether to enable auto-coloring
Check if automatic color generation is enabled
true if auto-coloring is enabled
Set visual state for an element
ID of the element (node or edge)
Visual state to apply
Whether to enable or disable the state
Get the theme manager instance for advanced usage
ThemeManager instance
Get current grid configuration
Create a string representation of the graph network
String representation
GraphNetwork - Modern modular interactive SVG graph visualization library
Enhanced with full TypeScript support, comprehensive API, and modular architecture. Orchestrates physics simulation, rendering, UI management, and user interactions.
Example