add graph drawing function