Class: VisualGraph

VisualGraph

A VisualGraph represents the visualization of a graph; it describes how the graph is to be drawn. Note that the actual drawing logic is not part of this class. A VisualGraph is a composition of VisualNodes and VisualEdges. It provides methods to get the corresponding VisualNode or VisualEdge from graph Nodes

Constructor

new VisualGraph(graph, layout, hostPermutation)

Constructs a VisualGraph that is the visualization of the specified graph. The VisualGraph will have the layout and host permutation specified
Parameters:
Name Type Description
graph Graph The underlying Graph that this VisualGraph is a visualization of
layout Layout A layout object that is responsible for setting the positions of VisualNodes and Edges
hostPermutation HostPermutation
Source:

Methods

getGraph() → {ModelGraph}

Returns the underlying ModelGraph that this VisualGraph is a visualization of
Source:
Returns:
the underlying graph.
Type
ModelGraph

getHeight() → {Number}

Gets the height of the VisualGraph
Source:
Returns:
The height
Type
Number

getHosts() → {Array.<String>}

Returns the hosts associated with this VisualGraph as an array
Source:
Returns:
The array of hosts
Type
Array.<String>

getNonStartVisualNodes() → {Array.<VisualNode>}

Returns non-start VisualNodes in this VisualGraph as an array. Start nodes correspond to dummy head ModelNodes and may be drawn as a header depending on the visualization

There are no guarantees about the ordering of elements in the returned array. Note that a new array is created to prevent access to the underlying one, so this method takes linear time.

Source:
Returns:
The array of VisualNodes
Type
Array.<VisualNode>

getStartVisualNodes() → {Array.<VisualNode>}

Returns only start VisualNodes in this VisualGraph as an array. Start nodes correspond to dummy head ModelNodes and may be drawn as a header depending on the visualization

There are no guarantees about the ordering of elements in the returned array. Note that a new array is created to prevent access to the underlying one, so this method takes linear time.

Source:
Returns:
The array of VisualNodes
Type
Array.<VisualNode>

getVisualEdgeByNodes(node1, node2) → {VisualEdge}

Gets the VisualEdge in this VisualGraph that is the visualization of the edge connecting node1 and node2. Note that getVisualEdgeByNodes(a, b) == getVisualEdgeByNodes(b, a)
Parameters:
Name Type Description
node1 ModelNode One of the end nodes of the edge
node2 ModelNode One of the end nodes of the edge
Source:
Returns:
The VisualEdge that is the visualization of the edge between node1 and node2, or null if none exists
Type
VisualEdge

getVisualEdges() → {Array.<VisualEdge>}

Returns all VisualEdges in this VisualGraph as an array.

There are no guarantees about the ordering of elements in the returned array. Note that a new array is created to prevent access to the underlying one, so this method takes linear time.

Source:
Returns:
The array of VisualEdges.
Type
Array.<VisualEdge>

getVisualNodeByNode(node) → {VisualNode}

Gets the VisualNode in this VisualGraph that is the visualization of the ModelNode provided as a parameter. Returns null if no VisualNode found
Parameters:
Name Type Description
node ModelNode The node whose visualization within this graph will be returned
Source:
Returns:
The VisualNode that is the visualization of node or null if none exists
Type
VisualNode

getVisualNodes() → {Array.<VisualNode>}

Returns all VisualNodes in this VisualGraph as an array.

There are no guarantees about the ordering of elements in the returned array. Note that a new array is created to prevent access to the underlying one, so this method takes linear time.

Source:
Returns:
The array of VisualNodes
Type
Array.<VisualNode>

getWidth() → {Number}

Gets the width of the VisualGraph
Source:
Returns:
The width
Type
Number

update()

Updates the VisualGraph and its layout
Source: