#NEWLINE# def connectivity_from_array( array , close_loop = False ) : #NEWLINE# #INDENT# '\n    Build the connectivity over a given array. For example, given ::\n\n        array = [(0, 3, 1, 2 )]\n\n    Generate the connectivity of ::\n\n        [(0, 3), (3, 1), (1, 2)]\n\n    If ``close_loop`` is true, add an extra connection from the last point to\n    the first.\n    ' #NEWLINE# conn = list ( zip ( array , array [ 1 : ] ) ) #NEWLINE# if array : #NEWLINE# #INDENT# conn . append ( ( array [ ( - 1 ) ] , array [ 0 ] ) ) #NEWLINE# #UNINDENT# return np . asarray ( conn )