I would call this a bug. It's a fairly typical type of failure, but it is very confusing (and hard to debug) if you have not encountered it in the past.
Most graph functions have the bad habit of just refusing to work when something goes wrong, but not reporting any errors. This is what happens here.
When you create a complete multipartite graph, the graph layout is automatically set to "MultipartiteLayout"
. Check Options[a1, GraphLayout]
.
In[7]:= Options[a1, GraphLayout]
Out[7]= {GraphLayout -> {"MultipartiteLayout",
"VertexPartition" -> {4, 6}}}
This layout is inherited by the result of EdgeAdd
. But now the graph has more vertices than 4+6=10, so the layout specification is no longer valid. Instead of indicating that something is wrong, and issuing some readable error message, Mathematica will simply not render the graph.
Workaround: set your own GraphLayout
:
Graph[g, GraphLayout -> "SpringElectricalEmbedding"]
It is frustrating to see so many of these issues because anyone who actually uses this functionality area will run into these things regularly. This is why I keep repeating that development should be driven by real use cases, and feedback from users who actually use this for real work.