Skip to main content
improved punctuation, capitalized I, added links
Source Link

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs iI need to draw a polygon map.

So iI tried to use voronoiVoronoi polygons for the map representation. The problem is: How can iI determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdpsfdp tool of graphvizgraphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the voronoiVoronoi diagram they arentaren't because of the position of the nodes. So for me this approach failed.

Googling i, I found a lot of tutorials generating maps with polygons or tiles but i haventI haven't found out yet how iI can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what iI need but i dontI don't know what iI shall search for.

Is there a keyword or an algorithm which can help me here?

Update/Result: For completeness: This is my result after using the suggestions of the accepted answer: result

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs i need to draw a polygon map.

So i tried to use voronoi polygons for the map representation. The problem is: How can i determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdp tool of graphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the voronoi diagram they arent because of the position of the nodes. So for me this approach failed.

Googling i found a lot of tutorials generating maps with polygons or tiles but i havent found out yet how i can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what i need but i dont know what i shall search for.

Is there a keyword or an algorithm which can help me here?

Update/Result: For completeness: This is my result after using the suggestions of the accepted answer: result

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs I need to draw a polygon map.

So I tried to use Voronoi polygons for the map representation. The problem is: How can I determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdp tool of graphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the Voronoi diagram they aren't because of the position of the nodes. So for me this approach failed.

Googling, I found a lot of tutorials generating maps with polygons or tiles but I haven't found out yet how I can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what I need but I don't know what I shall search for.

Is there a keyword or an algorithm which can help me here?

Update/Result: For completeness: This is my result after using the suggestions of the accepted answer: result

added the resulting map
Source Link
maggie
  • 203
  • 2
  • 5

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs i need to draw a polygon map.

So i tried to use voronoi polygons for the map representation. The problem is: How can i determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdp tool of graphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the voronoi diagram they arent because of the position of the nodes. So for me this approach failed.

Googling i found a lot of tutorials generating maps with polygons or tiles but i havent found out yet how i can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what i need but i dont know what i shall search for.

Is there a keyword or an algorithm which can help me here?

Update/Result: For completeness: This is my result after using the suggestions of the accepted answer: result

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs i need to draw a polygon map.

So i tried to use voronoi polygons for the map representation. The problem is: How can i determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdp tool of graphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the voronoi diagram they arent because of the position of the nodes. So for me this approach failed.

Googling i found a lot of tutorials generating maps with polygons or tiles but i havent found out yet how i can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what i need but i dont know what i shall search for.

Is there a keyword or an algorithm which can help me here?

I want to draw a 2d polygon map based on data provided by another source to ease analysing actions on the map. The data has the following format:

1 ['2', '4', '5', '7', '17', '10']
2 ['1', '3', '4']
3 ['2', '11', '4']
4 ['1', '2', '3', '11', '13', '18', '5']
5 ['1', '4', '18', '17']
6 ['7', '8']
...

The first number is the ID of a node, the following list contains the IDs of its neighbours. As a node's number of neighbours differs i need to draw a polygon map.

So i tried to use voronoi polygons for the map representation. The problem is: How can i determine the points to satisfy all neighbourhood relations? I guess my first try is more or less an error in my try and error cycle. I used the sfdp tool of graphviz to get the point positions of the graph:

sample graph representation using sfdp

Using the positions of the points resulted in the following map representation:

sample map using voronoi diagram

The problem of this approach is that for example nodes 4 and 1 are neighbours but in the voronoi diagram they arent because of the position of the nodes. So for me this approach failed.

Googling i found a lot of tutorials generating maps with polygons or tiles but i havent found out yet how i can create a map for my given data. I guess there is an approach using (multiple) hexagons/triangles/squares or a mixture to achieve what i need but i dont know what i shall search for.

Is there a keyword or an algorithm which can help me here?

Update/Result: For completeness: This is my result after using the suggestions of the accepted answer: result

Tweeted twitter.com/#!/StackGameDev/status/603112116732751872
retag
Link
congusbongus
  • 14.9k
  • 59
  • 91
Source Link
maggie
  • 203
  • 2
  • 5
Loading