I am having set of linear features lie on a plane (it does not a matter whether the pane is vertical or horizontal). all linear features are either parallel or othogonal to the vertical axis or to horizontal axis (see figure). I want to align vertical line segments which are collinear. As I am having many fragmented lines at every where i want some specific theory / concept to follow to build a technique.
Note: I know end point coordinates of each line segment.
can any one suggest a way.
i am not sure to which field, i should post this.

I would do the following.
Two line segments are parallel if they have the same slope. They are collinear if they have the same slope and the same intercept.
So I would sort the sequence by slope, and then by the intercept. All slopes within a predefined small tolerance $\epsilon_m$ will be considered the same, and all intercepts within some (possibly larger) tolerance $\epsilon_b$ will be considered the same. Based on that, go through the sorted list, checking if consecutive elements are within the allowed tolerance of each other, and output the groups once you find them.