File Exchange

image thumbnail

Graph manipulation

version (2.89 KB) by Arsen Arakelyan
These four files are intended for adding/deleting nodes and edges in biograph object

1 Download

Updated 13 Jul 2012

View License

Biograph class does not allow adding of deleting nodes or edges.
Here is the way how to overcome this. 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

Cite As

Arsen Arakelyan (2020). Graph manipulation (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

zabe freire


(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 (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;

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux