function [ indegree, outdegree ] = digraph_arc_degree ( L )

%*****************************************************************************80
%
%% digraph_arc_degree() determines the degree of the nodes of a digraph.
%
%  Discussion:
%
%    The in degree is the number of edges that terminate at a node.
%    The out degree is the number of edges that begin at a node.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 April 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer L(edge_num,2), the arc list.
%
%  Output:
%
%    integer INDEGREE(node_num), OUTDEGREE(node_num), the
%    indegree and outdegree of each node, that is, the number of edges that end
%    with the node, and the number of edges that begin with it.
%
  edge_num = size ( L, 1 );
  node_num = max ( max ( L ) );

  indegree(1:node_num) = 0;
  outdegree(1:node_num) = 0;

  for edge_id = 1 : edge_num

    node_out = L(edge_id,1);
    outdegree(node_out) = outdegree(node_out) + 1;

    node_in = L(edge_id,2);
    indegree(node_in) = indegree(node_in) + 1;

  end

  return
end
