I have a MeshRegion R and I want to extract all pairs of adjacent faces efficiently. The way that I've been computing this is demonstrated below:
R = DiscretizeRegion[Sphere[]];
faces = MeshCells[R, 2, "Multicells" -> True][[1, 1]];
adj = Select[Subsets[faces, {2}],Length[Intersection[#[[1]], #[[2]]]] == 2 &];
Of course, this is not very efficient since I explicitly construct all pairs of faces and then filter them by requiring that they have both contain two of the same vertices. Any thoughts on how I could compute the same thing efficiently?


Nearesttakes twice as long as OP's implementation... I think the reason is that the chosen distance function is no distance function at all, soNearestcannot take any advantage of it. – Henrik Schumacher Jul 12 '19 at 12:07