brainspace.mesh.mesh_elements.get_cell_neighbors

brainspace.mesh.mesh_elements.get_cell_neighbors(surf, include_self=True, with_edge=True, dtype=<class 'numpy.uint8'>)[source]

Get cell connectivity based on shared edges.

Parameters:
  • surf (vtkDataSet or BSDataSet) – Input surface.
  • include_self (bool, optional) – If True, set diagonal elements to 1. Default is True.
  • with_edge (bool, optional) – If True, neighboring cells are based on shared edges. Otherwise, cells must share, at least, one point. Default is True.
  • dtype (dtype, optional) – Data type. Default is uint8.
Returns:

output (sparse matrix, shape (n_cells, n_cells)) – The connectivity matrix. The (i,j) entry is 1 if cells i and j share an edge.