复杂网络工具包complex network package

时间:2024-10-13 10:31:55
【文件属性】:

文件名称:复杂网络工具包complex network package

文件大小:24.47MB

文件格式:RAR

更新时间:2024-10-13 10:31:55

复杂网络 连锁故障

Complex Networks Toolbox for MatLab is designed to analyze large-scale graphs, model them, explore with simulations of dynamic processes and generate appealing and insightful layouts. example: function [BetweenneessCentrality, varargout]= GraphBetweennessCentrality(Graph,SourceNodes) % Computes betweenneess centrality of each node. % % Receives: % Graph - Graph Struct - the graph loaded with GraphLoad % SourceNodes - array of double - (optional) nodes, from which passes start. Default: [] (all nodes). % % Returns: % BetweenneessCentrality - array of double - Betweenneess Centrality for each node. % Nodes - array of double - (optional)List of all nodes for which betweennessn centrality is computed % % Algorithm: % http://www.boost.org/libs/graph/doc/betweenness_centrality.html % % See Also: % mexGraphAllNodeShortestPasses % warning('Use the more optimized mexGraphBetweennessCentrality.dll'); error(nargchk(1,2,nargin)); error(nargoutchk(0,2,nargout)); if ~exist('SourceNodes') | isempty(SourceNodes) SourceNodes = unique(Graph.Data(:,1)); end Nodes = unique(Graph.Data(:,1:2)); %TotalPasses = zeros(GraphCountNumberOfNodes(Graph),GraphCountNumberOfNodes(Graph)); Betweenness = zeros(GraphCountNumberOfNodes(Graph),1); for Node = Nodes(:).' [ShortesPasses PassesHistogram]= mexGraphAllNodeShortestPasses(Graph,Node); %TotalPasses = TotalPasses + sum(PassesHistogram(2:end)); tic for i = 1 : numel(ShortesPasses) %T = ShortesPasses(i).Passes(end); %TotalPasses(Node,ShortesPasses(i).Passes(end)) = size(ShortesPasses(i).Passes,2); % compute total number of shortes passes from Node to some other node. Passes = ShortesPasses(i).Passes(2:end-1,:); NodesOnTheWay = unique(Passes); if numel(NodesOnTheWay)==1 Count = 1; % hist behaves differently in this case. else Count = hist(Passes(:),NodesOnTheWay);


网友评论