www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/OutdegreeOfAllGraphNodesExample.m

    %% Out-degree of All Graph Nodes
% Create and plot a directed graph, and then compute the out-degree of
% every node in the graph. The out-degree of a node is equal to the number
% of edges with that node as the source.

% Copyright 2015 The MathWorks, Inc.

s = [1 3 2 2 4 5 1 2];
t = [2 2 4 5 6 6 6 6];
G = digraph(s,t);
plot(G)

%%
%
outdeg = outdegree(G)

%%
% |outdeg(j)| indicates the out-degree of node |j|.