added indegree calculation