DEMOS
DOCS
FEATURES
DOWNLOAD
PURCHASE
CONTACT
BLOG
Show:

Edge Class

This is an Edge in the graph. There can be one or zero of these for every pair of Nodes/Ports in the Graph. Each Edge has an associated "cost", and may be either bidirectional or unidirectional.

Constructor

Edge

(
  • params
)

Parameters:

  • params Object

    Edge parameters.

    • [data] Object optional

      Optional backing data for the edge.

    • source Node | Port

      Edge's source.

    • target Node | Port

      Edge's target.

    • [cost=1] Number optional

      Edge's cost. Defaults to 1.

    • [directed] Boolean optional

      Whether or not the Edge is directed. Default is true.

Methods

getCost

() Number

Gets the cost for this edge. Defaults to 1.

Returns:

Number:

Edge cost.

getId

() Number

Gets the id for this Edge.

Returns:

Number:

Edge id.

inspect

() String

Returns a string representation of the Edge.

Returns:

String:

Edge dumped to a string.

isDirected

() Boolean

Gets whether or not the Edge is directed.

Returns:

Boolean:

True if the Edge is directed (unidirectional), false otherwise.

setCost

(
  • c
)

Sets the cost for this edge.

Parameters:

  • c Number

    Edge cost.

setDirected

()

Sets whether or not the Edge is directed.

Properties

data

Object

Data for the Edge.

source

Node | Port

Source of the Edge.

target

Node | Port

Target of the Edge.