Use cut to extract graph from spark