I would have a question regarding OSPF, when a topology is being created, how the LSA loop risk is prevented ? If you have X router the LSA should be routed over all the the network and how a loop is prevented for example in a full mesh area (all routers connected to all routers) ?
If you are a math type of person you may want to understand Dijkstra algorithm.
Reading RFC2328 as mentioned by Ron is best option.
If you are looking for a short down and dirty contribution I'll put it this way, yet feel free to dig links for in deep understanding.
SPF does the calculation per-area basis on each router. Dijkstra algorithm evaluates 3DB's:
- Link-state Database: Total compilation of routing knowledge. Consist of tuples (router ID, neighbor ID and cost).
- Candidate Database: Tuples are evaluated. It deletes "any tuples whose neighbor ID is currently in the Tree DB and whose cost to the root is greater than the entry currently in the tree database." (Adv Junos Service Provider Routing, Ch2-44)
- Tree Database: Loop free and lowest cost topology.