Take a simple GridGraph
:
g = GridGraph[{3, 3}, VertexLabels -> "Name", ImageSize -> 150, ImagePadding -> 10]
I am puzzled by the following behavior:
Try to delete vertex 2:
h=VertexDelete[g, 2]
Vertex 2 was deleted, but so were several edges that did not have a node at vertex 2. In addition, Vertex 1 appears to be connected to vertex 3; it wasn't before.
Now look at the remaining edges:
EdgeList[h]
{1 [UndirectedEdge] 4, 3 [UndirectedEdge] 6, 4 [UndirectedEdge] 5, 4 [UndirectedEdge] 7, 5 [UndirectedEdge] 6, 5 [UndirectedEdge] 8, 6 [UndirectedEdge] 9, 7 [UndirectedEdge] 8, 8 [UndirectedEdge] 9}
According to the edge list, Vertex 1 is not connected to vertex 3 (even though it was draw as connected to 3); but vertex 1 is connected to vertex 4 (even though it was not so drawn).
Try deleting vertices 1 and 3:
VertexDelete[g, {1, 3}]
Either I am misunderstanding something or Mathematica is erring. Can anyone explain which is the case?
Thanks.