Skip to content

eles.difference(other)

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

eles.difference — Collection › Building and filtering

Preview · Collection › Building and filtering

Read in the complete API reference · All API members

// This collection's elements that are not in other
eles.difference(other: Collection): Collection<NodeData, EdgeData, Data>

This collection's elements that are not in other.

Parameters
NameDescription
other: Collection

the collection to subtract

Returns Collection<NodeData, EdgeData, Data>

a new collection

Example

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

Example graph and handle setup

Also spelled eles.not, eles.subtract, eles.unmerge, eles.relativeComplement.