Skip to content

eles.union(other)

eles.union — Collection > Building and filtering. Cytoscape.js signatures, parameters and return contract.

eles.union — Collection › Building and filtering

Preview · Collection › Building and filtering

Read in the complete API reference · All API members

// The union of the two collections, deduped
eles.union<OtherData = Data>(other: Collection<NodeData, EdgeData, OtherData>): Collection<NodeData, EdgeData, Data | OtherData>

The union of the two collections, deduped.

Parameters
NameDescription
other: Collection<NodeData, EdgeData, OtherData>

the collection to add

Returns Collection<NodeData, EdgeData, Data | OtherData>

a new collection holding both sets

Example

const other = cy.getElementById('b');
console.log(cy.getElementById('a').union(other).map(ele => ele.id())); // ["a","b"]

Example graph and handle setup

Also spelled eles.u, eles.or, eles.add, eles.merge.