Skip to main content

Simple Layout

This example demonstrates how to render a pre-layout graph using react-graph-layers. You can pre-compute the layout and have the position information in each node. By simply specifying the nodePositionAccessor through constructor, you'll be able to render the graph right away.

Configurations

nodePositionAccessor

The accessor to get the position ([x, y]) of the node. Example:

<GraphGL
{...otherProps}
layout={
new SimpleLayout({
nodePositionAccessor: node => [
node.getPropertyValue('x'),
node.getPropertyValue('y'),
]
})
}
/>