Skip to content

cy.remove(eles)

cy.remove — Core > Graph manipulation > Adding, removing and reconciling. Cytoscape.js signatures, parameters and return contract.

cy.remove — Core › Graph manipulation › Adding, removing and reconciling

Preview · Core › Graph manipulation › Adding, removing and reconciling

Read in the complete API reference · All API members

// Remove elements from the graph
cy.remove<Data>(eles: Collection<NodeData, EdgeData, Data>): Collection<NodeData, EdgeData, Data>

Remove elements from the graph. Removing a node removes its connected edges, and removing a compound parent removes its descendants. Equivalent to eles.remove().

Parameters
NameDescription
eles: Collection<NodeData, EdgeData, Data>

the elements to remove

Returns Collection<NodeData, EdgeData, Data>

the removed elements

Example

cy.remove(cy.getElementById('c'));
console.log(cy.hasElementWithId('c')); // false

Example graph and handle setup