allocate graph from heap
adding cython interface