Skip to main content
Public

Share visualization

Loading preview…

Improving array to tree

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Improving array to tree

0
MMTR
Last edited Mar 24, 2021
Created on Mar 24, 2021
Forked from array to tree

A shuffled array of ten numbers becomes a binary tree, with each node displaying its value. D3's `d3.stratify` converts the flat array into hierarchical data, and `d3.tree` computes the layout. The SVG renders nodes as red-bordered circles connected by black paths. A transition animates the text labels, with a duration that increases based on node depth. The example shows repeated re-shuffling and re-rendering of the tree with each of the ten random permutations.

AI-generated description

Converts an Array into tree.

Comments

Sign in to join the discussion.

MIT Licensed