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

📄 graphsetnodeproperty.m

📁 复杂网络的一些节点面对攻击的代码
💻 M
字号:
function Graph = GraphSetNodeProperty(Graph,NodeIDs,Values,PropertyName,PropertyDescription)
% Sets node properties.
%
% Receives:
%       Graph      -   Graph Struct           -    the graph loaded with GraphLoad
%       NodeIDs    -   vector of integers     -    list of ids for which property values are provided.
%       Values     -   vector of any type     -    vector of property values.
%       PropertyName-  string                 -    String, whiche identifies the property.
%       PropertyDescription - string          -    Describes the 
%
% Returns:
%      NodeNames   -   cellstring             -    Names of the IDs in the order, identical to NodeIDs, If no IDs exist in the Graph, then empty cell is returen
% See Also:
%       GraphLoad, GraphGetNodeProperty
% 
% Example:
%   [WikiGraph Result]= WikiGraphLoad('DatabaseProperties.mat','hewiki');
%   Degree = GraphCountNodesDegree(WikiGraph);
%   WikiGraph  = GraphSetNodeProperty(WikiGraph ,Degree(:,1),Degree(:,2),'Inncoming Degree','Incoming node''s degree');
%
%Created:																							
%	Lev Muchnik,	11/05/2005
%	lev@topspin.co.il, +972-54-326496			
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


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

ObjectIsType(Graph,'Graph','The input must be of the type "Graph". Please use ObjectCreateGraph function');

if ~exist('PropertyDescription','var')
    PropertyDescription = '';
end

Property = [];
Property.PropertyName = PropertyName;
Property.PropertyDescription = PropertyDescription;
Property.NodeIDs    =   NodeIDs;
Property.Values     =   Values;

if isempty(Graph.Index.Properties)
    Graph.Index.Properties = Property;
else
    Index = numel(Graph.Index.Properties)+1;
    for i = 1 : numel(Graph.Index.Properties)
        if strcmp(Graph.Index.Properties(i).PropertyName,PropertyName)
            Index = i;            
        end        
    end
    Graph.Index.Properties(Index) = Property;
end

⌨️ 快捷键说明

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