Reputation: 61
I want to generate a hexagon grid on the ocean for finding a shortest path.
Networkx provides lattice.hexagonal_lattice_graph which generates a graph whose nodes and edges are the hexagonal tiling of the plane.
However, I do not want to search along the edges of the hexagons, but I would like to consider the hexagons as nodes and the 6 adjacent hexagons as the neighboring nodes. In this way, there are 6 search directions from a node, as shown in this figure.
To apply this on a ship routing problem, I would generate such a graph for the earth and exclude all hexagon tiles inside land polygons, and divide the hexagons intersecting with the land polygon borders into smaller hexagons, creating a higher graph density in coastal areas.
How do I create such a hexagonal tiling graph, such that each node has edges in the six directions with Networkx?
Upvotes: 0
Views: 337