Skip to content

eles.components(root?)

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

eles.components — Collection › Traversing › Connected components

Preview · Collection › Traversing › Connected components

Read in the complete API reference · All API members

// Connected components within this collection (undirected), each as a collection of the reached nodes plus the collection's edges internal to that component
eles.components(root?: Collection | null): Collection<NodeData, EdgeData>[]

Connected components within this collection (undirected), each as a collection of the reached nodes plus the collection's edges internal to that component.

Parameters
NameDescription
root: Collection | null?

restricts the seed nodes; omit to seed from every node

Returns Collection<NodeData, EdgeData>[]

one collection per component

Example

console.log(eles.components().length); // 1

Example graph and handle setup

Also spelled eles.componentsOf.