Graph serialization

后端 未结 4 1858
甜味超标
甜味超标 2020-12-13 05:55

I\'m looking for a simple algorithm to \'serialize\' a directed graph. In particular I\'ve got a set of files with interdependencies on their execution order, and I want to

4条回答
  •  醉酒成梦
    2020-12-13 06:41

    I would expect tools that need this simply walk the tree in a depth-first manner and when they hit a leaf, just process it (e.g. compile) and remove it from the graph (or mark it as processed, and treat nodes with all leaves processed as leaves).

    As long as it's a DAG, this simple stack-based walk should be trivial.

提交回复
热议问题