Function Repository Resource:

HexagonalGridGraph

Source Notebook

Generate a graph corresponding to a hexagonal grid

Contributed by: Wolfram Research

ResourceFunction["HexagonalGridGraph"][{width,height}]

returns a hexagonal grid graph with dimensions width×height.

Details and Options

ResourceFunction["HexagonalGridGraph"] takes the same options as Graph.

Examples

Basic Examples (1) 

A 6×6 hexagonal grid graph:

In[1]:=
ResourceFunction["HexagonalGridGraph"][{6, 6}]
Out[1]=

Scope (2) 

Use a different graph embedding:

In[2]:=
ResourceFunction["HexagonalGridGraph"][{12, 8}, GraphLayout -> "SpringElectricalEmbedding", VertexCoordinates -> Automatic]
Out[2]=

Use a different plot theme:

In[3]:=
ResourceFunction["HexagonalGridGraph"][{18, 18}, PlotTheme -> "LargeGraph"]
Out[3]=

Properties and Relations (2) 

Large graphs may be formatted differently in OutputForm than smaller graphs. A 50×60 hexagonal grid graph shows explicit edges and vertices:

In[4]:=
ResourceFunction["HexagonalGridGraph"][{50, 60}]
Out[4]=

A 60×60 hexagonal grid graph displays as an elided Graph expression:

In[5]:=
ResourceFunction["HexagonalGridGraph"][{60, 60}]
Out[5]=

Version History

  • 2.0.0 – 15 April 2020
  • 1.0.0 – 28 February 2020

Related Resources

License Information