Skip to content

eles.symmetricDifference(other)

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

eles.symmetricDifference — Collection › Building and filtering

Preview · Collection › Building and filtering

Read in the complete API reference · All API members

// The elements in exactly one of the two collections
eles.symmetricDifference<OtherData = Data>(other: Collection<NodeData, EdgeData, OtherData>): Collection<NodeData, EdgeData, Data | OtherData>

The elements in exactly one of the two collections.

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

the other collection

Returns Collection<NodeData, EdgeData, Data | OtherData>

a new collection

Example

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

Example graph and handle setup

Also spelled eles.symdiff, eles.xor.