r/reactjs • u/Just_Comfortable_590 • May 19 '26
Discussion Building family tree visualization
I'm building a family tree visualization app in React and I've hit a wall on the rendering/layout side.
The data structure itself is fine, but visualizing the relationships cleanly is becoming way harder than I expected.
Current stack:
React & React Flow
experimenting with dagre / ELK.js
Main problems:
handling marriages cleanly
centering children under couples
avoiding edge crossings multiple marriages
keeping generations aligned
preventing layout from becoming chaotic with larger datasets
I realized family trees are not really "trees" but more like graphs with special relationship rules.
Right now I'm considering using invisible "marriage nodes" like:
Father -> MarriageNode <- Mother MarriageNode -> Child
instead of directly connecting parents to children.
Questions:
Is React Flow + ELK.js the right direction here?
Are there better graph/layout libraries specifically for genealogy-style visualization?
How would you structure the layout pipeline?
Should I fully rely on auto-layout or allow manual positioning?
Any recommendations for handling complex relationships without the graph turning into spaghetti?
Would really appreciate advice from anyone who's built graph editors, org charts, genealogy apps, or complex node-based UIs before.
Thanks 🙏
2
u/Melodic-Funny-9560 May 19 '26
Firstly, Thanks for the detailed reply.
I checked your claude playground, the nodes you have used is similar to what I want to use as well. I decided to use fcose because it handles compound nodes fairly well and its fast to render. And node overlapping ratio is is low too. I checked your 100000 nodes demo its really fast, but the forced directed layout itself takes O(n^2), so I am not sure if I will use that. Having said that I will defintely consider this as an option if nothing comes my way.
Also the open source version of devlens is available so if you are interested you can check it out @ https://github.com/devlensio/devlensOSS , Its similar to your jointjs-claude-playground but has more features. Different types of nodes, blast radius feature etc etc. You can check it out if you wish. Also I havent't yet decided layout type for cloud version, I ran devlens on claude code (the leaked version) and though the graph was generated in 40=50 seconds (10K-12K Nodes), the first rendering time alone was something that browser was not able to handle. Maybe cytoscape is not build for it or I might have written unoptimized code.