more graph related code