Efficient way to get adjacency information from MeshRegion

What is the most efficient way to get adjacency information from a MeshRegion, i.e. some efficient representation of which vertex is connected to which other one?

The result could be a packed adjacency list, a sparse array or a Graph.

Example:

r = TriangulateMesh@DiscretizeRegion[Cuboid[]]


Now r["AdjacencyMatrix"] does not work. MeshCells[r,1] works well, but it gives a list of Lines, not a packed array.

adj1 = MeshCells[r, 1];

adj2 = DeveloperToPackedArray[adj1[[All, 1]]];

(* {3433488, 312280} *)

• – Szabolcs Oct 4 '15 at 9:39

You could use:

r["MakeRepresentation"["ElementMesh"]]["ElementConnectivity"]
`