Finding a graph that represents a word problem