Permalink
...
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Open a pull request
- 7 commits
- 30 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
1,674 additions
and 17 deletions.
- +87 −0 build/buildgaimc.m
- +35 −0 build/matlab_central_notes.txt
- +2 −7 demo/airports.m
- +8 −6 demo/demo.m
- +321 −0 demo/html/airports.html
- BIN demo/html/airports.png
- BIN demo/html/airports_01.png
- BIN demo/html/airports_02.png
- BIN demo/html/airports_03.png
- BIN demo/html/airports_04.png
- BIN demo/html/airports_05.png
- +744 −0 demo/html/demo.html
- BIN demo/html/demo.png
- BIN demo/html/demo_01.png
- BIN demo/html/demo_02.png
- BIN demo/html/demo_03.png
- BIN demo/html/demo_04.png
- BIN demo/html/demo_05.png
- BIN demo/html/demo_06.png
- BIN demo/html/demo_07.png
- BIN demo/html/demo_08.png
- BIN demo/html/demo_eq02910.png
- BIN demo/html/demo_eq74756.png
- BIN demo/html/demo_eq85525.png
- BIN demo/html/demo_eq91421.png
- +334 −0 demo/html/performance_comparison_simple.html
- BIN demo/html/performance_comparison_simple.png
- BIN demo/html/performance_comparison_simple_01.png
- +12 −4 demo/performance_comparison.m
- +131 −0 demo/performance_comparison_simple.m
View
87
build/buildgaimc.m
| @@ -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); | ||
| + |
View
35
build/matlab_central_notes.txt
| @@ -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
9
demo/airports.m
| @@ -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
14
demo/demo.m
| @@ -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.