Get the latest tech news

Show HN: The Algorithm Behind the Topological Sort Library TopoSort


Topological sort library in Zig. Contribute to williamw520/toposort development by creating an account on GitHub.

The main idea is to iteratively find the successive root sets of the graph after removing them at each round. A partial list of the topological order nodes can be produced at the end. After the main iteration, any nodes not in the "rooted" list can be classified as parts of the cycles since they were not reachable due to the prior cycle skipping when traversing the dependents of root nodes.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of algorithm

algorithm

Related news:

News photo

Perplexity AI says it would rebuild TikTok's algorithm and add Community Notes features

News photo

The Cassowary Linear Arithmetic Constraint Solving Algorithm [pdf] (2002)

News photo

Meta Plans To Test and Tinker With X's Community Notes Algorithm