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

📄 graphgetnodenames.m

📁 复杂网络的一些节点面对攻击的代码
💻 M
字号:
function NodeNames = GraphGetNodeNames(Graph,NodeIDs)
% Returns the list of node Names, specified in the index of the graph
%
% Receives:
%       Graph      -   Graph Struct           -    the graph loaded with GraphLoad
%       NodeIDs    -   vector of integers     -    (optional) list of ids for which the names are required. Default: all nodes are returned.
%                                                   Values, not in the original index are empty cells.
% 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
%
%Created:																							
%	Lev Muchnik,	11/05/2005
%	lev@topspin.co.il, +972-54-326496			
% Major Updates:
%	Lev Muchnik,	01/08/2005
%   Function name changed from GraphNodeNames to GraphGetNodeNames 

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

if ~exist('NodeIDs','var')
    NodeIDs = GraphNodeIDs(Graph);
end

NodeNames = {};
if isfield(Graph,'Index') & isfield(Graph.Index,'Values')
    [c,ia,ib] = intersect(NodeIDs,Graph.Index.Values);
    NodeNames(ia) = Graph.Index.Names(ib);
    EmptyEntriesIndex = find(cellfun('isempty',NodeNames.')==1);
    NodeNames(EmptyEntriesIndex.') = {' '};
    NodeNames = NodeNames(:);
end

⌨️ 快捷键说明

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