We present Social Groups and Navigation (SGN), a method to simulate the walking behavior of small pedestrian groups in virtual environments. SGN is the first method to simulate group behavior on both global and local levels of an underlying planning hierarchy. We define quantitative metrics to measure the coherence and the sociality of a group based on existing empirical data of real crowds. SGN does not explicitly model coherent and social formations, but it lets such formations emerge from simple geometric rules. In addition to a previous version, SGN also handles group-splitting to smaller groups throughout navigation as well as social subgroup behavior whenever a group has to temporarily split up to re-establish its coherence. For groups of four, SGN generates between 13% and 53% more socially-friendly behavior than previous methods, measured over the lifetime of a group in the simulation. For groups of three, the gain is between 15% and 31%, and for groups of two, the gain is between 1% and 4%. SGN is designed in a flexible way, and it can be integrated into any crowd-simulation framework that handles global path planning and any path following as separate steps. Experiments show that SGN enables the simulation of thousands of agents in real time.