create method to trace routes and create graph data.