Lorenzo Alberton

Reading / London, UK   ·   Contact me   ·  

« Open Source Projects

Layered Dependency Solver

Layer-based scheduling algorithm for parallel tasks with dependencies. Determines which tasks can be executed in parallel, by evaluating dependencies. Given a list of entries (each with its own dependency list), it can sort them in layers of execution, where all entries in the same layer can be executed in parallel, and have no other dependency than the previous layer.

For instance, given entries A, B, C, D, where B and C depend on A, and D depends on B and C, this function will return three layers of execution (as B and C can be executed in parallel after A completes).

Dependency tree:

A / \ B C \ / D
Resulting execution layers:
---------------- Layer 1: A ---------------- Layer 2: B, C ---------------- Layer 3: D ----------------

This package follows an algorithm described (albeit incorrectly implemented) here.