logoalt Hacker News

actionfromafartoday at 8:20 AM2 repliesview on HN

What is DAG ordering of structs?


Replies

michalsustrtoday at 8:23 AM

Each struct and its referenced fields can be thought of as a graph which can be sorted. Ideally, it is a DAG, but sometimes you can have recursive structures so it can be a cyclic graph. By DAG-ordering a I meant a topological sorting such that you do it by layers of the graph.

https://en.wikipedia.org/wiki/Topological_sorting

https://en.wikipedia.org/wiki/Directed_acyclic_graph

tablatomtoday at 8:24 AM

DAG is directed acyclic graph. A bit like a tree where branches are allowed to merge but there are no cycles.

show 1 reply