Biograph class does not allow adding of deleting nodes or edges.
Here is the way how to overcome this. Graph_man.zip contains four M-files:
node_add.m - add node to existing graph
node_del.m - delete node from existing graph
edge_add.m - add edge to existing graph
edge_del.m - delete edge from existing graph
(update to previous comment, I think you may want to add 'bg.IsLaidout = 0;' to the end of node_add())
Thanks for this submission, incredibly useful.
Currently testing in MATLAB Version 188.8.131.52613 (R2015a), win x64.
Note: In edge_add() I had to 'dolayout(bg);' to the end of the script. (Viewing caused error in edge::hgUpdate(), ControlPoints not set).
Excellent submission. I was surprised that there's nothing already in biograph to manipulate an already-computed graph. I'm making a few small additions such as the ability to remove a set of nodes by sticking this loop at the top of node_del()
if isnumeric(NodeID) && numel(NodeID)>1
for i = 1:length(NodeID)
thisNID = NodeID(i);
bg = node_del(bg,thisNID);
NodeID(NodeID>thisNID) = NodeID(NodeID>thisNID)-1;
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.