graphs working with database