Skip to content

Paths

A path is an object that passes over a series of edges.
A path is represented as a list of edge IDs so that the path can identify the edges it passes through, even when there are multiple edges between the same nodes.

Basic

A simple example is shown below.

TIP

When there are multiple edges between the same pair of nodes and each of them has a path through it, suggest changing the edge gaps from the default.

TIP

By default, the path color is automatically selected from a several colors, but the same color may be selected for some paths. It is also possible to specify colors individually, see the following sample.

Coloring

The following is a sample of how to specify the color of each path, based on the color values in the path data.

Animation

Paths can also be animated in the same way as in Edge.

Select paths

Set configs.path.selectable to true to make the path selectable by clicking or touching. If you specify a number instead of true, it will be taken as the maximum number of selectable paths.
Specify 2-way binding for selected-paths prop to get an array of path IDs selected. It is also possible to control the selection state on the network graph by setting a value to the same prop.

INFO

Since the paths cover the edges, by default the paths do not handle mouse/touch events. To make the path selectable by mouse/touch, it is necessary to set the configuration configs.path.clickable to true.
Also, to enable mouse hover response, set configs.path.hoverable to true.

Customize appearances

Z-order

The z-index of paths can be specified to control the order of the paths in the z-direction.
Since there is no concept of z-index in SVG, this feature is achieved by sorting the internal path objects. It is disabled by default for performance reasons. If configs.path.zOrder.enabled is set to true, this feature will be enabled.

In addition to specifying the z-index based on the properties of the path itself, it is also possible to move to the topmost when it is mouse hovered or selected.

With curved edges

Paths can be drawn on curved edges as well.