function L = digraph_adj_to_arc ( A )

%*****************************************************************************80
%
%% digraph_adj_to_arc() converts digraph from adjacency to arc list form.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    12 April 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer A(node_num,node_num), the adjacency information.
%    A(I,J) is 1 if there is a direct link from node I to node J.
%
%  Output:
%
%    integer L(edge_num,2), the arc list 
%    of the digraph.
%
  node_num = size ( A, 1 );
  edge_num = nnz ( A );
  L = zeros ( edge_num, 2 );

  edge_id = 0;

  for j = 1 : node_num
    for i = 1 : node_num
      if ( A(i,j) ~= 0 )
        edge_id = edge_id + 1;
        L(edge_id,1) = i;
        L(edge_id,2) = j;
      end
    end
  end

  return
end
