Skip to content

The squarified tile layout doesn't match the original published paper #224

@Lithopsian

Description

@Lithopsian

The qdirstat algorithm for laying out squarified treemaps is subtly different from that described by Bruls et al (https://link.springer.com/chapter/10.1007/978-3-7091-6783-0_4). I don't know if this was intentional or a happy accident back in pre-history that produced something that looking like it was working.

The current algorithm lays out tiles in rows along the longer side of the parent rectangle. This produces a series of ever-narrower stripes along the rectangle, each with a series of hopefully near-equal near-squares. It is prone to non-square tiles at the extremes of the long rows, and the last row in particular produces stretched tiles. See the attached screenshot for an example.
Screenshot_2023-11-16_18-29-20

The current algorithm is prone to leaving empty space at the end of rectangles. There are a number of reasons for this, and it isn't obvious when a minTileSize is set. However, even with minTileSize=0, there can be empty space. This is partly due to some rounding errors (much worse for the non-squarified code) and partly because the parent totalAllocatedSize doesn't match the sum of the children totalAllocatedSizes. In this particular case (theme icons) there are a lot of symlinks which have zero allocated space but do take up space. (totalSize is non-zero).
Screenshot_2023-11-16_18-34-40

The exact algorithm described in the paper lays out each row along the shorter side of the parent rectangle. This subtle difference means that the rows are shorter, the remaining space stays relatively square, and rows are laid out in roughly-alternating horizontal and vertical directions as the remaining space shrinks. See an attached example, showing the same files as before (note that the shading has also been fixed, see my other issue).
Screenshot_2023-11-16_18-29-42

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions