Domain and Range of Relations from a Graph