Local properties

You can assign values on the server side for local properties on the parentNodeLayout and parentLinkLayout objects of a node or link:
Property Description
<client-side local property name> The name of the node or link pseudo-property defined by getter and setter functions in the corresponding client-side layout class. All local properties of type number, boolean, point, and rectangle can be specified.
This example sets values for four local properties with a hierarchical layout:
"parentNodeLayout":{
                  "linkStyle": 1,
                  "linkPriority": 123,
                  "fromPortIndex": 3,
                  "toPortIndex": 5
},
In this example, the functions getLinkStyle and setLinkStyle of the HierarchicalLayout class correspond to the local property name linkStyle.
In the graph posted to the server, the parentNodeLayout and parentLinkLayout objects can be present at any node or link in a graph or subgraph where nodeLayout and linkLayout are present. The absence of the parentNodeLayout and parentLinkLayout objects for a given node or link indicates that there is no local node layout or link layout property for this node or link.

Node properties

Property Description
id A unique identifier for the node. Used when creating links.
b Bounding box for the node, specified as an array of four numbers (x coordinate, y coordinate, width, and height). The values for the bounding box are expressed in the coordinate space of the parent of the node.
parentNodeLayout An object that contains local properties of the node for the node layout of the graph containing the node. See Local properties.
parentLinkLayout An object that contains local properties of the node for the link layout of the graph containing the node. See Local properties.

Link properties

Property Description
id A unique identifier for the node. Used when creating links, and by the client, when updating its own model after server-side layout.
f From node. The ID value from the node at the source of the link.
t To node. The ID value of the node at the target of the link.
fp From point. The optional coordinate of the from point connector, specified as a JSON array of two numbers for the x and y coordinates. If not specified, the from point is set using the center of the node. The server response omits this property when the layout has not moved the connection point. In this case, the client must keep the original connection point unmodified.
tp To point. The optional coordinate of the to point connector, specified as a JSON array of two numbers for the x and y coordinates. If not specified, the to point is set using the center of the node. The server response omits this property when the layout has not moved the connection point. In this case, the client must keep the original connection point unmodified.
ip An optional list of intermediate points for the link, specified as an array of arrays of (x,y) coordinates, for example [[10,20], [30,40]]. The link is drawn through the points specified. The absence of this property means that the link is a straight line between the nodes.
sp True when the link start is pinned(BasicPort.isMovable returns true). If not specified, the link start is not pinned.
ep True when the link end is pinned (BasicPort.isMovable returns true). If not specified, the link end is not pinned.
w Link width.
parentNodeLayout An object that contains local properties of the link for the node layout of the graph containing the link. See Local properties.
parentLinkLayout An object that contains local properties of the link for the link layout of the graph containing the link. See Local properties.
All the values for geometry elements (point position and width) are expressed in the coordinate space of the parent of the link.
The server response omits any link that the layout execution does not lay out by either the node layout or the link layout. This behavior occurs when a point has not been moved, added, or removed.

Subgraphs

All properties valid for a node are also valid for a subgraph. The following properties are also valid on a subgraph:
Property Description
gb Bounding box of the graph inside the subgraph, specified as an array of four numbers (x coordinate, y coordinate, width, and height). The values for the bounding box are expressed in the same coordinate space as the parent of the subgraph. They serve to compute the margins of the subgraph.
m Defines the transformation matrix from the coordinate space of the graph inside the subgraph to the coordinate space of the subgraph. It is specified as an array of six numbers (xx, xy, yx, yy, dx, and dy). The absence of this property is equivalent to specifying an identity matrix.
If a client-side subgraph is in the collapsed state (Subgraph.isCollapsed returns true), do not describe the nodes and links of the subgraph. Instead, describe the subgraph as if it was a regular node.

Nested graphs with intergraph links

Any node can contain a subgraph, and any two nodes on any graph or subgraph can be linked together. To link them, it is important that every node is uniquely identifiable.
The following example specifies a graph with a subgraph and an intergraph link:
{
"nodeLayout": {"algorithm":"forcedirected"},
"nodes":[
   {"id":"object1", "b":[120, 400, 20, 20]},
   {"id":"object2", "b":[170, 400, 20, 20]},
   {
      "id":"subgraph1", 
      "b":[500,300,200,200],
      "gb":[510,310,180,180],
      "m":[1,0,0,1,12,30],
      "nodeLayout": {"algorithm":"forcedirected"},
      "nodes":[
         {"id":"subgraph1/object1", "b":[0, 0, 20, 20]},
         {"id":"subgraph1/object2", "b":[100, 120, 20, 20]}
      ],
      "links":[
         {"id":"igLink", "f":"subgraph1/object1", "t":"object2"}
      ]
   }
],

"links":[
   {"id":"myLink", "f":"object1", "t":"object2", "ip":[[20,20],[40,20],[40,40]]}
]
}
The subgraph in this example is defined as a node with a bounding box. There is an intergraph link from a node in the subgraph to one in the parent graph. No naming structure is required by the server code, as long as all nodes, across all subgraphs, have unique IDs. If a duplicate ID is found, the graph layout fails.
The JSON description of an intergraph link that starts or ends at a node inside a collapsed subgraph while its other extremity is in a non-collapsed graph must use the visible extremity node instead of the original extremity node. The visible extremity node is the closest parent of the extremity node that is not in a collapsed state.