function [ inode, jnode ] = graph_adj_to_arc ( ADJ )

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

  edge_id = 0;
  inode(1:edge_num) = -1;
  jnode(1:edge_num) = -1;

  for i = 1 : node_num
    for j = 1 : node_num
      if ( ADJ(i,j) ~= 0 )
        edge_id = edge_id + 1;
        inode(edge_id) = i;
        jnode(edge_id) = j;
      end
    end
  end

  return
end
