4
$\begingroup$

How can I generate the following lattice graph?

**A lattice graph**

You are welcome to make your own assumptions.

Is it possible to this using GridGraph?

$\endgroup$
2
  • 1
    $\begingroup$ It is not clear to me what you want. This does not look like a graph. It has no connections. Do you just want to draw circles at certain coordinates? If yes, please say so. But in that case, the question has nothing to do with graphs. $\endgroup$
    – Szabolcs
    Oct 30, 2018 at 6:04
  • $\begingroup$ -1 for an ambiguously written question and refusal to correct it. Neither of the answers generate what is called a lattice graph. I'm not sure what you mean by "You are welcome to make your own assumptions." but questions on SE should be clear and unambiguous. $\endgroup$
    – Szabolcs
    Oct 30, 2018 at 17:04

2 Answers 2

10
$\begingroup$
GridGraph[{4, 4}, EdgeStyle -> White, VertexSize -> Medium, 
 VertexStyle -> White, Frame -> True, PlotRangePadding -> Scaled[.25]]

enter image description here

You can also use GraphComputation`EmptyGraph:

Framed @ Show[GraphComputation`EmptyGraph[Range[16]],
 ImageMargins -> Scaled[.05], ImageSize -> 300]

enter image description here

$\endgroup$
2
$\begingroup$

Using GraphLayout:

Graph[Range[16], {}, 
 GraphLayout -> {"VertexLayout" -> {"GridEmbedding", 
     "Dimension" -> {4, 4}}, "PackingLayout" -> None}, 
 VertexSize -> Medium, VertexStyle -> White, PlotRangePadding -> 1, 
 Frame -> True]

You can modify "Dimension" to change the shape:

Graph[Range[16], {}, 
 GraphLayout -> {"VertexLayout" -> {"GridEmbedding", 
     "Dimension" -> {2, 8}}, "PackingLayout" -> None}, 
 VertexSize -> Medium, VertexStyle -> White, PlotRangePadding -> 1, 
 Frame -> True] 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.