DEMOS
DOCS
FEATURES
DOWNLOAD
PURCHASE
CONTACT
BLOG
Show:

Port Class

Extends Node

A Port resides on a Node, and may be the source/target of one or more connections. A convenient way to think of Ports is as the columns in a database table: they belong to a table, but it is the columns themselves that have relationships with other columns.

Constructor

Port

()

Methods

addEdge

(
  • edge
)

Inherited from Node:

Adds an Edge to the Node.

Parameters:

  • edge Edge

    The Edge to add.

addGraph

(
  • g
)
Graph

Inherited from Node:

Adds a sub-graph to this node. If you provide an existing Graph instance that does not have an id, one will be assigned.

Parameters:

  • g Graph | String

    Either a Graph instance, or the id you wish to assign to a new Graph.

Returns:

Graph:

The Graph that was added.

addPort

(
  • [data]
  • [idFunction]
)
Port

Inherited from Node:

Adds a Port to the Node.

Parameters:

  • [data] Object optional

    Optional data backing the Port. This object can be of any type you like.

  • [idFunction] Function optional

    Optional function that can take a Port's data and return its ID. By default this looks for an id member in the backing data.

Returns:

Port:

The newly created Port.

deleteEdge

(
  • edge
)

Inherited from Node:

Deletes an Edge from the Node.

Parameters:

  • edge Edge

    The Edge to delete.

filter

(
  • spec
  • [includePartials=false]
)
Selection

Inherited from Node:

Gets a Selection that is a filtered set of Nodes and Edges.

Parameters:

  • spec Object | Function

    Either a function, which will be passed each Edge and Node and is expected to return true to indicate inclusion, or an object consisting of key/value pairs, all of which are expected to match the data for any Edge or Node that should be included in the output.

  • [includePartials=false] Boolean optional

    If true, and you're using a match object, the results will include any objects that match at least one key in the match object.

Returns:

Selection:

A Selection.

getAllEdges

(
  • [params]
)
Edge[]

Inherited from Node:

Parameters:

  • [params] Object optional

    Method parameters.

    • [filter] Function optional

      Optional Edge filter.

Returns:

Edge[]:

List of Edges.

getEdges

(
  • params
)
Edge[]

Inherited from Node:

Gets all Edges where this Node is either the source or the target of the Edge. Note that this does not retrieve Edges on any Ports associated with this Node - for that, @see #getAllEdges.

Parameters:

  • params Object

    Method parameters.

    • [filter] Function optional

      Optional Edge filter.

Returns:

Edge[]:

List of edges.

getFullId

() String

Inherited from Node

Overrides the getFullId of Node to return a value in dotted notation of the form nodeId.portId.

Returns:

String:

The Port's "full" id, ie. the Port's id prepended by the parent Node's id, eg "BooksTable.idColumn"``.

getGraph

() Graph

Inherited from Node:

Retrieves a sub-graph by id.

Returns:

Graph:

Sub-graph with the given id, null if not found.

getIndegreeCentrality

() Float

Inherited from Node:

Gets this Node's "indegree" centrality; a measure of how many other Nodes are connected to this Node as the target of some Edge.

Returns:

Float:

Indegree centrality for the Node.

getInternalEdge

(
  • source
  • target
)
Object

Inherited from Node:

Gets an "internal" Edge from one Port to another.

Parameters:

  • source Port | String

    Source Port.

  • target Port | String

    Target Port.

Returns:

Object:

An object containing { source:..., target:..., cost:..., directed:... }.

getNode

() Node

Gets the Node this Port belongs to.

Returns:

Node:

The Node this Port belongs to.

getOutdegreeCentrality

() Float

Inherited from Node:

Gets this Node's "outdegree" centrality; a measure of how many other Nodes this Node is connected to as the source of some Edge.

Returns:

Float:

Outdegree centrality for the Node.

getPort

(
  • id
)
Port

Inherited from Node:

Gets the Port with the given id, null if nothing found.

Parameters:

  • id String

    Port id.

Returns:

Port:

Port with the given id, or null if not found.

getPorts

() Port[]

Inherited from Node:

Gets all Ports associated with this Node.

Returns:

Port[]:

List of Ports, empty list if none registered.

getSourceEdges

() Edge[]

Inherited from Node:

Gets all Edges where this Node is the source.

Returns:

getTargetEdges

() Edge[]

Inherited from Node:

Gets all Edges where this Node is the target.

Returns:

inspect

() String

Inherited from Node:

Returns a string representation of the Node.

Returns:

String:

Node dumped to a string.

isChildOf

(
  • node
)
Boolean

Parameters:

  • node Node

    Node to test if this is a child.

Returns:

Boolean:

True if this Port is a child of the given Node, false otherwise.

removePort

(
  • Either
)

Inherited from Node:

Removes the given Port.

Parameters:

  • Either Port | String

    a Port, or a Port id.

setDefaultInternalCost

(
  • cost
)

Inherited from Node:

Sets the default cost of travelling from one Port to another inside some Node. When a Node is created, this value is set to 1.

Parameters:

  • cost Number

    Default internal cost.

setInternalEdge

(
  • source
  • target
  • cost
  • [directed]
)

Inherited from Node:

Sets the cost and directedness of some internal Edge.

Parameters:

  • source Port | String

    Source Port.

  • target Port | String

    Target Port.

  • cost Number

    Cost to set. If you leave this as null, the default will be used.

  • [directed] Boolean optional

    Whether or not the internal Edge is directed.

setPort

(
  • id
  • data
)

Inherited from Node:

Sets the underlying data for the Port with the given id. If the Port does not yet exist, it is created.

Parameters:

  • id String

    Id of the Port for which to set data.

  • data Object

    Data to set for the Port.

Properties

data

Object

Inherited from Node:

Data associated with the Node.

id

String

Inherited from Node:

The Node's id. A String.

id The Port's id. This must be unique on a Node, but not necessarily unique with a given Graph.

String