DataViz.Layout.Hierarchy.EdgeBundle
- Package
- purescript-hylograph-layout
- Repository
- afcondon/purescript-hylograph-layout
DataViz.Layout.Hierarchy.EdgeBundle
Hierarchical edge bundling layout for visualizing dependencies in hierarchical data.
Based on Danny Holten's algorithm: "Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data"
This module provides:
- Hierarchy construction from flat dot-notation names
- Bidirectional link creation (bilink)
- Radial cluster layout for node positioning
- Bundle curve rendering with adjustable tension (beta)
Example Usage:
import DataViz.Layout.Hierarchy.EdgeBundle as EdgeBundle
-- Given flat data with imports
nodes :: Array { name :: String, size :: Number, imports :: Array String }
-- Build the visualization
result = EdgeBundle.edgeBundle
{ getName: _.name
, getImports: _.imports
, beta: 0.85
, radius: 400.0
}
nodes
-- result contains:
-- nodes: positioned nodes for rendering
-- links: paths between connected nodes
#edgeBundle Source
edgeBundle :: forall a. EdgeBundleConfig a -> Array a -> EdgeBundleResult aMain entry point: compute edge bundle layout
Takes configuration and array of nodes with imports, returns positioned nodes and bundled link paths.
#EdgeBundleResult Source
type EdgeBundleResult a = { links :: Array BundledLink, nodes :: Array (PositionedNode a) }Result of edge bundle layout
#BundledLink Source
type BundledLink = { path :: String, source :: String, target :: String }A bundled link with SVG path
Re-exports from DataViz.Layout.Hierarchy.EdgeBundle.Bilink
#BilinkedTree Source
type BilinkedTree a = BilinkedNode aType alias for the complete bilinked tree
#BilinkedNode Source
data BilinkedNode aA node with bidirectional link information
Constructors
BilinkedNode { children :: Array (BilinkedNode a), data_ :: Maybe a, depth :: Int, fullName :: String, height :: Int, incoming :: Array Link, name :: String, outgoing :: Array Link }
Instances
(Show a) => Show (BilinkedNode a)
#getOutgoing Source
getOutgoing :: forall a. BilinkedNode a -> Array LinkGet outgoing links from a node
#getIncoming Source
getIncoming :: forall a. BilinkedNode a -> Array LinkGet incoming links to a node
#getBilinkedFullName Source
getBilinkedFullName :: forall a. BilinkedNode a -> StringGet full name of a bilinked node
#getBilinkedData Source
getBilinkedData :: forall a. BilinkedNode a -> Maybe aGet the data from a bilinked node
#getBilinkedChildren Source
getBilinkedChildren :: forall a. BilinkedNode a -> Array (BilinkedNode a)Get children of a bilinked node
#bilink Source
bilink :: forall a. (a -> Array String) -> TreeNode a -> BilinkedTree aCreate bidirectional links from a hierarchy and import data
Algorithm:
- Build a map from fullName -> leaf node
- For each leaf with imports, create outgoing links
- For each outgoing link, add corresponding incoming link to target
Takes:
- A tree built from buildHierarchy
- A function to get imports from the leaf data
#allBilinkedNodes Source
allBilinkedNodes :: forall a. BilinkedNode a -> Array (BilinkedNode a)Get all nodes in the tree (pre-order)
#allBilinkedLeaves Source
allBilinkedLeaves :: forall a. BilinkedNode a -> Array (BilinkedNode a)Get all leaf nodes from a bilinked tree
Re-exports from DataViz.Layout.Hierarchy.EdgeBundle.BundleCurve
#BundlePoint Source
type BundlePoint = { x :: Number, y :: Number }A point on the bundle path
#bundlePath Source
bundlePath :: Number -> Array BundlePoint -> StringGenerate SVG path for a bundle curve given points Uses quadratic Bezier spline approximation with bundle tension
The beta parameter controls tension:
- beta = 0: control points are not adjusted (straight-ish curve)
- beta = 1: control points follow the path exactly (maximum bundling)
Re-exports from DataViz.Layout.Hierarchy.EdgeBundle.Hierarchy
#getTreeNodeName Source
getTreeNodeName :: forall a. TreeNode a -> StringGet the short name of a node
#getTreeNodeData Source
getTreeNodeData :: forall a. TreeNode a -> Maybe aGet the user data (if this is a leaf)
#getTreeNodeChildren Source
getTreeNodeChildren :: forall a. TreeNode a -> Array (TreeNode a)Get children of a node
#getFullName Source
getFullName :: forall a. TreeNode a -> StringGet the full name of a node
#getAncestors Source
getAncestors :: forall a. TreeNode a -> TreeNode a -> Array (TreeNode a)Get all ancestors of a node (from root to node, inclusive) This traverses down from root to find the path
#descendants Source
descendants :: forall a. TreeNode a -> Array (TreeNode a)Get all descendant nodes (pre-order traversal, including self)
#buildHierarchy Source
buildHierarchy :: forall a. { getName :: a -> String } -> Array a -> TreeNode aBuild a hierarchy from flat imported nodes Takes an array of nodes with dot-notation names and builds a tree
Algorithm:
- For each node, split name by "." to get path components
- Create/find intermediate nodes for each path component
- Attach leaf data at the final node
Re-exports from DataViz.Layout.Hierarchy.EdgeBundle.RadialCluster
#RadialNode Source
data RadialNode aA node with radial coordinates
Constructors
RadialNode { children :: Array (RadialNode a), data_ :: Maybe a, depth :: Int, fullName :: String, height :: Int, name :: String, x :: Number, y :: Number }
Instances
(Show a) => Show (RadialNode a)
#RadialLayoutConfig Source
type RadialLayoutConfig = { endAngle :: Number, innerRadius :: Number, outerRadius :: Number, startAngle :: Number }Configuration for radial cluster layout
#toCartesian Source
toCartesian :: forall a. RadialNode a -> { x :: Number, y :: Number }Convert radial coordinates to Cartesian for SVG rendering
#radialClusterFromTree Source
radialClusterFromTree :: forall a. TreeNode a -> RadialNode aConvenience function: layout from a TreeNode using default config
#radialCluster Source
radialCluster :: forall a. RadialLayoutConfig -> TreeNode a -> RadialNode aApply radial cluster layout to a tree
Algorithm:
- Assign sequential indices to leaves (angular positions)
- Position leaves evenly around the circle at outerRadius
- Position internal nodes at mean angle of children, at appropriate radius
#defaultRadialConfig Source
defaultRadialConfig :: RadialLayoutConfigDefault configuration
- Modules
- DataViz.
Layout. Adjacency - DataViz.
Layout. Adjacency. Layout - DataViz.
Layout. Adjacency. Types - DataViz.
Layout. Chord - DataViz.
Layout. Chord. Layout - DataViz.
Layout. Chord. Types - DataViz.
Layout. Hierarchy. Cluster - DataViz.
Layout. Hierarchy. Core - DataViz.
Layout. Hierarchy. EdgeBundle - DataViz.
Layout. Hierarchy. EdgeBundle. Bilink - DataViz.
Layout. Hierarchy. EdgeBundle. BundleCurve - DataViz.
Layout. Hierarchy. EdgeBundle. Hierarchy - DataViz.
Layout. Hierarchy. EdgeBundle. RadialCluster - DataViz.
Layout. Hierarchy. EdgeBundle. Types - DataViz.
Layout. Hierarchy. Link - DataViz.
Layout. Hierarchy. Pack - DataViz.
Layout. Hierarchy. Partition - DataViz.
Layout. Hierarchy. Tree - DataViz.
Layout. Hierarchy. TreeStyle - DataViz.
Layout. Hierarchy. Treemap - DataViz.
Layout. Hierarchy. Types - DataViz.
Layout. Pattern - DataViz.
Layout. Pattern. Types - DataViz.
Layout. Sankey. CSV - DataViz.
Layout. Sankey. Compute - DataViz.
Layout. Sankey. ComputeWithSteps - DataViz.
Layout. Sankey. Path - DataViz.
Layout. Sankey. Types - DataViz.
Layout. StateMachine - DataViz.
Layout. StateMachine. Layout - DataViz.
Layout. StateMachine. Path - DataViz.
Layout. StateMachine. Types