extract gate level netlist from layout
As you parse the data for the individual layers, you need to re-create the 3-D geometry that they describe. You need to figure out how individual polygons within a layer connect to each other to create larger structures, you need to discover where vias create connections between layers, and you need to recognize the places where gates and diffusion work together to create transistors.

A very long time ago, I wrote a similar program to extract a netlist from a set of PCB Gerber files, which is a similar low-level description of the geometry. It is not a trivial task, because you basically need to compare every vertex with every other vertex. I optimized the process by first sorting the vertices into a 2D array of "bins" and then doing a much smaller exhaustive comparison among the vertices within each bin (and its neighbors).