move graph related code to the separate file