few changes. this is in-efficient for join of two cirtical graphs