add util.py with toposort and groupby