File Exchange

image thumbnail

Graph manipulation

version 1.0 (2.89 KB) by

These four files are intended for adding/deleting nodes and edges in biograph object

5 Downloads

Updated

View License

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

Comments and Ratings (4)

Pranava Gopu

Corey

Corey (view profile)

(update to previous comment, I think you may want to add 'bg.IsLaidout = 0;' to the end of node_add())

Corey

Corey (view profile)

Thanks for this submission, incredibly useful.

Currently testing in MATLAB Version 8.5.0.197613 (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).

Sven

Sven (view profile)

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;
    end
    return;
end

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video