Link state routing protocols work by having each node independently construct a map of the network connectivity and calculate the best path to every destination. Each node sends link state advertisements containing its connections to all other nodes. As these advertisements are flooded through the network, each node builds an identical map and independently calculates the shortest paths using an algorithm like Dijkstra's. The routing table is then filled in based on the first node along the shortest path from the root node to each destination in the shortest path tree.