Balloon Layout

The balloon layout algorithm is designed to arrange directed and undirected tree graphs. Subtrees rooted at a node are placed in a radial fashion around their root node. All direct children of one node can be placed on a common circle around their parent node (depending on the alignment policy). Therefore, subtrees look like balloons or stars, especially if subtrees have similar sizes. The edges of the tree are drawn as straight lines.

Balloon layout

The balloon layout algorithm provides extensive customization options through a wide array of properties accessible via the BalloonLayoutOptions. Fundamental options include minimum node distances, children ordering, compactness, and others. It also automatically places node and edge labels when the corresponding properties are activated. Node labels can also be placed in a ray-like manner.

Additional customization for individual graph elements, such as edgeLabelPreferredPlacement, nodeHalos, and more, can be achieved via the BalloonLayoutDataProvider.

Feel free to play around with the hierarchic layout configuration in our online playground.

Extensive documentation detailing all available properties of the balloon layout supported by yFiles layouts for React Flow can be found here.

runLayout({
  name: 'BalloonLayout',
  layoutOptions: {
    integratedEdgeLabeling: true,
    integratedNodeLabeling: true,
    nodeLabelingPolicy: 'ray-like-leaves'
  },
  layoutData: {
    edgeLabelPreferredPlacement: () => ({
      sideOfEdge: 'left-of-edge',
      distanceToEdge: 20,
    })
  }
})

BalloonLayoutOptions

The configuration options for the balloon layout algorithm that arranges the subtrees of the tree graph in a balloon-like fashion.

For more information on the layout algorithm and its available settings, see BalloonLayout.

NameType
allowOverlaps?
boolean
chainStraighteningMode?
boolean
childAlignmentPolicy?
"plain" |"same-center" | "compact" | "smart"
childOrderingPolicy?
"compact" | "symmetric"
compactnessFactor?
number
componentLayoutEnabled?
boolean
considerNodeLabels?
boolean
edgeLabelSpacing?
number
fromSketchMode?
boolean
hideGroupsStageEnabled?
boolean
integratedEdgeLabeling?
boolean
integratedNodeLabeling?
boolean
interleavedMode?
"off" | "all-nodes" | "marked-nodes"
labelingEnabled?
boolean
layoutOrientation?
"top-to-bottom" | "left-to-right" | "right-to-left" | "bottom-to-top"
minimumEdgeLength?
number
minimumNodeDistance?
number
nodeLabelingPolicy?
"ray-like" | "ray-like-leaves" | "horizontal"
nodeLabelSpacing?
number
orientationLayoutEnabled?
boolean
parallelEdgeRouterEnabled?
boolean
preferredChildWedge?
number
preferredRootWedge?
number
rootNodePolicy?
"directed-root" | "center-root" | "weighted-center-root" | "selected-root"
selfLoopRouterEnabled?
boolean
subgraphLayoutEnabled?
boolean

BalloonLayoutDataProvider<TNodeData, TEdgeData>

A provider for individual options per nodes or edges in a BalloonLayout. It allows for defining a function that provide values for each element.

For more information, see BalloonLayoutData.

NameDescriptionType
edgeLabelPreferredPlacement?
Provides descriptors for the placement of edge labels.(label: LabelData) => PreferredPlacementDescriptor
nodeHalos?
Provides halos for nodes, i.e., a rectangular area around a specific node considered during the layout.(node: TNodeData) => NodeHalo
nodeTypes?
Provides types which can influence the ordering of nodes during layout.(node: TNodeData) => any
outEdgeComparer?
Provides an order for the given edges in which the edges are arranged at a node.(edge1: TEdgeData, edge2: TEdgeData) => number

Playground