Skip to content

eles.connectedEdges(criterion?)

eles.connectedEdges — Collection > Traversing > Incidence and neighbourhood. Cytoscape.js signatures, parameters and return contract.

eles.connectedEdges — Collection › Traversing › Incidence and neighbourhood

Preview · Collection › Traversing › Incidence and neighbourhood

Read in the complete API reference · All API members

// Every edge incident on the nodes in this collection, deduped — answered off the CSR adjacency index, so it is O(incident edges) rather than a scan
eles.connectedEdges(criterion?: FilterLike<NodeData, EdgeData, EdgeData, NodeData | EdgeData>): Collection<NodeData, EdgeData, EdgeData>

Every edge incident on the nodes in this collection, deduped — answered off the CSR adjacency index, so it is O(incident edges) rather than a scan. Loops appear once.

Parameters
NameDescription
criterion: FilterLike<NodeData, EdgeData, EdgeData, NodeData | EdgeData>?

an optional query object or predicate to filter the result

Fields of criterion
NameDescription
group: GroupName?

restrict to one group

selected: boolean?

require the element (not) to be selected

selectable: boolean?

whether the element may be selected by the user

locked: boolean?

whether the element is locked in place

grabbed: boolean?

whether the user is dragging the element

grabbable: boolean?

whether the element may be dragged

active: boolean?

whether the element is under an active press

hovered: boolean?

whether the pointer is over the element

emphasized: boolean?

whether the element is in the current emphasis (* cy.emphasize())

parent: boolean?

structural (nodes only): has at least one child

childless: boolean?

structural (nodes only): has no children — exactly { parent: false }

child: boolean?

structural (nodes only): has a parent

orphan: boolean?

structural (nodes only): has no parent — exactly { child: false }

collapsed: boolean?

whether this compound parent is in collapsed miniature state (nodes only)

data: QueryData<Data>?

data-sidecar conditions per key; a bare value means equality. Typed, the keys are the queried elements' fields.

Returns Collection<NodeData, EdgeData, EdgeData>

the incident edges

Example

console.log(eles.connectedEdges().map(ele => ele.id())); // ["ab","bc"]

Example graph and handle setup