function ival = r8mat_is_adjacency ( m, n, a )

%*****************************************************************************80
%
%% r8mat_is_adjacency() checks whether A is an adjacency matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 September 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the row and column dimensions of 
%    the matrix.  M and N must be positive.
%
%    real A(M,N), the matrix.
%
%  Output:
%
%    integer IVAL:
%    -1, the matrix is not an adjacency matrix.
%    1, the matrix is an adjacency matrix.
%
  ival = 1;

  tol = 0.00001;

  if ( ~ r8mat_is_square ( m, n, a ) )
    ival = -1;
    return
  end

  error_frobenius = r8mat_is_symmetric ( a );

  if ( tol < error_frobenius )
    ival = -1;
    return
  end

  jval = r8mat_is_zero_one ( m, n, a );

  if ( jval ~= 1 )
    ival = -1;
    return
  end

  return
end
