Make all graph resizable and factorize code