move exists method to Graph