Implementation of directed acyclic graph data strcutre