DEMOS
DOCS
FEATURES
DOWNLOAD
PURCHASE
CONTACT
BLOG
Show:

Path Class

Models the path between two Nodes/Ports, which consists of a series of [Node/Port, Edge] pairs.

Methods

contains

(
  • Node/Port/Edge,
  • [doNotFuzzyMatchNodes=false]
)
Boolean

Returns whether or not a Path contains the given object.

Parameters:

  • Node/Port/Edge, Node | Port | Edge | String

    or object id, of the element to test for.

  • [doNotFuzzyMatchNodes=false] Boolean optional

    If true, will return true iff a given Node is on the Path. Otherwise, if the test object is a Node that has a Port on the Path, this method will return true.

Returns:

Boolean:

True if Path contains the object, false otherwise.

deleteAll

()

Deletes every object in this Path from the underlying Toolkit toolkit.

deleteEdges

()

Deletes every Edge in this Path from the underlying Toolkit toolkit.

deleteNodes

()

Deletes every Node in this Path from the underlying Toolkit toolkit. Note that this has the effect of also deleting all the Edges, so this is analogous to #deleteAll.

each

(
  • fn
)

Iterates through the path one step at a time. Each step consists of an object containing a vertex, and, for all entries except the first, an edge member, which supplies the Edge that links to the Vertex (which is why it is null for the first entry).

Parameters:

  • fn Function

    Function to call for each step. Arguments are (index, {vertex:v,edge:e}).

eachEdge

(
  • fn
)

Iterates through the Edges in the path one step at a time. There is always one fewer Edges than Nodes/Ports.

Parameters:

  • fn Function

    Function to call for each step. Arguments are (index, Edge).

eachNode

(
  • fn
)

Iterates through the Nodes/Ports in the path one step at a time.

Parameters:

  • fn Function

    Function to call for each step. Arguments are (index, Node|Port).

exists

() Boolean

Returns whether or not a given path exists.

Returns:

Boolean:

True if path exists, false otherwise.

getCost

() Number

Returns the cost of a given path, computed as the sum of the cost of all of the edges in the path.

Returns:

Number:

Total cost of the Path. Null if path does not exist.

getEdgeCount

() Integer

Gets the number of Edges in the Path.

Returns:

Integer:

Number of Edges in the Path.

getNodeAt

(
  • idx
)

Gets the Node at the given index in the path.

Parameters:

  • idx Object

Returns:

:

getNodeCount

() Integer

Gets the number of Nodes in the Path.

Returns:

Integer:

Number of Nodes in the Path.

isEmpty

() Boolean

Returns whether or not a given path is empty

Returns:

Boolean:

True if path is empty, false otherwise.

selectAllEdges

(
  • params
)

Select all edges in the toolkit toolkit.

Parameters:

  • params Object

    Parameters for the selectAllEdges call.

selectEdges

(
  • params
)

Select a set of edges.

Parameters:

  • params Object

    parameters for the select call

    • [source] Node | String optional

      Source Node or id of source Node from which to select Edges.

    • [target] Node | String optional

      Target Node or id of target Node from which to select Edges.

Properties

path

Graph.Path

The Path from the underlying Graph. See Graph documentation.