Skip to content
  1. API

EdgeList

Ogma edge list class. Use this class to manipulate a list of edges, change data, attributes, etc.

  • edgeList.isNode

Read-only property that is always false.

  • edgeList.size

Read-only property that indicates the number of edges in the list.

edgeList.addClass(className[, options])

Add the specified class to the edges.

Arguments

Returns

edgeList.addClasses(classNames[, options])

Add the specified classes to the edges.

Arguments

Returns

edgeList.concat(edges)

Arguments

Returns

edgeList.dedupe()

Returns a new EdgeList which does not contain any duplicate edge.

Returns

edgeList.fillData([property], value)

Set the specified data property of the edges with the same value.

Arguments

  • property(optional) PropertyPath|any Path of the data property to update. If no property is specified, update the whole data object.
  • value any Value that will be assigned to all the edges.

Returns

edgeList.filter(callback)

Arguments

  • callback function(edge: Edge, index: number): boolean

Returns

edgeList.forEach(callback)

Arguments

  • callback function(edge: Edge, index: number)

edgeList.get(index)

Returns the edge at the specified index.

Arguments

  • index number

Returns

edgeList.getAdjacentElements()

Retrieves the list of edges parallel to the edges, excluding the source edges themselves plus the extremities of the edges.

Returns

edgeList.getAttribute(attributeName)

Returns an array containing the value of the specified attribute for each edge.

Arguments

Returns

  • any[]

edgeList.getAttributes([attributes])

Returns an array of objects containing the specified attributes for each edge.

Arguments

  • attributes(optional) PropertyPath[] List of attributes to include in the object. If not specified, includes all the edge attributes.

Returns

edgeList.getBoundingBox([options])

Returns the bounding box of the edges, in graph coordinates.

Arguments

  • options(optional) object
    • ignoreCurvature(optional) boolean[=false] Use it if you want to only take into account the edge sources and targets.
    • includeTexts(optional) boolean[=false] Wether or not take texts in account in the bouding box

Returns

edgeList.getClassList()

Returns the list of classes that each edge has.

Returns

  • Array<Array<string>>

edgeList.getData([property])

Retrieve the specified data property. If no property is specified, retrieve the whole data object. This method method returns the internal data object; modifying it could cause unexpected behavior.

Arguments

Returns

  • Array<any>

edgeList.getExtremities()

Returns a NodeList containing the sources and targets of the edges. Duplicate nodes are not removed.

Returns

edgeList.getId()

Returns the id of each edge.

Returns

edgeList.getMetaEdge()

Run getMetaEdge on each edge in the list and returns the array of results.

Returns

edgeList.getParallelEdges([options])

Retrieves the list of edges parallel to the edges, including the source edges themselves.

Arguments

  • options(optional) object
    • filter(optional) Filter[="visible"] Indicates which edges to take into account

Returns

edgeList.getSource()

Returns the list of source nodes of the edges

Returns

edgeList.getSubEdges()

Run getSubEdges on all the edges in the list and returns the array of results

Returns

edgeList.getTarget()

Returns the list of target nodes of the edges

Returns

edgeList.includes(edge)

Indicates if the EdgeList contains the specified edge.

Arguments

Returns

  • boolean

edgeList.inverse()

Returns a new EdgeList containing all the visible edges that are not in the list.

Returns

edgeList.isSelected()

Indicates if the edges are currently selected.

Returns

  • Array<boolean>

edgeList.isVisible()

Call isVisible on each edge in the list, and returns the array of results.

Returns

  • Array<boolean>

edgeList.locate([options])

Centers the view on the edges.

Arguments

Returns

  • Promise<void>

edgeList.map(callback)

Arguments

  • callback function(edge: Edge, index: number): any

Returns

  • Array<any>

edgeList.pulse([options])

Highlights the edges. It's a shorthand for the case when you want the elements pulse for number * (interval - 1) + duration milliseconds. It will also update the pulse attributes of the items with the one provided in the .pulse() call

Arguments

  • options(optional) object
    • duration(optional) number[=1000] Duration of a pulse (milliseconds)
    • endColor(optional) Color|"inherit"[="rgb(0,0,0,0.0)"] Ending color of the pulse
    • endRatio(optional) number[=2] Where the pulse ends, relative to the edge siz (1 = at the edge's border)
    • interval(optional) number[=800] Interval between two pulses (milliseconds)
    • number(optional) number[=1] Number of pulses
    • startColor(optional) Color|"inherit"[="rgb(0,0,0,0.6)"] Starting color of the pulse
    • startRatio(optional) number[=1] Where the pulse starts, relative to the edge siz (1 = at the edge's border)
    • width(optional) number[=10] Width of the pulse in pixels

Returns

edgeList.reduce(callback, initialValue)

Arguments

  • callback function(accumulator: any, currentValue: Edge, index: number): any
  • initialValue any

Returns

  • any

edgeList.removeClass(className[, options])

Remove the specified class from the edges.

Arguments

Returns

edgeList.removeClasses(classNames[, options])

Remove the specified class from the edges.

Arguments

Returns

edgeList.resetAttributes([attributes][, options])

Remove all attributes that have been applied through setAttributes of all the edges in the list. Original attributes or attributes applied by the rules are not affected.

Arguments

Returns

edgeList.setAttribute(attribute, value[, options])

Set the specified attribute of all the edges in the list.

Arguments

  • attribute PropertyPath
  • value any|Array<any> If it is an array, the values will be spread across the edges of the list. Otherwise the value will be assigned to all edges.
  • options(optional) AttributeAnimationOptions

Returns

edgeList.setAttributes(attributes[, options])

Set the individual attributes of all the edges in the list.

Arguments

Returns

edgeList.setData([property], values)

Set the specified data property of the edges. If no property is specified, update the whole data object.

Arguments

  • property(optional) PropertyPath Path of the data property to update.
  • values Array<any>|function(edge: Edge): any If it's an array, each value is assigned to the corresponding edge, meaning the array must have the same length as the EdgeList. If it's a function, it will be applied to each edge to

Returns

  • EdgeList Determine which value to assign.

edgeList.setSelected(active)

Arguments

  • active boolean|Array<boolean> Whether to select or unselect the edges.

edgeList.setVisible()

Call setVisible on each edge in the list.

edgeList.slice([start][, end])

Returns a new EdgeList which contains only the edges from index start to end (excluding end).

Arguments

  • start(optional) number
  • end(optional) number

Returns

edgeList.subtract([list])

Arguments

  • list(optional) EdgeList Returns a new EdgeList which does not contain any element from list

Returns

edgeList.toArray()

Returns an array of edges from the EdgeList.

Returns

edgeList.toJSON([options])

Runs toJSON on all the edges in the list and returns the list of objects.

Arguments

  • options(optional) object
    • attributes(optional) Array<PropertyPath>|"all"[=[]]
    • data(optional) function (data: any): any

Returns

edgeList.toList()

Returns itself.

Returns