From graphs to DAGs: a low-complexity model and a scalable algorithm