There are lot of rectangles ; each one will have lower left and upper right co-ordinates. And they are either overlapping (fully or partially ) or touching at-least one edge with other one.
Am looking for how to come up with a trace from start to end blocks by tracing each rectangles in sequence. Lets say there it an identifier (co-ordinates) both at start and end blocks, which can say that trace has started and ended.
In the image below, I need to trace such that i get rectangles numbering 1 , 2, 3, 4, 5 in sequence. Please let me know what is the best way to approach this ? and are there any already available modules which fits into this problem statement?
And also, next thing is , if there are multiple end points, how to come up with all the paths traced from single start to multiple end blocks ?

You can build a graph that models this problem. for every rectangle, consider a node, if this rectangle has connection with any other rectangle, their representing nodes have an edge connecting them.
Then you can use Depth First Search to traverse this graph and see if there is a path from start triangle to the end triangle.
This Algorithm has O(N^2) Complexity. which n is the number of triangles.