I suspect this is just a bug in Mathematica. Here is the same graph embedded with different options for GraphLayout:
edges =
{
UndirectedEdge[1, 2],
UndirectedEdge[2, 3],
UndirectedEdge[3, 5],
UndirectedEdge[4, 7],
UndirectedEdge[4, 8],
UndirectedEdge[5, 6],
UndirectedEdge[5, 7]
};
{Graph[edges, GraphLayout -> "GridEmbedding", ImageSize -> Medium],
Graph[edges, GraphLayout -> "LayeredEmbedding", ImageSize -> Medium]}
The output is shown below.
The two graphs appear to have different connectivity. What is up with this?
EdgeShapeFunction -> "CurvedArc"
andVertexLabels -> "Name"
to bothGraph
s to avoid overlapping edges. $\endgroup$ – kglr Jan 17 '20 at 1:03GridGraph
. It's a dumb method that puts vertices on a grid in the order they appear in the vertex list. It will almost always result in overlapping edges unless your graph has a very specific structure and vertex ordering (i.e. it's what GridGraph generates, possibly with some missing edges) $\endgroup$ – Szabolcs Jan 17 '20 at 8:05