How to Transform Graph into Maps?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ancay-dev

Hi all

I’m making a program that implements procedural content generation (PCG) to create maps in a 2d game.

I use the graph data structure as the basis. then the graph will be transformed into a map like in this example:

map example

with graph specifications as follows:

-vertex can have more than 4 edges

-allowed the formation of cycles in the graph

any suggestions what method I can use to convert the graph to a 2d map in a grid with space-tight results?

:bust_in_silhouette: Reply From: LLC

i don’t know if you want to have only 1 specific result for any input graph or input the same graph can result in a slight different every run
but i think you should generate the map at the same time when you generate each node in the graph so you can check for space available while generating the map