Layouts

The Graph Visualization library supports several graph layouts. Each layout has its own algorithm, which computes the placements of the vertices and edges, affecting the visual structure of the graph.

You can configure these layouts through the settings option as shown:

Settings:
{
  ...
  layout: <'circle', 'concentric', 'force', 'grid', 'hierarchical', 'preset', 'radial', 'random', 'geographical'>
  ...
}

In addition, you can create custom layouts by passing the layout specific options using the settings format as shown:

Settings:
{
  ...
  layout: {
    type: 'grid',
    spacing: 5
  }
  ...
}

The following describes the supported layouts in graph visualization.

Circle Layout

The circle layout positions the graph vertices in a circle.

Figure: Circle Layout

Description of image follows

Description of the illustration circle_layout.png

You can configure the spacing property to set the the radius of the circle.

Concentric Layout

The concentric layout positions the graph vertices in concentric circles.

Figure: Concentric Layout

Description of image follows

Description of the illustration concentric_layout.png

You can configure the spacing property to set the minimum spacing between the vertices. It is basically used for adjusting the radius of the concentric circles.

Force Layout

The force layout aims to create a visually appealing graph. It positions the graph vertices in the viewport so that all the edges are approximately equal in length and minimizes crossings between the edges.

The force layout can be used in one of the following modes:

Description of image follows

Description of the illustration cluster_layout.png

Geographical Layout

The geographical layout allows you to overlay the graph on a map.

However, this is provided that the latitude and longitude coordinates exist as graph properties on the graph’s vertices.

Figure: Geographical Layout

Description of image follows

Description of the illustration geographical_layout.png

You can configure this layout using the following properties:

Grid Layout

The grid layout positions the graph vertices in a well-spaced grid.

Figure: Grid Layout

Description of image follows

Description of the illustration grid_layout.png

You can configure the spacing property to set the space between the elements in the grid.

Hierarchical Layout

The hierarchical layout organizes the graph using Directed Acyclic Graph (DAG) system. It is especially suitable for DAGs and trees.

Figure: Hierarchical

Description of image follows

Description of the illustration hierarchical_layout.png

You can configure this layout using the following properties:

Radial Layout

The radial layout displays the dependency chain of a graph by using an outwards expanding tree structure. It can be especially useful if the graph data has a hierarchical structure and contains many children for each parent vertex.

Figure: Radial Layout

Description of image follows

Description of the illustration radial_layout.png

You can configure the spacing property to set the spacing between neighboring vertices if they share the same parent vertex. If set to zero, no spacing will be applied.

Random Layout

The random layout puts the graph vertices in random positions within the viewport.

Figure: Random Layout

Description of image follows

Description of the illustration random_layout.png