3
$\begingroup$

I had used

mesh = IGLatticeMesh["Hexagonal", Polygon@CirclePoints[3, 6], MeshCellLabel -> {2 -> "Index"}]

graph = IGMeshCellAdjacencyGraph[mesh, 2, VertexCoordinates -> Automatic];

from a thread here to create nearest neighbor graph in Mathematica for a Hexagonal Grid. I would like to do the same in 3D with alternative sphere packing strategies. I have not figured out how to extend the item above

$\endgroup$
2
  • $\begingroup$ If you can generate the points you need in 3D, then IGGabrielGraph will give you what you need in most cases. You did not mention any specific point arrangements you want, so I won't go into that. $\endgroup$
    – Szabolcs
    Commented Mar 3, 2023 at 15:32
  • $\begingroup$ Thank you. That is helpful. Your IG package is most useful. The point arrangement is Hexagonal Close Packing (HCG) $\endgroup$
    – RLip2
    Commented Mar 6, 2023 at 22:11

1 Answer 1

1
$\begingroup$

A few approaches:

NearestNeighborGraph[RandomReal[1, {50, 3}], 2]

enter image description here

data = RandomReal[{-1, 1}, {6, 17, 3}];
MeshConnectivityGraph[VoronoiMesh[#], 0] & /@ data

enter image description here

data = RandomReal[{-1, 1}, {6, 17, 3}];
MeshConnectivityGraph[DelaunayMesh[#], 0] & /@ data

enter image description here

$\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.