⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 components.m

📁 The MatlabBGL library fills a hole in Matlab s suite of algorithms. Namely, it provides a rich set o
💻 M
字号:
function [ci sizes] = components(A,varargin)
% COMPONENTS Compute the connected components of a graph.
%
% [ci sizes] = components(A) returns the component index vector (ci) and
% the size of each of the connected components (sizes).  The number of
% connected components is max(components(A)).  The algorithm used computes
% the strongly connected components of A, which are the connected
% components of A if A is undirected (i.e. symmetric).  
%
% This method works on directed graphs.
% The runtime is O(V+E), the algorithm is just depth first search.
%
% ... = components(A,u,options) sets optional parameters (see 
% set_matlab_bgl_options) for the standard options.
%   There are no additional options for this function.
%
% Note: this function does not depend upon the non-zero values of A, but
% only uses the non-zero structure of A.
%
% Example: 
%    load graphs/dfs_example.mat
%    components(A)
%
% See also DMPERM, BICONNECTED_COMPONENTS

%
% David Gleich
% 21 April 2006
%
% 2006-05-31: Added full2sparse check
%

[trans check full2sparse] = get_matlab_bgl_options(varargin{:});
if (full2sparse && ~issparse(A)) 
    A = sparse(A); 
end
if (check) 
    check_matlab_bgl(A,struct()); 
end
if (trans) 
    A = A'; 
end

[ci sizes] = components_mex(A);


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -