File Exchange

image thumbnail

Graph package

version 1.1 (36.9 KB) by

Graph package for molecular biologist



View License

In biology, graph formalism is prevalently used. This graph package is for you to analysis biomolecular interaction network with the comfort of MATLAB. The package includes algorithm like modularity, clustering coefficient, all-pair shortest path (amazingly fast, great if you have 64-bit) and so on. It also do plotting the graph with force directed layout. The graph can be generated from various input format as well as SBML , GML, DOT or SIF file.

The package is written as MATLAB object and furnish with rich tools for manipulating the graph object and export adjacency matrix for further analysis.

Comments and Ratings (18)

Hasdg Huegrfe


YF (view profile)

Excuse me.
Input:Adjacency matrix,how can I use the clustering algorithm to layout a graph,please?


YF (view profile)

use matlab built-in JAVA???


Jose (view profile)

How to install this package?

Shen Lin

Why it's aways 1 when I calculate the assortativity of a network? Did some try that before?



I'am using Matlab R2006a and I tried to use this package and I have the following error:
>> g = graph(10)
??? Attempt to reference field of non-structure array.

Error in ==> size at 14
m = length(g.nodes);

Error in ==> graph at 370
elseif (isnumeric(varargin{1}) || islogical(varargin{1})) && ...

Error in ==> graph at 366
g = graph(adj);

Moreover, I need to transform a gml graph into an adgacency matrix.

Could you explain me how does it works? Thanks a lot.


Tun (view profile)


Graph data structure is for directed, but most methods are for undirected graph.



I'm using your tool for plotting EEG channels in matlab. Now I want to change the node placement to arrange them in the proper position as appeared in EEG cab. Any suggestion?


xiao meng

has anyone had success installing this toolbox with MATLAB v7.5 Release R2007b (on Win XP Pro)

I unzipped the files to the /toolbox/local/ folder and tried adding the new @graph folder to path-- however I get this message:

"Warning: Method directories not allowed in MATLAB path: ...."

Any pointers? Thanks.


mezxl (view profile)

has anyone had success installing this toolbox with MATLAB v7.5 Release R2007b (on Win XP Pro)

I unzipped the files to the /toolbox/local/ folder and tried adding the new @graph folder to path-- however I get this message:

"Warning: Method directories not allowed in MATLAB path: ...."

Even when I cd into the folder, Matlab can't seem to find the .m files to run (I'm trying I gg = graph(10);)

Any pointers? Thanks.

Does these coded work for directed, weighted graph?


Kyaw (view profile)

To calculate mocularity,

g = graph(adjacency_matrix)
m = modularity(g)

Igor Mishkovski

I am interested in using the graph package for calculation of the modularity of a complex network. I work with adjacency matrix, but the input in modularity is in other format. So, can you tell me the input format of the network to calculate its modularity.
Thanks in advance,
Igor Mishkovski

Jeff Kilpatrick

BFS and shortestPath don't seem to work either. The former doesn't handle self-loops (which is why I tried this over the Bioinformatics toolbox to begin with) and the latter makes use of a non-existent function.

Sonia Leach

I believe there might be several errors in the code for computing the clustering coefficient in clusteringcoeff.m

Currently lines of the code read:
for k1 = 1:a
for k2 = k1+1:a
if adj(k1,k2) | adj(k2,k1)
E = E + 1;

1. if the nested for loops are meant to cover all possible pairs, technically it should be 'for k1 = 1:(a-1)' though if the original matrix did not have self-loops, this will not affect the result. The check for non-self loops in 'neighbours' only removes the self-loop of the node, not self-loops among its neighbors so if the adjacency matrix has self-loops, this code would be incorrect - unless I am mistaken about the calculation of the clustering coefficient? Given that the calculation counts the 'denominator' as 'all possible pairs' (a(a-1)/2), this makes me think that the authors assume no self loops in the graph. In that case, the code is incorrect.
3. a is meant to be the number of neighbors and k1, k2 to enumerate over the SET of neighbors, not be the IDENTITY of the neighbors so the line
'if adj(k1,k2) | adj(k2,k1)'
should instead read
if adj(neighbours(k1), neighbours(k2)) | adj(neighbours(k2), neighbours(k1))
to access the actual indices of the neighbors, not just the nodes 1:a....

I believe the correct version of this segment of code should be:
for k1 = 1:(a-1)
for k2 = k1+1:a
if adj(neighbours(k1),neighbours(k2)) | adj(neighbours(k2),neighbours(k1))
E = E + 1;

saad h


I am interested to do some experiments using
your Graph package for molecular biologist.
I you appreciate some examples on how to uses it.

khalid roshdy roshdy

please i need to know how to iniliaze the graph and entering the adject matrices and use all the package, plesae give me some examples about this



Add graph partitioning, some kernel methods and bug fix

Layout update.

spectral partitioning update

Spectral partitioning update

description, keywords update

Updated support for SIF file input and some bug fix.

MATLAB Release
MATLAB 7 (R14)

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

» Watch video