Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a base branch
...
Choose a head branch
Checking mergeability… Don’t worry, you can still create the pull request.
  • 7 commits
  • 30 files changed
  • 0 commit comments
  • 1 contributor
View
@@ -0,0 +1,87 @@
+%% build the gaimc distribution
+function buildgaimc(varargin)
+if ~isempty(strmatch('all',varargin))
+ buildlist = {'test','pages','zip'};
+else
+ buildlist = varargin;
+end
+tobuild = @(type,buidlist) ~isempty(strmatch(type,buildlist));
+gaimcversion = '1.0';
+mypath = fileparts(mfilename('fullpath'));
+oldpath = pwd;
+matlablpath=path;
+try
+ if tobuild('test',buildlist)
+ fprintf('Running tests...\n\n');
+ cd(mypath) % move to where we think we are
+ cd ../ % in main gaimc directory
+ addpath(pwd); % add it to the path
+ cd test % run tests
+ try
+ test_main
+ catch ME
+ fprintf('*************\n')
+ fprintf('Tests failed!\n');
+ fprintf('*************\n')
+ fprintf('\n');
+ fprintf('Build halted.\n');
+ fprintf('\n');
+ fprintf('Test error:\n');
+ rethrow(ME);
+ end
+ end
+
+ if tobuild('pages',buildlist)
+ fprintf('Building demos...\n\n');
+ cd(mypath) % move to where we think we are
+ cd ../ % in main gaimc directory
+ addpath(pwd); % add it to the path
+ cd demo
+ try
+ publish('demo');
+ publish('airports');
+ publish('performance_comparison_simple');
+ if tobuild('pages_fullperf')
+ publish('performance_comparison');
+ end
+ catch ME
+ fprintf('******************\n')
+ fprintf('Publishing failed!\n');
+ fprintf('******************\n')
+ fprintf('\n');
+ fprintf('Build halted.\n');
+ fprintf('\n');
+ fprintf('Test error:\n');
+ rethrow(ME);
+ end
+ end
+
+ if tobuild('zip',buildlist)
+ cd(mypath) % move to where we think we are
+ try
+ cd ../../
+ [status,result] = system(...
+ sprintf('zip -r gaimc/build/gaimc-%s.zip gaimc/*.m gaimc/demo gaimc/test gaimc/graphs',...
+ gaimcversion));
+ result
+ catch ME
+ fprintf('******************\n')
+ fprintf('Zipping failed!\n');
+ fprintf('******************\n')
+ fprintf('\n');
+ fprintf('Build halted.\n');
+ fprintf('\n');
+ fprintf('Error:\n');
+ rethrow(ME);
+ end
+ end
+
+catch ME
+ cd(oldpath); % move to where we think we are
+ path(matlabpath);
+ rethrow(ME)
+end
+
+cd(oldpath);
+path(matlabpath);
+
@@ -0,0 +1,35 @@
+Picture: minnesota graph (demo_08.png)
+
+Title : gaimc : Graph Algorithms In Matlab Code
+Summary (100 chars) :
+Efficient pure-Matlab implementations of graph algorithms to complement MatlabBGL's mex functions.
+Description (5000 chars) :
+
+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
+
+Tags:
+
+graph, network, dijkstra, core numbers, prim, dfs, bfs, connected components,
+strongly connected components, clustering coefficients, directed clustering coefficients,
+directed network, directed graph, depth first search, breadth first search,
+shortest paths, minimum spanning tree, mst
+
View
@@ -67,12 +67,10 @@
% That's the US, now we need to plot our data on top of it.
[X,Y] = gplot(T,xy); % get the information to reproduce a gplot
plotm(Y,X,'k.-','LineWidth',1.5); % plot the lines on the map
-%%
-% We need to clear the axes after the mapping toolbox
-clf;
+
%%
% Let's just look at the continential US too.
-figure; ax = usamap('conus');
+clf; ax = usamap('conus');
states = shaperead('usastatelo', 'UseGeoCoords', true, 'Selector',...
{@(name) ~any(strcmp(name,{'Alaska','Hawaii'})), 'Name'});
faceColors = makesymbolspec('Polygon',...
@@ -85,9 +83,6 @@
% One interesting aspect of this map is that major airline hubs (Chicago,
% New York, etc. are not well represented. One possible explaination is
% that they have larger delays than other regional airports.
-%
-% Clear the figure again before proceeding.
-clf;
%% Honolulu to St. Johns?
% Before, we saw that the lengthiest route was between St. John's and
View
@@ -83,7 +83,7 @@
%%
% Load the example matrix from the Boost Graph Library
-load('graphs/dfs_example');
+load_gaimc_graph('dfs_example');
figure(1); graph_draw(A,xy,'labels',labels);
%%
@@ -99,7 +99,7 @@
%%
% Let's look at breadth first search too, using a different example.
-load('graphs/bfs_example');
+load_gaimc_graph('bfs_example');
figure(1); clf; graph_draw(A,xy,'labels',labels);
%%
@@ -161,7 +161,8 @@
%%
% Now, we just call MST and look at the result.
-T = mst_prim(A);
+% T = mst_prim(A);
+% This command means we can't run the demo, so it's commented out.
%%
% Oops, travel time isn't symmetric! Let's just pick the longest possible
@@ -220,6 +221,7 @@
%%
% We also have a largest_component function that makes it easy to just get
% the largest connected component.
+clf;
[Acc,f] = largest_component(A);
graph_draw(Acc,xy(f,:))
%%
@@ -236,7 +238,7 @@
%%
% Load a road network to use for statistical computations
-load('graphs/minnesota');
+load_gaimc_graph('minnesota');
gplot(A,xy);
%%
@@ -280,7 +282,7 @@
%%
% Load and convert the graph.
-load ('graphs/all_shortest_paths_example');
+load_gaimc_graph('all_shortest_paths_example');
A = spfun(@(x) x-min(min(A))+1,A); % remove the negative edges
As = convert_sparse(A);
%%
@@ -305,4 +307,4 @@
toc
%%
% And just to check, let's make sure the output is the same.
-isequal(D,D2)
+isequal(D,D2)
Oops, something went wrong.

No commit comments for this range