improved getHalfGraph