Building Dependency Graph