Graph Interface
The Graph interface is the runtime abstraction consumed by the graph-layers module. It presents a
stable API for enumerating nodes and edges plus inspecting or mutating their state through
NodeInterface and EdgeInterface. Concrete implementations such as
ClassicGraph and TabularGraph provide different storage
strategies while conforming to the same contract.
Shape
version
number — Monotonically increasing revision counter supplied by the graph implementation. The
value updates whenever nodes, edges, or their state change.
getNodes()
Returns an iterable sequence of NodeInterface instances.
getEdges()
Returns an iterable sequence of EdgeInterface instances.
findNodeById(id) (optional)
Returns a node handle with the provided identifier when supported by the implementation.
destroy() (optional)
Releases any resources owned by the graph implementation.
GraphProps
Graph constructors accept an optional GraphProps object to register callbacks for graph data lifecycle changes. The callbacks mirror the legacy DOM events and include:
onTransactionStart/onTransactionEndonNodeAdded/onNodeRemoved/onNodeUpdatedonEdgeAdded/onEdgeRemoved/onEdgeUpdated
Implementations expose setProps and updateProps helpers for updating these callbacks at runtime. Layout lifecycle hooks (onLayoutStart, onLayoutChange, onLayoutDone, onLayoutError) are configured on the GraphEngine, GraphLayout, and GraphLayer props instead of the graph itself.
NodeInterface
Nodes returned by getNodes() implement the following methods:
getId()— Returns the node identifier supplied by the data source.getConnectedEdges()— Returns the edges that reference the node.getDegree(),getInDegree(),getOutDegree()— Connectivity helpers.getSiblingIds()— Returns the identifiers of nodes connected via an edge.getPropertyValue(key)— Reads a property exposed by the underlying data source.setData(data)/setDataProperty(key, value)— Update the node-specific data payload.setState(state)/getState()— Update or read the logical state (e.g.hover,selected).isSelectable()— Whether the runtime may select the node.shouldHighlightConnectedEdges()— Whether connected edges should be highlighted.
EdgeInterface
Edges returned by getEdges() implement the following methods:
getId()— Returns the edge identifier supplied by the data source.isDirected()— Indicates whether the edge direction should be considered.getSourceNodeId()/getTargetNodeId()— Node identifiers referenced by the edge.getConnectedNodes()— Returns the nodes that the edge currently references.addNode(node)/removeNode(node)— Mutate the set of connected nodes.getPropertyValue(key)— Reads a property exposed by the underlying data source.setData(data)/setDataProperty(key, value)— Update the edge-specific data payload.setState(state)/getState()— Update or read the logical state (e.g.hover,selected).
Refer to the TabularGraph and ClassicGraph reference
pages for implementation specific guidance.