function degree = graph_adj_degree ( A )

%*****************************************************************************80
%
%% graph_adj_degree() computes the degree of each node.
%
%  Discussion:
%
%    The degree of a node is the number of edges that are incident on it.
%
%    A self-edge increases the degree of the corresponding node by 2.
%
%    The sum of the degrees of the nodes is twice the number of edges.
%
%    The generalized case, where A(I,J) can be greater than 1, indicating
%    the existence of 2 or more distinct edges between nodes I and J,
%    will be properly handled by this routine.  
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    11 March 2023
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer A(node_num,node_num): the adjacency information.
%
%  Output:
%
%    integer degree(node_num), the degree of the nodes.
%
  degree = sum ( A + A', 2 ) / 2;

  return
end
