Graph not drawing after VertexDelete

I'm very new to Mathematica and am currently trying the VertexDelete function, but after using it, my graph isn't drawing.

Input:

a = CompleteGraph[{7, 2}]
a = VertexDelete[a, {3, 4}]

As the output I get

Graph["small default graph picture", vertex count:7 and edge count:10]

The vertex count and edge count are correct, so the removal is done, but why doesn't it evaluate to a graph drawing?

• Interesting - seems something breaks - you can get result by taking vertex and edge lists of result and making new graph with appropriate options for bipartite rendering... will ponder further, might be a bug (I had two kernel crashes fiddling with it on 9.x)
– ciao
May 22 '15 at 23:40
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. May 23 '15 at 1:06

CompleteGraph[a,b] set GraphLayout to be "MultipartiteLayout".

a = CompleteGraph[{7, 2}];

a // Options

{GraphLayout -> {"MultipartiteLayout", "VertexPartition" -> {7, 2}}}

and this layout carried over to new graph.

a = VertexDelete[a, {3, 4}];
a // Options

{GraphLayout -> {"MultipartiteLayout", "VertexPartition" -> {7, 2}}}

You could do what David suggested or you could add one more step to set up coordinate..

a = CompleteGraph[{7, 2}];
a = SetProperty[a, VertexCoordinates -> GraphEmbedding[a]];
a = VertexDelete[a, {3, 4}];

a • Do you have any comment on this? Jun 2 '15 at 9:01
• @Szabolcs you could send a report to Wolfram Tech Support Jun 2 '15 at 20:05
• I did, just wanted to make sure I didn't miss anything. E.g. first I was thinking that somehow one empty graph is marked as directed and the other as undirected, but (unlike other packages) Mathematica doesn't appear to make that distinction. Both DirectedGraphQ and UndirectedGraphQ give True on empty graphs. I asked because I thought you may have some insight. Jun 3 '15 at 8:46

A bit inelegant, but it works:

Graph[VertexDelete[a, {3, 4}],
DeleteCases[EdgeList[a], (3 | 4) <-> _ | _ <-> (3 | 4)],
VertexLabels -> "Name",
VertexCoordinates ->
Drop[AbsoluteOptions[a, VertexCoordinates][[1, 2]], {3, 4}]] • That kind of breaks the whole point of a k-partite display of the OP...
– ciao
May 22 '15 at 23:40
• Good fix! +1...
– ciao
May 23 '15 at 0:54
• +1. Going back to 8.0.1, I've run into many odd bugs with the internal representation of graphs getting messed up after calling any graph modification functions. The most robust solution is to write what a C++ programmer would call a copy constructor, and use it after any sequence of graph mutation operations.
– xcah
May 23 '15 at 2:12