Fork of D3 Tree with Multiple Parents Example
✓ Published0🌍 Public
This example adapts the D3 tree layout to visualize hierarchical data with multiple parents, where nodes may be shared across different branches. It shows a network of interconnected categories like "Government" and "Supply and demand" organized into overlapping trees, with the last root branch highlighted in blue. The code uses d3.hierarchy and d3.tree to compute positions, then deduplicates nodes by ID using underscore.js and manually recalculates their x/y coordinates to accommodate shared descendants. Links are drawn with d3.linkHorizontal, and the SVG view supports pan-and-zoom via d3.zoom, with data loaded from a local JSON file.
AI-generated descriptionMIT Licensed