An analytical approach to the safety of road networks