No BSD License  

Highlights from
gaimc : Graph Algorithms In Matlab Code

5.0

5.0 | 3 ratings Rate this file 106 Downloads (last 30 days) File Size: 649.73 KB File ID: #24134
image thumbnail

gaimc : Graph Algorithms In Matlab Code

by David Gleich

 

16 May 2009

Efficient pure-Matlab implementations of graph algorithms to complement MatlabBGL's mex functions.

| Watch this File

File Information
Description

While MatlabBGL uses the Boost Graph Library for efficient graph routines,
gaimc implements everything in pure Matlab code. While the routines are
slower, they aren't as slow as I initially thought. Since people often
have problems getting MatlabBGL to compile on new versions of Matlab
or on new architectures, this library is then a complement to MatlabBGL.

See the published M-files for a few examples of the capabilities.

Functions
  depth first search (dfs)
  breadth first search (bfs)
  connected components (scomponents)
  maximum weight bipartite matching (bipartite_matching)
  Dijkstra's shortest paths (dijkstra)
  Prim's minimum spanning tree (mst_prim)
  clustering coefficients (clustercoeffs)
  directed clustering coefficients (dirclustercoeffs)
  core numbers (corenums)

The project is maintained at github : http://github.com/dgleich/gaimc/tree/master

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
MatlabBGL

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
18 May 2009 Jeremy Kozdon  
25 Nov 2010 Forrest Bao  
25 Feb 2011 Leon

Thanks for your excellent library! It's great to be able to see how you've solved the technical issues. Good work!

I believe there is a small bug in your clusteringcoeffs.m code, Tt occurs when you try and calculate unweighted clustering with a normal format network (not csr).

Calling clustercoeffs.m(A,0) always exits with

"Error in ==> clustercoeffs at 42
    if any(ai)<0, error('gaimc:clustercoeffs',... "

This is because ai is not defined; the easy solution is to nest:
if any(ai) <0, error( ....
end
within the "if usew, [rp ci ai]..." loop.

your code (lines 39-45):
    if usew, [rp ci ai]=sparse_to_csr(A);
    else [rp ci]=sparse_to_csr(A);
    end
    if any(ai)<0, error('gaimc:clustercoeffs',...
            ['only positive edge weights allowed\n' ...
             'try clustercoeffs(A,0) for an unweighted comptuation']);
    end

proposed fix (lines 39-45)
    if usew, [rp ci ai]=sparse_to_csr(A);
        if any(ai)<0, error('gaimc:clustercoeffs',...
            ['only positive edge weights allowed\n' ...
             'try clustercoeffs(A,0) for an unweighted comptuation']);
        end
    else [rp ci]=sparse_to_csr(A);
    end

Hope that helps,
L.

22 Jul 2011 Alok

David/all:

Under what license is this available? Can I use this for commercial purposes?

Thanks for the great work.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
graph David Gleich 17 May 2009 19:21:44
network David Gleich 17 May 2009 19:21:44
dijkstra David Gleich 17 May 2009 19:21:44
core numbers David Gleich 17 May 2009 19:21:44
prim David Gleich 17 May 2009 19:21:44
dfs David Gleich 17 May 2009 19:21:44
bfs David Gleich 17 May 2009 19:21:44
connected components David Gleich 17 May 2009 19:21:44
strongly connected components David Gleich 17 May 2009 19:21:44
clustering coefficients David Gleich 17 May 2009 19:21:44
shortest David Gleich 17 May 2009 19:21:44
directed network David Gleich 17 May 2009 19:21:44
directed graph David Gleich 17 May 2009 19:21:44
depth first search David Gleich 17 May 2009 19:21:44
breadth first search David Gleich 17 May 2009 19:21:44
directed clustering coefficients David Gleich 17 May 2009 19:21:44
bfs Federico Felizzi 05 Mar 2010 13:07:17
breadth first search Federico Felizzi 05 Mar 2010 13:07:21
connected components TS 09 Sep 2010 15:13:06
directed network Janchiv Adiyabaatar 06 Jan 2011 15:12:13

Contact us at files@mathworks.com