Fix a bug in building small world graphs