purescript-hylograph-graph
Graph algorithms and data structures for PureScript, designed for visualization.
Overview
This package provides graph algorithms with optional tracing for visualization, consolidating graph-related code from the Hylograph ecosystem.
Features
Graph Algorithms
- Pathfinding: A*, Dijkstra, BFS/DFS
- Analysis: Reachability, transitive reduction, layer computation
- DAG operations: Topological sort, cycle detection
Tree Utilities
- Rose tree helpers (wrapping
tree-rose) - Tree manipulation functions
- DAGTree for “mostly hierarchical” graphs
Visualization Support
- Optional algorithm tracing for step-by-step animation
- Position helpers for layout
Installation
spago install hylograph-graphUsage
Basic Pathfinding
import Data.Graph.Pathfinding (findPath)
result = findPath startNode endNode myGraphWith Tracing (for visualization)
import Data.Graph.Pathfinding.Traced (findPathTraced)
{ result, steps, explored } = findPathTraced startNode endNode myGraph
-- Use `steps` to animate the algorithmModules
Data.Graph.Pathfinding- Basic pathfinding algorithmsData.Graph.Pathfinding.Traced- Pathfinding with step-by-step tracingData.Graph.Algorithms- Graph analysis (reachability, reduction)Data.Graph.Layout- Position helpers for graph visualizationData.Graph.Types- Core graph typesHylograph.Data.DAGTree- Hybrid DAG/tree structure
Part of Hylograph
This package is part of the Hylograph visualization ecosystem:
- hylograph-graph - Graph algorithms (this package)
- hylograph-selection - Type-safe D3 selection and rendering
- hylograph-simulation - Force-directed graph simulation
- hylograph-layout - Layout algorithms
License
MIT
