The lightmap size is optimized for minimum file size. When the total lightmap length is above 1024*1024*3, they a calculated like in our code, otherwise divide the length by 512*512*3 or by 256*256*3, whichever gives the smallest size.

The strange path format has historical reasons, it had to be compatible to an earlier path format where a node always had two edges.