new code for graph