Skip to content

eles.diff(other)

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

eles.diff — Collection › Building and filtering

Preview · Collection › Building and filtering

Read in the complete API reference · All API members

// Three-way set difference against another collection
eles.diff<OtherData = Data>(other: Collection<NodeData, EdgeData, OtherData>): { left: Collection<NodeData, EdgeData, Data>; right: Collection<NodeData, EdgeData, OtherData>; both: Collection<NodeData, EdgeData, Data>; }

Three-way set difference against another collection.

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

the collection to compare with

Returns { left: Collection<NodeData, EdgeData, Data>; right: Collection<NodeData, EdgeData, OtherData>; both: Collection<NodeData, EdgeData, Data>; }

{ left: only in this, right: only in other, both: in both }

Example

const result = cy.getElementById('a').diff(cy.getElementById('b'));
console.log(result.both.length); // 0

Example graph and handle setup