Updated the Graph construction with incoming edges count method