package tree_layout

  1. Overview
  2. Docs

Squarified Treemaps

Treemaps represent trees as nested rectangles. A subtree is a larger rectangle that contains all its children. Squarified treemaps are treemaps which attempts to keep rectangles as square as possible. Functions in this module expect a function to compute the area of a node, and return sequences of pair of nodes and rectangles.

val layout : area:('a -> float) -> children:('a -> 'a Iter.t) -> Common.rectangle -> 'a -> ('a * Common.rectangle) Iter.t

layout ~area ~children rect tree computes a squarified treemap of tree and return a sequence of subtrees and their positions.

  • parameter area

    Return the area of a subtree.

  • parameter children

    Return all the subtrees of a tree.

val squarify : area:('a -> float) -> Common.rectangle -> 'a Iter.t -> ('a * Common.rectangle) Iter.t

squarify ~area rect l takes a sequence of elements l and decorate them with positions.

  • parameter area

    Return the area of a subtree.

OCaml

Innovation. Community. Security.