Build DAG

FIrst step : build Directed Acyclic Graph from original graph.