%% Number of Edges Between Nodes
% Create a graph and display the edges table for reference. Find the number of edges between node 1 and node 2.

G = graph([1 1 1 1 2 2],[2 2 2 3 4 5]);
G.Edges

%

N = edgecount(G,1,2)

%
% You also can specify a single source node and several target nodes. Find the number of edges between node 1 and all other nodes (including self-loops).

N = edgecount(G,1,1:numnodes(G))

% Copyright 2012 The MathWorks, Inc.