Solving ratio problems with graph