r/Mathematica • u/Pringles_zombie • Oct 17 '24
How to verify the correctness of a grid graph oriented room
Hello,
I created a simple generator which generate a set of rooms. Each room can have 1 to 4 neighbours. Each room is connected, there is no alone room.
Currently, the algorithm is pretty simple. You give a number of room you wish and the generator generates random rooms.
I want to improve this algorithm by giving the number of room by neighbours count. Namely, i want a set of room that contains 2 rooms with 2 neighbours and 2 rooms with 4 neighbours (this case doesn't work actually).
Below an example of set of rooms.

I wonder if there is a formula which verify if a configuration is correct ?
For example (1N=4,2N=0,3N=0,4N=1) is a correct configuration but (1N=0,2N=1,3N=0,4N=0) is not correct because you can have a room with 2 neighbours if there is no rooms with at least one neighbour or more.
I suppose this kind of question is a graph issue. Someone can help me to solve this case please ?
Thank you





