resize graph depending on available space cleanup