Copyright © 2021 by K4.org
  (v.0.48.124)

This Design wraps the Graphology graph theory library. It uses the binder/breaker pattern like DynamicList. The graph can be created either by supplying the nodeData and edgeData, by referencing an existing graph to copy, or by directly calling addNode and edgeNode to build the graph.

Index

Rules

allEdges

allEdges: Array

move to DynamicPointGraph

Flags : cached

Expression : `const g = this.theGraph; const allEdges = g.edges(); let source = ""; let target = ""; let sourcePoint; let targetPoint; let result = [];

for (let j = 0; j < allEdges.length; j++) { const edge = allEdges[j]; source = g.source(edge); target = g.target(edge); if(source != target){ sourcePoint = g.getNodeAttribute(g.source(edge),'data'); targetPoint = g.getNodeAttribute(g.target(edge),'data'); result.push({"edge": edge, "source": source, "target": target, "sourcePoint": sourcePoint, "targetPoint": targetPoint}); } } result = R.removeDuplicates(result); return result;`

edgeData

edgeData: Array

An array of edge descriptions, where each edge is an array of three items: a source index, a target index, and an object containing custom data for the edge. The indexes are into the nodeData array. For a weighted graph, the custom data should contain a property with the weightAttributeName, for use by the algorithms to compute the cost of routes. This can only be supplied if nodeData is supplied. This is optional; if no edges are supplied, the graph starts without any, and they can be created using calls to addEdge or addDirectedEdge.

Flags : cached, parameter

Default expression : []

graphBinder

graphBinder: Boolean

Internal binder/breaker pattern binder.

Flags : cached

Expression : true

graphBreaker

graphBreaker: Any

Internal binder/breaker pattern breaker.

Flags : None. (Note this is uncached)

Expression : R.model.unbindSlot(this, 'graphBinder')

isDirected

isDirected: Boolean

If true, creates directed edges when building the graph.

Flags : cached, parameter

Default expression : false

nodeData

nodeData: Array

An array of data objects, one for each node. The objects do not have any required content. This is optional; if no nodes are supplied, the graph starts empty, and can be created using calls to addNode.

Flags : cached, parameter

Default expression : []

referenceGraph

referenceGraph: Any

An existing Graphology graph object (not an instance of NodeGraph) to copy. If this is provided, the nodeData and edgeData are ignored.

Flags : cached, parameter

Default expression : {}

theGraph

theGraph: Any

Accessor to the internal graphology object.

Flags : cached

Expression : this.graphBinder; return this.getGraph();

weightAttributeName

weightAttributeName: String

The name of the weight attribute in the edge data, for used in weighted graphs.

Flags : cached, parameter

Default expression : "weight"

Methods

addDirectedEdge

  • addDirectedEdge(): String
  • Adds a directed edge from source to target, with optional associated data. Returns the edge name.

    Flags : method (Note this is uncached)

    Returns String

addEdge

  • addEdge(): String
  • Adds an undirected edge between source and target, with optional associated data. Returns the edge name.

    Flags : method (Note this is uncached)

    Returns String

addNode

  • addNode(): String
  • Adds a named node to the graph, with associated data, and returns its name. The name must be unique in the graph.

    Flags : method (Note this is uncached)

    Returns String

clearGraph

  • clearGraph(): Any
  • Removes all data from the graph.

    Flags : method (Note this is uncached)

    Returns Any

getGraph

  • getGraph(): Any
  • The graph object, an instance of a Graphology graph. Do not reference this directly, call getGraph() to obtain the graphology object.

    Flags : method (Note this is uncached)

    Returns Any

isEdgeOnPath

  • isEdgeOnPath(): Boolean
  • Returns whether the given edge, identified by the two nodes it connects, is in the path, given by an array of nodes in order of traversal. Such a path can be returned by shortestPath.

    Flags : method (Note this is uncached)

    Returns Boolean

isNodeOnPath

  • isNodeOnPath(): Boolean
  • Returns whether the given node, identified by its name, is in the path, given by an array of nodes in order of traversal. Such a path can be returned by shortestPath.

    Flags : method (Note this is uncached)

    Returns Boolean

minimumSpanningTree

  • minimumSpanningTree(): Any
  • Returns the set of edges that define a minimum spanning tree on the current graph.

    Flags : method (Note this is uncached)

    Returns Any

nodeNameFunction

  • nodeNameFunction(): String
  • The function to use to compute the name of a node, given the node index and data. This function must produce a unique name for every node in the graph. Override this to provide your own node-naming function.

    Flags : method (Note this is uncached)

    Returns String

shortestPath

  • shortestPath(): Array
  • Returns the shortest path from startNode to endNode as an ordered array of node names. If there is no shortest path, an empty array is returned.

    Flags : method (Note this is uncached)

    Returns Array