Skip to content

ele.component()

eles.component — Collection > Traversing > Connected components. Cytoscape.js signatures, parameters and return contract.

eles.component — Collection › Traversing › Connected components

Preview · Collection › Traversing › Connected components

Read in the complete API reference · All API members

// The whole-graph connected component containing the first element
ele.component(): Collection<NodeData, EdgeData>

The whole-graph connected component containing the first element.

Returns Collection<NodeData, EdgeData>

the component as nodes and their connecting edges, computed over the whole graph rather than within this collection; an empty collection when this one is empty

Example

console.log(eles.component().map(ele => ele.id())); // ["a","b","c","ab","bc"]

Example graph and handle setup