English
@eightkk/vue-weave / core / cloneGraphElements
Function: cloneGraphElements()
cloneGraphElements<
N,E>(nodes,edges,nodeIds,options):GraphCloneResult<N,E>
Defined in: src/core/graphEditing.ts:83
Copies the nodes listed in nodeIds and every edge whose source and target are both among them, in input order. Copies are shallow: they keep every field (ports, data, labels) and only receive new IDs from options.createId, and copied edges point at the copied nodes. Saved positions of the source nodes are moved by options.offset and returned under the new IDs, and the waypoints (points) of copied edges are moved by the same offset so routes keep their shape. Duplicate IDs in nodeIds are ignored. Throws an Error for an invalid graph, an unknown node ID, or a new ID that is empty, repeated or already used by a node (or edge) of the input, and a RangeError for a non-finite offset, copied position or copied waypoint. The input arrays, maps and waypoints are not modified.
Type Parameters
N
N extends IdentifiedNode
E
E extends GraphEdge<unknown>
Parameters
nodes
readonly N[]
edges
readonly E[]
nodeIds
Iterable<string>
options
Returns
GraphCloneResult<N, E>