← All projects
Project record1 mention
Originally shared on Hacker News

toposort

A Zig library for topological sorting that builds a dependency graph from dependency pairs, generates the topological sort from the graph, produces ordered parallel task sets (subsets of nodes that can run in parallel within the overall order), and detects cycles while reporting the cyclical nodes.

Last shared
01 / The problem

What it addresses

The library was feature complete but publishing it as a Zig package failed: importing it in a separate project kept producing an "unable to find module 'toposort'" error, later traced to the default Zig 15 build template creating a private module instead of a public one.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. toposort

    A Zig library for topological sorting that builds a dependency graph from dependency pairs, generates the topological sort from the graph, produces ordered parallel task sets (subsets of nodes that can run in parallel within the overall order), and detects cycles while reporting the cyclical nodes.

    Problem: The library was feature complete but publishing it as a Zig package failed: importing it in a separate project kept producing an "unable to find module 'toposort'" error, later traced to the default Zig 15 build template creating a private module instead of a public one.

    Posted by @ww520 · Original source ↗

    Source text · @ww520 · · Source ↗

    Ended up building a topological sorting library that does the followings: - Build dependency graph from dependency pairs. - Generate the topological sort from the graph. - Ordered parallel task sets (i.e. subsets of nodes that can run in parallel, within the overall topological order). - Cycle detection and reporting the cyclical nodes. https://github.com/williamw520/toposort