P = set of all plugins with no after deps while P not empty remove a plugin J from P for each plugin L with a before dep from J remove before dep if L has no ever before deps insert L in to P