calculate graph size