class_docstr: An unstructured triangular grid consisting of npoints points and
  ntri triangles.  The triangles can either be specified by the user
  or automatically generated using a Delaunay triangulation.
  
  Parameters
  ----------
  x, y : (npoints,) array-like
      Coordinates of grid points.
  triangles : (ntri, 3) array-like of int, optional
      For each triangle, the indices of the three points that make
      up the triangle, ordered in an anticlockwise manner.  If not
      specified, the Delaunay triangulation is calculated.
  mask : (ntri,) array-like of bool, optional
      Which triangles are masked out.
  
  Attributes
  ----------
  triangles : (ntri, 3) array of int
      For each triangle, the indices of the three points that make
      up the triangle, ordered in an anticlockwise manner. If you want to
      take the *mask* into account, use `get_masked_triangles` instead.
  mask : (ntri, 3) array of bool or None
      Masked out triangles.
  is_delaunay : bool
      Whether the Triangulation is a calculated Delaunay
      triangulation (where *triangles* was not specified) or not.
  
  Notes
  -----
  For a Triangulation to be valid it must not have duplicate points,
  triangles formed from colinear points, or overlapping triangles.
class_docstr_tok: ["An","unstructured","triangular","grid","consisting","of","npoints","points","and","ntri","triangles",".","The","triangles","can","either","be","specified","by","the","user","or","automatically","generated","using","a","Delaunay","triangulation",".","Parameters","--","--","--","--","--","x",",","y",":","(","npoints",",",")","array-like","Coordinates","of","grid","points",".","triangles",":","(","ntri",",","3",")","array-like","of","int",",","optional","For","each","triangle",",","the","indices","of","the","three","points","that","make","up","the","triangle",",","ordered","in","an","anticlockwise","manner",".","If","not","specified",",","the","Delaunay","triangulation","is","calculated",".","mask",":","(","ntri",",",")","array-like","of","bool",",","optional","Which","triangles","are","masked","out",".","Attributes","--","--","--","--","--","triangles",":","(","ntri",",","3",")","array","of","int","For","each","triangle",",","the","indices","of","the","three","points","that","make","up","the","triangle",",","ordered","in","an","anticlockwise","manner",".","If","you","want","to","take","the","*","mask","*","into","account",",","use","`","get_masked_triangles","`","instead",".","mask",":","(","ntri",",","3",")","array","of","bool","or","None","Masked","out","triangles",".","is_delaunay",":","bool","Whether","the","Triangulation","is","a","calculated","Delaunay","triangulation","(","where","*","triangles","*","was","not","specified",")","or","not",".","Notes","--","--","-","For","a","Triangulation","to","be","valid","it","must","not","have","duplicate","points",",","triangles","formed","from","colinear","points",",","or","overlapping","triangles","."]
docstr: Return integer array of shape (ntri, 3) containing neighbor triangles.
  
  For each triangle, the indices of the three triangles that
  share the same edges, or -1 if there is no such neighboring
  triangle.  ``neighbors[i, j]`` is the triangle that is the neighbor
  to the edge from point index ``triangles[i, j]`` to point index
  ``triangles[i, (j+1)%3]``.
docstr_tok: ["Return","integer","array","of","shape","(","ntri",",","3",")","containing","neighbor","triangles",".","For","each","triangle",",","the","indices","of","the","three","triangles","that","share","the","same","edges",",","or","-1","if","there","is","no","such","neighboring","triangle",".","``","neighbors","[","i",",","j","]","``","is","the","triangle","that","is","the","neighbor","to","the","edge","from","point","index","``","triangles","[","i",",","j","]","``","to","point","index","``","triangles","[","i",",","(","j+1",")","%","3","]","``","."]
code: def neighbors(self):
      """
      Return integer array of shape (ntri, 3) containing neighbor triangles.
  
      For each triangle, the indices of the three triangles that
      share the same edges, or -1 if there is no such neighboring
      triangle.  ``neighbors[i, j]`` is the triangle that is the neighbor
      to the edge from point index ``triangles[i, j]`` to point index
      ``triangles[i, (j+1)%3]``.
      """
      if self._neighbors is None:
          self._neighbors = self.get_cpp_triangulation().get_neighbors()
      return self._neighbors
  
file_path: matplotlib/lib/matplotlib/tri/_triangulation.py
imports: import sys
  import numpy
  from matplotlib import _api
label_desc: Use image node_id 9 for calling the Triangulation obj's underlying member method code with example usage: obj.neighbors() and returns: self