use integer to represent edges instead of objects, save memory