calc n step m edges simple graph