Gosmore routing algorithm

Hi,
I am trying to understand the routing algorithm used in Gosmore (libgosm.cpp). It is quite cryptic, I was wondering if anyone can give me a high level description reg. how routing is done in gosmore.

Thanks,
Raghu