(obj)
return memoryview(require(obj, dtype=dtype, requirements="AC"))
Converts a NumPy array or matrix into a contiguous memoryview object
    that is suitable to be forwarded to the Graph constructor.

    This is used internally to allow us to use a NumPy array or matrix
    directly when constructing a Graph.
Converts a NumPy array or matrix into a contiguous memoryview object
    that is suitable to be forwarded to the Graph constructor.
Converts a NumPy array or matrix into a contiguous memoryview object that is suitable to be forwarded to the Graph constructor .
def numpy_to_contiguous_memoryview(obj):
    """Converts a NumPy array or matrix into a contiguous memoryview object
    that is suitable to be forwarded to the Graph constructor.

    This is used internally to allow us to use a NumPy array or matrix
    directly when constructing a Graph.
    """
    # Deferred import to prevent a hard dependency on NumPy
    from numpy import float32, float64, require

    size = sizeof(c_double)
    if size == 8:
        dtype = float64
    elif size == 4:
        dtype = float32
    else:
        raise TypeError("size of C double (%d bytes) is not supported" % size)

    return memoryview(require(obj, dtype=dtype, requirements="AC"))
def numpy_to_contiguous_memoryview ( obj ) : # Deferred import to prevent a hard dependency on NumPy from numpy import float32 , float64 , require size = sizeof ( c_double ) if size == 8 : dtype = float64 elif size == 4 : dtype = float32 else : raise TypeError ( "size of C double (%d bytes) is not supported" % size ) return memoryview ( require ( obj , dtype = dtype , requirements = "AC" ) )