function neighbors = ij_neighbors ( p )

%*****************************************************************************80
%
%% ij_neighbors() returns neighbors of a node given its ij coordinates.
%
%  Discussion:
%
%    The (i,j) coordinates refer to a parallelogram whose basic cell
%    is the unit parallelogram outlined by points (A,B,C,D)
%    with (i,j) coordinates
%      A = (0,0) --> B = (1,0) --> C = (1,1) --> D = (0,1).
%
%         D-----C
%        /     /
%       /     /
%      A-----B
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 November 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer P(2): the parallelogram coordinates of a point.
%
%  Output:
%
%    real NEIGHBORS(6,2): parallelogram coordinates of the neighbors.
%
  i = p(1);
  j = p(2);

  neighbors = [ ...
    i,     j + 1; ...
    i + 1, j    ; ...
    i + 1, j - 1; ...
    i,     j - 1; ...
    i - 1, j    ; ...
    i - 1, j + 1 ];

  return
end

