Calling WattsStrogatzGenerator(5,2,p) for nonzero p will cause an infinite loop. This happens because RegularRingLatticeGenerator(5,2) generates a complete ring lattice, and thus the rewiring process of the Watts-Strogatz generator (https://github.com/networkit/networkit/blob/Dev/networkit/cpp/generators/WattsStrogatzGenerator.cpp#L42) never finds a suitable node to rewire to.
This happens for other complete lattices, such as WattsStrogatzGenerator(7,3,p). Confusingly, these are cases that RegularRingLatticeGenerator should check for (https://github.com/networkit/networkit/blob/Dev/networkit/cpp/generators/RegularRingLatticeGenerator.cpp#L12) but this does not seem to be being checked in practice.