Package

purescript-hylograph-graph

Repository
afcondon/purescript-hylograph-graph
License
MIT
Uploaded by
pacchettibotti
Published on
2026-11-17T19:11:16Z

Graph algorithms and data structures for PureScript, designed for visualization.

Live interactive demo can be seen as part of the suite of Hylograph library demos. Click the screenshot below for The Honeycomb puzzle.

Honeycomb Puzzle Demo

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-graph

Usage

Basic Pathfinding

import Data.Graph.Pathfinding (findPath)

result = findPath startNode endNode myGraph

With Tracing (for visualization)

import Data.Graph.Pathfinding.Traced (findPathTraced)

{ result, steps, explored } = findPathTraced startNode endNode myGraph
-- Use `steps` to animate the algorithm

Modules

  • Data.Graph.Pathfinding - Basic pathfinding algorithms
  • Data.Graph.Pathfinding.Traced - Pathfinding with step-by-step tracing
  • Data.Graph.Algorithms - Graph analysis (reachability, reduction)
  • Data.Graph.Layout - Position helpers for graph visualization
  • Data.Graph.Types - Core graph types
  • Hylograph.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