资源简介
matlab 图论工具箱 有max_flow,Floyd最短路径等函数
代码片段和文件信息
function [DP] = all_shortest_paths(Avarargin)
% all_shortest_paths Compute the weighted all pairs shortest path problem.
%
% D = all_shortest_paths(A) returns the distance matrix D for all vertices
% where D(ij) indicates the shortest path distance between vertex i and
% vertex j.
%
% For the Floyd-Warshall algorithm this function can return the
% predecessor matrix as well:
% [D P]=all_shortest_paths(Astruct(‘algname‘‘floyd_warshall‘));
% returns P so that the P(ij) is the node preceeding j on the path from
% i to j. To build the path between (ij) use the commands
% p=[]; while j~=0 p(end+1)=j; j=P(ij); end; p=fliplr(p);
%
% ... = all_shortest_paths(Au...) takes a set of
% key-value pairs or an options structure. See set_matlab_bgl_options
% for the standard options.
% options.algname: the algorithm to use
% [{‘auto‘} | ‘johnson‘ | ‘floyd_warshall‘]
% options.inf: the value to use for unreachable vertices
% [double > 0 | {Inf}]
% options.edge_weight: a double array over the edges with an edge
% weight for each node see EDGE_INDEX and EXAMPLES/REWEIGHTED_GRAPHS
% for information on how to use this option correctly
% [{‘matrix‘} | length(nnz(A)) double vector]
%
% Note: ‘auto‘ cannot be used with ‘nocheck‘ = 1. The ‘auto‘ algorithms
% checks the number of edges in A and if the graph is more than 10% dense
% it uses the Floyd-Warshall algorithm instead of Johnson‘s algorithm.
%
% Example:
% load graphs/clr-26-1.mat
% all_shortest_paths(A)
% all_shortest_paths(Astruct(‘algname‘‘johnson‘))
%
% See also JOHNSON_ALL_SP FLOYD_WARSHALL_ALL_SP.
% David Gleich
% Copyright Stanford University 2006-2008
%% History
% 2006-04-19: Initial version
% 2006-05-31: Added full2sparse check
% 2007-03-01: Added option for predecessor matrix from floyd_warshall
% 2007-04-20: Added edge weight option
% 2007-07-08: Fixed typos in strings and documentation
% Removed fixes for the Johnson algorithm
% 2007-07-12: Fixed edge_weight documentation.
% 2007-07-21: Fixed divide by 0 error in check for algorithm type
% 2008-04-02: Added documenation for predecessor matrix
% 2008-10-07: Changed options parsing
%%
[trans check full2sparse] = get_matlab_bgl_options(varargin{:});
if full2sparse && ~issparse(A) A = sparse(A); end
options = struct(‘algname‘ ‘auto‘ ‘inf‘ Inf ‘edge_weight‘ ‘matrix‘);
options = merge_options(optionsvarargin{:});
% edge_weights is an indicator that is 1 if we are using edge_weights
% passed on the command line or 0 if we are using the matrix.
%edge_weights = 0;
edge_weight_opt = ‘matrix‘;
if strcmp(options.edge_weight ‘matrix‘)
% do nothing if we are using the matrix weights
else
edge_weight_opt = options.edge_weight;
end
if check
% check the values of the matrix
check_matlab_bgl(Astruct(‘values‘1));
% set the algname
if strcmpi(options.algname ‘auto‘)
nz = nnz(A);
if (nz/(numel(A)+1) > .1)
opti
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4560 2011-12-03 11:04 Contents.m
文件 3252 2011-12-03 11:04 core_numbers.m
文件 1226 2011-12-03 11:04 cycle_graph.m
文件 1253 2011-12-03 11:04 dag_sp.m
文件 2942 2011-12-03 11:04 depth_first_search.m
文件 2283 2011-12-03 11:04 dfs.m
文件 1603 2011-12-03 11:04 dijkstra_sp.m
文件 2969 2011-12-03 11:04 edge_weight_index.m
文件 1739 2011-12-03 11:04 edge_weight_vector.m
文件 1360 2011-12-03 11:04 edmonds_maximum_cardinality_matching.m
文件 957 2011-12-03 11:04 edmunds_karp_max_flow.m
文件 611 2011-12-03 11:04 erdos_reyni.m
文件 1220 2011-12-03 11:04 floyd_warshall_all_sp.m
文件 2532 2011-12-03 11:04 fruchterman_reingold_force_directed_layout.m
文件 2553 2011-12-03 11:04 grid_graph.m
文件 3631 2011-12-03 11:04 gursoy_atun_layout.m
文件 2550 2011-12-03 11:04 indexed_sparse.m
文件 1071 2011-12-03 11:04 is_kuratowski_graph.m
文件 2080 2011-12-03 11:04 is_straight_line_drawing.m
文件 1051 2011-12-03 11:04 johnson_all_sp.m
文件 3544 2011-12-03 11:04 kamada_kawai_spring_layout.m
文件 886 2011-12-03 11:04 kolmogorov_max_flow.m
文件 861 2011-12-03 11:04 kruskal_mst.m
文件 586 2011-12-03 11:04 kuratowski_subgraph.m
文件 1535 2011-12-03 11:04 lengauer_tarjan_dominator_tree.m
文件 1426 2011-12-03 11:04 make_biconnected_planar.m
文件 1200 2011-12-03 11:04 make_connected.m
文件 1327 2011-12-03 11:04 make_maximal_planar.m
文件 4110 2011-12-03 11:04 matching.m
文件 2976 2011-12-03 11:04 max_flow.m
............此处省略451个文件信息
- 上一篇:CLAHE 代码
- 下一篇:贝叶斯网络工具箱MATLAB工具箱
相关资源
- 《MATLAB扩展编程》代码
- HDB3码、AMI码的MATLAB实现
- 3点GPS定位MATLAB仿真
- MATLAB数字信号处理85个实用案例精讲入
- matlab从入门到精通pdf94795
- 欧拉放大论文及matlab代码
- 跳一跳辅助_matlab版本
- 全面详解LTE MATLAB建模、仿真与实现
- MIMO-OFDM无线通信技术及MATLAB实现_孙锴
- MATLAB Programming for Engineers 4th - Chapman
- matlab 各种谱分析对比
- 分数阶chen混沌matlab程序
- 基于粒子群算法的非合作博弈的matl
- MATLAB车流仿真 包括跟驰、延误
- matlab空间桁架计算程序
- 基于MATLAB的图像特征点匹配和筛选
- DMA-TVP-FAVAR
- GPS信号的码捕获matlab代码.7z
- 一维光子晶体MATLAB仿真代码吸收率折
- newmark法源程序
- 传统关联成像、计算鬼成像matlab
- pri传统分选算法
- 摆动滚子推杆盘形凸轮设计
- 医学图像重建作业matlab源码
- Matlab实现混沌系统的控制
- 检测疲劳驾驶
- Matlab锁相环仿真-Phase Locked Loop.rar
-
Fuzzysimuli
nk有关模糊PID问题概述-自适 - 用matlab写的有限元程序-FEM2DL_Box.m
- matlab开发-能带计算
评论
共有 条评论