Skip to main content
๐ŸŒ Public

Share visualization

Send this visualization to others.

Fork of D3 Tree with Multiple Parents Example

Public visualization

Viewing a saved revision (read-only)

c46f58968f814d0f85d3ae9d0455bbc5

Fork of D3 Tree with Multiple Parents Example

0 stars0๐ŸŒ Public
Ttxomin.sirera@gmail.com
Last edited Jun 23, 2024
Created on Jun 23, 2024

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 description