Link Data (RGLink)
RGLink is a runtime-derived, read-only relationship object.
It is generated from line data and provides convenient access to both endpoints plus render-related metadata.
1. Key Characteristics
- You do not create
RGLinkdirectly. - You cannot update
RGLinkdirectly. - Update line/node data, then link data is recalculated automatically.
2. How to Get RGLink
const links = graphInstance.getLinks();
const link = graphInstance.getLinkByLineId('line-a-b');
3. Core Fields
lineId: stringline: RGLinefromNode: RGNodetoNode: RGNodetotalLinesBetweenNodes: numbercurrentLineIndex: numberrgShouldRender?: booleanrgCalcedVisibility?: boolean
4. Why RGLink Is Useful
RGLink is ideal when handling line events or building analysis logic:
- find both endpoint node objects quickly
- understand multi-line ordering between same node pair
- read runtime visibility/render status
Example in line click event:
const onLineClick = (lineObject, linkObject, event) => {
console.log('from:', linkObject.fromNode.id);
console.log('to:', linkObject.toNode.id);
console.log('index:', linkObject.currentLineIndex, '/', linkObject.totalLinesBetweenNodes);
};
5. Read-Only Data Flow
Correct update path:
- update
RGLine/ node data - engine recalculates relation runtime state
RGLinkreflects latest state
6. Practical Notes
- Treat
RGLinkas computed relationship context. - For persistence/export, save node/line/fakeLine data, not
RGLink. - Use
RGLinkprimarily in event handlers, inspectors, and runtime analysis tools.