~dgleich/matlab-bgl/master

« back to all changes in this revision

Viewing changes to bellman_ford_sp.m

  • Committer: David Gleich
  • Date: 2008-09-29 22:06:39 UTC
  • mfrom: (1.1.19 work)
  • Revision ID: dgleich@stanford.edu-20080929220639-4ic8mxd20lu81dla
Incorporated misc. fixes and graph layout algorithms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [d pred] = bellman_ford_sp(A,u,varargin)
 
1
function [d pred] = bellman_ford_sp(A,u,options)
2
2
% BELLMAN_FORD_SP Compute the weighted single source shortest path problem.
3
3
%
4
4
% The Bellman-Ford algorithm for the single source shortest path problem
33
33
%
34
34
% See also SHORTEST_PATHS, DIJKSTRA_SP.
35
35
 
36
 
%
37
36
% David Gleich
38
 
% 23 April 2006
39
 
%
 
37
% Copyright, Stanford University, 2006-2008
 
38
 
 
39
%% History
 
40
%  2006-04-23: Initial version
 
41
%%
40
42
 
41
43
algname = 'bellman_ford';
42
44
 
43
 
if (nargin > 2)
44
 
    options = varargin{1};
45
 
    options.algname = algname;
46
 
else
47
 
    options = struct('algname',algname);
48
 
end;
 
45
if nargin > 2, options.algname = algname;
 
46
else options = struct('algname',algname);
 
47
end
49
48
 
50
49
[d pred] = shortest_paths(A,u,options);
51
50
 
52
51
 
53
 
 
54