graphnodeids.m

来自「复杂网络的一些节点面对攻击的代码」· M 代码 · 共 26 行

M
26
字号
function NodeIDs = GraphNodeIDs(Graph)
% Returns the list of node IDs in the graph
%
% Receives:
%       Graph      -   Graph Struct           -    the graph loaded with GraphLoad
%
% Returns:
%      NodeIDs    -     vector of integers    -    IDs of nodes, used in graph
% See Also:
%       GraphLoad
%
%Created:																							
%	Lev Muchnik,	20/04/2005
%	lev@topspin.co.il, +972-54-326496			
%
% Major Changes:
%   Lev Muchnik, 12/11/2006
%   Can now handle Index.Values in either row or column form

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

NodeIDs = unique(Graph.Data(:,1:2));
if isfield(Graph,'Index') & isfield(Graph.Index,'Values')
    NodeIDs  = unique([NodeIDs; Graph.Index.Values(:)]);
end

⌨️ 快捷键说明

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