UPDATED Hierarchy Charts AND Random Hierarchy Charts

john's Avatar

john

17 Jun, 2025 05:53 AM

Attached is the demo of a new node which also contains UPDATES to my recent hierarchy and hier_chart nodes.

FIRST, the updates.

  • Hierarchy Node. Now can go up to 24 levels deep (0 to 24).
  • Hier_Chart Node. Multiple tweaks:
    • Now can chart hierarchies up to 24 levels deep (0 to 24)
    • If no nodes are supplied, will use default black dots instead of throwing an error
    • VERY subtle bug fixed

I have also updated the comments on both these nodes to explicitly mention the current maximum depth. Initially the depth was 12, which, based on my experience, was enough for even very large org charts, deep family trees, and subnet charts. However, now that I am starting to make art, I needed more depth. So I doubled the limit. Increasing the maximum depth could slow the processing even for small charts, but according to my testing, the result seems to be negligible.

I am also starting to make more nodes using hierarchies, and I realized that I need to keep the maximum depth in sync. So if you want to chart a 24 level hierarchy, you not only need a hier_chart node at that depth, you also need a hierarchy node capable of creating a hierarchy at that depth. All hierarchy nodes and nodes that use hierarchies need to allow the same maximum depth.

For now, that number is 24. But if anyone out there needs even deeper charts, PLEASE let me know.

The bug I fixed, by the way, was VERY hard to spot, VERY hard to diagnose, and VERY hard to fix. It was barely noticeable, and only occurred in very large, very deep charts with a highly unusual structure. I feel I've earned my pay even spotting it, let alone fixing it. If anyone is curious I would be delighted to nerd out and explain it all in depth.

RANDOM_HIER node

The demo also includes a new node, random_hier, which generates random hierarchies. Random_hier takes two parameters:

  • Amount. The number of children added to the root. 0 will return a 1-row hierarchy with just the root.
  • Seed. A random seed. Each seed creates a distinct tree which keeps its form as you increase or decrease the amount.

It grows the tree by taking a random walk. That is, it generates a sequence of 3-sided coin flips. Each "coin" can be -1, 0, or 1. Each number in the sequence is added to the current level, adding to the tree one node at a time.

  • If the number is 1, I add a child to the latest node.
  • If the number is 0, I add a sibling to the latest node.
  • If the number is -1, I decrease the level and add an uncle to the latest node.

Lather, rinse, repeat until I have added the requested amount of nodes. I make sure that the level of each new node is greater than 0 (the root) and less than or equal to 24 (the current limit of the hierarchy node). If the random walk tries to add 0-level nodes (siblings to the root), I just add another node at level 1 instead. If the random walk tries to exceed level 24, I add another level 24 sibling.

As a result of this technique, the shape of the trees varies wildly. If the first few coin flips happen to be 1 the tree will get a chance to build some depth before spreading out, and may grow into a large, healthy specimen. But if it starts to spread quickly at the outset, or returns to the top and then has a run of 0s or -1s, it will become top-heavy, with a wide row of dozens of siblings right under the root. Similarly, if it manages to achieve a depth of 24 and then repeatedly tries to go deeper, it will start to develop rows of siblings at the bottom.

The best way to appreciate this is to set the amount to, say, 100. and then keep increasing the seed to see the different trees. It's fun to find seeds that can support deep, healthy trees. The screenshot shows a tree with 300 children using seed 12.

I'm not sure whether I should add this node to my library. What do you think?

For your convenience, I also placed a copy of the latest hierarchy node next to the random_hier node. Until I publish the next release of my library, you should the copies of hierarchy and hier_chart from this demo.

Enjoy!

  1. Support Staff 1 Posted by john on 17 Jun, 2025 06:15 AM

    john's Avatar

    Also, please let me know if you would like more control over the random numbers used to generate the chart, or have other suggestions of use cases.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • random_hierarchy_screenshot.png 653 KB
  • random_hierarchy.ndbx.zip 373 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

14 Jul, 2025 10:54 PM
06 Jul, 2025 10:35 PM
01 Jul, 2025 01:01 AM
29 Jun, 2025 04:39 AM
27 Jun, 2025 06:35 PM

 

25 Jun, 2025 08:54 AM
23 Jun, 2025 04:02 AM
21 Jun, 2025 08:45 AM
20 Jun, 2025 05:07 AM
19 Jun, 2025 10:26 PM
17 Jun, 2025 06:15 AM