function L = graph_adj_to_arc ( A )

%*****************************************************************************80
%
%% graph_adj_to_arc() converts an adjacency matrix to an arc list.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    27 April 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer A(node_num,node_num), the adjacency matrix.
%
%  Output:
%
%    integer L(edge_num,2): the arc list.
%
  edge_num = sum ( sum ( A ) );
  node_num = size ( A, 1 );

  edge_id = 0;
  L = zeros ( edge_num, 2 );

  for i = 1 : node_num
    for j = 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
