Given a random graph, I want to define a function MeshGraphQ
that tests if the graph is a lattice (or mesh) graph. Here, I don't need the tiling to be regular. Therefore, I believe it is enough to check the following
- If any two edges intersect.
- If some part of the graph does not form a polygon.
- If the graph is disconnected.
If any of these points are true, return False
. Return True
otherwise.
For example, I want MeshGraphQ
to return True
for the graphs
and False
for the graphs
Just to give a bit of context, my goal is to slightly improve the graphToMesh
function defined in this answer, in order to account for the cases where the graph does not define a lattice. I presume Mathematica already has some tools to help me do this, but I'm not used to working with graphs much, so any ideas/hints are appreciated.