graphgeneratecompletekpartitegraph.m
来自「复杂网络的一些节点面对攻击的代码」· M 代码 · 共 34 行
M
34 行
function Graph = GraphGenerateCompleteKPartiteGraph(GroupSizes)
%Generates a complete k-Partite graph. sum(GroupSizes) of nodes are split into numel(GroupSizes) groups. Nodes in each groups are connected to all nodes outsized their group.
%
% Receives:
% GroupSizes - vector of integers - List of group sizes. The graph will have sum(GroupSizes) nodes.
%
% Returns:
% Graph - structure - The required graph. The format is identical to the one loaded with GraphLoad
%
% Example:
% Graph = GraphGenerateCompleteKPartiteGraph(2,3);
%
% See Also:
% ObjectCreateGraph, GraphGenerateCompleteGraph, GraphGenerateCompleteBipartiteGraph
%
% Algorithm:
% http://mathworld.wolfram.com/CompleteBipartiteGraph.html
%
% Created:
% Lev Muchnik 20/03/2005, Tel.: 972-054-4326496
% Major Changes:
error(nargchk(2,2,nargin));
error(nargoutchk(0,1,nargout));
Groups = {};
Degree = 0;
for n = GroupSizes(:)
Groups{end+1} = Degree+1 : n+Degree;
Degree = Degree + n;
end
error('not implemented yet');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?