function [ ni, nj ] = graph_adj_edge_select ( A )

%*****************************************************************************80
%
%% graph_adj_edge_select() returns one edge from a graph.
%
%  Discussion:
%
%    This function returns the first edge it encounters.
%
%  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 matrix for the graph.
%
%  Output:
%
%    integer ni, nj: the endpoints of an edge of the graph.
%    If no edge was found, ni and nj are -1.
%
  node_num = size ( A, 1 );

  ni = -1;
  nj = -1;

  for i = 1 : node_num
    for j = 1 : node_num
      if ( A(i,j) ~= 0 )
        ni = i;
        nj = j;
        return
      end
    end
  end

  return
end
