update graph and main