simple DAG implementation