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

📄 graphconvertfromv2.m

📁 复杂网络的一些节点面对攻击的代码
💻 M
字号:
function Graph  = GraphConvertFromV2(Graph)
% Converts the Graph structure from V2 of the toolbox to V1. Links, weights, index and properties are converted. Up to 50% more space is requires.
%
% Receives:
%   Graph       -   Graph Struct                                -   the graph structure which can be used with any function of V2 of the toolbox.
%   
% Returns:
%   Graph       -   Graph Struct                                -   the graph structure compatible with the V1 of the Toolbox
%
%Created:
%	Lev Muchnik,	04/11/2005
%	lev@topspin.co.il, +972-54-326496

error(nargchk(1,1,nargin));
error(nargoutchk(0,1,nargout));

if isfield(Graph,'Version') & Graph.Version==2
    if isempty(Graph.Weights) | numel(Graph.Weights)~=size(Graph.Data,1)
      Graph.Data = [double(Graph.Data) ones(size(Graph.Data,1),1)];
    else
        Graph.Data = [double(Graph.Data) Graph.Weights];
    end
    Graph.Index.Values = double(Graph.Index.Values);

    for i = 1 : numel(Graph.Index.Properties)
        Graph.Index.Properties(i).NodeIDs = double(Graph.Index.Properties(i).NodeIDs);
    end
    Graph.Version = 1;
end

⌨️ 快捷键说明

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