def mesh_edges(tris):
 if (np.max(tris) > len(np.unique(tris))):
  raise ValueError('Cannot compute connectivity on a selection of triangles.')
 npoints = (np.max(tris) + 1)
 ones_ntris = np.ones((3 * len(tris)))
 (a, b, c) = tris.T
 x = np.concatenate((a, b, c))
 y = np.concatenate((b, c, a))
 edges = coo_matrix((ones_ntris, (x, y)), shape=(npoints, npoints))
 edges = edges.tocsr()
 edges = (edges + edges.T)
 return edges

def mesh_edges ( tris ) : if ( np . max ( tris ) > len ( np . unique ( tris ) ) ) : raise ValueError ( 'Cannot compute connectivity on a selection of triangles.' ) npoints = ( np . max ( tris ) + 1 ) ones_ntris = np . ones ( ( 3 * len ( tris ) ) ) ( a , b , c ) = tris . T x = np . concatenate ( ( a , b , c ) ) y = np . concatenate ( ( b , c , a ) ) edges = coo_matrix ( ( ones_ntris , ( x , y ) ) , shape = ( npoints , npoints ) ) edges = edges . tocsr ( ) edges = ( edges + edges . T ) return edges
return sparse matrix with edges as an adjacency matrix .