A Graph Approach to Measuring Text Distance